Chaste
Release::3.4
|
#include <ExecutableSupport.hpp>
Static Public Member Functions | |
static void | InitializePetsc (int *pArgc, char ***pArgv) |
static void | ShowCopyright () |
static void | ShowParallelLaunching () |
static void | SetOutputDirectory (const std::string &rOutputDirectory) |
static void | WriteMachineInfoFile (std::string fileBaseName) |
static void | WriteProvenanceInfoFile () |
static void | GetBuildInfo (std::string &rInfo) |
static void | StandardStartup (int *pArgc, char ***pArgv) |
static void | PrintError (const std::string &rMessage, bool masterOnly=false) |
static void | Print (const std::string &rMessage) |
static void | FinalizePetsc () |
Static Public Attributes | |
static const int | EXIT_OK = 0 |
static const int | EXIT_ERROR = 1 |
static const int | EXIT_BAD_ARGUMENTS = 2 |
Static Private Attributes | |
static FileFinder | mOutputDirectory |
Various helpful static methods for people writing their own executables within the Chaste framework.
Most executables will just need to call StandardStartup as the first thing in their main() function, and FinalizePetsc before quitting. The other methods allow you to fine-tune what output is presented to users.
Definition at line 51 of file ExecutableSupport.hpp.
|
static |
Shut down PETSc so we exit cleanly.
Definition at line 449 of file ExecutableSupport.cpp.
References PetscSetupUtils::CommonFinalize().
|
static |
Get information about library and compiler versions in XML-like format.
rInfo | a string to populate with library info. |
Definition at line 341 of file ExecutableSupport.cpp.
References ChasteBuildInfo::GetBuilderUnameInfo(), ChasteBuildInfo::GetBuildInformation(), ChasteBuildInfo::GetBuildTime(), ChasteBuildInfo::GetCompilerFlags(), ChasteBuildInfo::GetCompilerType(), ChasteBuildInfo::GetCompilerVersion(), ChasteBuildInfo::GetVersionString(), ChasteBuildInfo::GetXsdVersion(), ChasteBuildInfo::IsWorkingCopyModified(), and ChasteBuildInfo::rGetProjectVersions().
Referenced by AbstractCellBasedSimulation< ELEMENT_DIM, SPACE_DIM >::OutputSimulationSetup(), and WriteProvenanceInfoFile().
|
static |
Initialise PETSc from the command line arguments.
pArgc | pointer to the number of arguments |
pArgv | pointer to the argument list |
Definition at line 107 of file ExecutableSupport.cpp.
References RelativeTo::ChasteTestOutput, CommandLineArguments::Instance(), FileFinder::IsPathSet(), mOutputDirectory, CommandLineArguments::p_argc, CommandLineArguments::p_argv, and FileFinder::SetPath().
Referenced by StandardStartup().
|
static |
Display an informative message to the user, on stdout. Message is only displayed by master process
rMessage | the message to display |
Definition at line 440 of file ExecutableSupport.cpp.
References PetscTools::AmMaster().
|
static |
Display an error message to the user, on stderr.
rMessage | the message to display |
masterOnly | whether only the master process should display the error |
Definition at line 418 of file ExecutableSupport.cpp.
References PetscTools::AmMaster(), RelativeTo::ChasteTestOutput, PetscTools::GetMyRank(), FileFinder::IsPathSet(), mOutputDirectory, OutputFileHandler::OpenOutputFile(), and FileFinder::SetPath().
|
static |
Set the directory to which the files created by WriteMachineInfoFile, and WriteProvenanceInfoFile will be written. By default they will write to the CHASTE_TEST_OUTPUT folder.
rOutputDirectory | the directory to write to |
Definition at line 95 of file ExecutableSupport.cpp.
References RelativeTo::Absolute, RelativeTo::ChasteTestOutput, FileFinder::IsAbsolutePath(), mOutputDirectory, and FileFinder::SetPath().
Referenced by CardiacSimulation::CardiacSimulation(), and AbstractCellBasedSimulation< ELEMENT_DIM, SPACE_DIM >::OutputSimulationSetup().
|
static |
Display Chaste's copyright information.
Definition at line 124 of file ExecutableSupport.cpp.
References PetscTools::AmMaster(), ChasteBuildInfo::GetBuilderUnameInfo(), ChasteBuildInfo::GetBuildInformation(), ChasteBuildInfo::GetBuildTime(), ChasteBuildInfo::GetLicenceText(), and ChasteBuildInfo::GetRevisionNumber().
Referenced by StandardStartup().
|
static |
Output extra diagnostics when Chaste is launched in parallel.
Definition at line 142 of file ExecutableSupport.cpp.
References PetscTools::BeginRoundRobin(), PetscTools::EndRoundRobin(), PetscTools::GetMyRank(), PetscTools::GetNumProcs(), and PetscTools::IsParallel().
Referenced by StandardStartup().
|
static |
Call InitializePetsc, ShowCopyright, then ShowParallelLaunching.
pArgc | pointer to the number of arguments |
pArgv | pointer to the argument list |
Definition at line 411 of file ExecutableSupport.cpp.
References InitializePetsc(), ShowCopyright(), and ShowParallelLaunching().
|
static |
Write to log files information about the machine that ran the code. Each process will output its own file.
fileBaseName | base name of the file to write to |
Definition at line 154 of file ExecutableSupport.cpp.
References RelativeTo::ChasteTestOutput, PetscTools::GetMyRank(), PetscTools::GetNumProcs(), FileFinder::IsPathSet(), mOutputDirectory, OutputFileHandler::OpenOutputFile(), and FileFinder::SetPath().
Referenced by CardiacSimulation::CardiacSimulation(), and AbstractCellBasedSimulation< ELEMENT_DIM, SPACE_DIM >::OutputSimulationSetup().
|
static |
Write to log files provenance information about this executable. Each process will output its own file, named provenance_info.n.txt.
Definition at line 315 of file ExecutableSupport.cpp.
References RelativeTo::ChasteTestOutput, ChasteBuildInfo::GetBuilderUnameInfo(), GetBuildInfo(), ChasteBuildInfo::GetBuildInformation(), ChasteBuildInfo::GetBuildTime(), PetscTools::GetMyRank(), ChasteBuildInfo::GetRevisionNumber(), FileFinder::IsPathSet(), mOutputDirectory, OutputFileHandler::OpenOutputFile(), and FileFinder::SetPath().
Referenced by CardiacSimulation::CardiacSimulation().
|
static |
Standard exit codes for executables to return from main(): bad arguments passed on command line.
Definition at line 146 of file ExecutableSupport.hpp.
|
static |
Standard exit codes for executables to return from main(): exception thrown during execution.
Definition at line 140 of file ExecutableSupport.hpp.
|
static |
Standard exit codes for executables to return from main(): successful termination.
Definition at line 134 of file ExecutableSupport.hpp.
|
staticprivate |
The output directory to put machine provenance information into.
Definition at line 150 of file ExecutableSupport.hpp.
Referenced by InitializePetsc(), PrintError(), SetOutputDirectory(), WriteMachineInfoFile(), and WriteProvenanceInfoFile().