From 53b7d03b39ae30bcca53dc294f213e6d455943f7 Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Wed, 6 Oct 2010 01:05:17 -0400 Subject: Add base Integrator class, and simple compilation test. --- src/vZ/simple.hpp | 56 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 src/vZ/simple.hpp (limited to 'src/vZ/simple.hpp') 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 * + * * + * 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 * + * . * + *************************************************************************/ + +#ifndef VZ_SIMPLE_HPP +#define VZ_SIMPLE_HPP + +#include + +namespace vZ +{ + // Base class for non-adaptive RK-style algorithms + template + class GenericSimpleIntegrator : public GenericIntegrator + { + public: + typedef typename GenericIntegrator::Function Function; + + // Coefficients in the tableau representation of the RK algorithm + typedef std::vector > ACoefficients; + typedef std::vector BCoefficients; + + GenericSimpleIntegrator(Function f, Real dt, + ACoefficients a, BCoefficients b) + : GenericIntegrator(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 SimpleIntegrator; +} + +#endif // VZ_SIMPLE_HPP -- cgit v1.2.3