Documentation
This helper singleton class simplifies initialization of MPQC.
An object of this type is created on every process of the default MADWorld World by calling mpqc::initialize() and can be accessed for additional customization via mpqc::MPQCInit::instance(). The object is destroyed by calling mpqc::finalize() .
- Note
- this object is meant to be manipulated by 1 (usually, main) thread.
Public Types | |
using | InputFormat = KeyVal::InputFormat |
Public Member Functions | |
~MPQCInit () | |
const int & | argc () const |
char ** | argv () const |
std::shared_ptr< const GetLongOpt > | opt () const |
bool | initialized_ta () const |
InputFormat | input_format () const |
std::shared_ptr< mpqc::KeyVal > | make_keyval (madness::World &world, const std::string &filename) |
void | init_io (const std::string &input_filename, const std::string &output_filename="") |
Initialize formatted I/O (i.e., the FormIO class ). More... | |
MPQCInit (int &argc, char **argv, std::shared_ptr< GetLongOpt > opt, madness::World &world, bool initialized_ta, singleton_ctor_tag) | |
Static Public Member Functions | |
static MPQCInit & | instance () |
Member Typedef Documentation
◆ InputFormat
Constructor & Destructor Documentation
◆ ~MPQCInit()
mpqc::MPQCInit::~MPQCInit | ( | ) |
◆ MPQCInit()
mpqc::MPQCInit::MPQCInit | ( | int & | argc, |
char ** | argv, | ||
std::shared_ptr< GetLongOpt > | opt, | ||
madness::World & | world, | ||
bool | initialized_ta, | ||
singleton_ctor_tag | |||
) |
Create the initializer. Only one object of this time can be created. Needed options will be enrolled in the opt object. The parse member of opt must be called after this constructor completes, but before any of the other members of MPQCInit are called.
- Note
- This is not explicitly implemented as a Singleton for syntactic reasons.
- Warning
- TiledArray's sparse shape threshold is set to double-precision epsilon, and restored when this is destructed
- Parameters
-
[in] argc the argc parameter passed to main [in] argv the argv parameter passed to main [in] opt the GetLongOpt object [in] world the top World object in which MPQC will execute [in] initialized_ta reports whether TA was initialized by MPQC or not [in] singleton_ctor_tag controls access to this constructor
Member Function Documentation
◆ argc()
|
inline |
- Returns
- the command-line argument count
◆ argv()
|
inline |
- Returns
- the command-line arguments
◆ init_io()
void mpqc::MPQCInit::init_io | ( | const std::string & | input_filename, |
const std::string & | output_filename = "" |
||
) |
Initialize formatted I/O (i.e., the FormIO class ).
This initializes C and standard C++ I/O to use en_US.UTF-8
locale, For standard C++ I/O streams this also sets the default precision to the max necessary for double values , configures indentation width to 2 , and configures ExEnv::out0() and ExEnv::err0() to return printing streams on rank 0 only. This also configures static data of the FormIO class, namely the values returned by FormIO::default_basename() , FormIO::default_work_dir() , and FormIO::default_file_prefix() (see the FormIO documentation for the defaults returned by those functions ).
- Note
- This is a collective operation with respect to the World object returned by mpqc::get_default_world() .
- C and C++ I/O is left syncronized, so it should be safe to use C I/O .
- Parameters
-
[in] world the top World object in which MPQC will execute [in] input_filename the input file name [in] output_filename the output file name; the default is empty
- See also
- FormIO
- Exceptions
-
FileOperationFailed if file input_filename
does not exist.
◆ initialized_ta()
|
inline |
- Returns
- true if TA was initialized by mpqc::initialize()
◆ input_format()
|
inline |
- Returns
- an InputFormat value that indicated which format the input was given in
◆ instance()
|
static |
- Returns
- the reference to the only instance of this object
- Exceptions
-
mpqc::ProgrammingError if mpqc::initialize() had not been called
◆ make_keyval()
std::shared_ptr< mpqc::KeyVal > mpqc::MPQCInit::make_keyval | ( | madness::World & | world, |
const std::string & | filename | ||
) |
Creates the KeyVal object from the contents of file filename
. This is a collective operation: the file will be read by one of the processes in world
and broadcast to every other process.
- Parameters
-
[in] world the madness::World object [in] filename the name of the file to be read
- Returns
- the shared_ptr to the KeyVal object
- Note
- Must be called on every process in
world
- Exceptions
-
InputError if file format not recognized (see mpqc::KeyVal for more information on the recognized formats)
◆ opt()
|
inline |
- Returns
- the command-line options parser
The documentation for this class was generated from the following files:
- bin/mpqc/mpqc_init.h
- bin/mpqc/mpqc_init.cpp