Changeset 12429
- Timestamp:
- 06/15/12 16:12:50 (13 years ago)
- Location:
- issm/trunk-jpl/src/c/toolkits
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/c/toolkits/issm/SeqMat.cpp
r12365 r12429 33 33 this->N=pN; 34 34 this->matrix=NULL; 35 if(M*N) this->matrix= (double*)xcalloc(pM*pN,sizeof(double));35 if(M*N) this->matrix=xNewInit<double>(pM*pN,0.0); 36 36 } 37 37 /*}}}*/ … … 42 42 this->N=pN; 43 43 this->matrix=NULL; 44 if(M*N) this->matrix= (double*)xcalloc(pM*pN,sizeof(double));44 if(M*N) this->matrix=xNewInit<double>(pM*pN,0.0); 45 45 } 46 46 /*}}}*/ … … 54 54 this->matrix=NULL; 55 55 if(M*N){ 56 this->matrix= (double*)xcalloc(pM*pN,sizeof(double));56 this->matrix=xNewInit<double>(pM*pN,0.0); 57 57 memcpy(this->matrix,serial_mat,pM*pN*sizeof(double)); 58 58 } … … 66 66 this->N=pN; 67 67 this->matrix=NULL; 68 if(M*N) this->matrix=(double*)xcalloc(pM*pN,sizeof(double));68 if(M*N) this->matrix=xNewInit<double>(pM*pN,0.0); 69 69 } 70 70 /*}}}*/ … … 72 72 SeqMat::~SeqMat(){ 73 73 74 x free((void**)&this->matrix);74 xDelete<double>(this->matrix); 75 75 M=0; 76 76 N=0; … … 178 178 179 179 if(this->M*this->N){ 180 buffer= (double*)xmalloc(this->M*this->N*sizeof(double));180 buffer=xNew<double>(this->M*this->N); 181 181 memcpy(buffer,this->matrix,this->M*this->N*sizeof(double)); 182 182 } -
issm/trunk-jpl/src/c/toolkits/issm/SeqVec.cpp
r12365 r12429 31 31 this->M=pM; 32 32 this->vector=NULL; 33 if(this->M) this->vector= (double*)xcalloc(pM,sizeof(double));33 if(this->M) this->vector=xNewInit<double>(pM,0.0); 34 34 } 35 35 /*}}}*/ … … 42 42 this->vector=NULL; 43 43 if(this->M){ 44 this->vector= (double*)xcalloc(pM,sizeof(double));44 this->vector=xNewInit<double>(pM,0.0); 45 45 memcpy(this->vector,buffer,pM*sizeof(double)); 46 46 } … … 49 49 /*FUNCTION SeqVec::~SeqVec(){{{*/ 50 50 SeqVec::~SeqVec(){ 51 x free((void**)&this->vector);51 xDelete<double>(this->vector); 52 52 M=0; 53 53 } … … 170 170 171 171 if(this->M){ 172 buffer= (double*)xmalloc(this->M*sizeof(double));172 buffer=xNew<double>(this->M); 173 173 memcpy(buffer,this->vector,this->M*sizeof(double)); 174 174 } -
issm/trunk-jpl/src/c/toolkits/metis/patches/METIS_PartMeshNodalPatch.cpp
r10087 r12429 13 13 METIS_PartMeshNodal(pnumberofelements,pnumberofnodes, index, petype, pnumflag, pnum_procs, pedgecut, epart, npart); 14 14 #elif _METIS_VERSION_ == 5 15 /*This interface is heavily changed. More options, different way of meshing, etc ...: */15 /*This interface is heavily changed. More options, different ways of meshing, etc ...: */ 16 16 int i; 17 17 … … 21 21 idx_t k=0; 22 22 real_t* tpwgts=NULL; 23 24 25 23 26 24 /*setup options: */ … … 40 38 options[METIS_OPTION_NCUTS] = 1; 41 39 42 43 40 /*create eptr: */ 44 eptr= (idx_t*)xmalloc((*pnumberofelements+1)*sizeof(idx_t));41 eptr=xNew<idx_t>((*pnumberofelements+1)); 45 42 eptr[0]=0; 46 43 for(i=0;i<*pnumberofelements;i++){ … … 49 46 } 50 47 51 52 48 /*create tpwgts: */ 53 tpwgts= (real_t*)xmalloc(*pnum_procs*sizeof(real_t));49 tpwgts=xNew<real_t>(*pnum_procs); 54 50 for(i=0;i<*pnum_procs;i++){ 55 51 tpwgts[i]=1.0/(*pnum_procs); 56 52 } 57 53 58 59 54 METIS_PartMeshNodal(pnumberofelements,pnumberofnodes, eptr, index, 60 NULL, NULL, pnum_procs, tpwgts, options, &objval, 61 epart, npart); 62 55 NULL, NULL, pnum_procs, tpwgts, options, &objval,epart, npart); 63 56 64 57 #else -
issm/trunk-jpl/src/c/toolkits/mpi/patches/DetermineLocalSize.cpp
r11695 r12429 5 5 #include <stdio.h> 6 6 #include <math.h> 7 8 9 7 #include "../../../shared/shared.h" 10 8 … … 24 22 25 23 /*We are not bound by any library, just use what seems most logical*/ 26 num_local_rows= (int*)xmalloc(num_procs*sizeof(int));24 num_local_rows=xNew<int>(num_procs); 27 25 28 26 for (i=0;i<num_procs;i++){ 29 30 27 /*Here, we use floor. We under distribute rows. The rows 31 28 left are then redistributed, therefore resulting in a … … 39 36 num_local_rows[i]++; 40 37 } 41 42 38 local_size=num_local_rows[my_rank]; 43 39 44 40 /*free ressources: */ 45 x free((void**)&num_local_rows);41 xDelete<double>(num_local_rows); 46 42 47 43 /*return size: */ -
issm/trunk-jpl/src/c/toolkits/mpi/patches/MPI_Boundariesfromrange.cpp
r11695 r12429 20 20 21 21 /*Gather all range values into allranges, for all nodes*/ 22 allranges= (int*)xmalloc(num_procs*sizeof(int));22 allranges=xNew<int>(num_procs); 23 23 MPI_Allgather(&range,1,MPI_INT,allranges,1,MPI_INT,MPI_COMM_WORLD); 24 25 24 26 25 /*From all ranges, get lower row and upper row*/ … … 31 30 upper_row=upper_row+allranges[i]; 32 31 } 33 34 /*free: */35 xfree((void**)&allranges);36 32 37 33 /*Assign output pointers: */ 34 xDelete<double>(allranges); 38 35 *plower_row=lower_row; 39 36 *pupper_row=upper_row; 40 41 37 return 1; 42 38 }
Note:
See TracChangeset
for help on using the changeset viewer.