CLHEP VERSION Reference Documentation
   
CLHEP Home Page     CLHEP Documentation     CLHEP Bug Reports

GenericFunctions/ClassicalSolver.hh
Go to the documentation of this file.
1 // This is a class the creates an N-Dimensional Phase Space //
2 
3 // It is for use in computing the time development of classical //
4 // Hamiltonian Systems. //
5 
6 // Joe Boudreau October 2011 //
7 
8 //--------------------------------------------------------------//
9 
10 #ifndef _ClassicalSolver_h__
11 #define _ClassicalSolver_h__
12 
16 
17 
18 namespace Genfun {
19  class EnergyFunction;
20 }
21 
22 
23 namespace Classical {
24 
25 
26  class Solver {
27 
28  public:
29  //
30  // Constructor--takes a hamiltonian and a point in p-space:
31  //
32  Solver(){};
33  //
34  // Destructor:
35  //
36  virtual ~Solver(){};
37  //
38  // Returns the time evolution for a variable (q_i or p_i)
39  //
40  virtual Genfun::GENFUNCTION equationOf(const Genfun::Variable & v) const=0;
41  //
42  // Returns the phase space
43  //
44  virtual const PhaseSpace & phaseSpace() const=0;
45  //
46  // Returns the Hamiltonian (function of the 2N phase space variables).
47  //
48  virtual Genfun::GENFUNCTION hamiltonian() const=0;
49  //
50  // Returns the energy (function of time).
51  //
52  virtual Genfun::GENFUNCTION energy() const=0;
53  //
54  // This is in the rare case that the user needs to edit starting values.
55  // or parameterize the Hamiltonian. Most users: can ignore.
56  virtual Genfun::Parameter *takeQ0(unsigned int index)=0;
57  virtual Genfun::Parameter *takeP0(unsigned int index)=0;
58  virtual Genfun::Parameter *createControlParameter(const std::string & variableName="anon",
59  double defStartingValue=0.0,
60  double startingValueMin=0.0,
61  double startingValueMax=0.0) const = 0;
62 
63 
64 
65  private:
66 
67  // Illegal Operations:
68  Solver (const Solver &);
69  Solver & operator=(const Solver &);
70 
71  };
72 }
73 
74 namespace Genfun {
75 
76  class EnergyFunction: public Genfun::AbsFunction {
77 
79 
80  public:
81 
82  // Constructor
84 
85  // Destructor
86  virtual ~EnergyFunction();
87 
88  // Copy constructor
90 
91  // Retreive function value
92  virtual double operator ()(double argument) const;
93  virtual double operator ()(const Argument & a) const {return operator() (a[0]);}
94 
95  private:
96 
97  // It is illegal to assign a EnergyFunction
98  const EnergyFunction & operator=(const EnergyFunction &right);
99 
100  const Classical::Solver & solver;
101 
102  };
103 
104 }
105 
106 
107 
108 #endif
#define FUNCTION_OBJECT_DEF(classname)
virtual Genfun::GENFUNCTION equationOf(const Genfun::Variable &v) const =0
virtual Genfun::Parameter * takeQ0(unsigned int index)=0
virtual Genfun::GENFUNCTION hamiltonian() const =0
virtual Genfun::Parameter * takeP0(unsigned int index)=0
virtual const PhaseSpace & phaseSpace() const =0
virtual Genfun::Parameter * createControlParameter(const std::string &variableName="anon", double defStartingValue=0.0, double startingValueMin=0.0, double startingValueMax=0.0) const =0
virtual Genfun::GENFUNCTION energy() const =0
EnergyFunction(const EnergyFunction &right)
virtual double operator()(double argument) const
EnergyFunction(const Classical::Solver &)
@ a