Changeset 12458
- Timestamp:
- 06/18/12 16:25:19 (13 years ago)
- Location:
- issm/trunk-jpl/src/c/objects/Elements
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/c/objects/Elements/Penta.cpp
r12406 r12458 100 100 101 101 //deal with PentaRef mother class 102 penta->element_type_list= (int*)xmalloc(this->numanalyses*sizeof(int));102 penta->element_type_list=xNew<int>(this->numanalyses); 103 103 for(i=0;i<this->numanalyses;i++) penta->element_type_list[i]=this->element_type_list[i]; 104 104 … … 130 130 131 131 /*recover objects: */ 132 penta->nodes= (Node**)xmalloc(6*sizeof(Node*)); //we cannot rely on an analysis_counter to tell us which analysis_type we are running, so we just copy the nodes.132 penta->nodes=xNew<Node*>(6); //we cannot rely on an analysis_counter to tell us which analysis_type we are running, so we just copy the nodes. 133 133 for(i=0;i<6;i++)penta->nodes[i]=this->nodes[i]; 134 134 penta->matice=(Matice*)penta->hmatice->delivers(); … … 730 730 731 731 /*Allocate: */ 732 doflist= (int*)xmalloc(numberofdofs*sizeof(int));732 doflist=xNew<int>(numberofdofs); 733 733 734 734 /*Populate: */ … … 1147 1147 Input** old_inputs=NULL; 1148 1148 1149 new_inputs= (Input**)xmalloc(num_enums/2*sizeof(Input*)); //half the enums are for the new inputs1150 old_inputs= (Input**)xmalloc(num_enums/2*sizeof(Input*)); //half the enums are for the old inputs1149 new_inputs=xNew<Input*>(num_enums/2); //half the enums are for the new inputs 1150 old_inputs=xNew<Input*>(num_enums/2); //half the enums are for the old inputs 1151 1151 1152 1152 for(i=0;i<num_enums/2;i++){ … … 1164 1164 1165 1165 /*clean up*/ 1166 x free((void**)&new_inputs);1167 x free((void**)&old_inputs);1166 xDelete<Input*>(new_inputs); 1167 xDelete<Input*>(old_inputs); 1168 1168 1169 1169 /*Return output*/ … … 1399 1399 if (object_type==ElementEnum){ 1400 1400 num_inputs=1; 1401 base_inputs= (Input**)xmalloc(num_inputs*sizeof(Input*));1401 base_inputs=xNew<Input*>(num_inputs); 1402 1402 base_inputs[0]=(Input*)this->inputs->GetInput(enum_type); 1403 1403 } 1404 1404 else if (object_type==MaterialsEnum){ 1405 1405 num_inputs=1; 1406 base_inputs= (Input**)xmalloc(num_inputs*sizeof(Input*));1406 base_inputs=xNew<Input*>(num_inputs); 1407 1407 base_inputs[0]=(Input*)matice->inputs->GetInput(enum_type); 1408 1408 } 1409 1409 else if (object_type==NodeEnum){ 1410 1410 num_inputs=3; //only the three upper nodes 1411 base_inputs= (Input**)xmalloc(num_inputs*sizeof(Input*));1411 base_inputs=xNew<Input*>(num_inputs); 1412 1412 for(i=0;i<num_inputs;i++){ 1413 1413 base_inputs[i]=(Input*)this->nodes[i]->inputs->GetInput(enum_type); … … 1454 1454 1455 1455 /*clean-up and return*/ 1456 x free((void**)&base_inputs);1456 xDelete<Input*>(base_inputs); 1457 1457 } 1458 1458 /*}}}*/ … … 1795 1795 1796 1796 /*Free ressources:*/ 1797 x free((void**)&doflist);1797 xDelete<int>(doflist); 1798 1798 } 1799 1799 /*}}}*/ … … 1819 1819 1820 1820 /*Free ressources:*/ 1821 x free((void**)&doflist);1821 xDelete<int>(doflist); 1822 1822 } 1823 1823 /*}}}*/ … … 1859 1859 1860 1860 /*Free ressources:*/ 1861 x free((void**)&doflist);1861 xDelete<int>(doflist); 1862 1862 } 1863 1863 /*}}}*/ … … 2031 2031 2032 2032 /*Allocate output*/ 2033 resultsenums= (int*)xmalloc(numberofresults*sizeof(int));2034 resultssizes= (int*)xmalloc(numberofresults*sizeof(int));2035 resultstimes= (double*)xmalloc(numberofresults*sizeof(double));2036 resultssteps= (int*)xmalloc(numberofresults*sizeof(int));2033 resultsenums=xNew<int>(numberofresults); 2034 resultssizes=xNew<int>(numberofresults); 2035 resultstimes=xNew<double>(numberofresults); 2036 resultssteps=xNew<int>(numberofresults); 2037 2037 2038 2038 /*populate enums*/ … … 4269 4269 /*Free ressources:*/ 4270 4270 delete gauss; 4271 x free((void**)&doflist);4271 xDelete<int>(doflist); 4272 4272 } 4273 4273 /*}}}*/ … … 4300 4300 /*Free ressources:*/ 4301 4301 delete gauss; 4302 x free((void**)&doflist);4302 xDelete<int>(doflist); 4303 4303 } 4304 4304 /*}}}*/ … … 4371 4371 4372 4372 /*Free ressources:*/ 4373 x free((void**)&doflist);4373 xDelete<int>(doflist); 4374 4374 } 4375 4375 /*}}}*/ … … 4449 4449 4450 4450 /*Free ressources:*/ 4451 x free((void**)&doflist);4451 xDelete<int>(doflist); 4452 4452 } 4453 4453 /*}}}*/ … … 4868 4868 _error_("response %s not supported yet",EnumToStringx(responses[resp])); 4869 4869 } 4870 x free((void**)&responses);4870 xDelete<int>(responses); 4871 4871 } 4872 4872 /*}}}*/ … … 5133 5133 /*Clean up and return*/ 5134 5134 cleanup_and_return: 5135 x free((void**)&control_type);5135 xDelete<int>(control_type); 5136 5136 } 5137 5137 /*}}}*/ … … 5176 5176 5177 5177 /*Free ressources:*/ 5178 x free((void**)&doflist);5178 xDelete<int>(doflist); 5179 5179 } 5180 5180 /*}}}*/ … … 5211 5211 5212 5212 /*Free ressources:*/ 5213 x free((void**)&doflist);5213 xDelete<int>(doflist); 5214 5214 } 5215 5215 /*}}}*/ … … 7940 7940 /*Free ressources:*/ 7941 7941 delete gauss; 7942 x free((void**)&doflist);7942 xDelete<int>(doflist); 7943 7943 } 7944 7944 /*}}}*/ … … 7976 7976 /*Free ressources:*/ 7977 7977 delete gauss; 7978 x free((void**)&doflist);7978 xDelete<int>(doflist); 7979 7979 } 7980 7980 /*}}}*/ … … 8009 8009 /*Free ressources:*/ 8010 8010 delete gauss; 8011 x free((void**)&doflist);8011 xDelete<int>(doflist); 8012 8012 } 8013 8013 /*}}}*/ … … 8054 8054 /*Free ressources:*/ 8055 8055 delete gauss; 8056 x free((void**)&doflist);8056 xDelete<int>(doflist); 8057 8057 } 8058 8058 /*}}}*/ … … 8171 8171 8172 8172 /*Free ressources:*/ 8173 x free((void**)&doflist);8173 xDelete<int>(doflist); 8174 8174 } 8175 8175 /*}}}*/ … … 8254 8254 8255 8255 /*Free ressources:*/ 8256 x free((void**)&doflistp);8257 x free((void**)&doflistm);8256 xDelete<int>(doflistp); 8257 xDelete<int>(doflistm); 8258 8258 } 8259 8259 /*}}}*/ … … 8354 8354 8355 8355 /*Free ressources:*/ 8356 x free((void**)&doflistm);8357 x free((void**)&doflists);8356 xDelete<int>(doflistm); 8357 xDelete<int>(doflists); 8358 8358 } 8359 8359 /*}}}*/ … … 8429 8429 8430 8430 /*Free ressources:*/ 8431 x free((void**)&doflist);8431 xDelete<int>(doflist); 8432 8432 } 8433 8433 /*}}}*/ … … 8522 8522 8523 8523 /*Free ressources:*/ 8524 x free((void**)&doflistp);8525 x free((void**)&doflists);8524 xDelete<int>(doflistp); 8525 xDelete<int>(doflists); 8526 8526 } 8527 8527 /*}}}*/ … … 8586 8586 8587 8587 /*Free ressources:*/ 8588 x free((void**)&doflist);8588 xDelete<int>(doflist); 8589 8589 } 8590 8590 /*}}}*/ … … 8690 8690 8691 8691 /*Free ressources:*/ 8692 x free((void**)&doflist);8692 xDelete<int>(doflist); 8693 8693 } 8694 8694 /*}}}*/ … … 8751 8751 8752 8752 /*Free ressources:*/ 8753 x free((void**)&doflist);8753 xDelete<int>(doflist); 8754 8754 } 8755 8755 /*}}}*/ -
issm/trunk-jpl/src/c/objects/Elements/PentaRef.cpp
r12365 r12458 35 35 36 36 /*Only allocate pointer*/ 37 element_type_list= (int*)xmalloc(nummodels*sizeof(int));37 element_type_list=xNew<int>(nummodels); 38 38 39 39 } … … 41 41 /*FUNCTION PentaRef::~PentaRef(){{{*/ 42 42 PentaRef::~PentaRef(){ 43 x free((void**)&element_type_list);43 xDelete<int>(element_type_list); 44 44 } 45 45 /*}}}*/ -
issm/trunk-jpl/src/c/objects/Elements/Tria.cpp
r12406 r12458 82 82 83 83 //deal with TriaRef mother class 84 tria->element_type_list= (int*)xmalloc(this->numanalyses*sizeof(int));84 tria->element_type_list=xNew<int>(this->numanalyses); 85 85 for(i=0;i<this->numanalyses;i++) tria->element_type_list[i]=this->element_type_list[i]; 86 86 … … 111 111 112 112 /*recover objects: */ 113 tria->nodes= (Node**)xmalloc(3*sizeof(Node*)); //we cannot rely on an analysis_counter to tell us which analysis_type we are running, so we just copy the nodes.113 tria->nodes=xNew<Node*>(3); //we cannot rely on an analysis_counter to tell us which analysis_type we are running, so we just copy the nodes. 114 114 for(i=0;i<3;i++)tria->nodes[i]=this->nodes[i]; 115 115 tria->matice=(Matice*)tria->hmatice->delivers(); … … 974 974 /*First, figure out size of doflist and create it: */ 975 975 for(i=0;i<3;i++) numberofdofs+=nodes[i]->GetNumberOfDofs(approximation_enum,setenum); 976 doflist= (int*)xmalloc(numberofdofs*sizeof(int));976 doflist=xNew<int>(numberofdofs); 977 977 978 978 /*Populate: */ … … 1246 1246 Input** old_inputs=NULL; 1247 1247 1248 new_inputs= (Input**)xmalloc(num_enums/2*sizeof(Input*)); //half the enums are for the new inputs1249 old_inputs= (Input**)xmalloc(num_enums/2*sizeof(Input*)); //half the enums are for the old inputs1248 new_inputs=xNew<Input*>(num_enums/2); //half the enums are for the new inputs 1249 old_inputs=xNew<Input*>(num_enums/2); //half the enums are for the old inputs 1250 1250 1251 1251 for(i=0;i<num_enums/2;i++){ … … 1263 1263 1264 1264 /*clean up and return*/ 1265 x free((void**)&new_inputs);1266 x free((void**)&old_inputs);1265 xDelete<Input*>(new_inputs); 1266 xDelete<Input*>(old_inputs); 1267 1267 return converged; 1268 1268 } … … 1530 1530 1531 1531 /*Free ressources:*/ 1532 x free((void**)&doflist);1532 xDelete<int>(doflist); 1533 1533 } 1534 1534 /*}}}*/ … … 1597 1597 1598 1598 /*Free ressources:*/ 1599 x free((void**)&doflist);1599 xDelete<int>(doflist); 1600 1600 } 1601 1601 /*}}}*/ … … 1862 1862 1863 1863 /*Allocate output*/ 1864 resultsenums= (int*)xmalloc(numberofresults*sizeof(int));1865 resultssizes= (int*)xmalloc(numberofresults*sizeof(int));1866 resultstimes= (double*)xmalloc(numberofresults*sizeof(double));1867 resultssteps= (int*)xmalloc(numberofresults*sizeof(int));1864 resultsenums=xNew<int>(numberofresults); 1865 resultssizes=xNew<int>(numberofresults); 1866 resultstimes=xNew<double>(numberofresults); 1867 resultssteps=xNew<int>(numberofresults); 1868 1868 1869 1869 /*populate enums*/ … … 3252 3252 /*Free ressources:*/ 3253 3253 delete gauss; 3254 x free((void**)&doflist);3254 xDelete<int>(doflist); 3255 3255 } 3256 3256 /*}}}*/ … … 3291 3291 /*Free ressources:*/ 3292 3292 delete gauss; 3293 x free((void**)&doflist);3293 xDelete<int>(doflist); 3294 3294 } 3295 3295 /*}}}*/ … … 3353 3353 3354 3354 /*Free ressources:*/ 3355 x free((void**)&doflist);3355 xDelete<int>(doflist); 3356 3356 3357 3357 } … … 3413 3413 3414 3414 /*Free ressources:*/ 3415 x free((void**)&doflist);3415 xDelete<int>(doflist); 3416 3416 } 3417 3417 /*}}}*/ … … 3451 3451 3452 3452 /*Clean up and return*/ 3453 x free((void**)&control_type);3453 xDelete<int>(control_type); 3454 3454 } 3455 3455 /*}}}*/ … … 3569 3569 } 3570 3570 3571 x free((void**)&responses);3571 xDelete<int>(responses); 3572 3572 } 3573 3573 /*}}}*/ … … 4428 4428 /*Clean up and return*/ 4429 4429 delete gauss; 4430 x free((void**)&responses);4430 xDelete<int>(responses); 4431 4431 return pe; 4432 4432 } … … 4607 4607 /*Clean up and return*/ 4608 4608 delete gauss; 4609 x free((void**)&responses);4609 xDelete<int>(responses); 4610 4610 return pe; 4611 4611 } … … 4784 4784 /*Clean up and return*/ 4785 4785 delete gauss; 4786 x free((void**)&responses);4786 xDelete<int>(responses); 4787 4787 return pe; 4788 4788 } … … 4956 4956 4957 4957 /*Free ressources:*/ 4958 x free((void**)&doflist);4958 xDelete<int>(doflist); 4959 4959 } 4960 4960 /*}}}*/ … … 4985 4985 4986 4986 /*Free ressources:*/ 4987 x free((void**)&doflist);4987 xDelete<int>(doflist); 4988 4988 } 4989 4989 /*}}}*/ … … 5295 5295 /*Free ressources:*/ 5296 5296 delete gauss; 5297 x free((void**)&doflist);5297 xDelete<int>(doflist); 5298 5298 } 5299 5299 /*}}}*/ … … 5323 5323 5324 5324 /*Free ressources:*/ 5325 x free((void**)&doflist);5325 xDelete<int>(doflist); 5326 5326 } 5327 5327 /*}}}*/ -
issm/trunk-jpl/src/c/objects/Elements/TriaRef.cpp
r12365 r12458 34 34 35 35 /*Only allocate pointer*/ 36 element_type_list= (int*)xmalloc(nummodels*sizeof(int));36 element_type_list=xNew<int>(nummodels); 37 37 38 38 } … … 40 40 /*FUNCTION TriaRef::~TriaRef(){{{*/ 41 41 TriaRef::~TriaRef(){ 42 x free((void**)&element_type_list);42 xDelete<int>(element_type_list); 43 43 } 44 44 /*}}}*/
Note:
See TracChangeset
for help on using the changeset viewer.