Chaste Commit::f2ff7ee04e70ac9d06c57344df8d017dbb12b97b
ArchiveLocationInfo Class Reference

#include <ArchiveLocationInfo.hpp>

+ Collaboration diagram for ArchiveLocationInfo:

Static Public Member Functions

static void SetMeshPathname (const FileFinder &rDirectory, const std::string &rFilename)
 
static void SetMeshPathname (const std::string &rDirectory, const std::string &rFilename)
 
static void SetMeshFilename (const std::string &rFilename)
 
static std::string GetMeshFilename ()
 
static std::string GetArchiveDirectory ()
 
static std::string GetProcessUniqueFilePath (const std::string &rFileName, unsigned procId=PetscTools::GetMyRank())
 
static void SetArchiveDirectory (const FileFinder &rDirectory)
 
static std::string GetArchiveRelativePath ()
 
static bool GetIsDirRelativeToChasteTestOutput ()
 

Static Private Attributes

static std::string mDirAbsPath = ""
 
static std::string mMeshFilename = "mesh"
 

Detailed Description

Mini-class to help with 'archiving' various classes that don't write their data directly to the archive file. They thus need to know information about where the archive is being written to, in order to write their own files into the same folder. The main methods are GetArchiveDirectory and SetArchiveDirectory.

This functionality is used by the meshes, LinearSystem and HeartConfig.

For the benefit of the meshes (and the cell_based code), there are also shortcut methods SetMeshPathname and GetMeshFilename, allowing you to specify the base file name for the mesh. This is needed because the cell_based code adds timestamp information to the file name.

Definition at line 57 of file ArchiveLocationInfo.hpp.

Member Function Documentation

◆ GetArchiveDirectory()

◆ GetArchiveRelativePath()

◆ GetIsDirRelativeToChasteTestOutput()

bool ArchiveLocationInfo::GetIsDirRelativeToChasteTestOutput ( )
static
Returns
true if the directory provided is relative to CHASTE_TEST_OUTPUT.

Definition at line 126 of file ArchiveLocationInfo.cpp.

References OutputFileHandler::GetChasteTestOutputDirectory(), and mDirAbsPath.

Referenced by ArchiveOpener< Archive, Stream >::ArchiveOpener().

◆ GetMeshFilename()

◆ GetProcessUniqueFilePath()

std::string ArchiveLocationInfo::GetProcessUniqueFilePath ( const std::string &  rFileName,
unsigned  procId = PetscTools::GetMyRank() 
)
static

Get the full path to an output file which has a name unique to the current process. Useful for ensuring that each process writes to / reads from a separate file when running in parallel.

The path will have the form "path_to_output_dir/rFileName.process_rank"

Parameters
rFileNamethe base file name
procIdthe process id number (defaults to current process)
Returns
a full path to the file for this process

Definition at line 92 of file ArchiveLocationInfo.cpp.

References GetArchiveDirectory().

Referenced by ArchiveOpener< Archive, Stream >::ArchiveOpener(), and CardiacSimulationArchiver< PROBLEM_CLASS >::Migrate().

◆ SetArchiveDirectory()

void ArchiveLocationInfo::SetArchiveDirectory ( const FileFinder rDirectory)
static

Set the directory that archives are being written to.

Parameters
rDirectorythe directory in question.

Definition at line 101 of file ArchiveLocationInfo.cpp.

References FileFinder::GetAbsolutePath(), and mDirAbsPath.

Referenced by ArchiveOpener< Archive, Stream >::ArchiveOpener(), OutputFileHandler::SetArchiveDirectory(), SetMeshPathname(), and SetMeshPathname().

◆ SetMeshFilename()

void ArchiveLocationInfo::SetMeshFilename ( const std::string &  rFilename)
static

Set the filename for mesh files.

Parameters
rFilenamethe base name (minus extension) for the mesh files, used to put on a timestamp.

Definition at line 69 of file ArchiveLocationInfo.cpp.

References mMeshFilename.

Referenced by CellBasedSimulationArchiver< ELEMENT_DIM, SIM, SPACE_DIM >::Save().

◆ SetMeshPathname() [1/2]

void ArchiveLocationInfo::SetMeshPathname ( const FileFinder rDirectory,
const std::string &  rFilename 
)
static

Set the location to write mesh files.

Parameters
rDirectorythe directory to write to.
rFilenamethe base name (minus extension) for the mesh files.

Definition at line 46 of file ArchiveLocationInfo.cpp.

References mMeshFilename, and SetArchiveDirectory().

Referenced by CellBasedSimulationArchiver< ELEMENT_DIM, SIM, SPACE_DIM >::Load().

◆ SetMeshPathname() [2/2]

void ArchiveLocationInfo::SetMeshPathname ( const std::string &  rDirectory,
const std::string &  rFilename 
)
static

Set the location to write mesh files.

Parameters
rDirectorythe directory to write to (if relative, assumes relative to CHASTE_TEST_OUTPUT).
rFilenamethe base name (minus extension) for the mesh files.

Definition at line 52 of file ArchiveLocationInfo.cpp.

References RelativeTo::Absolute, RelativeTo::ChasteTestOutput, FileFinder::IsAbsolutePath(), mMeshFilename, and SetArchiveDirectory().

Member Data Documentation

◆ mDirAbsPath

std::string ArchiveLocationInfo::mDirAbsPath = ""
staticprivate

Absolute path for directory that archives are being written to.

Definition at line 62 of file ArchiveLocationInfo.hpp.

Referenced by GetArchiveDirectory(), GetArchiveRelativePath(), GetIsDirRelativeToChasteTestOutput(), and SetArchiveDirectory().

◆ mMeshFilename

std::string ArchiveLocationInfo::mMeshFilename = "mesh"
staticprivate

Mesh filename (relative to mDirAbsPath).

Definition at line 65 of file ArchiveLocationInfo.hpp.

Referenced by GetMeshFilename(), SetMeshFilename(), SetMeshPathname(), and SetMeshPathname().


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