168 double z = point[2] + fZoffset;
171 if ( x>=minx && x<=maxx &&
172 y>=miny && y<=maxy &&
173 z>=minz && z<=maxz ) {
177 double xfraction = (x - minx) / dx;
178 double yfraction = (y - miny) / dy;
179 double zfraction = (z - minz) / dz;
181 if (invertX) { xfraction = 1 - xfraction;}
182 if (invertY) { yfraction = 1 - yfraction;}
183 if (invertZ) { zfraction = 1 - zfraction;}
187 double xdindex, ydindex, zdindex;
191 double xlocal = ( std::modf(xfraction*(nx-1), &xdindex));
192 double ylocal = ( std::modf(yfraction*(ny-1), &ydindex));
193 double zlocal = ( std::modf(zfraction*(nz-1), &zdindex));
197 int xindex =
static_cast<int>(xdindex);
198 int yindex =
static_cast<int>(ydindex);
199 int zindex =
static_cast<int>(zdindex);
202 #ifdef DEBUG_INTERPOLATING_FIELD
203 G4cout <<
"Local x,y,z: " << xlocal <<
" " << ylocal <<
" " << zlocal << endl;
204 G4cout <<
"Index x,y,z: " << xindex <<
" " << yindex <<
" " << zindex << endl;
205 double valx0z0, mulx0z0, valx1z0, mulx1z0;
206 double valx0z1, mulx0z1, valx1z1, mulx1z1;
207 valx0z0= table[xindex ][0][zindex]; mulx0z0= (1-xlocal) * (1-zlocal);
208 valx1z0= table[xindex+1][0][zindex]; mulx1z0= xlocal * (1-zlocal);
209 valx0z1= table[xindex ][0][zindex+1]; mulx0z1= (1-xlocal) * zlocal;
210 valx1z1= table[xindex+1][0][zindex+1]; mulx1z1= xlocal * zlocal;
215 xField[xindex ][yindex ][zindex ] * (1-xlocal) * (1-ylocal) * (1-zlocal) +
216 xField[xindex ][yindex ][zindex+1] * (1-xlocal) * (1-ylocal) * zlocal +
217 xField[xindex ][yindex+1][zindex ] * (1-xlocal) * ylocal * (1-zlocal) +
218 xField[xindex ][yindex+1][zindex+1] * (1-xlocal) * ylocal * zlocal +
219 xField[xindex+1][yindex ][zindex ] * xlocal * (1-ylocal) * (1-zlocal) +
220 xField[xindex+1][yindex ][zindex+1] * xlocal * (1-ylocal) * zlocal +
221 xField[xindex+1][yindex+1][zindex ] * xlocal * ylocal * (1-zlocal) +
222 xField[xindex+1][yindex+1][zindex+1] * xlocal * ylocal * zlocal ;
224 yField[xindex ][yindex ][zindex ] * (1-xlocal) * (1-ylocal) * (1-zlocal) +
225 yField[xindex ][yindex ][zindex+1] * (1-xlocal) * (1-ylocal) * zlocal +
226 yField[xindex ][yindex+1][zindex ] * (1-xlocal) * ylocal * (1-zlocal) +
227 yField[xindex ][yindex+1][zindex+1] * (1-xlocal) * ylocal * zlocal +
228 yField[xindex+1][yindex ][zindex ] * xlocal * (1-ylocal) * (1-zlocal) +
229 yField[xindex+1][yindex ][zindex+1] * xlocal * (1-ylocal) * zlocal +
230 yField[xindex+1][yindex+1][zindex ] * xlocal * ylocal * (1-zlocal) +
231 yField[xindex+1][yindex+1][zindex+1] * xlocal * ylocal * zlocal ;
233 zField[xindex ][yindex ][zindex ] * (1-xlocal) * (1-ylocal) * (1-zlocal) +
234 zField[xindex ][yindex ][zindex+1] * (1-xlocal) * (1-ylocal) * zlocal +
235 zField[xindex ][yindex+1][zindex ] * (1-xlocal) * ylocal * (1-zlocal) +
236 zField[xindex ][yindex+1][zindex+1] * (1-xlocal) * ylocal * zlocal +
237 zField[xindex+1][yindex ][zindex ] * xlocal * (1-ylocal) * (1-zlocal) +
238 zField[xindex+1][yindex ][zindex+1] * xlocal * (1-ylocal) * zlocal +
239 zField[xindex+1][yindex+1][zindex ] * xlocal * ylocal * (1-zlocal) +
240 zField[xindex+1][yindex+1][zindex+1] * xlocal * ylocal * zlocal ;
G4GLOB_DLL std::ostream G4cout