ArchiveLocationInfo Class Reference

#include <ArchiveLocationInfo.hpp>

Collaboration diagram for ArchiveLocationInfo:
Collaboration graph
[legend]

List of all members.

Static Public Member Functions

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 std::string &rDirectory, bool relativeToChasteTestOutput=true)
static std::string GetArchiveRelativePath ()
static bool GetIsDirRelativeToChasteTestOutput ()

Static Private Attributes

static std::string mDirPath = ""
static bool mDirIsRelativeToChasteTestOutput = true
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 54 of file ArchiveLocationInfo.hpp.


Member Function Documentation

static std::string ArchiveLocationInfo::GetArchiveDirectory (  )  [inline, static]
static std::string ArchiveLocationInfo::GetArchiveRelativePath (  )  [inline, static]

Get the directory to which the archives are being written. Remove CHASTE_TEST_OUTPUT prefix (assuming it exists) Will always end in a '/'.

Returns:
relative path to directory

Definition at line 161 of file ArchiveLocationInfo.hpp.

References OutputFileHandler::GetChasteTestOutputDirectory(), mDirIsRelativeToChasteTestOutput, and mDirPath.

Referenced by AbstractCardiacProblem< ELEMENT_DIM, ELEMENT_DIM, 1 >::load(), VertexMesh< 2, 2 >::save(), AbstractTetrahedralMesh< SPACE_DIM, SPACE_DIM >::save(), and AbstractCardiacProblem< ELEMENT_DIM, ELEMENT_DIM, 1 >::save().

static bool ArchiveLocationInfo::GetIsDirRelativeToChasteTestOutput (  )  [inline, static]

Get wheter the directory provided is relative to CHASTE_TEST_OUTPUT

Returns:
true if the directory provided lives in CHASTE_TEST_OUTPUT, false if it's relative to CWD

Definition at line 186 of file ArchiveLocationInfo.hpp.

References mDirIsRelativeToChasteTestOutput.

Referenced by AbstractCardiacProblem< ELEMENT_DIM, ELEMENT_DIM, 1 >::load().

static std::string ArchiveLocationInfo::GetMeshFilename (  )  [inline, static]

Get the filename that the mesh should be written to

Returns:
mesh filename

Definition at line 95 of file ArchiveLocationInfo.hpp.

References mMeshFilename.

Referenced by VertexMesh< 2, 2 >::load(), AbstractTetrahedralMesh< SPACE_DIM, SPACE_DIM >::load(), VertexMesh< 2, 2 >::save(), and AbstractTetrahedralMesh< SPACE_DIM, SPACE_DIM >::save().

static std::string ArchiveLocationInfo::GetProcessUniqueFilePath ( const std::string &  rFileName,
unsigned  procId = PetscTools::GetMyRank() 
) [inline, 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:
rFileName the base file name
procId the process id number (defaults to current process)
Returns:
a full path to the file for this process

Definition at line 129 of file ArchiveLocationInfo.hpp.

References GetArchiveDirectory().

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

static void ArchiveLocationInfo::SetArchiveDirectory ( const std::string &  rDirectory,
bool  relativeToChasteTestOutput = true 
) [inline, static]

Set the directory that archives are being written to.

Parameters:
rDirectory the directory in question.
relativeToChasteTestOutput Whether to convert directory to an absolute path using the OutputFileHandler (defaults to true)

Definition at line 144 of file ArchiveLocationInfo.hpp.

References mDirIsRelativeToChasteTestOutput, and mDirPath.

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

static void ArchiveLocationInfo::SetMeshFilename ( const std::string &  rFilename  )  [inline, static]

Set the filename for mesh files.

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

Definition at line 86 of file ArchiveLocationInfo.hpp.

References mMeshFilename.

Referenced by TissueSimulationArchiver< DIM, SIM >::Save().

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

Set the location to write mesh files.

Parameters:
rDirectory the directory to write to.
rFilename the base name (minus extension) for the mesh files.

Definition at line 76 of file ArchiveLocationInfo.hpp.

References mMeshFilename, and SetArchiveDirectory().

Referenced by TissueSimulationArchiver< DIM, SIM >::Load().


Member Data Documentation

Whether mDirPath is relative to CHASTE_TEST_OUTPUT true if the directory provided lives in CHASTE_TEST_OUTPUT, false if it's relative to CWD

Definition at line 64 of file ArchiveLocationInfo.hpp.

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

std::string ArchiveLocationInfo::mDirPath = "" [static, private]

Directory that archives are being written to.

Definition at line 59 of file ArchiveLocationInfo.hpp.

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

std::string ArchiveLocationInfo::mMeshFilename = "mesh" [static, private]

Mesh filename (relative to mDirPath).

Definition at line 67 of file ArchiveLocationInfo.hpp.

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


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

Generated by  doxygen 1.6.2