Chaste
Release::3.4
|
#include <OdeSolution.hpp>
Public Member Functions | |
OdeSolution () | |
unsigned | GetNumberOfTimeSteps () const |
void | SetNumberOfTimeSteps (unsigned numTimeSteps) |
void | SetOdeSystemInformation (boost::shared_ptr< const AbstractOdeSystemInformation > pOdeSystemInfo) |
std::vector< double > | GetVariableAtIndex (unsigned index) const |
std::vector< double > | GetAnyVariable (const std::string &rName) const |
std::vector< double > & | rGetTimes () |
const std::vector< double > & | rGetTimes () const |
std::vector< std::vector < double > > & | rGetSolutions () |
const std::vector< std::vector < double > > & | rGetSolutions () const |
void | SetSolverName (std::string solverName) |
std::string | GetSolverName () |
template<typename VECTOR > | |
void | CalculateDerivedQuantitiesAndParameters (AbstractParameterisedSystem< VECTOR > *pOdeSystem) |
std::vector< std::vector < double > > & | rGetDerivedQuantities (AbstractParameterisedSystem< std::vector< double > > *pOdeSystem) |
std::vector< std::vector < double > > & | rGetDerivedQuantities (AbstractParameterisedSystem< N_Vector > *pOdeSystem) |
template<typename VECTOR > | |
std::vector< double > & | rGetParameters (AbstractParameterisedSystem< VECTOR > *pOdeSystem) |
void | WriteToFile (std::string directoryName, std::string baseResultsFilename, std::string timeUnits, unsigned stepsPerRow=1, bool cleanDirectory=true, unsigned precision=8, bool includeDerivedQuantities=false) |
Private Attributes | |
unsigned | mNumberOfTimeSteps |
std::vector< double > | mTimes |
std::vector< std::vector < double > > | mSolutions |
std::vector< std::vector < double > > | mDerivedQuantities |
std::vector< double > | mParameters |
std::string | mSolverName |
boost::shared_ptr< const AbstractOdeSystemInformation > | mpOdeSystemInformation |
A class that that stores the output data from solving a system of ODEs, and allows us to save it to file.
Definition at line 58 of file OdeSolution.hpp.
OdeSolution::OdeSolution | ( | ) |
Public constructor - ensures data is empty to start with.
Definition at line 45 of file OdeSolution.cpp.
void OdeSolution::CalculateDerivedQuantitiesAndParameters | ( | AbstractParameterisedSystem< VECTOR > * | pOdeSystem | ) |
Calculate the derived quantities and store them and the current parameters for printing/accessing.
pOdeSystem | the ODE system which was solved to generate this solution object |
Definition at line 134 of file OdeSolution.cpp.
References AbstractUntemplatedParameterisedSystem::GetSystemInformation(), mpOdeSystemInformation, rGetDerivedQuantities(), and rGetParameters().
std::vector< double > OdeSolution::GetAnyVariable | ( | const std::string & | rName | ) | const |
rName | the name of the variable to extract |
Definition at line 107 of file OdeSolution.cpp.
References GetVariableAtIndex(), and mpOdeSystemInformation.
unsigned OdeSolution::GetNumberOfTimeSteps | ( | ) | const |
Get the number of timesteps.
Definition at line 52 of file OdeSolution.cpp.
References mNumberOfTimeSteps.
|
inline |
Definition at line 169 of file OdeSolution.hpp.
References mSolverName.
index | the index of the variable in the system |
Definition at line 71 of file OdeSolution.cpp.
References EXCEPTION, mDerivedQuantities, mParameters, mSolutions, and mTimes.
Referenced by GetAnyVariable().
std::vector< std::vector< double > > & OdeSolution::rGetDerivedQuantities | ( | AbstractParameterisedSystem< std::vector< double > > * | pOdeSystem | ) |
pOdeSystem | the ODE system which was solved to generate this solution object |
Definition at line 159 of file OdeSolution.cpp.
References mDerivedQuantities, mSolutions, and mTimes.
Referenced by CalculateDerivedQuantitiesAndParameters().
std::vector< std::vector< double > > & OdeSolution::rGetDerivedQuantities | ( | AbstractParameterisedSystem< N_Vector > * | pOdeSystem | ) |
pOdeSystem | the ODE system which was solved to generate this solution object |
Definition at line 175 of file OdeSolution.cpp.
References AbstractParameterisedSystem< VECTOR >::ComputeDerivedQuantities(), CopyFromStdVector(), CopyToStdVector(), DeleteVector(), AbstractUntemplatedParameterisedSystem::GetNumberOfDerivedQuantities(), mDerivedQuantities, mSolutions, and mTimes.
std::vector< double > & OdeSolution::rGetParameters | ( | AbstractParameterisedSystem< VECTOR > * | pOdeSystem | ) |
This method currently assumes that mParameters is constant through time. This may not be the case when using modifiers.
pOdeSystem | The ODE system which was solved to generate this solution object. |
Definition at line 143 of file OdeSolution.cpp.
References AbstractUntemplatedParameterisedSystem::GetNumberOfParameters(), AbstractParameterisedSystem< VECTOR >::GetParameter(), and mParameters.
Referenced by CalculateDerivedQuantitiesAndParameters().
std::vector< std::vector< double > > & OdeSolution::rGetSolutions | ( | ) |
Definition at line 122 of file OdeSolution.cpp.
References mSolutions.
Referenced by AbstractGeneralizedRushLarsenCardiacCell::Compute(), AbstractRushLarsenCardiacCell::Compute(), AbstractBackwardEulerCardiacCell< SIZE >::Compute(), AbstractBackwardEulerCardiacCell< 0u >::Compute(), RungeKuttaFehlbergIvpOdeSolver::InternalSolve(), AbstractOneStepIvpOdeSolver::Solve(), CvodeAdaptor::Solve(), and AbstractCvodeSystem::Solve().
const std::vector< std::vector< double > > & OdeSolution::rGetSolutions | ( | ) | const |
Definition at line 127 of file OdeSolution.cpp.
References mSolutions.
std::vector< double > & OdeSolution::rGetTimes | ( | ) |
Definition at line 112 of file OdeSolution.cpp.
References mTimes.
Referenced by AbstractGeneralizedRushLarsenCardiacCell::Compute(), AbstractRushLarsenCardiacCell::Compute(), AbstractBackwardEulerCardiacCell< SIZE >::Compute(), AbstractBackwardEulerCardiacCell< 0u >::Compute(), RungeKuttaFehlbergIvpOdeSolver::InternalSolve(), AbstractOneStepIvpOdeSolver::Solve(), CvodeAdaptor::Solve(), and AbstractCvodeSystem::Solve().
const std::vector< double > & OdeSolution::rGetTimes | ( | ) | const |
Definition at line 117 of file OdeSolution.cpp.
References mTimes.
void OdeSolution::SetNumberOfTimeSteps | ( | unsigned | numTimeSteps | ) |
Set the number of timesteps.
numTimeSteps | the number of timesteps to use |
Definition at line 58 of file OdeSolution.cpp.
References mNumberOfTimeSteps, mSolutions, and mTimes.
Referenced by AbstractGeneralizedRushLarsenCardiacCell::Compute(), AbstractRushLarsenCardiacCell::Compute(), AbstractBackwardEulerCardiacCell< SIZE >::Compute(), AbstractBackwardEulerCardiacCell< 0u >::Compute(), RungeKuttaFehlbergIvpOdeSolver::InternalSolve(), AbstractOneStepIvpOdeSolver::Solve(), CvodeAdaptor::Solve(), and AbstractCvodeSystem::Solve().
void OdeSolution::SetOdeSystemInformation | ( | boost::shared_ptr< const AbstractOdeSystemInformation > | pOdeSystemInfo | ) |
Set the ODE system information
pOdeSystemInfo | ODE system information (used to get the names and units of variables). |
Definition at line 66 of file OdeSolution.cpp.
References mpOdeSystemInformation.
Referenced by AbstractGeneralizedRushLarsenCardiacCell::Compute(), AbstractRushLarsenCardiacCell::Compute(), AbstractBackwardEulerCardiacCell< SIZE >::Compute(), AbstractBackwardEulerCardiacCell< 0u >::Compute(), AbstractOneStepIvpOdeSolver::Solve(), CvodeAdaptor::Solve(), and AbstractCvodeSystem::Solve().
|
inline |
Set the ODE solver used to create these results
solverName | solver used |
Definition at line 163 of file OdeSolution.hpp.
References mSolverName.
Referenced by AbstractOneStepIvpOdeSolver::Solve().
void OdeSolution::WriteToFile | ( | std::string | directoryName, |
std::string | baseResultsFilename, | ||
std::string | timeUnits, | ||
unsigned | stepsPerRow = 1 , |
||
bool | cleanDirectory = true , |
||
unsigned | precision = 8 , |
||
bool | includeDerivedQuantities = false |
||
) |
Write the data to a file.
directoryName | the directory in which to write the data to file |
baseResultsFilename | the name of the file in which to write the data |
timeUnits | name of the units of time used |
stepsPerRow | the solution to the ODE system is written to file every this number of timesteps (defaults to 1) |
cleanDirectory | whether to clean the directory (defaults to true) |
precision | the precision with which to write the data (i.e. exactly how many digits to display after the decimal point). Defaults to 8. Must be between 2 and 20 (inclusive). |
includeDerivedQuantities | whether to include parameters and derived quantities in the output. |
Definition at line 199 of file OdeSolution.cpp.
References ColumnDataWriter::AdvanceAlongUnlimitedDimension(), PetscTools::AmMaster(), ColumnDataWriter::Close(), ColumnDataWriter::DefineUnlimitedDimension(), ColumnDataWriter::DefineVariable(), ColumnDataWriter::EndDefineMode(), EXCEPTION, mDerivedQuantities, mParameters, mpOdeSystemInformation, mSolutions, mSolverName, mTimes, ColumnDataWriter::PutVariable(), and ColumnDataWriter::SetCommentForInfoFile().
|
private |
Derived quantities at each timestep.
Definition at line 71 of file OdeSolution.hpp.
Referenced by GetVariableAtIndex(), rGetDerivedQuantities(), and WriteToFile().
|
private |
Variable for the number of timesteps.
Definition at line 62 of file OdeSolution.hpp.
Referenced by GetNumberOfTimeSteps(), and SetNumberOfTimeSteps().
|
private |
Parameters - these are currently assumed constant across all time
Definition at line 74 of file OdeSolution.hpp.
Referenced by GetVariableAtIndex(), rGetParameters(), and WriteToFile().
|
private |
Information about the concrete ODE system class.
Used to get names and units into the file output.
Definition at line 84 of file OdeSolution.hpp.
Referenced by CalculateDerivedQuantitiesAndParameters(), GetAnyVariable(), SetOdeSystemInformation(), and WriteToFile().
|
private |
Solutions for each variable at each timestep.
Definition at line 68 of file OdeSolution.hpp.
Referenced by GetVariableAtIndex(), rGetDerivedQuantities(), rGetSolutions(), SetNumberOfTimeSteps(), and WriteToFile().
|
private |
The ODE solver used to create these results
Definition at line 77 of file OdeSolution.hpp.
Referenced by GetSolverName(), SetSolverName(), and WriteToFile().
|
private |
A vector of times at each timestep.
Definition at line 65 of file OdeSolution.hpp.
Referenced by GetVariableAtIndex(), rGetDerivedQuantities(), rGetTimes(), SetNumberOfTimeSteps(), and WriteToFile().