Class for interpolating the of a 1-dimensional function.
More...
#include <G4INCLInterpolationTable.hh>
Class for interpolating the of a 1-dimensional function.
Definition at line 106 of file G4INCLInterpolationTable.hh.
◆ InterpolationTable() [1/2]
G4INCL::InterpolationTable::InterpolationTable |
( |
std::vector< G4double > const & |
x, |
|
|
std::vector< G4double > const & |
y |
|
) |
| |
Definition at line 54 of file G4INCLInterpolationTable.cc.
61 for(
unsigned i = 0; i <
x.size(); ++i)
62 nodes.push_back(InterpolationNode(
x.at(i),
y.at(i), 0.));
void initDerivatives()
Initialise the values of the node derivatives.
std::vector< InterpolationNode > nodes
Interpolating nodes.
◆ ~InterpolationTable()
virtual G4INCL::InterpolationTable::~InterpolationTable |
( |
| ) |
|
|
inlinevirtual |
◆ InterpolationTable() [2/2]
G4INCL::InterpolationTable::InterpolationTable |
( |
| ) |
|
|
protected |
◆ getNodeAbscissae()
std::vector< G4double > G4INCL::InterpolationTable::getNodeAbscissae |
( |
| ) |
const |
◆ getNodeValues()
std::vector< G4double > G4INCL::InterpolationTable::getNodeValues |
( |
| ) |
const |
◆ getNumberOfNodes()
unsigned int G4INCL::InterpolationTable::getNumberOfNodes |
( |
| ) |
const |
|
inline |
◆ initDerivatives()
void G4INCL::InterpolationTable::initDerivatives |
( |
| ) |
|
|
protected |
Initialise the values of the node derivatives.
Definition at line 81 of file G4INCLInterpolationTable.cc.
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);
std::vector< InterpolationNode > nodes
Interpolating nodes.
◆ operator()()
Implements G4INCL::IFunction1D.
Definition at line 91 of file G4INCLInterpolationTable.cc.
93 InterpolationNode xNode(
x,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;
std::vector< InterpolationNode > nodes
Interpolating nodes.
◆ print()
std::string G4INCL::InterpolationTable::print |
( |
| ) |
const |
Definition at line 108 of file G4INCLInterpolationTable.cc.
110 for(std::vector<InterpolationNode>::const_iterator
n=
nodes.begin(),
e=
nodes.end();
n!=
e; ++
n)
111 message +=
n->print();
std::vector< InterpolationNode > nodes
Interpolating nodes.
◆ nodes
The documentation for this class was generated from the following files: