Chaste Release::3.1
CardiacSimulationArchiver< PROBLEM_CLASS > Class Template Reference

#include <CardiacSimulationArchiver.hpp>

List of all members.

Static Public Member Functions

static void Save (PROBLEM_CLASS &rSimulationToArchive, const std::string &rDirectory, bool clearDirectory=true)
static PROBLEM_CLASS * Load (const std::string &rDirectory)
static PROBLEM_CLASS * Load (const FileFinder &rDirectory)
static PROBLEM_CLASS * Migrate (const FileFinder &rDirectory)

Detailed Description

template<class PROBLEM_CLASS>
class CardiacSimulationArchiver< PROBLEM_CLASS >

CardiacSimulationArchiver is a helper class for checkpointing of cardiac simulations.

The class is templated over the class defining the simulation (e.g. MonodomainProblem). It would be more natural to template over dimensions as for other classes, and just deal with pointers to AbstractCardiacProblem. However, this breaks archive backwards compatibility...

Definition at line 52 of file CardiacSimulationArchiver.hpp.


Member Function Documentation

template<class PROBLEM_CLASS >
PROBLEM_CLASS * CardiacSimulationArchiver< PROBLEM_CLASS >::Load ( const std::string &  rDirectory) [static]

Unarchives a simulation from the directory specified.

Does a migrate if necessary (this is actually just a wrapper around the Migrate method now).

Note:
Must be called collectively, i.e. by all processes.
Parameters:
rDirectorydirectory where the multiple files defining the checkpoint are located (relative to CHASTE_TEST_OUTPUT)

Definition at line 122 of file CardiacSimulationArchiver.cpp.

References RelativeTo::ChasteTestOutput, and CardiacSimulationArchiver< PROBLEM_CLASS >::Migrate().

template<class PROBLEM_CLASS >
PROBLEM_CLASS * CardiacSimulationArchiver< PROBLEM_CLASS >::Load ( const FileFinder rDirectory) [static]

Unarchives a simulation from the directory specified.

Does a migrate if necessary (this is actually just a wrapper around the Migrate method now).

Note:
Must be called collectively, i.e. by all processes.
Parameters:
rDirectorydirectory where the multiple files defining the checkpoint are located

Definition at line 129 of file CardiacSimulationArchiver.cpp.

References CardiacSimulationArchiver< PROBLEM_CLASS >::Migrate().

template<class PROBLEM_CLASS >
PROBLEM_CLASS * CardiacSimulationArchiver< PROBLEM_CLASS >::Migrate ( const FileFinder rDirectory) [static]

Load a simulation, saved by any number of processes, into the correct number of processes for those currently launched.

Note:
Must be called collectively, i.e. by all processes.

Uses the DistributedVectorFactory saved in the process 0 archive to work out how many secondary archive files to read, and loads the cells and boundary conditions from these too.

Uses a dumb partition to work out how to distribute the mesh and cells over the processes. If we are loading on the same number of processes as the simulation was saved on, it uses exactly the same distribution as before.

Parameters:
rDirectorydirectory where the multiple files defining the checkpoint are located

Definition at line 136 of file CardiacSimulationArchiver.cpp.

References EXCEPTION, FileFinder::Exists(), FileFinder::GetAbsolutePath(), ArchiveOpener< Archive, Stream >::GetCommonArchive(), PetscTools::GetMyRank(), DistributedVectorFactory::GetNumProcs(), PetscTools::GetNumProcs(), DistributedVectorFactory::GetOriginalFactory(), ArchiveLocationInfo::GetProcessUniqueFilePath(), FileFinder::IsDir(), and DistributedVectorFactory::SetCheckNumberOfProcessesOnLoad().

Referenced by CardiacSimulationArchiver< PROBLEM_CLASS >::Load().

template<class PROBLEM_CLASS >
void CardiacSimulationArchiver< PROBLEM_CLASS >::Save ( PROBLEM_CLASS &  rSimulationToArchive,
const std::string &  rDirectory,
bool  clearDirectory = true 
) [static]

Archives a simulation in the directory specified.

Note:
Must be called collectively, i.e. by all processes.
Parameters:
rSimulationToArchiveobject defining the simulation to archive
rDirectorydirectory where the multiple files defining the checkpoint will be stored (relative to CHASTE_TEST_OUTPUT)
clearDirectorywhether the directory needs to be cleared or not.

Todo:
#1026 get a real version number!

Definition at line 74 of file CardiacSimulationArchiver.cpp.

References PetscTools::AmMaster(), PetscTools::Barrier(), RelativeTo::ChasteTestOutput, EXCEPTION, ArchiveOpener< Archive, Stream >::GetCommonArchive(), PetscTools::GetNumProcs(), OutputFileHandler::GetOutputDirectoryFullPath(), and PetscTools::ReplicateBool().


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