34#define INCLXX_IN_GEANT4_MODE 1
61 for(
unsigned i = 0; i < x.size(); ++i)
68 std::vector<G4double> x(
nodes.size());
69 std::transform(
nodes.begin(),
nodes.end(), x.begin(),
75 std::vector<G4double> y(
nodes.size());
76 std::transform(
nodes.begin(),
nodes.end(), y.begin(),
82 for(
unsigned i = 0; i <
nodes.size()-1; i++) {
83 if((
nodes.at(i+1).getX() -
nodes.at(i).getX()) == 0.0)
84 nodes[i].setYPrime(0.0);
94 std::vector<InterpolationNode>::const_iterator iter =
95 std::lower_bound(
nodes.begin(),
nodes.end(), xNode);
97 if(iter==
nodes.begin())
98 return nodes.front().getY();
100 if(iter==
nodes.end())
101 return nodes.back().getY();
103 std::vector<InterpolationNode>::const_iterator previousIter = iter - 1;
104 const G4double dx = x - previousIter->getX();
105 return previousIter->getY() + previousIter->getYPrime()*dx;
110 for(std::vector<InterpolationNode>::const_iterator n=
nodes.begin(), e=
nodes.end(); n!=e; ++n)
111 message += n->print();
Simple interpolation table.
std::vector< InterpolationNode > nodes
Interpolating nodes.
void initDerivatives()
Initialise the values of the node derivatives.
std::string print() const
std::vector< G4double > getNodeValues() const
std::vector< G4double > getNodeAbscissae() const
G4double operator()(const G4double x) const
Compute the value of the function.