39 #include "AbstractParameterisedSystem.hpp" 45 template<
typename VECTOR>
53 template<
typename VECTOR>
59 template<
typename VECTOR>
66 template<
typename VECTOR>
71 std::stringstream extra_message;
72 extra_message << std::endl <<
"At independent variable (usually time) = " << time;
73 std::string new_message = rMessage + extra_message.str();
77 template<
typename VECTOR>
80 std::stringstream res;
81 res << rMessage << std::endl <<
"State:" << std::endl;
89 res <<
" " << r_units[i];
96 template<
typename VECTOR>
104 EXCEPTION(
"Number of ODE parameters in archive does not match number in class.");
111 std::vector<unsigned> index_map(rParameterNames.size());
112 for (
unsigned i=0; i<rParameterNames.size(); ++i)
118 EXCEPTION(
"Archive specifies a parameter '" + rParameterNames[i] +
"' which does not appear in this class.");
122 for (
unsigned i=0; i<rParameterNames.size(); ++i)
135 template<
typename VECTOR>
141 template<
typename VECTOR>
147 template<
typename VECTOR>
152 EXCEPTION(
"The size of the passed in vector must be that of the number of state variables.");
162 template<
typename VECTOR>
167 EXCEPTION(
"The index passed in must be less than the number of state variables.");
172 template<
typename VECTOR>
178 template<
typename VECTOR>
183 EXCEPTION(
"The index passed in must be less than the number of state variables.");
188 template<
typename VECTOR>
198 template<
typename VECTOR>
203 EXCEPTION(
"The number of initial conditions must be that of the number of state variables.");
206 std::vector<double> inits;
211 template<
typename VECTOR>
216 EXCEPTION(
"Index is greater than the number of state variables.");
219 mpSystemInfo->SetDefaultInitialCondition(index, initialCondition);
222 template<
typename VECTOR>
233 template<
typename VECTOR>
245 template<
typename VECTOR>
250 EXCEPTION(
"The index passed in must be less than the number of parameters.");
255 template<
typename VECTOR>
260 EXCEPTION(
"The index passed in must be less than the number of parameters.");
265 template<
typename VECTOR>
271 template<
typename VECTOR>
281 template<
typename VECTOR>
283 VECTOR* pDerivedQuantities)
299 if (pDerivedQuantities ==
nullptr)
302 pDerivedQuantities = &dqs;
305 if (pDerivedQuantities == &dqs)
313 EXCEPTION(
"Invalid index passed to GetAnyVariable.");
318 template<
typename VECTOR>
321 VECTOR* pDerivedQuantities)
326 template<
typename VECTOR>
339 EXCEPTION(
"Cannot set the value of a derived quantity, or invalid index.");
343 template<
typename VECTOR>
353 template<
typename VECTOR>
355 const VECTOR& rState)
357 EXCEPTION(
"This ODE system does not define derived quantities.");
360 template<
typename VECTOR>
void SetDefaultInitialCondition(unsigned index, double initialCondition)
void SetDefaultInitialConditions(const VECTOR &rInitialConditions)
const std::vector< std::string > & rGetStateVariableUnits() const
#define EXCEPTION(message)
VECTOR CopyVector(VECTOR &rVec)
VECTOR & rGetStateVariables()
void ResetToInitialConditions()
std::string DumpState(const std::string &rMessage)
void InitialiseEmptyVector(VECTOR &rVec)
void SetStateVariables(const VECTOR &rStateVariables)
double GetStateVariable(unsigned index) const
const std::vector< std::string > & rGetStateVariableNames() const
unsigned GetParameterIndex(const std::string &rName) const
double GetParameter(unsigned index) const
VECTOR GetInitialConditions() const
unsigned GetAnyVariableIndex(const std::string &rName) const
void CreateVectorIfEmpty(VECTOR &rVec, unsigned size)
VECTOR GetStateVariables()
unsigned GetStateVariableIndex(const std::string &rName) const
void SetVectorComponent(VECTOR &rVec, unsigned index, double value)
void SetAnyVariable(unsigned index, double value)
void SetParameter(const std::string &rName, double value)
boost::shared_ptr< AbstractOdeSystemInformation > mpSystemInfo
virtual VECTOR ComputeDerivedQuantities(double time, const VECTOR &rState)
void SetStateVariable(unsigned index, double newValue)
void CopyFromStdVector(const std::vector< double > &rSrc, VECTOR &rDest)
void CheckParametersOnLoad(const std::vector< double > &rParameters, const std::vector< std::string > &rParameterNames)
unsigned mNumberOfStateVariables
void CopyToStdVector(const VECTOR &rSrc, std::vector< double > &rDest)
double GetVectorComponent(const VECTOR &rVec, unsigned index)
VECTOR ComputeDerivedQuantitiesFromCurrentState(double time)
std::string GetStateMessage(const std::string &rMessage, VECTOR Y)
const std::vector< std::string > & rGetParameterNames() const
void DeleteVector(VECTOR &rVec)
double GetAnyVariable(unsigned index, double time=0.0, VECTOR *pDerivedQuantities=NULL)
unsigned GetNumberOfDerivedQuantities() const
unsigned GetVectorSize(const VECTOR &rVec)
AbstractParameterisedSystem(unsigned numberOfStateVariables)