Changeset 12437
- Timestamp:
- 06/15/12 17:14:12 (13 years ago)
- Location:
- issm/trunk-jpl/src/c/shared
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/c/shared/Elements/GetGlobalDofList.cpp
r10116 r12437 14 14 15 15 /*Allocate:*/ 16 ndof_list= (int*)xmalloc(numnodes*sizeof(int));16 ndof_list=xNew<int>(numnodes); 17 17 18 18 /*First, figure out size of doflist: */ … … 25 25 if(numdof){ 26 26 /*Allocate: */ 27 doflist= (int*)xmalloc(numdof*sizeof(int));27 doflist=xNew<int>(numdof); 28 28 29 29 /*Populate: */ … … 37 37 } 38 38 /*Free ressources:*/ 39 x free((void**)&ndof_list);39 xDelete<int>(ndof_list); 40 40 41 41 return doflist; -
issm/trunk-jpl/src/c/shared/Elements/GetLocalDofList.cpp
r10104 r12437 13 13 if(numnodes){ 14 14 /*allocate: */ 15 ndof_list= (int*)xmalloc(numnodes*sizeof(int));16 ngdof_list_cumulative= (int*)xmalloc(numnodes*sizeof(int));15 ndof_list=xNew<int>(numnodes); 16 ngdof_list_cumulative=xNew<int>(numnodes); 17 17 18 18 … … 33 33 if(numdof){ 34 34 /*Allocate: */ 35 doflist= (int*)xmalloc(numdof*sizeof(int));35 doflist=xNew<int>(numdof); 36 36 37 37 /*Populate: */ … … 55 55 56 56 /*Free ressources:*/ 57 x free((void**)&ndof_list);58 x free((void**)&ngdof_list_cumulative);57 xDelete<int>(ndof_list); 58 xDelete<int>(ngdof_list_cumulative); 59 59 60 60 /*CLean-up and return*/ -
issm/trunk-jpl/src/c/shared/Elements/TransformLoadVectorCoord.cpp
r10523 r12437 8 8 9 9 /*All nodes have the same Coordinate System*/ 10 cs_array= (int*)xmalloc(numnodes*sizeof(int));10 cs_array=xNew<int>(numnodes); 11 11 for(int i=0;i<numnodes;i++) cs_array[i]=cs_enum; 12 12 … … 15 15 16 16 /*Clean-up*/ 17 x free((void**)&cs_array);17 xDelete<int>(cs_array); 18 18 } 19 19 … … 35 35 36 36 /*Copy current load vector*/ 37 values= (double*)xmalloc(pe->nrows*sizeof(double));37 values=xNew<double>(pe->nrows); 38 38 for(i=0;i<pe->nrows;i++) values[i]=pe->values[i]; 39 39 … … 46 46 &pe->values[0],0); 47 47 48 /*Free Matri x*/49 x free((void**)&transform);50 x free((void**)&values);48 /*Free Matrices*/ 49 xDelete<double>(transform); 50 xDelete<double>(values); 51 51 } -
issm/trunk-jpl/src/c/shared/Elements/TransformSolutionCoord.cpp
r10523 r12437 9 9 10 10 /*All nodes have the same Coordinate System*/ 11 cs_array= (int*)xmalloc(numnodes*sizeof(int));11 cs_array=xNew<int>(numnodes); 12 12 for(int i=0;i<numnodes;i++) cs_array[i]=cs_enum; 13 13 … … 16 16 17 17 /*Clean-up*/ 18 x free((void**)&cs_array);18 xDelete<int>(cs_array); 19 19 } 20 20 … … 36 36 37 37 /*Copy current solution vector*/ 38 values= (double*)xmalloc(numdofs*sizeof(double));38 values=xNew<double>(numdofs); 39 39 for(i=0;i<numdofs;i++) values[i]=solution[i]; 40 40 … … 47 47 &solution[0],0); 48 48 49 /*Free Matri x*/50 x free((void**)&transform);51 x free((void**)&values);49 /*Free Matrices*/ 50 xDelete<double>(transform); 51 xDelete<double>(values); 52 52 } -
issm/trunk-jpl/src/c/shared/Exceptions/exprintf.cpp
r11199 r12437 9 9 #include <stdarg.h> 10 10 #include <stdio.h> 11 #include "../Alloc/ alloc.h"11 #include "../Alloc/xNewDelete.h" 12 12 13 13 char* exprintf(const char* format,...){ … … 17 17 18 18 /*Assum nobody will print more that 1024 characters!*/ 19 string= (char*)xmalloc(1024*sizeof(char));//assume that nobody will print more than 1024 characters at once.19 string=xNew<char>(1024);//assume that nobody will print more than 1024 characters at once. 20 20 21 21 //variable list of arguments -
issm/trunk-jpl/src/c/shared/Exp/DomainOutlineRead.cpp
r12435 r12437 88 88 89 89 /*Allocate vertices: */ 90 x= (double*)xmalloc(n*sizeof(double));91 y= (double*)xmalloc(n*sizeof(double));90 x=xNew<double>(n); 91 y=xNew<double>(n); 92 92 93 93 /*Read vertices: */ -
issm/trunk-jpl/src/c/shared/Matrix/MatrixUtils.cpp
r12365 r12437 69 69 70 70 if (idima*idimc*(idimb+idimd) <= idimb*idimd*(idima+idimc)) { 71 dtemp=(double *) xmalloc(idima*idimc*sizeof(double)); 72 73 MatrixMultiply(a ,nrowa,ncola,itrna, 74 b ,nrowb,ncolb,itrnb, 75 dtemp,0); 76 MatrixMultiply(dtemp,idima,idimc,0 , 77 c ,nrowc,ncolc,itrnc, 78 d ,iaddd); 79 80 xfree((void **)&dtemp); 71 dtemp=xNew<double>(idima*idimc); 72 73 MatrixMultiply(a,nrowa,ncola,itrna,b,nrowb,ncolb,itrnb,dtemp,0); 74 MatrixMultiply(dtemp,idima,idimc,0,c,nrowc,ncolc,itrnc,d,iaddd); 75 xDelete<double>(dtemp); 81 76 } 82 77 … … 84 79 85 80 else { 86 dtemp=(double *) xmalloc(idimb*idimd*sizeof(double)); 87 88 MatrixMultiply(b ,nrowb,ncolb,itrnb, 89 c ,nrowc,ncolc,itrnc, 90 dtemp,0); 91 MatrixMultiply(a ,nrowa,ncola,itrna, 92 dtemp,idimb,idimd,0 , 93 d ,iaddd); 94 95 xfree((void **)&dtemp); 81 dtemp=xNew<double>(idimb*idimd); 82 83 MatrixMultiply(b,nrowb,ncolb,itrnb,c,nrowc,ncolc,itrnc,dtemp,0); 84 MatrixMultiply(a,nrowa,ncola,itrna,dtemp,idimb,idimd,0,d,iaddd); 85 xDelete<double>(dtemp); 96 86 } 97 87 … … 198 188 ncol=nrow; 199 189 det=1.; 200 201 pivrc = (int (*)[2]) xmalloc((nrow*2)*sizeof(int)); 202 pindx = (int (*) ) xcalloc( nrow ,sizeof(int)); 190 pivrc =(int(*)[2])xNew<int>(nrow*2); 191 pindx =xNew<int>(nrow); 203 192 204 193 /* loop over the rows/columns of the matrix */ … … 221 210 222 211 if (fabs(pivot) < DBL_EPSILON) { 223 xfree((void 224 x free((void **)&pindx);212 xfree((void**)&pivrc); 213 xDelete<int>(pindx); 225 214 _error_("Pivot %f less than machine epsilon",pivot); 226 215 noerr=0; … … 339 328 *pdet=det; 340 329 341 xfree((void 342 x free((void **)&pindx);330 xfree((void**)&pivrc); 331 xDelete<int>(pindx); 343 332 344 333 return noerr; -
issm/trunk-jpl/src/c/shared/Numerics/OptionsFromAnalysis.cpp
r12319 r12437 65 65 66 66 /*Free ressources*/ 67 x free((void**)&analyses);67 xDelete<double>(analyses); 68 68 for(i=0;i<numanalyses;i++){ 69 69 string=strings[i]; 70 x free((void**)&string);70 xDelete<char>(string); 71 71 } 72 xfree((void**)&strings); 73 74 72 xDelete<char*>(strings); 75 73 return outstring; 76 74 } -
issm/trunk-jpl/src/c/shared/Numerics/PetscOptionsFromAnalysis.cpp
r11695 r12437 39 39 40 40 /*Free ressources:*/ 41 x free((void**)&options);41 xDelete<char>(options); 42 42 }
Note:
See TracChangeset
for help on using the changeset viewer.