From 3d8acfbde5f4eb4b612da36c136f9e8904f0c09d Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Wed, 6 Oct 2010 14:27:54 -0400 Subject: Capitalize include filenames. --- src/vZ/Integrator.hpp | 83 +++++++++++++++++++++++++++++++++++++++++++++++++++ src/vZ/Simple.hpp | 57 +++++++++++++++++++++++++++++++++++ src/vZ/Traits.hpp | 38 +++++++++++++++++++++++ src/vZ/integrator.hpp | 83 --------------------------------------------------- src/vZ/simple.hpp | 57 ----------------------------------- src/vZ/traits.hpp | 38 ----------------------- 6 files changed, 178 insertions(+), 178 deletions(-) create mode 100644 src/vZ/Integrator.hpp create mode 100644 src/vZ/Simple.hpp create mode 100644 src/vZ/Traits.hpp delete mode 100644 src/vZ/integrator.hpp delete mode 100644 src/vZ/simple.hpp delete mode 100644 src/vZ/traits.hpp (limited to 'src/vZ') diff --git a/src/vZ/Integrator.hpp b/src/vZ/Integrator.hpp new file mode 100644 index 0000000..a652bf6 --- /dev/null +++ b/src/vZ/Integrator.hpp @@ -0,0 +1,83 @@ +/************************************************************************* + * 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_INTEGRATOR_HPP +#define VZ_INTEGRATOR_HPP + +#include +#include + +namespace vZ +{ + // Base Integrator class + // + // All integration methods derrive from this class + // If the initial value problem is specified as + // y' = f(t, y); y(t0) = y0 + // then an Integrator could be constructed as Integrator(f, dt).y(y0).t(t0) + template + class GenericIntegrator + { + public: + typedef std::tr1::function Function; + + // By default, y and t start at zero + GenericIntegrator(Function f, T dt) + : m_f(f), m_y(0), m_t(0), m_dt(dt) { } + virtual ~GenericIntegrator() { } + + GenericIntegrator& y(T y) { m_y = y; return *this; } + GenericIntegrator& t(T t) { m_t = t; return *this; } + GenericIntegrator& dt(T dt) { m_dt = dt; return *this; } + + T y() const { return m_y; } + T t() const { return m_t; } + T dt() const { return m_dt; } + + // Integrate until time t + void integrate(T t_final); + + protected: + virtual void step(T& t, T& dt) = 0; + Function m_f; + + private: + T m_y; + T m_t, m_dt; + }; + + // Type alias + typedef GenericIntegrator Integrator; + + // Definitions + + template + void + GenericIntegrator::integrate(T t_final) + { + while (m_t < t_final) { + m_dt = std::min(m_dt, t_final - m_t); + step(m_t, m_dt); + } + } +} + + +#endif // VZ_INTEGRATOR_HPP diff --git a/src/vZ/Simple.hpp b/src/vZ/Simple.hpp new file mode 100644 index 0000000..706b52c --- /dev/null +++ b/src/vZ/Simple.hpp @@ -0,0 +1,57 @@ +/************************************************************************* + * 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 + { + protected: + // Coefficients in the tableau representation of the RK algorithm + typedef std::vector > ACoefficients; + typedef std::vector BCoefficients; + + public: + typedef typename GenericIntegrator::Function Function; + + GenericSimpleIntegrator(Function f, T dt, + ACoefficients a, BCoefficients b) + : GenericIntegrator(f, dt), m_a(a), m_b(b) { } + virtual ~GenericSimpleIntegrator() { } + + protected: + virtual void step(T& t, T& dt); + + private: + ACoefficients m_a; + BCoefficients m_b; + }; + + // Type alias + typedef GenericSimpleIntegrator SimpleIntegrator; +} + +#endif // VZ_SIMPLE_HPP diff --git a/src/vZ/Traits.hpp b/src/vZ/Traits.hpp new file mode 100644 index 0000000..baac9ed --- /dev/null +++ b/src/vZ/Traits.hpp @@ -0,0 +1,38 @@ +/************************************************************************* + * 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_TRAITS_HPP +#define VZ_TRAITS_HPP + +namespace vZ +{ + // Traits class + // + // Specialize this class for non-scalar types which are used as template + // arguments to the Generic* classes + template + class Traits + { + public: + typedef T Scalar; + }; +} + +#endif // VZ_TRAITS_HPP diff --git a/src/vZ/integrator.hpp b/src/vZ/integrator.hpp deleted file mode 100644 index a652bf6..0000000 --- a/src/vZ/integrator.hpp +++ /dev/null @@ -1,83 +0,0 @@ -/************************************************************************* - * 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_INTEGRATOR_HPP -#define VZ_INTEGRATOR_HPP - -#include -#include - -namespace vZ -{ - // Base Integrator class - // - // All integration methods derrive from this class - // If the initial value problem is specified as - // y' = f(t, y); y(t0) = y0 - // then an Integrator could be constructed as Integrator(f, dt).y(y0).t(t0) - template - class GenericIntegrator - { - public: - typedef std::tr1::function Function; - - // By default, y and t start at zero - GenericIntegrator(Function f, T dt) - : m_f(f), m_y(0), m_t(0), m_dt(dt) { } - virtual ~GenericIntegrator() { } - - GenericIntegrator& y(T y) { m_y = y; return *this; } - GenericIntegrator& t(T t) { m_t = t; return *this; } - GenericIntegrator& dt(T dt) { m_dt = dt; return *this; } - - T y() const { return m_y; } - T t() const { return m_t; } - T dt() const { return m_dt; } - - // Integrate until time t - void integrate(T t_final); - - protected: - virtual void step(T& t, T& dt) = 0; - Function m_f; - - private: - T m_y; - T m_t, m_dt; - }; - - // Type alias - typedef GenericIntegrator Integrator; - - // Definitions - - template - void - GenericIntegrator::integrate(T t_final) - { - while (m_t < t_final) { - m_dt = std::min(m_dt, t_final - m_t); - step(m_t, m_dt); - } - } -} - - -#endif // VZ_INTEGRATOR_HPP diff --git a/src/vZ/simple.hpp b/src/vZ/simple.hpp deleted file mode 100644 index 706b52c..0000000 --- a/src/vZ/simple.hpp +++ /dev/null @@ -1,57 +0,0 @@ -/************************************************************************* - * 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 - { - protected: - // Coefficients in the tableau representation of the RK algorithm - typedef std::vector > ACoefficients; - typedef std::vector BCoefficients; - - public: - typedef typename GenericIntegrator::Function Function; - - GenericSimpleIntegrator(Function f, T dt, - ACoefficients a, BCoefficients b) - : GenericIntegrator(f, dt), m_a(a), m_b(b) { } - virtual ~GenericSimpleIntegrator() { } - - protected: - virtual void step(T& t, T& dt); - - private: - ACoefficients m_a; - BCoefficients m_b; - }; - - // Type alias - typedef GenericSimpleIntegrator SimpleIntegrator; -} - -#endif // VZ_SIMPLE_HPP diff --git a/src/vZ/traits.hpp b/src/vZ/traits.hpp deleted file mode 100644 index baac9ed..0000000 --- a/src/vZ/traits.hpp +++ /dev/null @@ -1,38 +0,0 @@ -/************************************************************************* - * 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_TRAITS_HPP -#define VZ_TRAITS_HPP - -namespace vZ -{ - // Traits class - // - // Specialize this class for non-scalar types which are used as template - // arguments to the Generic* classes - template - class Traits - { - public: - typedef T Scalar; - }; -} - -#endif // VZ_TRAITS_HPP -- cgit v1.2.3