diff options
author | Tavian Barnes <tavianator@gmail.com> | 2010-10-06 01:05:17 -0400 |
---|---|---|
committer | Tavian Barnes <tavianator@gmail.com> | 2010-10-06 01:05:17 -0400 |
commit | 53b7d03b39ae30bcca53dc294f213e6d455943f7 (patch) | |
tree | 4571d85012efd41efa48baef7cb9a1e041e10682 /src/vZ/simple.hpp | |
parent | c8632ec95cc7a7209e0298aa0fbfbbbfd83bfd80 (diff) | |
download | vz-53b7d03b39ae30bcca53dc294f213e6d455943f7.tar.xz |
Add base Integrator class, and simple compilation test.
Diffstat (limited to 'src/vZ/simple.hpp')
-rw-r--r-- | src/vZ/simple.hpp | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/src/vZ/simple.hpp b/src/vZ/simple.hpp new file mode 100644 index 0000000..65b7560 --- /dev/null +++ b/src/vZ/simple.hpp @@ -0,0 +1,56 @@ +/************************************************************************* + * Copyright (C) 2009-2010 Tavian Barnes <tavianator@gmail.com> * + * * + * This file is part of The vZ Library. * + * * + * The vZ Library is free software; you can redistribute it and/or * + * modify it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation; either version 3 of the * + * License, or (at your option) any later version. * + * * + * The vZ Library is distributed in the hope that it will be useful, but * + * WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * + * Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public * + * License along with this program. If not, see * + * <http://www.gnu.org/licenses/>. * + *************************************************************************/ + +#ifndef VZ_SIMPLE_HPP +#define VZ_SIMPLE_HPP + +#include <vector> + +namespace vZ +{ + // Base class for non-adaptive RK-style algorithms + template <typename Real> + class GenericSimpleIntegrator : public GenericIntegrator<Real> + { + public: + typedef typename GenericIntegrator<Real>::Function Function; + + // Coefficients in the tableau representation of the RK algorithm + typedef std::vector<std::vector<Real> > ACoefficients; + typedef std::vector<Real> BCoefficients; + + GenericSimpleIntegrator(Function f, Real dt, + ACoefficients a, BCoefficients b) + : GenericIntegrator<Real>(f, dt), m_a(a), m_b(b) { } + virtual ~GenericSimpleIntegrator() { } + + protected: + virtual void step(Real& t, Real& dt); + + private: + ACoefficients m_a; + BCoefficients m_b; + }; + + // Type alias + typedef GenericSimpleIntegrator<double> SimpleIntegrator; +} + +#endif // VZ_SIMPLE_HPP |