Geant4  10.03.p01
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
G4INCL::InvFInterpolationTable Class Reference

Class for interpolating the inverse of a 1-dimensional function. More...

#include <G4INCLInvFInterpolationTable.hh>

Inheritance diagram for G4INCL::InvFInterpolationTable:
Collaboration diagram for G4INCL::InvFInterpolationTable:

Public Member Functions

 InvFInterpolationTable (IFunction1D const &f, const unsigned int nNodes=30)
 
virtual ~InvFInterpolationTable ()
 
- Public Member Functions inherited from G4INCL::InterpolationTable
 InterpolationTable (std::vector< G4double > const &x, std::vector< G4double > const &y)
 
virtual ~InterpolationTable ()
 
unsigned int getNumberOfNodes () const
 
std::vector< G4doublegetNodeAbscissae () const
 
std::vector< G4doublegetNodeValues () const
 
G4double operator() (const G4double x) const
 Compute the value of the function. More...
 
std::string print () const
 
- Public Member Functions inherited from G4INCL::IFunction1D
 IFunction1D ()
 
 IFunction1D (const G4double x0, const G4double x1)
 
virtual ~IFunction1D ()
 
virtual G4double getXMinimum () const
 Return the minimum allowed value of the independent variable. More...
 
virtual G4double getXMaximum () const
 Return the maximum allowed value of the independent variable. More...
 
virtual G4double integrate (const G4double x0, const G4double x1, const G4double step=-1.) const
 Integrate the function between two values. More...
 
IFunction1Dprimitive () const
 Return a pointer to the (numerical) primitive to this function. More...
 
InterpolationTableinverseCDFTable (ManipulatorFunc fWrap=0, const G4int nNodes=60) const
 Return a pointer to the inverse of the CDF of this function. More...
 

Additional Inherited Members

- Public Types inherited from G4INCL::IFunction1D
typedef G4double(*const ManipulatorFunc )(const G4double)
 Typedef to simplify the syntax of inverseCDFTable. More...
 
- Protected Member Functions inherited from G4INCL::InterpolationTable
 InterpolationTable ()
 
void initDerivatives ()
 Initialise the values of the node derivatives. More...
 
- Protected Attributes inherited from G4INCL::InterpolationTable
std::vector< InterpolationNodenodes
 Interpolating nodes. More...
 
- Protected Attributes inherited from G4INCL::IFunction1D
G4double xMin
 Minimum value of the independent variable. More...
 
G4double xMax
 Maximum value of the independent variable. More...
 

Detailed Description

Class for interpolating the inverse of a 1-dimensional function.

Definition at line 56 of file G4INCLInvFInterpolationTable.hh.

Constructor & Destructor Documentation

G4INCL::InvFInterpolationTable::InvFInterpolationTable ( IFunction1D const &  f,
const unsigned int  nNodes = 30 
)

Definition at line 52 of file G4INCLInvFInterpolationTable.cc.

52  {
53 // assert(nNodes>2);
54 
55  const G4double x0 = f.getXMinimum();
56  const G4double x1 = f.getXMaximum();
57 
58  // Build the nodes
59  G4double last = f(x0);
60  InterpolationNode firstNode(last, x0, 0.);
61  nodes.push_back(firstNode);
62  G4int skippedNodes = 0;
63  for(unsigned i = 1; i < nNodes; i++) {
64  const G4double xi = x0 + i*(x1-x0)/((G4double)(nNodes-1));
65  // Make sure that the x vector is sorted (corresponding to a monotonous
66  // function)
67  const G4double value = f(xi);
68  if(value <= last) {
69  ++skippedNodes;
70  continue;
71  }
72  InterpolationNode node(value, xi, 0.);
73  nodes.push_back(node);
74  last = value;
75  }
76 
77 // assert(nNodes==nodes.size()+skippedNodes);
78 
79  // Initialise the "derivative" values
81  }
void initDerivatives()
Initialise the values of the node derivatives.
int G4int
Definition: G4Types.hh:78
const XML_Char int const XML_Char * value
Definition: expat.h:331
double G4double
Definition: G4Types.hh:76
std::vector< InterpolationNode > nodes
Interpolating nodes.

Here is the call graph for this function:

virtual G4INCL::InvFInterpolationTable::~InvFInterpolationTable ( )
inlinevirtual

Definition at line 59 of file G4INCLInvFInterpolationTable.hh.

59 {}

The documentation for this class was generated from the following files: