#include <CombinedOdeSystem.hpp>
Inherits AbstractOdeSystem.
Classes | |
struct | VariableParameterMap |
Public Member Functions | |
CombinedOdeSystem (std::vector< AbstractOdeSystem * > odeSystems) | |
void | Configure (const std::map< unsigned, unsigned > &rVariableParameterMap, AbstractOdeSystem *pVariableOdeSystem, AbstractOdeSystem *pParameterOdeSystem) |
void | EvaluateYDerivatives (double time, const std::vector< double > &rY, std::vector< double > &rDY) |
Private Attributes | |
std::vector< AbstractOdeSystem * > | mOdeSystems |
std::vector< std::vector < double > > | mWorkingStateVars |
std::vector< std::vector < double > > | mWorkingDerivs |
std::vector< unsigned > | mOffsets |
std::vector< struct VariableParameterMap > | mVariableParameterMaps |
An ODE system formed by combining several subsystems.
Instances of this class are formed by passing other ODE system instances to our constructor, and then calling Configure to set up any coupling between subsystems. This allows state variables from one system to be used as parameters in other systems.
This allows us to set up coupled systems such as from subsystems and where .
The vector of state variables for the combined system is formed as the concatenation of the state variable vectors of the subsystem. This class also makes use of the CombinedOdeSystemInformation class to provide initial conditions, etc.
Definition at line 59 of file CombinedOdeSystem.hpp.
CombinedOdeSystem::CombinedOdeSystem | ( | std::vector< AbstractOdeSystem * > | odeSystems | ) |
Create a combined ODE system from a vector of subsystems.
odeSystems | the subsystems. |
Definition at line 35 of file CombinedOdeSystem.cpp.
References CombinedOdeSystemInformation::Instance(), AbstractUntemplatedParameterisedSystem::mNumberOfStateVariables, mOdeSystems, mOffsets, AbstractUntemplatedParameterisedSystem::mpSystemInfo, mWorkingDerivs, mWorkingStateVars, and AbstractParameterisedSystem< std::vector< double > >::ResetToInitialConditions().
void CombinedOdeSystem::Configure | ( | const std::map< unsigned, unsigned > & | rVariableParameterMap, | |
AbstractOdeSystem * | pVariableOdeSystem, | |||
AbstractOdeSystem * | pParameterOdeSystem | |||
) |
Configure a mapping between the state variables of one subsystem and the parameters of another.
rVariableParameterMap | a map specifying which state variables (keys) are mapped to which parameters (values). | |
pVariableOdeSystem | the ODE subsystem providing state variable values. | |
pParameterOdeSystem | the ODE subsystem whose parameters should be set. |
Definition at line 62 of file CombinedOdeSystem.cpp.
References mOdeSystems, mVariableParameterMaps, CombinedOdeSystem::VariableParameterMap::pParameterOdeSystem, CombinedOdeSystem::VariableParameterMap::pVariableOdeSystemIndex, and CombinedOdeSystem::VariableParameterMap::theMap.
void CombinedOdeSystem::EvaluateYDerivatives | ( | double | time, | |
const std::vector< double > & | rY, | |||
std::vector< double > & | rDY | |||
) | [virtual] |
Evaluate the right-hand side of the combined system.
This calls EvaluateYDerivatives for each subsystem with the appropriate portion of rY and rDY, having set parameters from values in rY according to the configured maps.
time | the current time | |
rY | the current values of the state variables | |
rDY | storage for the derivatives of the system; will be filled in on return |
Implements AbstractOdeSystem.
Definition at line 80 of file CombinedOdeSystem.cpp.
References mOdeSystems, mOffsets, mVariableParameterMaps, mWorkingDerivs, and mWorkingStateVars.
std::vector<AbstractOdeSystem*> CombinedOdeSystem::mOdeSystems [private] |
The subsystems forming this combined system.
Definition at line 64 of file CombinedOdeSystem.hpp.
Referenced by CombinedOdeSystem(), Configure(), and EvaluateYDerivatives().
std::vector<unsigned> CombinedOdeSystem::mOffsets [private] |
Keeps track of where the state variable vector for each subsystem is located within the combined state variable vector.
Definition at line 74 of file CombinedOdeSystem.hpp.
Referenced by CombinedOdeSystem(), and EvaluateYDerivatives().
std::vector<struct VariableParameterMap> CombinedOdeSystem::mVariableParameterMaps [private] |
Stores the information passed to Configure calls.
Definition at line 97 of file CombinedOdeSystem.hpp.
Referenced by Configure(), and EvaluateYDerivatives().
std::vector<std::vector<double> > CombinedOdeSystem::mWorkingDerivs [private] |
Working memory for the DY vectors of the subsystems.
Definition at line 69 of file CombinedOdeSystem.hpp.
Referenced by CombinedOdeSystem(), and EvaluateYDerivatives().
std::vector<std::vector<double> > CombinedOdeSystem::mWorkingStateVars [private] |
Working memory for the Y vectors of the subsystems.
Definition at line 67 of file CombinedOdeSystem.hpp.
Referenced by CombinedOdeSystem(), and EvaluateYDerivatives().