Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:54:34

0001 #ifndef _ButcherTableau_h_
0002 #define _ButcherTableau_h_
0003 // This class defines a Butcher Tableau, which completely specifies
0004 // a Runge-Kutte integration scheme. Butcher Tableau are described
0005 // in Numerical Methods for Ordinary Differential Equations, John
0006 // Wiley & sons, West Sussex England.
0007 //
0008 // General form is :
0009 // 
0010 //      c|A
0011 //      ---
0012 //       |b^T
0013 //
0014 // where A is a matrix and b, c are column vectors. 
0015 // 
0016 // The Butcher Tableau Class presents itself as an empty structure
0017 // that the user has to fill up.  One can blithely fill write into
0018 // any element of A, b, or c. Space is automatically allocated.
0019 
0020 #include <vector>
0021 #include <string>
0022 namespace Genfun {
0023   class ButcherTableau {
0024     
0025   public:
0026     
0027     // Constructor:
0028     inline ButcherTableau(const std::string &name, unsigned int order);
0029     
0030     // Returns the name:
0031     inline const std::string & name() const;
0032     
0033     // Returns the order:
0034     inline unsigned int order() const;
0035     
0036     // Returns the number of steps:
0037     inline unsigned int nSteps() const;
0038     
0039     // Write access to elements:
0040     inline double & A(unsigned int i, unsigned int j);
0041     inline double & b(unsigned int i);
0042     inline double & c(unsigned int i);
0043     
0044     // Read access to elements (inline for speed)
0045     inline const double & A(unsigned int i, unsigned int j) const;
0046     inline const double & b(unsigned int i) const;
0047     inline const double & c(unsigned int i) const;
0048     
0049     
0050   private:
0051     
0052     std::vector< std::vector<double> > _A;
0053     std::vector<double>                _b;
0054     std::vector<double>                _c;
0055     std::string                        _name;
0056     unsigned int                       _order;
0057   };
0058 
0059 
0060   class EulerTableau: public ButcherTableau {
0061     // Constructor:
0062   public:
0063     inline EulerTableau();
0064   };
0065 
0066   class MidpointTableau: public ButcherTableau {
0067     // Constructor:
0068   public:
0069     inline MidpointTableau();
0070   };
0071 
0072   class TrapezoidTableau: public ButcherTableau {
0073     // Constructor:
0074   public:
0075     inline TrapezoidTableau();
0076   };
0077 
0078   class RK31Tableau: public ButcherTableau {
0079     // Constructor:
0080   public:
0081     inline RK31Tableau();
0082   };
0083 
0084   class RK32Tableau: public ButcherTableau {
0085     // Constructor:
0086   public:
0087     inline RK32Tableau();
0088   };
0089 
0090   class ClassicalRungeKuttaTableau: public ButcherTableau {
0091     // Constructor:
0092   public:
0093     inline ClassicalRungeKuttaTableau();
0094   };
0095 
0096   class ThreeEighthsRuleTableau: public ButcherTableau {
0097     // Constructor:
0098   public:
0099     inline ThreeEighthsRuleTableau();
0100   };
0101 
0102 }
0103 
0104 inline std::ostream & operator << (std::ostream & o, const Genfun::ButcherTableau & b);
0105 
0106 
0107 #include "CLHEP/GenericFunctions/ButcherTableau.icc"
0108 
0109 #endif