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 GetLongOptopt () const
 
bool initialized_ta () const
 
InputFormat input_format () const
 
std::shared_ptr< mpqc::KeyValmake_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 MPQCInitinstance ()
 

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]argcthe argc parameter passed to main
[in]argvthe argv parameter passed to main
[in]optthe GetLongOpt object
[in]worldthe top World object in which MPQC will execute
[in]initialized_tareports whether TA was initialized by MPQC or not
[in]singleton_ctor_tagcontrols access to this constructor

Member Function Documentation

◆ argc()

const int& mpqc::MPQCInit::argc ( ) const
inline
Returns
the command-line argument count

◆ argv()

char** mpqc::MPQCInit::argv ( ) const
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]worldthe top World object in which MPQC will execute
[in]input_filenamethe input file name
[in]output_filenamethe output file name; the default is empty
See also
FormIO
Exceptions
FileOperationFailedif file input_filename does not exist.

◆ initialized_ta()

bool mpqc::MPQCInit::initialized_ta ( ) const
inline
Returns
true if TA was initialized by mpqc::initialize()

◆ input_format()

InputFormat mpqc::MPQCInit::input_format ( ) const
inline
Returns
an InputFormat value that indicated which format the input was given in

◆ instance()

MPQCInit & mpqc::MPQCInit::instance ( )
static
Returns
the reference to the only instance of this object
Exceptions
mpqc::ProgrammingErrorif 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]worldthe madness::World object
[in]filenamethe 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
InputErrorif file format not recognized (see mpqc::KeyVal for more information on the recognized formats)

◆ opt()

std::shared_ptr<const GetLongOpt> mpqc::MPQCInit::opt ( ) const
inline
Returns
the command-line options parser

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