ExecutableSupport Class Reference

#include <ExecutableSupport.hpp>

Collaboration diagram for ExecutableSupport:

Collaboration graph
[legend]

List of all members.

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 WriteLibraryInfo (out_stream &outFile)
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 std::string mOutputDirectory


Detailed Description

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 43 of file ExecutableSupport.hpp.


Member Function Documentation

void ExecutableSupport::InitializePetsc ( int *  pArgc,
char ***  pArgv 
) [static]

Initialise PETSc from the command line arguments.

Parameters:
pArgc pointer to the number of arguments
pArgv pointer to the argument list

Definition at line 61 of file ExecutableSupport.cpp.

References CommandLineArguments::Instance(), CommandLineArguments::p_argc, and CommandLineArguments::p_argv.

Referenced by StandardStartup().

void ExecutableSupport::ShowCopyright (  )  [static]

void ExecutableSupport::ShowParallelLaunching (  )  [static]

Output extra diagnostics when Chaste is launched in parallel.

Information to show that Chaste is being run in parallel

Definition at line 101 of file ExecutableSupport.cpp.

References PetscTools::BeginRoundRobin(), PetscTools::EndRoundRobin(), PetscTools::GetMyRank(), PetscTools::GetNumProcs(), and PetscTools::IsParallel().

Referenced by StandardStartup().

void ExecutableSupport::SetOutputDirectory ( const std::string &  rOutputDirectory  )  [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.

Parameters:
rOutputDirectory the directory to write to

Definition at line 56 of file ExecutableSupport.cpp.

References mOutputDirectory.

Referenced by CardiacSimulation::CardiacSimulation().

void ExecutableSupport::WriteMachineInfoFile ( std::string  fileBaseName  )  [static]

Write to log files information about the machine that ran the code. Each process will output its own file.

Parameters:
fileBaseName base name of the file to write to

Definition at line 113 of file ExecutableSupport.cpp.

References PetscTools::GetMyRank(), PetscTools::GetNumProcs(), mOutputDirectory, and OutputFileHandler::OpenOutputFile().

Referenced by CardiacSimulation::CardiacSimulation(), and CellBasedSimulation< DIM >::OutputSimulationSetup().

void ExecutableSupport::WriteProvenanceInfoFile (  )  [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 160 of file ExecutableSupport.cpp.

References ChasteBuildInfo::GetBuilderUnameInfo(), ChasteBuildInfo::GetBuildInformation(), ChasteBuildInfo::GetBuildTime(), PetscTools::GetMyRank(), ChasteBuildInfo::GetRevisionNumber(), mOutputDirectory, OutputFileHandler::OpenOutputFile(), and WriteLibraryInfo().

Referenced by CardiacSimulation::CardiacSimulation().

void ExecutableSupport::WriteLibraryInfo ( out_stream &  outFile  )  [static]

void ExecutableSupport::StandardStartup ( int *  pArgc,
char ***  pArgv 
) [static]

Call InitializePetsc, ShowCopyright, then ShowParallelLaunching.

Parameters:
pArgc pointer to the number of arguments
pArgv pointer to the argument list

Definition at line 233 of file ExecutableSupport.cpp.

References InitializePetsc(), ShowCopyright(), and ShowParallelLaunching().

void ExecutableSupport::PrintError ( const std::string &  rMessage,
bool  masterOnly = false 
) [static]

Display an error message to the user, on stderr.

Parameters:
rMessage the message to display
masterOnly whether only the master process should display the error

Definition at line 240 of file ExecutableSupport.cpp.

References PetscTools::AmMaster(), PetscTools::GetMyRank(), mOutputDirectory, and OutputFileHandler::OpenOutputFile().

void ExecutableSupport::Print ( const std::string &  rMessage  )  [static]

Display an informative message to the user, on stdout. Message is only displayed by master process

Parameters:
rMessage the message to display

Definition at line 255 of file ExecutableSupport.cpp.

References PetscTools::AmMaster().

void ExecutableSupport::FinalizePetsc (  )  [static]

Shut down PETSc so we exit cleanly.

Definition at line 264 of file ExecutableSupport.cpp.


Member Data Documentation

const int ExecutableSupport::EXIT_OK = 0 [static]

Standard exit codes for executables to return from main(): successful termination.

Definition at line 127 of file ExecutableSupport.hpp.

const int ExecutableSupport::EXIT_ERROR = 1 [static]

Standard exit codes for executables to return from main(): exception thrown during execution.

Definition at line 133 of file ExecutableSupport.hpp.

const int ExecutableSupport::EXIT_BAD_ARGUMENTS = 2 [static]

Standard exit codes for executables to return from main(): bad arguments passed on command line.

Definition at line 139 of file ExecutableSupport.hpp.

std::string ExecutableSupport::mOutputDirectory [static, private]

The output directory to put machine provenance information into

Definition at line 143 of file ExecutableSupport.hpp.

Referenced by PrintError(), SetOutputDirectory(), WriteMachineInfoFile(), and WriteProvenanceInfoFile().


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

Generated on Tue May 31 14:33:23 2011 for Chaste by  doxygen 1.5.5