CLHEP VERSION Reference Documentation
CLHEP Home Page CLHEP Documentation CLHEP Bug Reports |
00001 #ifndef _ButcherTableau_h_ 00002 #define _ButcherTableau_h_ 00003 // This class defines a Butcher Tableau, which completely specifies 00004 // a Runge-Kutte integration scheme. Butcher Tableau are described 00005 // in Numerical Methods for Ordinary Differential Equations, John 00006 // Wiley & sons, West Sussex England. 00007 // 00008 // General form is : 00009 // 00010 // c|A 00011 // --- 00012 // |b^T 00013 // 00014 // where A is a matrix and b, c are column vectors. 00015 // 00016 // The Butcher Tableau Class presents itself as an empty structure 00017 // that the user has to fill up. One can blithely fill write into 00018 // any element of A, b, or c. Space is automatically allocated. 00019 00020 #include <vector> 00021 #include <string> 00022 namespace Genfun { 00023 class ButcherTableau { 00024 00025 public: 00026 00027 // Constructor: 00028 inline ButcherTableau(const std::string &name, unsigned int order); 00029 00030 // Returns the name: 00031 inline const std::string & name() const; 00032 00033 // Returns the order: 00034 inline unsigned int order() const; 00035 00036 // Returns the number of steps: 00037 inline unsigned int nSteps() const; 00038 00039 // Write access to elements: 00040 inline double & A(unsigned int i, unsigned int j); 00041 inline double & b(unsigned int i); 00042 inline double & c(unsigned int i); 00043 00044 // Read access to elements (inline for speed) 00045 inline const double & A(unsigned int i, unsigned int j) const; 00046 inline const double & b(unsigned int i) const; 00047 inline const double & c(unsigned int i) const; 00048 00049 00050 private: 00051 00052 std::vector< std::vector<double> > _A; 00053 std::vector<double> _b; 00054 std::vector<double> _c; 00055 std::string _name; 00056 unsigned int _order; 00057 }; 00058 00059 00060 class EulerTableau: public ButcherTableau { 00061 // Constructor: 00062 public: 00063 inline EulerTableau(); 00064 }; 00065 00066 class MidpointTableau: public ButcherTableau { 00067 // Constructor: 00068 public: 00069 inline MidpointTableau(); 00070 }; 00071 00072 class TrapezoidTableau: public ButcherTableau { 00073 // Constructor: 00074 public: 00075 inline TrapezoidTableau(); 00076 }; 00077 00078 class RK31Tableau: public ButcherTableau { 00079 // Constructor: 00080 public: 00081 inline RK31Tableau(); 00082 }; 00083 00084 class RK32Tableau: public ButcherTableau { 00085 // Constructor: 00086 public: 00087 inline RK32Tableau(); 00088 }; 00089 00090 class ClassicalRungeKuttaTableau: public ButcherTableau { 00091 // Constructor: 00092 public: 00093 inline ClassicalRungeKuttaTableau(); 00094 }; 00095 00096 class ThreeEighthsRuleTableau: public ButcherTableau { 00097 // Constructor: 00098 public: 00099 inline ThreeEighthsRuleTableau(); 00100 }; 00101 00102 } 00103 00104 inline std::ostream & operator << (std::ostream & o, const Genfun::ButcherTableau & b); 00105 00106 00107 #include "CLHEP/GenericFunctions/ButcherTableau.icc" 00108 00109 #endif