Documentation


stepper.h

Go to the documentation of this file.
00001 #ifndef ANIMAL_INTEGRATION_STEPPER_H
00002 #define ANIMAL_INTEGRATION_STEPPER_H
00003 
00004 #include <animal/integration/solver.h>
00005 
00006 
00007 
00008 namespace animal { namespace integration {
00009 
00010 // ----------------------------------
00011 //  
00012 //  Stepper class.
00022 //  
00023 // ----------------------------------
00024 
00025 template <
00026   class SolverF,
00027   class HSmallerF,
00028   class HLargerF,
00029   class IsDifferentF >
00030 
00031 struct Stepper_Function
00032 {
00033   typedef typename SolverF::Real       Real;        
00034   typedef typename SolverF::Model      Model;       
00035   typedef typename SolverF::State      State;       
00036   typedef typename SolverF::Derivative Derivative;  
00037   
00038   SolverF      solve;         
00039   HSmallerF    hsmaller;      
00040   HLargerF     hlarger;       
00041   IsDifferentF isDifferent;   
00042   
00044   Stepper_Function()
00045     {}
00046   
00048   Stepper_Function(const SolverF& slf,
00049            const HSmallerF& hsf, const HLargerF& hlf,
00050            const IsDifferentF& isdf)
00051   : solve(slf),
00052     hsmaller(hsf), hlarger(hlf),
00053     isDifferent(isdf)
00054     {}
00055   
00063   void operator()(const Model& M,
00064           State& S,
00065           const Real t,
00066           const Real htry, Real& hdid, Real& hnext);
00067   void operator()(const Model& M,
00068           const State& initial_S,
00069           State& final_S,
00070           const Real t,
00071           const Real htry, Real& hdid, Real& hnext);
00073 };
00074 
00075 
00076 
00079 template <class TraitsT>
00080 
00081 struct HSmaller_Function
00082 {
00083   typedef typename TraitsT::Real     Real;      
00084   typedef typename TraitsT::Model    Model;     
00085   typedef typename TraitsT::State    State;     
00086   typedef typename TraitsT::Numerics Numerics;  
00087   
00089   Real hmin(const Model& M,
00090           const State& S,
00091           const Real t) const;
00092   
00094   Real operator()(const Model& M,
00095             const State& S,
00096             const Real t, const Real h) const;
00097 };
00098 
00099 
00100 
00103 template <class TraitsT>
00104 
00105 struct HLarger_Function
00106 {
00107   typedef typename TraitsT::Real     Real;       
00108   typedef typename TraitsT::Model    Model;      
00109   typedef typename TraitsT::State    State;      
00110   typedef typename TraitsT::Numerics Numerics;   
00111   
00113   Real hmax(const Model& M,
00114           const State& S,
00115           const Real t) const;
00116   
00118   Real operator()(const Model& M,
00119             const State& S,
00120             const Real t, const Real h) const;
00121 };
00122 
00123 
00124 
00127 template <class TraitsT>
00128 
00129 struct IsDifferent_Function
00130 {
00131   typedef typename TraitsT::Real       Real;        
00132   typedef typename TraitsT::Model      Model;       
00133   typedef typename TraitsT::State      State;       
00134   typedef typename TraitsT::Derivative Derivative;  
00135   typedef typename TraitsT::Numerics   Numerics;    
00136   
00138   Real errormax(const Model& M,
00139           const State& S,
00140           const Real t) const;
00141   
00144 
00145   bool operator()(const Model& M,
00146           const State& S1, const State& S2,
00147           const Real t) const;
00148   
00150   bool operator()(const Model& M,
00151           const State& S,
00152           const Real t) const;
00154 };
00155 
00156 } } // namespace animal { namespace integration {
00157 
00158 
00159 
00160 #endif // ANIMAL_INTEGRATION_STEPPER_H

Generated on Thu Dec 23 13:52:27 2004 by doxygen 1.3.6