CLHEP 2.4.6.4
C++ Class Library for High Energy Physics
Loading...
Searching...
No Matches
Genfun::RKIntegrator::RKFunction Class Reference

#include <RKIntegrator.hh>

+ Inheritance diagram for Genfun::RKIntegrator::RKFunction:

Public Member Functions

 RKFunction (RKData *data, unsigned int index)
 
virtual ~RKFunction ()
 
 RKFunction (const RKFunction &right)
 
virtual double operator() (double argument) const override
 
virtual double operator() (const Argument &a) const override
 
- Public Member Functions inherited from Genfun::AbsFunction
 AbsFunction ()
 
 AbsFunction (const AbsFunction &right)
 
virtual ~AbsFunction ()
 
virtual unsigned int dimensionality () const
 
virtual double operator() (double argument) const =0
 
virtual double operator() (const Argument &argument) const =0
 
virtual AbsFunctionclone () const =0
 
virtual FunctionComposition operator() (const AbsFunction &f) const
 
virtual ParameterComposition operator() (const AbsParameter &p) const
 
Derivative derivative (const Variable &v) const
 
Derivative prime () const
 
virtual bool hasAnalyticDerivative () const
 
virtual Derivative partial (unsigned int) const
 

Detailed Description

Definition at line 140 of file RKIntegrator.hh.

Constructor & Destructor Documentation

◆ RKFunction() [1/2]

Genfun::RKIntegrator::RKFunction::RKFunction ( RKData data,
unsigned int  index 
)

Definition at line 14 of file RKIntegrator.cc.

15 :_data(data),
16 _index(index)
17{
18 _data->ref();
19}
void ref() const
Definition: RCBase.cc:15

◆ ~RKFunction()

Genfun::RKIntegrator::RKFunction::~RKFunction ( )
virtual

Definition at line 21 of file RKIntegrator.cc.

22{
23 _data->unref();
24}
void unref() const
Definition: RCBase.cc:20

◆ RKFunction() [2/2]

Genfun::RKIntegrator::RKFunction::RKFunction ( const RKFunction right)

Definition at line 26 of file RKIntegrator.cc.

27 :AbsFunction(right),
28 _data(right._data),
29 _index(right._index)
30{
31 _data->ref();
32}

Member Function Documentation

◆ operator()() [1/2]

virtual double Genfun::RKIntegrator::RKFunction::operator() ( const Argument a) const
inlineoverridevirtual

Implements Genfun::AbsFunction.

Definition at line 157 of file RKIntegrator.hh.

157{return operator() (a[0]);}
virtual double operator()(double argument) const override
Definition: RKIntegrator.cc:35

◆ operator()() [2/2]

double Genfun::RKIntegrator::RKFunction::operator() ( double  argument) const
overridevirtual

Implements Genfun::AbsFunction.

Definition at line 35 of file RKIntegrator.cc.

35 {
36 if (t<0) return 0;
37 if (!_data->_locked) _data->lock();
38
39 // Do this first, thereafter, just read the cache
40 _data->recache();
41
42
43 // If the cache is empty, make an entry for t=0;
44 size_t nvar = _data->_startingValParameter.size();
45 if (_data->_fx.empty()) {
46 RKData::Data d((int)nvar);
47 d.time=0;
48 Argument arg((int)nvar);
49 for (size_t f=0;f<nvar;f++) {
50 d.variable[f]=_data->_startingValParameterCache[f];
51 arg[(int)f]=d.variable[f];
52 }
53 _data->_fx.insert(d);
54 }
55
56 if (t==0) return (*_data->_fx.begin()).variable[_index];
57
58 RKData::Data dt((int)nvar);
59 dt.time=t;
60 std::set<RKData::Data>::iterator l =_data->_fx.lower_bound(dt);
61
62 // We did find an exact value (measure 0), just return it.
63 if (l!=_data->_fx.end() && (*l).time==t) {
64 return (*l).variable[_index];
65 }
66
67 else {
68 std::set<RKData::Data>::iterator u =_data->_fx.upper_bound(dt);
69
70 while (u==_data->_fx.end()) {
71 u--;
72 RKData::Data newData((int)nvar);;
73 _data->_stepper->step(_data,*u, newData, 0);
74 _data->_fx.insert(l,newData);
75 if (newData.time==t) return newData.variable[_index];
76 u = _data->_fx.upper_bound(dt);
77 }
78 u--;
79 _data->_stepper->step(_data,*u, dt, t);
80 return dt.variable[_index];
81 }
82}
std::vector< Parameter * > _startingValParameter
std::vector< double > _startingValParameterCache
const RKStepper * _stepper
virtual void step(const RKIntegrator::RKData *data, const RKIntegrator::RKData::Data &sdata, RKIntegrator::RKData::Data &ddata, double timeLimit=0) const =0
void f(void g())
Definition: excDblThrow.cc:38

Referenced by operator()().


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