Changeset 12455
- Timestamp:
- 06/18/12 15:54:17 (13 years ago)
- Location:
- issm/trunk-jpl/src/c/objects
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/c/objects/Gauss/GaussPenta.cpp
r12365 r12455 47 47 /*Allocate GaussPenta fields*/ 48 48 numgauss=numgauss_horiz*numgauss_vert; 49 coords1= (double*)xmalloc(numgauss*sizeof(double));50 coords2= (double*)xmalloc(numgauss*sizeof(double));51 coords3= (double*)xmalloc(numgauss*sizeof(double));52 coords4= (double*)xmalloc(numgauss*sizeof(double));53 weights= (double*)xmalloc(numgauss*sizeof(double));49 coords1=xNew<double>(numgauss); 50 coords2=xNew<double>(numgauss); 51 coords3=xNew<double>(numgauss); 52 coords4=xNew<double>(numgauss); 53 weights=xNew<double>(numgauss); 54 54 55 55 /*Combine Horizontal and vertical points*/ … … 72 72 73 73 /*Clean up*/ 74 x free((void**)&coords1_horiz);75 x free((void**)&coords2_horiz);76 x free((void**)&coords3_horiz);77 x free((void**)&coords_vert);78 x free((void**)&weights_horiz);79 x free((void**)&weights_vert);74 xDelete<double>(coords1_horiz); 75 xDelete<double>(coords2_horiz); 76 xDelete<double>(coords3_horiz); 77 xDelete<double>(coords_vert); 78 xDelete<double>(weights_horiz); 79 xDelete<double>(weights_vert); 80 80 } 81 81 /*}}}*/ … … 93 93 94 94 /*Allocate GaussPenta fields*/ 95 coords1= (double*)xmalloc(numgauss*sizeof(double));96 coords2= (double*)xmalloc(numgauss*sizeof(double));97 coords3= (double*)xmalloc(numgauss*sizeof(double));98 coords4= (double*)xmalloc(numgauss*sizeof(double));99 weights= (double*)xmalloc(numgauss*sizeof(double));95 coords1=xNew<double>(numgauss); 96 coords2=xNew<double>(numgauss); 97 coords3=xNew<double>(numgauss); 98 coords4=xNew<double>(numgauss); 99 weights=xNew<double>(numgauss); 100 100 101 101 if(index1==0 && index2==3){ … … 132 132 133 133 /*clean up*/ 134 x free((void**)&seg_coords);135 x free((void**)&seg_weights);134 xDelete<double>(seg_coords); 135 xDelete<double>(seg_weights); 136 136 137 137 } … … 147 147 148 148 /*compute z coordinate*/ 149 coords4= (double*)xmalloc(numgauss*sizeof(double));149 coords4=xNew<double>(numgauss); 150 150 for(int i=0;i<numgauss;i++) coords4[i]=-1.0; 151 151 } … … 157 157 158 158 /*compute z coordinate*/ 159 coords4= (double*)xmalloc(numgauss*sizeof(double));159 coords4=xNew<double>(numgauss); 160 160 for(int i=0;i<numgauss;i++) coords4[i]=1.0; 161 161 } … … 182 182 /*Allocate GaussPenta fields*/ 183 183 numgauss=order_horiz*order_vert; 184 coords1= (double*)xmalloc(numgauss*sizeof(double));185 coords2= (double*)xmalloc(numgauss*sizeof(double));186 coords3= (double*)xmalloc(numgauss*sizeof(double));187 coords4= (double*)xmalloc(numgauss*sizeof(double));188 weights= (double*)xmalloc(numgauss*sizeof(double));184 coords1=xNew<double>(numgauss); 185 coords2=xNew<double>(numgauss); 186 coords3=xNew<double>(numgauss); 187 coords4=xNew<double>(numgauss); 188 weights=xNew<double>(numgauss); 189 189 190 190 /*Quads: get the gauss points using the product of two line rules */ … … 227 227 228 228 /*clean-up*/ 229 x free((void**)&seg_horiz_coords);230 x free((void**)&seg_horiz_weights);231 x free((void**)&seg_vert_coords);232 x free((void**)&seg_vert_weights);229 xDelete<double>(seg_horiz_coords); 230 xDelete<double>(seg_horiz_weights); 231 xDelete<double>(seg_vert_coords); 232 xDelete<double>(seg_vert_weights); 233 233 } 234 234 /*}}}*/ 235 235 /*FUNCTION GaussPenta::~GaussPenta(){{{*/ 236 236 GaussPenta::~GaussPenta(){ 237 x free((void**)&weights);238 x free((void**)&coords1);239 x free((void**)&coords2);240 x free((void**)&coords3);241 x free((void**)&coords4);237 xDelete<double>(weights); 238 xDelete<double>(coords1); 239 xDelete<double>(coords2); 240 xDelete<double>(coords3); 241 xDelete<double>(coords4); 242 242 } 243 243 /*}}}*/ … … 357 357 if(index1==0 && index2==1 && index3==2){ 358 358 GaussLegendreTria(&numgauss,&coords1,&coords2,&coords3,&weights,order); 359 coords4= (double*)xmalloc(numgauss*sizeof(double));359 coords4=xNew<double>(numgauss); 360 360 for(int i=0;i<numgauss;i++) coords4[i]=-1.0; 361 361 } -
issm/trunk-jpl/src/c/objects/Gauss/GaussTria.cpp
r12424 r12455 91 91 92 92 /*clean up*/ 93 x free((void**)&seg_coords);94 x free((void**)&seg_weights);93 xDelete<double>(seg_coords); 94 xDelete<double>(seg_weights); 95 95 } 96 96 /*}}}*/ -
issm/trunk-jpl/src/c/objects/Inputs/TransientInput.cpp
r12426 r12455 46 46 /*FUNCTION TransientInput::~TransientInput{{{*/ 47 47 TransientInput::~TransientInput(){ 48 x free((void**)&this->timesteps);48 xDelete<double>(this->timesteps); 49 49 this->timesteps=NULL; 50 50 this->numtimesteps=0; … … 100 100 output->enum_type=this->enum_type; 101 101 output->numtimesteps=this->numtimesteps; 102 output->timesteps= (IssmPDouble*)xmalloc(this->numtimesteps*sizeof(IssmPDouble));102 output->timesteps=xNew<IssmPDouble>(this->numtimesteps); 103 103 memcpy(output->timesteps,this->timesteps,this->numtimesteps*sizeof(IssmPDouble)); 104 104 output->inputs=(Inputs*)this->inputs->Copy(); … … 128 128 outinput->enum_type=this->enum_type; 129 129 outinput->numtimesteps=this->numtimesteps; 130 outinput->timesteps= (IssmPDouble*)xmalloc(this->numtimesteps*sizeof(IssmPDouble));130 outinput->timesteps=xNew<IssmPDouble>(this->numtimesteps); 131 131 memcpy(outinput->timesteps,this->timesteps,this->numtimesteps*sizeof(IssmPDouble)); 132 132 outinput->inputs=(Inputs*)this->inputs->SpawnTriaInputs(indices); … … 237 237 238 238 if (this->numtimesteps > 0){ 239 old_timesteps= (IssmPDouble*)xmalloc(this->numtimesteps*sizeof(IssmPDouble));239 old_timesteps=xNew<IssmPDouble>(this->numtimesteps); 240 240 memcpy(old_timesteps,this->timesteps,this->numtimesteps*sizeof(IssmPDouble)); 241 x free((void**)&this->timesteps);241 xDelete<double>(this->timesteps); 242 242 } 243 243 244 244 this->numtimesteps=this->numtimesteps+1; 245 this->timesteps= (IssmPDouble*)xmalloc(this->numtimesteps*sizeof(IssmPDouble));245 this->timesteps=xNew<IssmPDouble>(this->numtimesteps); 246 246 247 247 if (this->numtimesteps > 1){ 248 248 memcpy(this->timesteps,old_timesteps,(this->numtimesteps-1)*sizeof(IssmPDouble)); 249 x free((void**)&old_timesteps);249 xDelete<double>(old_timesteps); 250 250 } 251 251 -
issm/trunk-jpl/src/c/objects/Kriging/Quadtree.cpp
r12365 r12455 496 496 497 497 /*Allocate indices (maximum by default*/ 498 if(this->NbObs) indices = (int*)xmalloc(this->NbObs*sizeof(int));498 if(this->NbObs) indices = xNew<int>(this->NbObs); 499 499 nobs = 0; 500 500 -
issm/trunk-jpl/src/c/objects/Loads/Friction.cpp
r12424 r12455 33 33 this->analysis_type=in_analysis_type; 34 34 this->inputs=inputs_in; 35 this->element_type= (char*)xmalloc((strlen(element_type_in)+1)*sizeof(char));35 this->element_type=xNew<char>(strlen(element_type_in)+1); 36 36 memcpy(this->element_type,element_type_in,(strlen(element_type_in)+1)*sizeof(char)); 37 37 … … 41 41 /*FUNCTION Friction::~Friction() {{{*/ 42 42 Friction::~Friction(){ 43 x free((void**)&element_type);43 xDelete<char>(element_type); 44 44 } 45 45 /*}}}*/ -
issm/trunk-jpl/src/c/objects/Loads/Icefront.cpp
r12365 r12455 691 691 692 692 /*Allocate: */ 693 doflist= (int*)xmalloc(numberofdofs*sizeof(int));693 doflist=xNew<int>(numberofdofs); 694 694 695 695 /*Populate: */
Note:
See TracChangeset
for help on using the changeset viewer.