36 #include "CardiacSimulationArchiver.hpp"
37 #include "CardiacSimulation.hpp"
64 out_stream p_file = handler.
OpenOutputFile(
"ResumeParameters.xml");
65 (*p_file) <<
"<?xml version='1.0' encoding='UTF-8'?>" << std::endl;
66 (*p_file) <<
"<ChasteParameters xmlns='https://chaste.comlab.ox.ac.uk/nss/parameters/3_0' "
67 <<
"xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' "
68 <<
"xsi:schemaLocation='https://chaste.comlab.ox.ac.uk/nss/parameters/3_0 ChasteParameters_3_0.xsd'>" << std::endl;
69 (*p_file) << std::endl;
70 (*p_file) <<
" <ResumeSimulation>" << std::endl;
71 (*p_file) <<
" <ArchiveDirectory relative_to='this_file'>" << rArchiveDirectory <<
"</ArchiveDirectory>" << std::endl;
73 (*p_file) <<
" <SimulationDuration unit='ms'>0.0</SimulationDuration> <!-- Edit with new simulation duration. Please "
74 <<
"note that the simulation does not restart at t=0 but at the time where the checkpoint was created.-->" << std::endl;
78 <<
"'/> <!-- This is optional; if not given, the loaded simulation will NOT itself be checkpointed -->" << std::endl;
83 (*p_file) <<
" </ResumeSimulation>" << std::endl;
84 (*p_file) << std::endl;
85 (*p_file) <<
" <!-- These elements must exist, but their contents are ignored -->" << std::endl;
86 (*p_file) <<
" <Physiological/>" << std::endl;
87 (*p_file) <<
" <Numerical/>" << std::endl;
88 (*p_file) <<
"</ChasteParameters>" << std::endl;
96 bool writeProvenanceInfo,
97 bool saveProblemInstance)
98 : mSaveProblemInstance(saveProblemInstance)
101 if (parameterFileName ==
"")
109 if (writeProvenanceInfo)
144 #define DOMAIN_CASE(VALUE, CLASS, DIM) \
147 CreateAndRun<CLASS<DIM>, DIM>(); \
151 #define DOMAIN_SWITCH(DIM) \
152 switch (HeartConfig::Instance()->GetDomain()) \
154 DOMAIN_CASE(cp::domain_type::Mono, MonodomainProblem, DIM) \
155 DOMAIN_CASE(cp::domain_type::Bi, BidomainProblem, DIM) \
156 DOMAIN_CASE(cp::domain_type::BiWithBath, BidomainWithBathProblem, DIM) \
182 EXCEPTION(
"Space dimension not supported: should be 1, 2 or 3");
CardiacSimulation(std::string parameterFileName, bool writeProvenanceInfo=false, bool saveProblemInstance=false)
double GetCheckpointTimestep() const
#define EXCEPTION(message)
boost::shared_ptr< AbstractUntemplatedCardiacProblem > mSavedProblem
void SetUseFixedSchemaLocation(bool useFixedSchemaLocation)
std::string GetOutputDirectoryFullPath() const
static void WriteProvenanceInfoFile()
cp::domain_type GetDomain() const
out_stream OpenOutputFile(const std::string &rFileName, std::ios_base::openmode mode=std::ios::out|std::ios::trunc) const
unsigned GetSpaceDimension() const
unsigned GetMaxCheckpointsOnDisk() const
std::string BoolToString(bool yesNo)
void CreateResumeXmlFile(const std::string &rOutputDirectory, const std::string &rArchiveDirectory)
void SetParametersFile(const std::string &rFileName)
boost::shared_ptr< AbstractUntemplatedCardiacProblem > GetSavedProblem()
std::string CheckShortMessageContains(std::string expected) const
static void WriteMachineInfoFile(std::string fileBaseName)
static HeartConfig * Instance()
void ReadParametersFromFile(std::string parameterFileName)
static void SetOutputDirectory(const std::string &rOutputDirectory)