MathTL
numerics/rosenbrock.h
00001 // -*- c++ -*-
00002 
00003 // +--------------------------------------------------------------------+
00004 // | This file is part of MathTL - the Mathematical Template Library    |
00005 // |                                                                    |
00006 // | Copyright (c) 2002-2009                                            |
00007 // | Thorsten Raasch, Manuel Werner                                     |
00008 // +--------------------------------------------------------------------+
00009 
00010 #ifndef _MATHTL_ROSENBROCK_H
00011 #define _MATHTL_ROSENBROCK_H
00012 
00013 #include <algebra/triangular_matrix.h>
00014 #include <algebra/vector.h>
00015 
00016 namespace MathTL
00017 {
00056   template <class VECTOR, class IVP>
00057   class Rosenbrock
00058   {
00059   public:
00077     enum Method {
00078       Euler,  // s=1, p=1, L-stable
00079       ROS2,   // s=2, p=2, L-stable
00080       ROS3,   // s=3, p=3, L-stable, stiffly accurate
00081       ROWDA3, // s=3, p=3, L-stable
00082       RODAS3  // s=4, p=3, L-stable, stiffly accurate
00083     };
00084 
00088     Rosenbrock(const Method method = Euler);
00089 
00093     void increment(const IVP& ivp,
00094                    const double t_m, const VECTOR& u_m,
00095                    const double tau,
00096                    VECTOR& u_mplus1) const;
00097     
00102     void increment(const IVP& ivp,
00103                    const double t_m, const VECTOR& u_m,
00104                    const double tau,
00105                    VECTOR& u_mplus1,
00106                    VECTOR& error_estimate) const;
00107   protected:
00111     LowerTriangularMatrix<double> alpha_, gamma_;
00112     Vector<double> b_;
00113 
00117     Method method_;
00118   };
00119 }
00120 
00121 // include implementation
00122 #include "numerics/rosenbrock.cpp"
00123 
00124 #endif
 All Classes Functions Variables Typedefs Enumerations