49 numberOfXNodes(0), numberOfYNodes(0),
50 verboseLevel(0), useBicubic(false)
57 numberOfXNodes(nx), numberOfYNodes(ny),
58 verboseLevel(0), useBicubic(false)
76 numberOfXNodes = right.numberOfXNodes;
77 numberOfYNodes = right.numberOfYNodes;
79 verboseLevel = right.verboseLevel;
80 useBicubic = right.useBicubic;
82 xVector = right.xVector;
83 yVector = right.yVector;
93 if (&right==
this) {
return *
this; }
98 numberOfXNodes = right.numberOfXNodes;
99 numberOfYNodes = right.numberOfYNodes;
101 verboseLevel = right.verboseLevel;
102 useBicubic = right.useBicubic;
114 xVector.resize(numberOfXNodes,0.);
115 yVector.resize(numberOfYNodes,0.);
116 value.resize(numberOfYNodes,0);
117 for(
size_t j=0; j<numberOfYNodes; ++j) {
119 v->resize(numberOfXNodes,0.);
128 for(
size_t j=0; j<numberOfYNodes; ++j) {
137 for(
size_t i=0; i<numberOfXNodes; ++i) {
138 xVector[i] = right.xVector[i];
140 for(
size_t j=0; j<numberOfYNodes; ++j) {
141 yVector[j] = right.yVector[j];
143 for(
size_t i=0; i<numberOfXNodes; ++i) {
152 size_t& idx,
size_t& idy)
const
160 }
else if(x > xVector[numberOfXNodes - 1]) {
161 x = xVector[numberOfXNodes - 1];
165 }
else if(y > yVector[numberOfYNodes - 1]) {
166 y = yVector[numberOfYNodes - 1];
185 return ((y2 - y)*(v11*(x2 - x) + v12*(x - x1)) +
186 ((y - y1)*(v21*(x2 - x) + v22*(x - x1))))/((x2 -
x1)*(y2 - y1));
194 size_t idx,
size_t idy)
const
225 G4double f1x = DerivativeX(idx, idy, dx);
226 G4double f2x = DerivativeX(idx+1, idy, dx);
227 G4double f3x = DerivativeX(idx+1, idy+1, dx);
228 G4double f4x = DerivativeX(idx, idy+1, dx);
230 G4double f1y = DerivativeY(idx, idy, dy);
231 G4double f2y = DerivativeY(idx+1, idy, dy);
232 G4double f3y = DerivativeY(idx+1, idy+1, dy);
233 G4double f4y = DerivativeY(idx, idy+1, dy);
236 G4double f1xy = DerivativeXY(idx, idy, dxy);
237 G4double f2xy = DerivativeXY(idx+1, idy, dxy);
238 G4double f3xy = DerivativeXY(idx+1, idy+1, dxy);
239 G4double f4xy = DerivativeXY(idx, idy+1, dxy);
242 f1 + f1y*h2 + (3*(f4-
f1) - 2*f1y - f4y)*h22 + (2*(f1 -
f4) + f1y + f4y)*h23
243 + f1x*h1 + f1xy*h1*h2 +(3*(f4x - f1x) - 2*f1xy - f4xy)*h1*h22
244 + (2*(f1x - f4x) + f1xy + f4xy)*h1*h23
245 + (3*(f2 -
f1) - 2*f1x - f2x)*h12 + (3*f2y - 3*f1y - 2*f1xy - f2xy)*h12*h2
246 + (9*(f1 - f2 + f3 - f4) + 6*f1x + 3*f2x - 3*f3x - 6*f4x + 6*f1y - 6*f2y
247 - 3*f3y + 3*f4y + 4*f1xy + 2*f2xy + f3xy + 2*f4xy)*h12*h22
248 + (6*(-f1 + f2 - f3 + f4) - 4*f1x - 2*f2x + 2*f3x + 4*f4x - 3*f1y
249 + 3*f2y + 3*f3y - 3*f4y - 2*f1xy - f2xy - f3xy - 2*f4xy)*h12*h23
250 + (2*(f1 - f2) + f1x + f2x)*h13 + (2*(f1y - f2y) + f1xy + f2xy)*h13*h2
251 + (6*(-f1 + f2 -f3 + f4) + 3*(-f1x - f2x + f3x + f4x) - 4*f1y
252 + 4*f2y + 2*f3y - 2*f4y - 2*f1xy - 2*f2xy - f3xy - f4xy)*h13*h22
253 + (4*(f1 - f2 + f3 -
f4) + 2*(f1x + f2x - f3x - f4x)
254 + 2*(f1y - f2y - f3y + f4y) + f1xy + f2xy + f3xy + f4xy)*h13*h23;
261 const std::vector<G4double>& vecY)
264 numberOfXNodes = vecX.size();
265 numberOfYNodes = vecY.size();
267 for(
size_t i = 0; i<numberOfXNodes; ++i) {
268 xVector[i] = vecX[i];
270 for(
size_t j = 0; j<numberOfYNodes; ++j) {
271 yVector[j] = vecY[j];
280 G4int prec = out.precision();
281 out <<
G4int(type) <<
" " << numberOfXNodes <<
" " << numberOfYNodes
283 out << std::setprecision(5);
286 for(
size_t i = 0; i<numberOfXNodes-1; ++i) {
287 out << xVector[i] <<
" ";
289 out << xVector[numberOfXNodes-1] <<
G4endl;
290 for(
size_t j = 0; j<numberOfYNodes-1; ++j) {
291 out << yVector[j] <<
" ";
293 out << yVector[numberOfYNodes-1] <<
G4endl;
294 for(
size_t j = 0; j<numberOfYNodes; ++j) {
295 for(
size_t i = 0; i<numberOfXNodes-1; ++i) {
313 in >> k >> numberOfXNodes >> numberOfYNodes;
314 if (in.fail() || 0 >= numberOfXNodes || 0 >= numberOfYNodes) {
322 for(
size_t i = 0; i<numberOfXNodes; ++i) {
324 if (in.fail()) {
return false; }
326 for(
size_t j = 0; j<numberOfYNodes; ++j) {
328 if (in.fail()) {
return false; }
330 for(
size_t j = 0; j<numberOfYNodes; ++j) {
331 for(
size_t i = 0; i<numberOfXNodes; ++i) {
333 if (in.fail()) {
return false; }
347 for(
size_t j = 0; j<numberOfYNodes; ++j) {
348 for(
size_t i = 0; i<numberOfXNodes; ++i) {
361 size_t lowerBound = 0;
362 size_t upperBound = v.size() - 2;
364 while (lowerBound <= upperBound)
366 size_t midBin = (lowerBound + upperBound)/2;
367 if( z < v[midBin] ) { upperBound = midBin-1; }
368 else { lowerBound = midBin+1; }
384 }
else if(y > yVector[numberOfYNodes - 1]) {
385 y = yVector[numberOfYNodes - 1];
394 G4double del = yVector[idy+1] - yVector[idy];
396 res += (x2 -
x1)*(y - yVector[idy])/del;
406 size_t nn = v.size();
407 if(1 >= nn) {
return 0.0; }
418 n2 = (n3 + n1 + 1)/2;
423 res += (y - v[n1])*(xVector[n3] - res)/del;
std::vector< G4double > G4PV2DDataVector
G4double GetValue(size_t idx, size_t idy) const
void Store(std::ofstream &fOut)
size_t FindBinLocation(G4double z, const G4PV2DDataVector &) const
size_t FindBinLocationX(G4double x, size_t lastidx) const
void CopyData(const G4Physics2DVector &vec)
void PutValue(size_t idx, size_t idy, G4double value)
G4double Value(G4double x, G4double y, size_t &lastidx, size_t &lastidy) const
G4Physics2DVector & operator=(const G4Physics2DVector &)
G4bool Retrieve(std::ifstream &fIn)
G4double BicubicInterpolation(G4double x, G4double y, size_t idx, size_t idy) const
size_t FindBinLocationY(G4double y, size_t lastidy) const
const XML_Char int const XML_Char * value
void PutVectors(const std::vector< G4double > &vecX, const std::vector< G4double > &vecY)
void ScaleVector(G4double factor)
G4double FindLinearX(G4double rand, G4double y, size_t &lastidy) const