Chaste  Release::2017.1
CombinedOdeSystem Class Reference

#include <CombinedOdeSystem.hpp>

+ Inheritance diagram for CombinedOdeSystem:
+ Collaboration diagram for CombinedOdeSystem:

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)
 
- Public Member Functions inherited from AbstractOdeSystem
 AbstractOdeSystem (unsigned numberOfStateVariables)
 
virtual ~AbstractOdeSystem ()
 
virtual bool CalculateStoppingEvent (double time, const std::vector< double > &rY)
 
virtual double CalculateRootFunction (double time, const std::vector< double > &rY)
 
bool GetUseAnalyticJacobian ()
 
const std::vector< double > & rGetConstStateVariables () const
 
- Public Member Functions inherited from AbstractParameterisedSystem< std::vector< double > >
 AbstractParameterisedSystem (unsigned numberOfStateVariables)
 
std::vector< double > & rGetStateVariables ()
 
std::vector< doubleGetStateVariables ()
 
void SetStateVariables (const std::vector< double > &rStateVariables)
 
double GetStateVariable (unsigned index) const
 
double GetStateVariable (const std::string &rName) const
 
void SetStateVariable (unsigned index, double newValue)
 
void SetStateVariable (const std::string &rName, double newValue)
 
virtual void VerifyStateVariables ()
 
void SetDefaultInitialConditions (const std::vector< double > &rInitialConditions)
 
void SetDefaultInitialCondition (unsigned index, double initialCondition)
 
std::vector< doubleGetInitialConditions () const
 
void ResetToInitialConditions ()
 
double GetParameter (unsigned index) const
 
double GetParameter (const std::string &rName) const
 
void SetParameter (const std::string &rName, double value)
 
void SetParameter (unsigned index, double value)
 
double GetAnyVariable (unsigned index, double time=0.0, std::vector< double > *pDerivedQuantities=NULL)
 
double GetAnyVariable (const std::string &rName, double time=0.0, std::vector< double > *pDerivedQuantities=NULL)
 
void SetAnyVariable (unsigned index, double value)
 
void SetAnyVariable (const std::string &rName, double value)
 
virtual std::vector< doubleComputeDerivedQuantities (double time, const std::vector< double > &rState)
 
std::vector< doubleComputeDerivedQuantitiesFromCurrentState (double time)
 
- Public Member Functions inherited from AbstractUntemplatedParameterisedSystem
 AbstractUntemplatedParameterisedSystem (unsigned numberOfStateVariables)
 
virtual ~AbstractUntemplatedParameterisedSystem ()
 
boost::shared_ptr< const AbstractOdeSystemInformationGetSystemInformation () const
 
std::string GetSystemName () const
 
unsigned GetNumberOfAttributes () const
 
bool HasAttribute (const std::string &rName) const
 
double GetAttribute (const std::string &rName) const
 
unsigned GetNumberOfStateVariables () const
 
const std::vector< std::string > & rGetStateVariableNames () const
 
const std::vector< std::string > & rGetStateVariableUnits () const
 
unsigned GetStateVariableIndex (const std::string &rName) const
 
bool HasStateVariable (const std::string &rName) const
 
std::string GetStateVariableUnits (unsigned index) const
 
unsigned GetNumberOfParameters () const
 
const std::vector< std::string > & rGetParameterNames () const
 
const std::vector< std::string > & rGetParameterUnits () const
 
unsigned GetParameterIndex (const std::string &rName) const
 
bool HasParameter (const std::string &rName) const
 
std::string GetParameterUnits (unsigned index) const
 
unsigned GetNumberOfDerivedQuantities () const
 
const std::vector< std::string > & rGetDerivedQuantityNames () const
 
const std::vector< std::string > & rGetDerivedQuantityUnits () const
 
unsigned GetDerivedQuantityIndex (const std::string &rName) const
 
bool HasDerivedQuantity (const std::string &rName) const
 
std::string GetDerivedQuantityUnits (unsigned index) const
 
unsigned GetAnyVariableIndex (const std::string &rName) const
 
bool HasAnyVariable (const std::string &rName) const
 
std::string GetAnyVariableUnits (unsigned index) const
 
std::string GetAnyVariableUnits (const std::string &rName) const
 

Private Attributes

std::vector< AbstractOdeSystem * > mOdeSystems
 
std::vector< std::vector< double > > mWorkingStateVars
 
std::vector< std::vector< double > > mWorkingDerivs
 
std::vector< unsignedmOffsets
 
std::vector< struct VariableParameterMapmVariableParameterMaps
 

Additional Inherited Members

- Protected Member Functions inherited from AbstractParameterisedSystem< std::vector< double > >
std::string DumpState (const std::string &rMessage)
 
std::string DumpState (const std::string &rMessage, std::vector< double >Y)
 
std::string DumpState (const std::string &rMessage, std::vector< double >Y, double time)
 
void CheckParametersOnLoad (const std::vector< double > &rParameters, const std::vector< std::string > &rParameterNames)
 
- Protected Attributes inherited from AbstractOdeSystem
bool mUseAnalyticJacobian
 
- Protected Attributes inherited from AbstractParameterisedSystem< std::vector< double > >
std::vector< doublemStateVariables
 
std::vector< doublemParameters
 
- Protected Attributes inherited from AbstractUntemplatedParameterisedSystem
unsigned mNumberOfStateVariables
 
boost::shared_ptr< AbstractOdeSystemInformationmpSystemInfo
 

Detailed Description

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 $dy/dt = f(y, t)$ from subsystems $dy_1/dt = f_1(y_1, t; y_2)$ and $dy_2/dt = f_2(y_2, t; y_1)$ where $y = (y_1, y_2)$.

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 66 of file CombinedOdeSystem.hpp.

Constructor & Destructor Documentation

CombinedOdeSystem::CombinedOdeSystem ( std::vector< AbstractOdeSystem * >  odeSystems)

Member Function Documentation

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.

Parameters
rVariableParameterMapa map specifying which state variables (keys) are mapped to which parameters (values).
pVariableOdeSystemthe ODE subsystem providing state variable values.
pParameterOdeSystemthe ODE subsystem whose parameters should be set.

Definition at line 67 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.

Parameters
timethe current time
rYthe current values of the state variables
rDYstorage for the derivatives of the system; will be filled in on return

Implements AbstractOdeSystem.

Definition at line 85 of file CombinedOdeSystem.cpp.

References mOdeSystems, mOffsets, mVariableParameterMaps, mWorkingDerivs, and mWorkingStateVars.

Member Data Documentation

std::vector<AbstractOdeSystem*> CombinedOdeSystem::mOdeSystems
private

The subsystems forming this combined system.

Definition at line 71 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 81 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 104 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 76 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 74 of file CombinedOdeSystem.hpp.

Referenced by CombinedOdeSystem(), and EvaluateYDerivatives().


The documentation for this class was generated from the following files: