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>
38 #include <queso/ScopedPtr.h>
39 #include <queso/RngBase.h>
40 #include <queso/BasicPdfsBase.h>
42 #ifndef DISABLE_BOOST_PROGRAM_OPTIONS
45 namespace program_options {
46 class options_description;
50 #endif // DISABLE_BOOST_PROGRAM_OPTIONS
56 class EnvironmentOptions;
57 class EnvOptionsValues;
75 struct FilePtrSetStruct {
256 unsigned int subId ()
const;
270 #ifndef DISABLE_BOOST_PROGRAM_OPTIONS
271 #ifdef UQ_USES_COMMAND_LINE_OPTIONS
272 const boost::program_options::options_description& allOptionsDesc ()
const;
274 #endif // DISABLE_BOOST_PROGRAM_OPTIONS
276 #ifndef DISABLE_BOOST_PROGRAM_OPTIONS
277 boost::program_options::variables_map&
allOptionsMap ()
const;
280 #endif // DISABLE_BOOST_PROGRAM_OPTIONS
283 #ifndef DISABLE_BOOST_PROGRAM_OPTIONS
288 #endif // DISABLE_BOOST_PROGRAM_OPTIONS
325 struct timeval timevalBegin () const;
332 bool openOutputFile(
const std::string& fileName,
const std::string& fileType,
333 const std::set<unsigned int>& allowedSubEnvIds,
bool writeOver,
341 bool openInputFile (
const std::string& fileName,
const std::string& fileType,
342 const std::set<unsigned int>& allowedSubEnvIds,
362 virtual void print (std::ostream& os)
const = 0;
376 #ifndef DISABLE_BOOST_PROGRAM_OPTIONS
379 #endif // DISABLE_BOOST_PROGRAM_OPTIONS
423 void print(std::ostream& os)
const;
449 const std::string& passedOptionsInputFileName,
450 const std::string& prefix,
462 const std::string& prefix,
471 void print (std::ostream& os)
const;
495 #endif // UQ_ENVIRONMENT_H
virtual ~BaseEnvironment()
Destructor.
const RngBase * rngObject() const
Access to the RNG object.
std::string m_optionsInputFileName
EnvOptionsValues * m_optionsObj
struct timeval m_timevalBegin
int worldRank() const
Returns the process world rank.
const GetPot & input() const
The GetPot input file parser.
std::ofstream * subDisplayFile() const
Access function for m_subDisplayFile (displays file on stream).
int subRank() const
Access function for sub-rank.
std::ifstream * ifsVar
Provides a stream interface to read data from files.
std::string optionsInputFileName() const
Access to the attribute m_optionsInputFileName, which stores the name of the input file passed by the...
boost::program_options::variables_map * m_allOptionsMap
This class provides a suite options one can pass to a QUESO environment.
This (virtual) class sets up the environment underlying the use of the QUESO library by an executable...
void resetIdentifyingString(const std::string &newString)
Reset private attribute m_identifyingString with the value newString.
int inter0Rank() const
Returns the process inter0 rank.
std::string subDisplayFileName() const
Access function for m_subDisplayFileName (displays filename on stream).
RawType_MPI_Group m_subGroup
std::ofstream * m_subDisplayFile
std::string platformName() const
Access to the platform name.
EmptyEnvironment()
Default constructor. Does nothing.
bool fullEnvIsReady() const
Returns whether the full environment class is ready (constructor has successfully been called)...
int QUESO_get_numeric_version()
void print(std::ostream &os) const
Sends the environment options to the stream.
bool openInputFile(const std::string &fileName, const std::string &fileType, const std::set< unsigned int > &allowedSubEnvIds, FilePtrSetStruct &filePtrSet) const
Opens an input file.
boost::program_options::variables_map & allOptionsMap() const
std::string m_subIdString
Struct for handling data input and output from files.
boost::program_options::options_description * m_allOptionsDesc
unsigned int subId() const
Access function to the number of each sub-environment Id: m_subId.
unsigned int syncVerbosity() const
Access function to private attribute m_syncVerbosity.
void print(std::ostream &os) const
bool m_optionsInputFileAccessState
bool m_exceptionalCircumstance
std::ostream & operator<<(std::ostream &os, const BaseEnvironment &obj)
std::string identifyingString() const
Access function to private attribute m_identifyingString: identifying string.
void scanInputFileForMyOptions(const boost::program_options::options_description &optionsDesc) const
This method scans the input file provided by the user to QUESO.
Class for random number generation (base class for either GSL or Boost RNG).
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.
void setExceptionalCircumstance(bool value) const
Set an exceptional circumstance.
void checkTheParallelEnvironment() const
void closeFile(FilePtrSetStruct &filePtrSet, const std::string &fileType) const
Closes the file.
int fullRank() const
Returns the process full rank.
void readOptionsInputFile()
Checks the options input file and reads the options.
unsigned int numSubEnvironments() const
Access function to the number of sub-environments.
void queso_terminate_handler()
Function for unhandled exceptions in Queso.
~FilePtrSetStruct()
Destructor.
void QUESO_version_print(std::ostream &os)
std::ofstream * ofsVar
Provides a stream interface to write data to files.
BaseEnvironment(const char *passedOptionsInputFileName, EnvOptionsValues *alternativeOptionsValues)
Default constructor.
RawType_MPI_Group subGroup() const
Access function for sub-group.
bool exceptionalCircumstance() const
Decides whether there is an exceptional circumstance.
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...
void resetSeed(int newSeedOption)
Reset RNG seed.
TODO: Base class for basic PDFs (via either GSL or Boost).
unsigned int checkingLevel() const
Access function to private attribute m_checkingLevel.
int seed() const
Access to the RNG seed.
ScopedPtr< GetPot >::Type m_input
unsigned int displayVerbosity() const
RawType_MPI_Group m_fullGroup
const MpiComm & subComm() const
Access function for MpiComm sub communicator.
virtual void print(std::ostream &os) const =0
const BasicPdfsBase * basicPdfs() const
Access to Basic PDFs.
The QUESO MPI Communicator Class.
~FullEnvironment()
Destructor.
const MpiComm & fullComm() const
Access function for MpiComm full communicator.
~EmptyEnvironment()
Destructor.
This class sets up the environment underlying the use of the QUESO library by an executable.
This class sets up the full environment underlying the use of the QUESO library by an executable...
bool openUnifiedInputFile(const std::string &fileName, const std::string &fileType, FilePtrSetStruct &filePtrSet) const
Opens the unified input file.
void setOptionsInputFileAccessState(bool newState) const
RawType_MPI_Group m_inter0Group
bool isThereInputFile() const
//TODO Not implemented? it is called in examples/validationCycle/tests_old/results_5_25/uqTgaEx4.h.
FullEnvironment(const char *passedOptionsInputFileName, const char *prefix, EnvOptionsValues *alternativeOptionsValues)
Parallel constructor.
FilePtrSetStruct()
Struct constructor.
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.
BasicPdfsBase * m_basicPdfs
const MpiComm & inter0Comm() const
Access function for MpiComm inter0-communicator.
void construct(const char *prefix)
Named constructor backend for multiple constructor overloads.
const MpiComm & selfComm() const
Access function for MpiComm self-communicator.