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

CLHEP/GenericFunctions/ButcherTableau.hh
Go to the documentation of this file.
1 #ifndef _ButcherTableau_h_
2 #define _ButcherTableau_h_
3 // This class defines a Butcher Tableau, which completely specifies
4 // a Runge-Kutte integration scheme. Butcher Tableau are described
5 // in Numerical Methods for Ordinary Differential Equations, John
6 // Wiley & sons, West Sussex England.
7 //
8 // General form is :
9 //
10 // c|A
11 // ---
12 // |b^T
13 //
14 // where A is a matrix and b, c are column vectors.
15 //
16 // The Butcher Tableau Class presents itself as an empty structure
17 // that the user has to fill up. One can blithely fill write into
18 // any element of A, b, or c. Space is automatically allocated.
19 
20 #include <vector>
21 #include <string>
22 namespace Genfun {
24 
25  public:
26 
27  // Constructor:
28  inline ButcherTableau(const std::string &name, unsigned int order);
29 
30  // Returns the name:
31  inline const std::string & name() const;
32 
33  // Returns the order:
34  inline unsigned int order() const;
35 
36  // Returns the number of steps:
37  inline unsigned int nSteps() const;
38 
39  // Write access to elements:
40  inline double & A(unsigned int i, unsigned int j);
41  inline double & b(unsigned int i);
42  inline double & c(unsigned int i);
43 
44  // Read access to elements (inline for speed)
45  inline const double & A(unsigned int i, unsigned int j) const;
46  inline const double & b(unsigned int i) const;
47  inline const double & c(unsigned int i) const;
48 
49 
50  private:
51 
52  std::vector< std::vector<double> > _A;
53  std::vector<double> _b;
54  std::vector<double> _c;
55  std::string _name;
56  unsigned int _order;
57  };
58 
59 
60  class EulerTableau: public ButcherTableau {
61  // Constructor:
62  public:
63  inline EulerTableau();
64  };
65 
67  // Constructor:
68  public:
69  inline MidpointTableau();
70  };
71 
73  // Constructor:
74  public:
75  inline TrapezoidTableau();
76  };
77 
78  class RK31Tableau: public ButcherTableau {
79  // Constructor:
80  public:
81  inline RK31Tableau();
82  };
83 
84  class RK32Tableau: public ButcherTableau {
85  // Constructor:
86  public:
87  inline RK32Tableau();
88  };
89 
91  // Constructor:
92  public:
94  };
95 
97  // Constructor:
98  public:
100  };
101 
102 }
103 
104 inline std::ostream & operator << (std::ostream & o, const Genfun::ButcherTableau & b);
105 
106 
107 #include "CLHEP/GenericFunctions/ButcherTableau.icc"
108 
109 #endif
double & A(unsigned int i, unsigned int j)
const double & A(unsigned int i, unsigned int j) const
ButcherTableau(const std::string &name, unsigned int order)
unsigned int nSteps() const
const double & b(unsigned int i) const
const double & c(unsigned int i) const
unsigned int order() const
double & b(unsigned int i)
double & c(unsigned int i)
const std::string & name() const
std::ostream & operator<<(std::ostream &, const BasicVector3D< float > &)
@ b