Chaste Commit::675f9facbe008c5eacb9006feaeb6423206579ea
CellBasedSimulationArchiver< ELEMENT_DIM, SIM, SPACE_DIM, INPUT_ARCHIVE_TYPE, OUTPUT_ARCHIVE_TYPE > Class Template Reference

#include <CellBasedSimulationArchiver.hpp>

+ Collaboration diagram for CellBasedSimulationArchiver< ELEMENT_DIM, SIM, SPACE_DIM, INPUT_ARCHIVE_TYPE, OUTPUT_ARCHIVE_TYPE >:

Static Public Member Functions

static SIM * Load (const std::string &rArchiveDirectory, const double &rTimeStamp)
 
static void Save (SIM *pSim)
 

Detailed Description

template<unsigned ELEMENT_DIM, class SIM, unsigned SPACE_DIM = ELEMENT_DIM, class INPUT_ARCHIVE_TYPE = boost::archive::text_iarchive, class OUTPUT_ARCHIVE_TYPE = boost::archive::text_oarchive>
class CellBasedSimulationArchiver< ELEMENT_DIM, SIM, SPACE_DIM, INPUT_ARCHIVE_TYPE, OUTPUT_ARCHIVE_TYPE >

CellBasedSimulationArchiver handles the checkpointing (saving and loading) of all the various AbstractCellBasedSimulation objects. It has no explicit constructor (just uses a default one) and no member variables.

The template options for INPUT_ARCHIVE_TYPE and OUTPUT_ARCHIVE_TYPE can (in theory) be set independently but should be chosen accordingly. To help with this, below, we define type aliases to set both archive types for text and binary I/O respectively. Default settings are chosen such that existing implementations depending on text format as default are kept intact.

Definition at line 63 of file CellBasedSimulationArchiver.hpp.

Member Function Documentation

◆ Load()

template<unsigned ELEMENT_DIM, class SIM , unsigned SPACE_DIM, class INPUT_ARCHIVE_TYPE , class OUTPUT_ARCHIVE_TYPE >
SIM * CellBasedSimulationArchiver< ELEMENT_DIM, SIM, SPACE_DIM, INPUT_ARCHIVE_TYPE, OUTPUT_ARCHIVE_TYPE >::Load ( const std::string &  rArchiveDirectory,
const double rTimeStamp 
)
static

Loads a saved cell-based simulation to run further.

Returns
the unarchived simulation object
Parameters
rArchiveDirectorythe name of the simulation to load (specified originally by simulation.SetOutputDirectory("wherever"); )
rTimeStampthe time at which to load the simulation (this must be one of the times at which simulation.Save() was called)

Find the right archive (and mesh) to load. The files are contained within the 'archive' folder in rArchiveDirectory, with the archive itself called 'cell_population_sim_at_time_`rTimeStamp`.arch'. The path to this file is returned.

The path to the mesh is stored in ArchiveLocationInfo for use by the CellPopulation de-serialization routines.

Definition at line 93 of file CellBasedSimulationArchiver.hpp.

References RelativeTo::ChasteTestOutput, ArchiveOpener< Archive, Stream >::GetCommonArchive(), and ArchiveLocationInfo::SetMeshPathname().

◆ Save()

template<unsigned ELEMENT_DIM, class SIM , unsigned SPACE_DIM, class INPUT_ARCHIVE_TYPE , class OUTPUT_ARCHIVE_TYPE >
void CellBasedSimulationArchiver< ELEMENT_DIM, SIM, SPACE_DIM, INPUT_ARCHIVE_TYPE, OUTPUT_ARCHIVE_TYPE >::Save ( SIM *  pSim)
static

Saves the whole cell-based simulation for restarting later.

Puts it in the archive folder under the simulation's OutputDirectory, in the file "cell_population_sim_at_time_<SIMULATION TIME>.arch". The mesh is written to files in the same folder.

First archives simulation time (and other singletons, if used) then the simulation itself.

Parameters
pSimpointer to the simulation

Definition at line 121 of file CellBasedSimulationArchiver.hpp.

References RelativeTo::ChasteTestOutput, ArchiveOpener< Archive, Stream >::GetCommonArchive(), SimulationTime::GetTime(), SimulationTime::Instance(), SimulationTime::IsStartTimeSetUp(), and ArchiveLocationInfo::SetMeshFilename().


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