Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:42:55

0001 /*
0002  boost/numeric/odeint/stepper/detail/pid_step_adjuster_coefficients.hpp
0003 
0004  [begin_description]
0005  Coefficients for the PID stepsize controller.
0006  [end_description]
0007 
0008  Copyright 2017 Valentin Noah Hartmann
0009 
0010  Distributed under the Boost Software License, Version 1.0.
0011  (See accompanying file LICENSE_1_0.txt or
0012  copy at http://www.boost.org/LICENSE_1_0.txt)
0013  */
0014 
0015 #ifndef BOOST_NUMERIC_ODEINT_STEPPER_DETAIL_PID_STEP_ADJUSTER_COEFFICIENTS_HPP_INCLUDED
0016 #define BOOST_NUMERIC_ODEINT_STEPPER_DETAIL_PID_STEP_ADJUSTER_COEFFICIENTS_HPP_INCLUDED
0017 
0018 #include <boost/array.hpp>
0019 
0020 namespace boost {
0021 namespace numeric {
0022 namespace odeint {
0023 namespace detail {
0024 
0025 enum adjuster_type{
0026     BASIC,
0027     H0211,
0028     H211b,
0029     H211PI,
0030     H0312,
0031     H312b,
0032     H312PID,
0033     H0321,
0034     H321
0035 };
0036 
0037 template<int Type>
0038 class pid_step_adjuster_coefficients;
0039 
0040 template<>
0041 class pid_step_adjuster_coefficients<BASIC> : public boost::array<double, 5>
0042 {
0043 public:
0044     pid_step_adjuster_coefficients()
0045     : boost::array<double, 5>()
0046     {
0047         (*this)[0] = 1.0;
0048         (*this)[1] = 0.0;
0049         (*this)[2] = 0.0;
0050         (*this)[3] = 0.0;
0051         (*this)[4] = 0.0;
0052     }
0053 };
0054 
0055 template<>
0056 class pid_step_adjuster_coefficients<H0211> : public boost::array<double, 5>
0057 {
0058 public:
0059     pid_step_adjuster_coefficients()
0060     : boost::array<double, 5>()
0061     {
0062         (*this)[0] = 1.0 / 2.0;
0063         (*this)[1] = 1.0 / 2.0;
0064         (*this)[2] = 0.0;
0065         (*this)[3] = 1.0 / 2.0;
0066         (*this)[4] = 0.0;
0067     }
0068 };
0069 
0070 template<>
0071 class pid_step_adjuster_coefficients<H211b> : public boost::array<double, 5>
0072 {
0073 public:
0074     pid_step_adjuster_coefficients()
0075     : boost::array<double, 5>()
0076     {
0077         (*this)[0] = 1.0 / 5.0;
0078         (*this)[1] = 2.0 / 5.0;
0079         (*this)[2] = 0.0;
0080         (*this)[3] = 1.0 / 5.0;
0081         (*this)[4] = 0.0;
0082     }
0083 };
0084 
0085 template<>
0086 class pid_step_adjuster_coefficients<H211PI> : public boost::array<double, 5>
0087 {
0088 public:
0089     pid_step_adjuster_coefficients()
0090     : boost::array<double, 5>()
0091     {
0092         (*this)[0] = 1.0 / 6.0;
0093         (*this)[1] = 2.0 / 6.0;
0094         (*this)[2] = 0.0;
0095         (*this)[3] = 0.0;
0096         (*this)[4] = 0.0;
0097     }
0098 };
0099 
0100 template<>
0101 class pid_step_adjuster_coefficients<H0312> : public boost::array<double, 5>
0102 {
0103 public:
0104     pid_step_adjuster_coefficients()
0105     : boost::array<double, 5>()
0106     {
0107         (*this)[0] = 1.0 / 4.0;
0108         (*this)[1] = 2.0 / 2.0;
0109         (*this)[2] = 1.0 / 4.0;
0110         (*this)[3] = 3.0 / 4.0;
0111         (*this)[4] = 1.0 / 4.0;
0112     }
0113 };
0114 
0115 template<>
0116 class pid_step_adjuster_coefficients<H312b> : public boost::array<double, 5>
0117 {
0118 public:
0119     pid_step_adjuster_coefficients()
0120     : boost::array<double, 5>()
0121     {
0122         (*this)[0] = 1.0 / 6.0;
0123         (*this)[1] = 2.0 / 6.0;
0124         (*this)[2] = 1.0 / 6.0;
0125         (*this)[3] = 3.0 / 6.0;
0126         (*this)[4] = 1.0 / 6.0;
0127     }
0128 };
0129 
0130 template<>
0131 class pid_step_adjuster_coefficients<H312PID> : public boost::array<double, 5>
0132 {
0133 public:
0134     pid_step_adjuster_coefficients()
0135     : boost::array<double, 5>()
0136     {
0137         (*this)[0] = 1.0 / 18.0;
0138         (*this)[1] = 2.0 / 9.0;
0139         (*this)[2] = 1.0 / 18.0;
0140         (*this)[3] = 0.0;
0141         (*this)[4] = 0.0;
0142     }
0143 };
0144 
0145 template<>
0146 class pid_step_adjuster_coefficients<H0321> : public boost::array<double, 5>
0147 {
0148 public:
0149     pid_step_adjuster_coefficients()
0150     : boost::array<double, 5>()
0151     {
0152         (*this)[0] =  5.0 / 4.0;
0153         (*this)[1] =  1.0 / 2.0;
0154         (*this)[2] = -3.0 / 4.0;
0155         (*this)[3] = -1.0 / 4.0;
0156         (*this)[4] = -3.0 / 4.0;
0157     }
0158 };
0159 
0160 template<>
0161 class pid_step_adjuster_coefficients<H321> : public boost::array<double, 5>
0162 {
0163 public:
0164     pid_step_adjuster_coefficients()
0165     : boost::array<double, 5>()
0166     {
0167         (*this)[0] =  1.0 / 3.0;
0168         (*this)[1] =  1.0 / 18.0;
0169         (*this)[2] = -5.0 / 18.0;
0170         (*this)[3] = -5.0 / 16.0;
0171         (*this)[4] = -1.0 / 6.0;
0172     }
0173 };
0174 
0175 } // detail
0176 } // odeint
0177 } // numeric
0178 } // boost
0179 
0180 #endif