49 numberOfXNodes(0), numberOfYNodes(0),
50 verboseLevel(0), useBicubic(false)
59 numberOfXNodes(nx), numberOfYNodes(ny),
60 verboseLevel(0), useBicubic(false)
80 numberOfXNodes = right.numberOfXNodes;
81 numberOfYNodes = right.numberOfYNodes;
83 verboseLevel = right.verboseLevel;
84 useBicubic = right.useBicubic;
86 xVector = right.xVector;
87 yVector = right.yVector;
98 if (&right==
this) {
return *
this; }
103 numberOfXNodes = right.numberOfXNodes;
104 numberOfYNodes = right.numberOfYNodes;
106 verboseLevel = right.verboseLevel;
107 useBicubic = right.useBicubic;
120 xVector.resize(numberOfXNodes,0.);
121 yVector.resize(numberOfYNodes,0.);
122 value.resize(numberOfYNodes,0);
123 for(
size_t j=0; j<numberOfYNodes; ++j) {
125 v->resize(numberOfXNodes,0.);
134 for(
size_t j=0; j<numberOfYNodes; ++j) {
143 for(
size_t i=0; i<numberOfXNodes; ++i) {
144 xVector[i] = right.xVector[i];
146 for(
size_t j=0; j<numberOfYNodes; ++j) {
147 yVector[j] = right.yVector[j];
149 for(
size_t i=0; i<numberOfXNodes; ++i) {
160 if(xx <= xVector[0]) {
161 cache->
lastX = xVector[0];
163 }
else if(xx >= xVector[numberOfXNodes-1]) {
164 cache->
lastX = xVector[numberOfXNodes-1];
172 if(yy <= yVector[0]) {
173 cache->
lastY = yVector[0];
175 }
else if(yy >= yVector[numberOfYNodes-1]) {
176 cache->
lastY = yVector[numberOfYNodes-1];
199 ((y2 - y)*(v11*(x2 - x) + v12*(x - x1)) +
200 ((y - y1)*(v21*(x2 - x) + v22*(x - x1))))/((x2 - x1)*(y2 - y1));
239 G4double f1x = DerivativeX(idx, idy, dx);
240 G4double f2x = DerivativeX(idx+1, idy, dx);
241 G4double f3x = DerivativeX(idx+1, idy+1, dx);
242 G4double f4x = DerivativeX(idx, idy+1, dx);
244 G4double f1y = DerivativeY(idx, idy, dy);
245 G4double f2y = DerivativeY(idx+1, idy, dy);
246 G4double f3y = DerivativeY(idx+1, idy+1, dy);
247 G4double f4y = DerivativeY(idx, idy+1, dy);
250 G4double f1xy = DerivativeXY(idx, idy, dxy);
251 G4double f2xy = DerivativeXY(idx+1, idy, dxy);
252 G4double f3xy = DerivativeXY(idx+1, idy+1, dxy);
253 G4double f4xy = DerivativeXY(idx, idy+1, dxy);
256 f1 + f1y*h2 + (3*(f4-f1) - 2*f1y - f4y)*h22 + (2*(f1 - f4) + f1y + f4y)*h23
257 + f1x*h1 + f1xy*h1*h2 +(3*(f4x - f1x) - 2*f1xy - f4xy)*h1*h22
258 + (2*(f1x - f4x) + f1xy + f4xy)*h1*h23
259 + (3*(f2 - f1) - 2*f1x - f2x)*h12 + (3*f2y - 3*f1y - 2*f1xy - f2xy)*h12*h2
260 + (9*(f1 - f2 + f3 - f4) + 6*f1x + 3*f2x - 3*f3x - 6*f4x + 6*f1y - 6*f2y
261 - 3*f3y + 3*f4y + 4*f1xy + 2*f2xy + f3xy + 2*f4xy)*h12*h22
262 + (6*(-f1 + f2 - f3 + f4) - 4*f1x - 2*f2x + 2*f3x + 4*f4x - 3*f1y
263 + 3*f2y + 3*f3y - 3*f4y - 2*f1xy - f2xy - f3xy - 2*f4xy)*h12*h23
264 + (2*(f1 - f2) + f1x + f2x)*h13 + (2*(f1y - f2y) + f1xy + f2xy)*h13*h2
265 + (6*(-f1 + f2 -f3 + f4) + 3*(-f1x - f2x + f3x + f4x) - 4*f1y
266 + 4*f2y + 2*f3y - 2*f4y - 2*f1xy - 2*f2xy - f3xy - f4xy)*h13*h22
267 + (4*(f1 - f2 + f3 - f4) + 2*(f1x + f2x - f3x - f4x)
268 + 2*(f1y - f2y - f3y + f4y) + f1xy + f2xy + f3xy + f4xy)*h13*h23;
275 const std::vector<G4double>& vecY)
278 numberOfXNodes = vecX.size();
279 numberOfYNodes = vecY.size();
283 for(
size_t i = 0; i<numberOfXNodes; ++i) {
284 xVector[i] = vecX[i];
286 for(
size_t j = 0; j<numberOfYNodes; ++j) {
287 yVector[j] = vecY[j];
296 G4int prec = out.precision();
297 out <<
G4int(type) <<
" " << numberOfXNodes <<
" " << numberOfYNodes
299 out << std::setprecision(5);
302 for(
size_t i = 0; i<numberOfXNodes-1; ++i) {
303 out << xVector[i] <<
" ";
305 out << xVector[numberOfXNodes-1] <<
G4endl;
306 for(
size_t j = 0; j<numberOfYNodes-1; ++j) {
307 out << yVector[j] <<
" ";
309 out << yVector[numberOfYNodes-1] <<
G4endl;
310 for(
size_t j = 0; j<numberOfYNodes; ++j) {
311 for(
size_t i = 0; i<numberOfXNodes-1; ++i) {
330 in >> k >> numberOfXNodes >> numberOfYNodes;
331 if (in.fail()) {
return false; }
337 for(
size_t i = 0; i<numberOfXNodes; ++i) {
339 if (in.fail()) {
return false; }
341 for(
size_t j = 0; j<numberOfYNodes; ++j) {
343 if (in.fail()) {
return false; }
345 for(
size_t j = 0; j<numberOfYNodes; ++j) {
346 for(
size_t i = 0; i<numberOfXNodes; ++i) {
348 if (in.fail()) {
return false; }
362 for(
size_t j = 0; j<numberOfYNodes; ++j) {
363 for(
size_t i = 0; i<numberOfXNodes; ++i) {
376 size_t lowerBound = 0;
377 size_t upperBound = v.size() - 2;
379 while (lowerBound <= upperBound)
381 size_t midBin = (lowerBound + upperBound)/2;
382 if( z < v[midBin] ) { upperBound = midBin-1; }
383 else { lowerBound = midBin+1; }
std::vector< G4double > G4PV2DDataVector
G4bool Retrieve(std::ifstream &fIn)
void FindBinLocationY(G4double y)
G4Physics2DVector & operator=(const G4Physics2DVector &)
void BicubicInterpolation(size_t idx, size_t idy)
void CopyData(const G4Physics2DVector &vec)
void PutVectors(const std::vector< G4double > &vecX, const std::vector< G4double > &vecY)
G4double GetValue(size_t idx, size_t idy) const
size_t FindBinLocation(G4double z, const G4PV2DDataVector &)
void FindBinLocationX(G4double x)
void Store(std::ofstream &fOut)
void ScaleVector(G4double factor)
void PutValue(size_t idx, size_t idy, G4double value)
void ComputeValue(G4double x, G4double y)