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

CLHEP/GenericFunctions/PhaseSpace.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 _PHASE_SPACE_
11 #define _PHASE_SPACE_
13 #include <vector>
14 
15 namespace Classical {
16 
17  class PhaseSpace {
18 
19 
20  public:
21 
22  // A component is like a vector: of coordinates or momenta:
23  class Component;
24 
25  // constructor
26  PhaseSpace(unsigned int NDIM);
27 
28  // Destructor
29  ~PhaseSpace();
30 
31  // Get the dimensionality:
32  unsigned int dim() const;
33 
34  // Get the coordinates:
35  const Component & coordinates() const;
36 
37  // Get the momenta:
38  const Component & momenta() const;
39 
40  // Set starting values for the coordinates or momenta:
41  void start (const Genfun::Variable & variable, double value);
42 
43  // Get starting values for the coordinates or momenta:
44  double startValue(const Genfun::Variable & component) const ;
45 
46 
47  // Each component has N-dimensions:
48  class Component {
49 
50  public:
51 
52  // Access to the ith element;
53  Genfun::Variable operator [] (unsigned int i) const;
54 
55  private:
56 
57  // Constructor:
58  Component(unsigned int NDIM, bool isMomentum);
59 
60  // Destructor:
61  ~Component();
62 
63  // Illegal operations:
64  Component (const Component &);
65  Component & operator=(const Component &);
66 
67  // Internal clockwork;
68  class Clockwork;
69  Clockwork *c;
70  friend class PhaseSpace;
71 
72  };
73 
74  private:
75 
76  Component _coordinates;
77  Component _momenta;
78  std::vector<double> _q0;
79  std::vector<double> _p0;
80  unsigned int DIM;
81  };
82 
83 }
84 #endif
85 
PhaseSpace(unsigned int NDIM)
Definition: PhaseSpace.cc:57
Genfun::Variable operator[](unsigned int i) const
Definition: PhaseSpace.cc:53
const Component & momenta() const
Definition: PhaseSpace.cc:70
void start(const Genfun::Variable &variable, double value)
Definition: PhaseSpace.cc:75
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