76 tarch::la::Vector<DIMENSIONS,double> Offset,
81 tarch::la::Vector<DIMENSIONS*2,int> index= {0,0,0,0,0,0};
82 for (
int i=0;i<patchSize;i++){
83 if (coor[0]>(Offset(0)+i*volumeH) and coor[0]<(Offset(0)+(i+1)*volumeH))
85 if (coor[0]<(Offset(0)+(i+0.5)*volumeH))
87 else if (coor[0]>(Offset(0)+(i+0.5)*volumeH))
93 for (
int i=0;i<patchSize;i++){
94 if (coor[1]>(Offset(1)+i*volumeH) and coor[1]<(Offset(1)+(i+1)*volumeH))
96 if (coor[1]<(Offset(1)+(i+0.5)*volumeH))
98 else if (coor[1]>(Offset(1)+(i+0.5)*volumeH))
104 for (
int i=0;i<patchSize;i++){
105 if (coor[2]>(Offset(2)+i*volumeH) and coor[2]<(Offset(2)+(i+1)*volumeH))
107 if (coor[2]<(Offset(2)+(i+0.5)*volumeH))
109 else if (coor[2]>(Offset(2)+(i+0.5)*volumeH))
118inline void FindInterIndex(tarch::la::Vector<DIMENSIONS,int>* InterIndex, tarch::la::Vector<DIMENSIONS*2,int> IndexOfCell)
122 if (IndexOfCell(3)==1) {
123 x[0]=IndexOfCell(0);x[1]=IndexOfCell(0)+1;
124 }
else if (IndexOfCell(3)==-1) {
125 x[0]=IndexOfCell(0)-1;x[1]=IndexOfCell(0);
127 x[0]=IndexOfCell(0);x[1]=IndexOfCell(0);}
129 if (IndexOfCell(4)==1) {
130 y[0]=IndexOfCell(1);y[1]=IndexOfCell(1)+1;
131 }
else if (IndexOfCell(4)==-1) {
132 y[0]=IndexOfCell(1)-1;y[1]=IndexOfCell(1);
134 y[0]=IndexOfCell(1);y[1]=IndexOfCell(1);}
136 if (IndexOfCell(5)==1) {
137 z[0]=IndexOfCell(2);z[1]=IndexOfCell(2)+1;
138 }
else if (IndexOfCell(5)==-1) {
139 z[0]=IndexOfCell(2)-1;z[1]=IndexOfCell(2);
141 z[0]=IndexOfCell(2);z[1]=IndexOfCell(2);}
145 for(
int k=0;k<2;k++){
146 InterIndex[i*4+j*2+k]={x[i],y[j],z[k]};
155 tarch::la::Vector<DIMENSIONS,int>* IndexForInter,
158 tarch::la::Vector<DIMENSIONS,double> Offset,
164 double CoorsForInter1[8][inter_number];
165 double raw1[8][inter_number];
168 for(
int k=0;k<2;k++){
169 for (
int m=0;m<inter_number;m++){
170 CoorsForInter1[i*4+j*2+k][m]=Offset(m)+(IndexForInter[i*4+j*2+k](m)-0.5)*volumeH;
171 raw1[i*4+j*2+k][m]=raw[(i*4+j*2+k)*inter_number+m];
176 double CoorsForInter2[4][inter_number];
177 double raw2[4][inter_number];
178 for (
int n=0;n<4;n++){
179 CoorsForInter2[n][0]=coor[0];
180 CoorsForInter2[n][1]=CoorsForInter1[n][1];
181 CoorsForInter2[n][2]=CoorsForInter1[n][2];
182 for (
int m=0;m<inter_number;m++){
183 raw2[n][m]=
linearInter(CoorsForInter1[n][0],raw1[n][m],CoorsForInter1[n+4][0],raw1[n+4][m],coor[0]);
188 double CoorsForInter3[2][inter_number];
189 double raw3[2][inter_number];
190 for (
int n=0;n<2;n++){
191 CoorsForInter3[n][0]=coor[0];
192 CoorsForInter3[n][1]=coor[1];
193 CoorsForInter3[n][2]=CoorsForInter1[n][2];
194 for (
int m=0;m<inter_number;m++){
195 raw3[n][m]=
linearInter(CoorsForInter2[n][1],raw2[n][m],CoorsForInter2[n+2][1],raw2[n+2][m],coor[1]);
200 double CoorsForInter4[1][inter_number];
201 double raw4[1][inter_number];
202 for (
int n=0;n<1;n++){
203 CoorsForInter4[n][0]=coor[0];
204 CoorsForInter4[n][1]=coor[1];
205 CoorsForInter4[n][2]=coor[2];
206 for (
int m=0;m<inter_number;m++){
207 raw4[n][m]=
linearInter(CoorsForInter3[n][2],raw3[n][m],CoorsForInter3[n+1][2],raw3[n+1][m],coor[2]);
211 result[0]=raw4[0][0]; result[1]=raw4[0][1]; result[2]=raw4[0][2];result[3]=raw4[0][3];
tarch::la::Vector< DIMENSIONS *2, int > FindCellIndex(const double *coor, tarch::la::Vector< DIMENSIONS, double > Offset, double volumeH, int patchSize)
void Interpolation(double *result, tarch::la::Vector< DIMENSIONS, int > *IndexForInter, double *raw, const double *coor, tarch::la::Vector< DIMENSIONS, double > Offset, double volumeH, int patchSize)