AbstractOdeSystem.hpp
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036 #ifndef _ABSTRACTODESYSTEM_HPP_
00037 #define _ABSTRACTODESYSTEM_HPP_
00038
00039 #include <vector>
00040 #include <string>
00041 #include <algorithm>
00042
00043
00044 #include "ChasteSerialization.hpp"
00045 #include "ChasteSerializationVersion.hpp"
00046 #include <boost/serialization/split_member.hpp>
00047 #include <boost/serialization/vector.hpp>
00048 #include "ClassIsAbstract.hpp"
00049
00050 #include "AbstractParameterisedSystem.hpp"
00051 #include "Exception.hpp"
00052
00087 class AbstractOdeSystem : public AbstractParameterisedSystem<std::vector<double> >
00088 {
00089 friend class TestAbstractOdeSystem;
00090
00091 private:
00092
00093
00094 friend class boost::serialization::access;
00101 template<class Archive>
00102 void save(Archive & archive, const unsigned int version) const
00103 {
00104
00105
00106
00107
00108 archive & mNumberOfStateVariables;
00109 archive & mUseAnalyticJacobian;
00110 archive & mStateVariables;
00111 archive & mParameters;
00112
00113 if (version > 0)
00114 {
00115 archive & rGetParameterNames();
00116 }
00117
00118
00119
00120
00121 }
00128 template<class Archive>
00129 void load(Archive & archive, const unsigned int version)
00130 {
00131 archive & mNumberOfStateVariables;
00132 archive & mUseAnalyticJacobian;
00133 archive & mStateVariables;
00134 std::vector<double> parameters;
00135 archive & parameters;
00136
00137 if (version > 0)
00138 {
00139 std::vector<std::string> param_names;
00140 archive & param_names;
00141
00142 CheckParametersOnLoad(parameters,param_names);
00143 }
00144 else
00145 {
00146 mParameters = parameters;
00147 }
00148 }
00149 BOOST_SERIALIZATION_SPLIT_MEMBER()
00150
00151 protected:
00152
00154 bool mUseAnalyticJacobian;
00155
00156 public:
00157
00163 AbstractOdeSystem(unsigned numberOfStateVariables);
00164
00168 virtual ~AbstractOdeSystem();
00169
00177 virtual void EvaluateYDerivatives(double time, const std::vector<double>& rY,
00178 std::vector<double>& rDY)=0;
00179
00192 virtual bool CalculateStoppingEvent(double time, const std::vector<double>& rY);
00193
00205 virtual double CalculateRootFunction(double time, const std::vector<double>& rY);
00206
00212 bool GetUseAnalyticJacobian();
00213
00219 const std::vector<double>& rGetConstStateVariables() const;
00220 };
00221
00222 CLASS_IS_ABSTRACT(AbstractOdeSystem)
00223 BOOST_CLASS_VERSION(AbstractOdeSystem, 1u)
00224
00225 #endif //_ABSTRACTODESYSTEM_HPP_