Chi-Tech
|
All global entities for the ChiTech library are contained within the static chi
class. This class has the name chi
and an instance of it cannot be created. Within this class, all of its members are statically declared. Several singleton objects are defined in chi
, they are:
A number of stacks are also declared. They are basically arrays of shared pointers (i.e., std::shared_ptr
)
There are also a number of secondary global variables that assist developers with coding. They are:
chi::run_time::input_file_name
Holds the input file name if supplied.chi::run_time::termination_posted
A flag used during interactive mode.chi::run_time::sim_option_interactive
A flag indicating whether the code is run in interactive mode.chi::run_time::allow_petsc_error_handler
A flag indicating whether the allow the native PETSC error handler.The stack items stored within chi
can be accessed either by reference or as a std::shared_ptr
. The two functions that facilitate this are as follows:
There are multiple stacks, currently (which might not be still accurate):
General MPI information like the current location id and the total amount of parallel processes is contained in CHI_MPI:
Additionally, by including the headers for chi_mpi, developers have access to all the classic mpi headers.
Printing information in a parallel environment can be a very involved process. One can't simply use std::cout <<
on every process otherwise the output to the log will be chaotic. For this reason we employ a common logging utility which returns an output string-stream using the function call ChiLog::Log.
Connecting to chi::log is done as follows
The logger has calls of differing verbosity:
chi_objects::ChiLog::Log0()
, Used only for location 0chi_objects::ChiLog::Log0Warning()
, Warning only for location 0chi_objects::ChiLog::Log0Error()
, Error only for location 0chi_objects::ChiLog::Log0Verbose0()
, Default verbosity levelchi_objects::ChiLog::Log0Verbose1()
, Used only if verbosity level equals 1chi_objects::ChiLog::Log0Verbose2()
, Used only if verbosity level equals 2chi_objects::ChiLog::LogAll()
, Verbose level 0 all locationschi_objects::ChiLog::LogAllWarning()
, Warning for any locationchi_objects::ChiLog::LogAllError()
, Error for any locationchi_objects::ChiLog::LogAllVerbose0()
, Default verbosity levelchi_objects::ChiLog::LogAllVerbose1()
, Used only if verbosity level equals 1chi_objects::ChiLog::LogAllVerbose2()
, Used only if verbosity level equals 2