CLHEP 2.4.6.4
C++ Class Library for High Energy Physics
Loading...
Searching...
No Matches
Classical::RungeKuttaSolver Class Reference

#include <RungeKuttaClassicalSolver.hh>

+ Inheritance diagram for Classical::RungeKuttaSolver:

Classes

class  Clockwork
 

Public Member Functions

 RungeKuttaSolver (Genfun::GENFUNCTION H, const PhaseSpace &phaseSpace, const Genfun::RKIntegrator::RKStepper *stepper=NULL)
 
 ~RungeKuttaSolver ()
 
virtual Genfun::GENFUNCTION equationOf (const Genfun::Variable &v) const
 
virtual const PhaseSpacephaseSpace () const
 
virtual Genfun::GENFUNCTION hamiltonian () const
 
virtual Genfun::GENFUNCTION energy () const
 
virtual Genfun::ParametertakeQ0 (unsigned int index)
 
virtual Genfun::ParametertakeP0 (unsigned int index)
 
virtual Genfun::ParametercreateControlParameter (const std::string &variableName="anon", double defStartingValue=0.0, double startingValueMin=0.0, double startingValueMax=0.0) const
 
- Public Member Functions inherited from Classical::Solver
 Solver ()
 
virtual ~Solver ()
 
virtual Genfun::GENFUNCTION equationOf (const Genfun::Variable &v) const =0
 
virtual const PhaseSpacephaseSpace () const =0
 
virtual Genfun::GENFUNCTION hamiltonian () const =0
 
virtual Genfun::GENFUNCTION energy () const =0
 
virtual Genfun::ParametertakeQ0 (unsigned int index)=0
 
virtual Genfun::ParametertakeP0 (unsigned int index)=0
 
virtual Genfun::ParametercreateControlParameter (const std::string &variableName="anon", double defStartingValue=0.0, double startingValueMin=0.0, double startingValueMax=0.0) const =0
 

Detailed Description

Definition at line 21 of file RungeKuttaClassicalSolver.hh.

Constructor & Destructor Documentation

◆ RungeKuttaSolver()

Classical::RungeKuttaSolver::RungeKuttaSolver ( Genfun::GENFUNCTION  H,
const PhaseSpace phaseSpace,
const Genfun::RKIntegrator::RKStepper stepper = NULL 
)

Definition at line 25 of file RungeKuttaClassicalSolver.cc.

25 :c(new Clockwork(gH,mphaseSpace)){
26 c->integrator=new Genfun::RKIntegrator(stepper);
27 //
28 // Dimension (of coords, or phase space)
29 //
30 const unsigned int DIM=c->phaseSpace.dim();
31 //
32 // Equations of motion via hamilton's equations:
33 //
36
37 for (unsigned int i=0;i<DIM;i++) {
38 Genfun::GENFUNCTION DXDT = c->H.partial(P[i].index());
39 c->startingQ.push_back(c->integrator->addDiffEquation(&DXDT,"X",c->phaseSpace.startValue(X[i])));
40 }
41 for (unsigned int i=0;i<DIM;i++) {
42 Genfun::GENFUNCTION DPDT = -c->H.partial(X[i].index());
43 c->startingP.push_back(c->integrator->addDiffEquation(&DPDT,"P",c->phaseSpace.startValue(P[i])));
44 }
45 c->energy=NULL;
46
47 }
const Component & momenta() const
Definition: PhaseSpace.cc:70
const Component & coordinates() const
Definition: PhaseSpace.cc:66
double startValue(const Genfun::Variable &component) const
Definition: PhaseSpace.cc:87
unsigned int dim() const
Definition: PhaseSpace.cc:98
std::vector< Genfun::Parameter * > startingQ
std::vector< Genfun::Parameter * > startingP
virtual Derivative partial(unsigned int) const
Definition: AbsFunction.cc:40
Parameter * addDiffEquation(const AbsFunction *diffEquation, const std::string &variableName="anon", double defStartingValue=0.0, double startingValueMin=0.0, double startingValueMax=0.0)

◆ ~RungeKuttaSolver()

Classical::RungeKuttaSolver::~RungeKuttaSolver ( )

Definition at line 48 of file RungeKuttaClassicalSolver.cc.

48 {
49 delete c->integrator;
50 delete c->energy;
51 delete c;
52 }

Member Function Documentation

◆ createControlParameter()

Genfun::Parameter * Classical::RungeKuttaSolver::createControlParameter ( const std::string &  variableName = "anon",
double  defStartingValue = 0.0,
double  startingValueMin = 0.0,
double  startingValueMax = 0.0 
) const
virtual

Implements Classical::Solver.

Definition at line 68 of file RungeKuttaClassicalSolver.cc.

71 {
72 return c->integrator->createControlParameter(variableName, defStartingValue, startingValueMin, startingValueMax) ;
73 }
Parameter * createControlParameter(const std::string &variableName="anon", double defStartingValue=0.0, double startingValueMin=0.0, double startingValueMax=0.0)

◆ energy()

Genfun::GENFUNCTION Classical::RungeKuttaSolver::energy ( ) const
virtual

Implements Classical::Solver.

Definition at line 63 of file RungeKuttaClassicalSolver.cc.

63 {
64 if (!c->energy) c->energy=new Genfun::EnergyFunction(*this);
65 return *c->energy;
66 }

◆ equationOf()

Genfun::GENFUNCTION Classical::RungeKuttaSolver::equationOf ( const Genfun::Variable v) const
virtual

Implements Classical::Solver.

Definition at line 54 of file RungeKuttaClassicalSolver.cc.

54 {
55 return *c->integrator->getFunction(v.index());
56 }
const RKFunction * getFunction(unsigned int i) const
unsigned int index() const
Definition: Variable.cc:34

◆ hamiltonian()

Genfun::GENFUNCTION Classical::RungeKuttaSolver::hamiltonian ( ) const
virtual

Implements Classical::Solver.

Definition at line 57 of file RungeKuttaClassicalSolver.cc.

57 {
58 return c->H;
59 }

◆ phaseSpace()

const Classical::PhaseSpace & Classical::RungeKuttaSolver::phaseSpace ( ) const
virtual

Implements Classical::Solver.

Definition at line 60 of file RungeKuttaClassicalSolver.cc.

60 {
61 return c->phaseSpace;
62 }

◆ takeP0()

Genfun::Parameter * Classical::RungeKuttaSolver::takeP0 ( unsigned int  index)
virtual

Implements Classical::Solver.

Definition at line 78 of file RungeKuttaClassicalSolver.cc.

78 {
79 return c->startingP[index];
80 }

◆ takeQ0()

Genfun::Parameter * Classical::RungeKuttaSolver::takeQ0 ( unsigned int  index)
virtual

Implements Classical::Solver.

Definition at line 75 of file RungeKuttaClassicalSolver.cc.

75 {
76 return c->startingQ[index];
77 }

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