Changeset 12366
- Timestamp:
- 06/05/12 09:11:56 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/c/objects/Patch.cpp
r12365 r12366 52 52 } 53 53 else{ 54 this->values=(double*)xmalloc(this->numcols*this->numrows*sizeof(double));54 this->values=xNew<IssmDouble>(this->numcols*this->numrows); 55 55 for(i=0;i<this->numrows;i++){ 56 56 for(j=0;j<this->numcols;j++){ … … 64 64 /*FUNCTION Patch::~Patch(){{{*/ 65 65 Patch::~Patch(){ 66 x free((void**)&values);66 xDelete<IssmDouble>(values); 67 67 } 68 68 /*}}}*/ … … 73 73 74 74 int i; 75 double* row=NULL;75 IssmDouble* row=NULL; 76 76 77 77 /*point to the start of the row: */ … … 89 89 /*}}}*/ 90 90 /*FUNCTION Patch::fillresultinfo{{{*/ 91 void Patch::fillresultinfo(int count,int enum_type,int step, double time, int interpolation, double* nodal_values, int num_nodes){91 void Patch::fillresultinfo(int count,int enum_type,int step, IssmDouble time, int interpolation, IssmDouble* nodal_values, int num_nodes){ 92 92 93 93 int i; 94 double* row=NULL;94 IssmDouble* row=NULL; 95 95 96 96 /*point to the start of the row: */ … … 101 101 */ 102 102 row[0]=enum_type; 103 row[1]=( double)step;103 row[1]=(IssmDouble)step; 104 104 row[2]=time; 105 105 row[4]=interpolation; … … 119 119 int total_numrows; 120 120 int node_numrows; 121 double *total_values = NULL;121 IssmDouble *total_values = NULL; 122 122 #ifdef _HAVE_MPI_ 123 123 MPI_Status status; … … 136 136 137 137 /*Now, allocate buffer to holds all the values, on node 0: */ 138 if(my_rank==0)total_values= (double*)xmalloc(this->numcols*total_numrows*sizeof(double));138 if(my_rank==0)total_values=xNew<IssmDouble>(this->numcols*total_numrows); 139 139 140 140 /*Start by copying node 0 values onto total_values: */ 141 141 if(my_rank==0){ 142 142 count=0; 143 memcpy(total_values+count,this->values,this->numcols*this->numrows*sizeof(double));143 xMemCpy<IssmDouble>(total_values+count,this->values,this->numcols*this->numrows); 144 144 count+=this->numrows*this->numcols; 145 145 } … … 164 164 if(my_rank==0){ 165 165 this->numrows=total_numrows; 166 x free((void**)&this->values);166 xDelete<IssmDouble>(this->values); 167 167 this->values=total_values; 168 168 } … … 170 170 else{ 171 171 this->numrows=0; 172 x free((void**)&this->values);172 xDelete<IssmDouble>(this->values); 173 173 } 174 174 #endif
Note:
See TracChangeset
for help on using the changeset viewer.