#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 > & | rGetTimes () |
const std::vector< double > & | rGetTimes () const |
std::vector< std::vector < double > > & | rGetSolutions () |
const std::vector< std::vector < double > > & | rGetSolutions () const |
std::vector< std::vector < double > > & | rGetDerivedQuantities (AbstractOdeSystem *pOdeSystem) |
void | WriteToFile (std::string directoryName, std::string baseResultsFilename, std::string timeUnits, unsigned stepsPerRow=1, bool cleanDirectory=true, unsigned precision=8, bool includeDerivedQuantities=false, AbstractOdeSystem *pOdeSystem=NULL) |
Private Attributes | |
unsigned | mNumberOfTimeSteps |
std::vector< double > | mTimes |
std::vector< std::vector < double > > | mSolutions |
std::vector< std::vector < double > > | mDerivedQuantities |
boost::shared_ptr< const AbstractOdeSystemInformation > | mpOdeSystemInformation |
Definition at line 45 of file OdeSolution.hpp.
OdeSolution::OdeSolution | ( | ) |
Public constructor - ensures data is empty to start with.
Definition at line 35 of file OdeSolution.cpp.
unsigned OdeSolution::GetNumberOfTimeSteps | ( | ) | const |
Get the number of timesteps.
Definition at line 41 of file OdeSolution.cpp.
References mNumberOfTimeSteps.
void OdeSolution::SetNumberOfTimeSteps | ( | unsigned | numTimeSteps | ) |
Set the number of timesteps.
numTimeSteps | the number of timesteps to use |
Definition at line 46 of file OdeSolution.cpp.
References mNumberOfTimeSteps, mSolutions, and mTimes.
Referenced by AbstractBackwardEulerCardiacCell< SIZE >::Compute(), RungeKuttaFehlbergIvpOdeSolver::InternalSolve(), CvodeAdaptor::Solve(), AbstractOneStepIvpOdeSolver::Solve(), and AbstractCvodeCell::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 53 of file OdeSolution.cpp.
References mpOdeSystemInformation.
Referenced by AbstractBackwardEulerCardiacCell< SIZE >::Compute(), CvodeAdaptor::Solve(), AbstractOneStepIvpOdeSolver::Solve(), and AbstractCvodeCell::Solve().
std::vector< double > OdeSolution::GetVariableAtIndex | ( | unsigned | index | ) | const |
Get the values of a state variable with a given index in the ODE system at each timestep.
index | the index of the state variable in the system |
Definition at line 58 of file OdeSolution.cpp.
References mSolutions.
std::vector< double > & OdeSolution::rGetTimes | ( | ) |
Get the times at which the solution to the ODE system is stored.
Definition at line 71 of file OdeSolution.cpp.
References mTimes.
Referenced by AbstractBackwardEulerCardiacCell< SIZE >::Compute(), RungeKuttaFehlbergIvpOdeSolver::InternalSolve(), CvodeAdaptor::Solve(), AbstractOneStepIvpOdeSolver::Solve(), and AbstractCvodeCell::Solve().
const std::vector< double > & OdeSolution::rGetTimes | ( | ) | const |
Get the times at which the solution to the ODE system is stored.
Definition at line 76 of file OdeSolution.cpp.
References mTimes.
std::vector< std::vector< double > > & OdeSolution::rGetSolutions | ( | ) |
Get the values of the solution to the ODE system at each timestep.
Definition at line 81 of file OdeSolution.cpp.
References mSolutions.
Referenced by AbstractBackwardEulerCardiacCell< SIZE >::Compute(), RungeKuttaFehlbergIvpOdeSolver::InternalSolve(), CvodeAdaptor::Solve(), AbstractOneStepIvpOdeSolver::Solve(), and AbstractCvodeCell::Solve().
const std::vector< std::vector< double > > & OdeSolution::rGetSolutions | ( | ) | const |
Get the values of the solution to the ODE system at each timestep.
Definition at line 86 of file OdeSolution.cpp.
References mSolutions.
std::vector< std::vector< double > > & OdeSolution::rGetDerivedQuantities | ( | AbstractOdeSystem * | pOdeSystem | ) |
Get the derived quantities for this ODE system at each timestep.
pOdeSystem | the ODE system which was solved to generate this solution object |
Definition at line 91 of file OdeSolution.cpp.
References AbstractParameterisedSystem< VECTOR >::ComputeDerivedQuantities(), AbstractParameterisedSystem< VECTOR >::GetNumberOfDerivedQuantities(), mDerivedQuantities, mSolutions, and mTimes.
Referenced by WriteToFile().
void OdeSolution::WriteToFile | ( | std::string | directoryName, | |
std::string | baseResultsFilename, | |||
std::string | timeUnits, | |||
unsigned | stepsPerRow = 1 , |
|||
bool | cleanDirectory = true , |
|||
unsigned | precision = 8 , |
|||
bool | includeDerivedQuantities = false , |
|||
AbstractOdeSystem * | pOdeSystem = NULL | |||
) |
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 derived quantities in the output | |
pOdeSystem | the ODE system which was solved to generate this solution object (only used if includeDerivedQuantities=true) |
Definition at line 106 of file OdeSolution.cpp.
References ColumnDataWriter::AdvanceAlongUnlimitedDimension(), PetscTools::AmMaster(), ColumnDataWriter::Close(), ColumnDataWriter::DefineUnlimitedDimension(), ColumnDataWriter::DefineVariable(), ColumnDataWriter::EndDefineMode(), EXCEPTION, AbstractParameterisedSystem< VECTOR >::GetNumberOfDerivedQuantities(), AbstractParameterisedSystem< VECTOR >::GetSystemInformation(), mpOdeSystemInformation, mSolutions, mTimes, ColumnDataWriter::PutVariable(), and rGetDerivedQuantities().
unsigned OdeSolution::mNumberOfTimeSteps [private] |
Variable for the number of timesteps.
Definition at line 50 of file OdeSolution.hpp.
Referenced by GetNumberOfTimeSteps(), and SetNumberOfTimeSteps().
std::vector<double> OdeSolution::mTimes [private] |
A vector of times at each timestep.
Definition at line 53 of file OdeSolution.hpp.
Referenced by rGetDerivedQuantities(), rGetTimes(), SetNumberOfTimeSteps(), and WriteToFile().
std::vector<std::vector<double> > OdeSolution::mSolutions [private] |
Solutions for each variable at each timestep.
Definition at line 56 of file OdeSolution.hpp.
Referenced by GetVariableAtIndex(), rGetDerivedQuantities(), rGetSolutions(), SetNumberOfTimeSteps(), and WriteToFile().
std::vector<std::vector<double> > OdeSolution::mDerivedQuantities [private] |
Derived quantities at each timestep.
Definition at line 59 of file OdeSolution.hpp.
Referenced by rGetDerivedQuantities().
boost::shared_ptr<const AbstractOdeSystemInformation> OdeSolution::mpOdeSystemInformation [private] |
Information about the concrete ODE system class.
Used to get names and units into the file output.
Definition at line 66 of file OdeSolution.hpp.
Referenced by SetOdeSystemInformation(), and WriteToFile().