00001 // Runge Kutta 2 strategy 00002 00003 #ifndef rungekutta2_hh 00004 #define rungekutta2_hh 00005 00006 #include "basics/typedefs.hh" 00007 #include "function/vector.hh" 00008 #include "strategy.hh" 00009 00010 namespace concepts { 00011 template<typename F> 00012 class Operator; 00013 } 00014 00015 namespace timestepping { 00016 00017 using concepts::Real; 00018 00019 class TimeVector; 00020 00021 // ************************************************* Runge Kutta 2nd order ** 00022 00034 class RungeKutta2 : public TimeStepStrategy { 00035 public: 00045 RungeKutta2(concepts::SolverFabric<Real>& fabric, 00046 concepts::Operator<Real>& D1, 00047 concepts::Operator<Real>& D0, 00048 timestepping::TimeVector& trhs, 00049 const concepts::Vector<Real>& Y0, 00050 Real dt, 00051 Real alpha = 0.5); 00052 virtual ~RungeKutta2(); 00053 protected: 00054 virtual std::ostream& info(std::ostream& os) const; 00055 virtual void next(); 00056 private: 00058 concepts::Operator<Real> &D1_, &D0_; 00060 timestepping::TimeVector &trhs_; 00062 concepts::Vector<Real> Yn1_; // Yn1 = Y(t_{n-1}) 00064 Real alpha_; 00065 }; 00066 00067 } 00068 00069 #endif // rungekutta2_hh 00070