Changeset 21802 for issm/trunk-jpl/src/c/modules/InterpFromMeshToMesh2dx/InterpFromMeshToMesh2dx.cpp
- Timestamp:
- 07/17/17 21:18:32 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/c/modules/InterpFromMeshToMesh2dx/InterpFromMeshToMesh2dx.cpp
r21792 r21802 24 24 R2 r; 25 25 I2 I; 26 int i,j ;26 int i,j,k; 27 27 int it; 28 28 int i0,i1,i2; … … 64 64 if(y_data[i]<ymin) ymin=y_data[i]; 65 65 if(y_data[i]>ymax) ymax=y_data[i]; 66 } 67 68 /*Create Single vertex to element connectivity*/ 69 int* connectivity = xNew<int>(nods_data); 70 for(i=0;i<nels_data;i++){ 71 for(j=0;j<3;j++){ 72 k = index_data[i*3+j]-1; 73 _assert_(k>=0 & k<nods_data); 74 connectivity[k]=i; 75 } 66 76 } 67 77 … … 137 147 /*If we fall outside of the convex or outside of the mesh, return NaN*/ 138 148 if(tb.det<0 || reft[it]<0){ 139 for (j=0;j<N_data;j++){ 140 data_interp[i*N_data+j]=NAN; 141 } 149 _assert_(i0>=0 & i0<nods_data); 150 it=connectivity[i0]; //or i1 or i2 151 _assert_(it>=0 && it<nels_data); 152 for(j=0;j<N_data;j++) data_interp[i*N_data+j]=data[N_data*it+j]; 142 153 } 143 154 else{ 155 /*Inside the mesh!*/ 144 156 if(it<0 || it>=nels_data){ 145 157 _error_("Triangle number " << it << " not in [0 " << nels_data 146 158 << "], report bug to developers (interpolation point: " <<x_interp[i]<<" "<<y_interp[i]<<")"); 147 159 } 148 for (j=0;j<N_data;j++){ 149 150 data_interp[i*N_data+j]=data[N_data*it+j]; 151 } 160 for (j=0;j<N_data;j++) data_interp[i*N_data+j]=data[N_data*it+j]; 152 161 } 153 162 } … … 158 167 delete Th; 159 168 xDelete<long>(reft); 169 xDelete<int>(connectivity); 160 170 *pdata_interp=data_interp; 161 171 return 1;
Note:
See TracChangeset
for help on using the changeset viewer.