Chaste Commit::ca8ccdedf819b6e02855bc0e8e6f50bdecbc5208
|
#include <CardiacSimulation.hpp>
Public Member Functions | |
CardiacSimulation (std::string parameterFileName, bool writeProvenanceInfo=false, bool saveProblemInstance=false) | |
boost::shared_ptr< AbstractUntemplatedCardiacProblem > | GetSavedProblem () |
Private Member Functions | |
void | ReadParametersFromFile (std::string parameterFileName) |
template<class Problem , unsigned SPACE_DIM> | |
void | CreateAndRun () |
void | Run () |
void | CreateResumeXmlFile (const std::string &rOutputDirectory, const std::string &rArchiveDirectory) |
std::string | BoolToString (bool yesNo) |
Private Attributes | |
bool | mSaveProblemInstance |
boost::shared_ptr< AbstractUntemplatedCardiacProblem > | mSavedProblem |
A class which encapsulates the executable functionality.
Takes in a chaste parameters XML file and runs the relevant simulation.
The XML Schema, which describes what is allowed in the XML configuration file, can be found at heart/src/io/ChasteParameters_2_0.xsd (for Chaste release 2.0). It contains documentation describing what settings are available. The documentation of the HeartConfig class may also be of use.
Definition at line 80 of file CardiacSimulation.hpp.
CardiacSimulation::CardiacSimulation | ( | std::string | parameterFileName, |
bool | writeProvenanceInfo = false , |
||
bool | saveProblemInstance = false |
||
) |
Constructor
This also runs the simulation immediately.
parameterFileName | The name of the chaste parameters xml file to use to run a simulation. |
writeProvenanceInfo | Whether to write provanence and machine information files. |
saveProblemInstance | Whether to save a copy of the problem instance for examination by tests. |
Definition at line 95 of file CardiacSimulation.cpp.
References EXCEPTION, GenericEventHandler< 16, HeartEventHandler >::Headings(), HeartConfig::Instance(), ReadParametersFromFile(), GenericEventHandler< 16, HeartEventHandler >::Report(), Run(), ExecutableSupport::SetOutputDirectory(), ExecutableSupport::WriteMachineInfoFile(), and ExecutableSupport::WriteProvenanceInfoFile().
|
private |
Convert a boolean to a "yes" or "no" string.
yesNo |
Definition at line 45 of file CardiacSimulation.cpp.
Referenced by CreateResumeXmlFile().
|
inlineprivate |
Templated method which creates and runs a cardiac simulation, based on the XML file passed to our constructor.
Definition at line 95 of file CardiacSimulation.hpp.
References TimeStepper::AdvanceOneTimeStep(), FileFinder::CopyTo(), OutputDirectoryFifoQueue::CreateNextDir(), CreateResumeXmlFile(), OutputFileHandler::FindFile(), AbstractCardiacTissue< ELEMENT_DIM, SPACE_DIM >::GetCardiacCell(), HeartConfig::GetCheckpointSimulation(), HeartConfig::GetCheckpointTimestep(), DistributedVectorFactory::GetHigh(), DistributedVectorFactory::GetLow(), TimeStepper::GetNextTime(), HeartConfig::GetOutputDirectory(), HeartConfig::GetSimulationDuration(), HeartConfig::Instance(), TimeStepper::IsTimeAtEnd(), mSavedProblem, mSaveProblemInstance, CardiacSimulationArchiver< PROBLEM_CLASS >::Save(), HeartConfigRelatedCellFactory< SPACE_DIM >::SetCellIntracellularStimulus(), HeartConfigRelatedCellFactory< SPACE_DIM >::SetCellParameters(), AbstractCardiacCellFactory< ELEMENT_DIM, SPACE_DIM >::SetMesh(), HeartConfig::SetSimulationDuration(), and TRY_IF_MASTER.
|
private |
Write a ResumeParameters.xml file to the checkpoint directory, to help users in resuming a checkpointed simulation. If the contents of rOutputDirectory are copied to CHASTE_TEST_OUTPUT, and ResumeParameters.xml edited to specify a sensible simulation duration, then it can be used as the input parameters file to resume from the given checkpoint.
rOutputDirectory | the directory to put the XML file in |
rArchiveDirectory | the relative path from this directory to the archive directory |
Definition at line 59 of file CardiacSimulation.cpp.
References PetscTools::AmMaster(), BoolToString(), HeartConfig::GetCheckpointTimestep(), HeartConfig::GetDomain(), HeartConfig::GetMaxCheckpointsOnDisk(), OutputFileHandler::GetOutputDirectoryFullPath(), HeartConfig::GetSpaceDimension(), HeartConfig::Instance(), OutputFileHandler::OpenOutputFile(), and TRY_IF_MASTER.
Referenced by CreateAndRun().
boost::shared_ptr< AbstractUntemplatedCardiacProblem > CardiacSimulation::GetSavedProblem | ( | ) |
Definition at line 40 of file CardiacSimulation.cpp.
References mSavedProblem.
|
private |
Read parameters from the HeartConfig XML file.
parameterFileName | a string containing the chaste simulation parameters XML file name. |
Definition at line 117 of file CardiacSimulation.cpp.
References HeartConfig::Instance(), HeartConfig::Reset(), HeartConfig::SetParametersFile(), and HeartConfig::SetUseFixedSchemaLocation().
Referenced by CardiacSimulation().
|
private |
Run the simulation. This method basically contains switches on the problem type and space dimension, and calls CreateAndRun() to do the work.
Definition at line 164 of file CardiacSimulation.cpp.
References EXCEPTION, and HeartConfig::Instance().
Referenced by CardiacSimulation().
|
private |
The saved problem instance, if any.
Definition at line 227 of file CardiacSimulation.hpp.
Referenced by CreateAndRun(), and GetSavedProblem().
|
private |
Whether to save a copy of the problem instance for examination by tests.
Definition at line 224 of file CardiacSimulation.hpp.
Referenced by CreateAndRun().