25 #ifndef UQ_ENVIRONMENT_H
26 #define UQ_ENVIRONMENT_H
28 #include <queso/Defines.h>
29 #undef UQ_USES_COMMAND_LINE_OPTIONS
31 #include <queso/MpiComm.h>
32 #include <queso/ScopedPtr.h>
41 #ifndef QUESO_DISABLE_BOOST_PROGRAM_OPTIONS
44 namespace program_options {
45 class options_description;
49 #endif // QUESO_DISABLE_BOOST_PROGRAM_OPTIONS
55 class EnvironmentOptions;
56 class EnvOptionsValues;
76 struct FilePtrSetStruct {
329 unsigned int subId ()
const;
343 #ifndef QUESO_DISABLE_BOOST_PROGRAM_OPTIONS
344 #ifdef UQ_USES_COMMAND_LINE_OPTIONS
345 const boost::program_options::options_description&
allOptionsDesc ()
const;
347 #endif // QUESO_DISABLE_BOOST_PROGRAM_OPTIONS
349 #ifndef QUESO_DISABLE_BOOST_PROGRAM_OPTIONS
350 boost::program_options::variables_map&
allOptionsMap ()
const;
353 #endif // QUESO_DISABLE_BOOST_PROGRAM_OPTIONS
356 #ifndef QUESO_DISABLE_BOOST_PROGRAM_OPTIONS
361 #endif // QUESO_DISABLE_BOOST_PROGRAM_OPTIONS
398 struct timeval timevalBegin () const;
405 bool openOutputFile(
const std::string& fileName,
const std::string& fileType,
406 const std::set<unsigned int>& allowedSubEnvIds,
bool writeOver,
414 bool openInputFile (
const std::string& fileName,
const std::string& fileType,
415 const std::set<unsigned int>& allowedSubEnvIds,
432 const GetPot &
input()
const;
435 virtual void print (std::ostream& os)
const = 0;
449 #ifndef QUESO_DISABLE_BOOST_PROGRAM_OPTIONS
452 #endif // QUESO_DISABLE_BOOST_PROGRAM_OPTIONS
496 void print(std::ostream& os)
const;
522 const std::string& passedOptionsInputFileName,
523 const std::string& prefix,
535 const std::string& prefix,
544 void print (std::ostream& os)
const;
568 #endif // UQ_ENVIRONMENT_H
ScopedPtr< GetPot >::Type m_input
MPI_Comm RawType_MPI_Comm
unsigned int subId() const
Access function to the number of each sub-environment Id: m_subId.
std::unique_ptr< T > Type
bool m_optionsInputFileAccessState
const boost::program_options::options_description & allOptionsDesc() const
std::string platformName() const
Access to the platform name.
bool isThereInputFile() const
//TODO Not implemented? it is called in examples/validationCycle/tests_old/results_5_25/uqTgaEx4.h.
ScopedPtr< MpiComm >::Type m_fullComm
This (virtual) class sets up the environment underlying the use of the QUESO library by an executable...
ScopedPtr< EnvOptionsValues >::Type m_optionsObj
void construct(RawType_MPI_Comm inputComm, const char *prefix)
Named constructor backend for multiple constructor overloads.
TODO: Base class for basic PDFs (via either GSL or Boost).
boost::program_options::variables_map & allOptionsMap() const
std::ostream & operator<<(std::ostream &os, const SequenceStatisticalOptions &obj)
void closeFile(FilePtrSetStruct &filePtrSet, const std::string &fileType) const
Closes the file.
const GetPot & input() const
The GetPot input file parser.
const MpiComm & inter0Comm() const
Access function for MpiComm communicator for processes with subRank() 0.
int subRank() const
Returns the rank of the MPI process in the sub-communicator subComm()
~FilePtrSetStruct()
Destructor.
std::string optionsInputFileName() const
Access to the attribute m_optionsInputFileName, which stores the name of the input file passed by the...
bool m_exceptionalCircumstance
const MpiComm & selfComm() const
Access function for MpiComm self-communicator.
This class sets up the full environment underlying the use of the QUESO library by an executable...
const RngBase * rngObject() const
Access to the RNG object.
Class for random number generation (base class for either GSL or Boost RNG).
bool exceptionalCircumstance() const
Decides whether there is an exceptional circumstance.
This class sets up the environment underlying the use of the QUESO library by an executable.
FilePtrSetStruct()
Struct constructor.
unsigned int checkingLevel() const
Access function to private attribute m_checkingLevel.
void resetIdentifyingString(const std::string &newString)
Reset private attribute m_identifyingString with the value newString.
RawType_MPI_Group m_fullGroup
std::string subDisplayFileName() const
Access function for m_subDisplayFileName (displays filename on stream).
RawType_MPI_Group m_subGroup
ScopedPtr< RngBase >::Type m_rngObject
int worldRank() const
Returns the same thing as fullRank()
void setExceptionalCircumstance(bool value) const
Set an exceptional circumstance.
void checkTheParallelEnvironment() const
int fullRank() const
Returns the rank of the MPI process in QUESO's full communicator.
bool openInputFile(const std::string &fileName, const std::string &fileType, const std::set< unsigned int > &allowedSubEnvIds, FilePtrSetStruct &filePtrSet) const
Opens an input file.
ScopedPtr< boost::program_options::variables_map >::Type m_allOptionsMap
BaseEnvironment(const char *passedOptionsInputFileName, EnvOptionsValues *alternativeOptionsValues)
Default constructor.
RawType_MPI_Group subGroup() const
Access function for sub-group.
bool openUnifiedInputFile(const std::string &fileName, const std::string &fileType, FilePtrSetStruct &filePtrSet) const
Opens the unified input file.
ScopedPtr< boost::program_options::options_description >::Type m_allOptionsDesc
unsigned int syncVerbosity() const
Access function to private attribute m_syncVerbosity.
const MpiComm & subComm() const
Access function for each sub-environment's communicator.
void queso_terminate_handler()
Function for unhandled exceptions in Queso.
bool openUnifiedOutputFile(const std::string &fileName, const std::string &fileType, bool writeOver, FilePtrSetStruct &filePtrSet) const
Opens a unified output file, that will contain data from all sub-environments.
const BasicPdfsBase * basicPdfs() const
Access to Basic PDFs.
void scanInputFileForMyOptions(const boost::program_options::options_description &optionsDesc) const
This method scans the input file provided by the user to QUESO.
std::string m_subIdString
std::ifstream * ifsVar
Provides a stream interface to read data from files.
MPI_Group RawType_MPI_Group
void readOptionsInputFile()
Checks the options input file and reads the options.
std::string m_optionsInputFileName
void QUESO_version_print(std::ostream &os)
std::string identifyingString() const
Access function to private attribute m_identifyingString: identifying string.
This class provides a suite options one can pass to a QUESO environment.
ScopedPtr< MpiComm >::Type m_selfComm
The QUESO MPI Communicator Class.
void resetSeed(int newSeedOption)
Reset RNG seed.
void print(std::ostream &os) const
Sends the environment options to the stream.
ScopedPtr< MpiComm >::Type m_inter0Comm
unsigned int displayVerbosity() const
const std::string & subIdString() const
Access to the attribute m_subIdString; which stores the string for the sub-environment, and it will be used, for instance, to create the output files for each sub-environment.
FullEnvironment(RawType_MPI_Comm inputComm, const char *passedOptionsInputFileName, const char *prefix, EnvOptionsValues *alternativeOptionsValues)
Parallel constructor.
std::ofstream * ofsVar
Provides a stream interface to write data to files.
virtual void print(std::ostream &os) const =0
int QUESO_get_numeric_version()
virtual ~BaseEnvironment()
Destructor.
~FullEnvironment()
Destructor.
const MpiComm & fullComm() const
Access function for the communicator that was passed to QUESO's environment.
Struct for handling data input and output from files.
EmptyEnvironment()
Default constructor. Does nothing.
unsigned int numSubEnvironments() const
Access function to the number of sub-environments.
struct timeval m_timevalBegin
int inter0Rank() const
Returns the process inter0 rank.
~EmptyEnvironment()
Destructor.
void print(std::ostream &os) const
ScopedPtr< MpiComm >::Type m_subComm
void setOptionsInputFileAccessState(bool newState) const
bool fullEnvIsReady() const
Returns whether the full environment class is ready (constructor has successfully been called)...
RawType_MPI_Group m_inter0Group
bool openOutputFile(const std::string &fileName, const std::string &fileType, const std::set< unsigned int > &allowedSubEnvIds, bool writeOver, FilePtrSetStruct &filePtrSet) const
Opens an output file for each sub-environment that was chosen to send data to the file...
ScopedPtr< BasicPdfsBase >::Type m_basicPdfs
std::ofstream * subDisplayFile() const
Access function for m_subDisplayFile (displays file on stream).
int seed() const
Access to the RNG seed.
ScopedPtr< std::ofstream >::Type m_subDisplayFile