Back to home page

EIC code displayed by LXR

 
 

    


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

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