25 #include <boost/program_options.hpp>
27 #include <queso/EnvironmentOptions.h>
28 #include <queso/Miscellaneous.h>
30 #include <queso/asserts.h>
56 m_debugParams(m_numDebugParams,0.),
58 m_option_help(m_prefix +
"help"),
59 m_option_numSubEnvironments(m_prefix +
"numSubEnvironments"),
60 m_option_subDisplayFileName(m_prefix +
"subDisplayFileName"),
61 m_option_subDisplayAllowAll(m_prefix +
"subDisplayAllowAll"),
62 m_option_subDisplayAllowInter0(m_prefix +
"subDisplayAllowInter0"),
63 m_option_subDisplayAllowedSet(m_prefix +
"subDisplayAllowedSet"),
64 m_option_displayVerbosity(m_prefix +
"displayVerbosity"),
65 m_option_syncVerbosity(m_prefix +
"syncVerbosity"),
66 m_option_checkingLevel(m_prefix +
"checkingLevel"),
67 m_option_rngType(m_prefix +
"rngType"),
68 m_option_seed(m_prefix +
"seed"),
69 m_option_platformName(m_prefix +
"platformName"),
70 m_option_identifyingString(m_prefix +
"identifyingString")
77 m_prefix((std::string) +
"env_"),
92 m_debugParams(m_numDebugParams,0.),
94 m_option_help(m_prefix +
"help"),
95 m_option_numSubEnvironments(m_prefix +
"numSubEnvironments"),
96 m_option_subDisplayFileName(m_prefix +
"subDisplayFileName"),
97 m_option_subDisplayAllowAll(m_prefix +
"subDisplayAllowAll"),
98 m_option_subDisplayAllowInter0(m_prefix +
"subDisplayAllowInter0"),
99 m_option_subDisplayAllowedSet(m_prefix +
"subDisplayAllowedSet"),
100 m_option_displayVerbosity(m_prefix +
"displayVerbosity"),
101 m_option_syncVerbosity(m_prefix +
"syncVerbosity"),
102 m_option_checkingLevel(m_prefix +
"checkingLevel"),
103 m_option_rngType(m_prefix +
"rngType"),
104 m_option_seed(m_prefix +
"seed"),
105 m_option_platformName(m_prefix +
"platformName"),
106 m_option_identifyingString(m_prefix +
"identifyingString")
204 os << (*(obj.
m_parser)) << std::endl;
238 m_prefix ((std::string)(prefix) +
"env_"),
239 m_optionsDesc (new boost::program_options::options_description(
"Environment options")),
240 m_option_help (m_prefix +
"help" ),
241 m_option_numSubEnvironments (m_prefix +
"numSubEnvironments" ),
242 m_option_subDisplayFileName (m_prefix +
"subDisplayFileName" ),
243 m_option_subDisplayAllowAll (m_prefix +
"subDisplayAllowAll" ),
244 m_option_subDisplayAllowInter0(m_prefix +
"subDisplayAllowInter0"),
245 m_option_subDisplayAllowedSet (m_prefix +
"subDisplayAllowedSet" ),
246 m_option_displayVerbosity (m_prefix +
"displayVerbosity" ),
247 m_option_syncVerbosity (m_prefix +
"syncVerbosity" ),
248 m_option_checkingLevel (m_prefix +
"checkingLevel" ),
249 m_option_rngType (m_prefix +
"rngType" ),
250 m_option_seed (m_prefix +
"seed" ),
251 m_option_platformName (m_prefix +
"platformName" ),
252 m_option_identifyingString (m_prefix +
"identifyingString" )
263 m_ov (alternativeOptionsValues),
265 m_prefix ((std::string)(prefix) +
"env_"),
266 m_optionsDesc (NULL),
267 m_option_help (m_prefix +
"help" ),
268 m_option_numSubEnvironments (m_prefix +
"numSubEnvironments" ),
269 m_option_subDisplayFileName (m_prefix +
"subDisplayFileName" ),
270 m_option_subDisplayAllowAll (m_prefix +
"subDisplayAllowAll" ),
271 m_option_subDisplayAllowInter0(m_prefix +
"subDisplayAllowInter0"),
272 m_option_subDisplayAllowedSet (m_prefix +
"subDisplayAllowedSet" ),
273 m_option_displayVerbosity (m_prefix +
"displayVerbosity" ),
274 m_option_syncVerbosity (m_prefix +
"syncVerbosity" ),
275 m_option_checkingLevel (m_prefix +
"checkingLevel" ),
276 m_option_rngType (m_prefix +
"rngType" ),
277 m_option_seed (m_prefix +
"seed" ),
278 m_option_platformName (m_prefix +
"platformName" ),
279 m_option_identifyingString (m_prefix +
"identifyingString" )
286 <<
": after setting values of options with prefix '" <<
m_prefix
287 <<
"', state of object is:"
315 std::cout <<
"In EnvironmentOptions::scanOptionsValues()"
316 <<
": after reading values of options with prefix '" <<
m_prefix
317 <<
"', state of object is:"
356 #ifdef QUESO_MEMORY_DEBUGGING
357 std::cout <<
"In EnvOptions::defineMyOptions(), before add_options()" << std::endl;
359 optionsDesc.add_options()
360 (
m_option_help.c_str(),
"produce help message for environment" )
375 #ifdef QUESO_MEMORY_DEBUGGING
376 std::cout <<
"In EnvOptions::defineMyOptions(), after add_options()" << std::endl;
387 #ifdef QUESO_MEMORY_DEBUGGING
388 std::cout <<
"Entering EnvOptions::getMyOptionsValues()" << std::endl;
400 std::cerr <<
"In BaseEnvironment::getMyOptionValues()"
429 std::vector<double> tmpAllow(0,0.);
440 if (tmpAllow.size() > 0) {
441 for (
unsigned int i = 0; i < tmpAllow.size(); ++i) {
479 #ifdef QUESO_MEMORY_DEBUGGING
480 std::cout <<
"Leaving EnvOptions::getMyOptionsValues()" << std::endl;
#define UQ_ENV_SUB_DISPLAY_FILE_NAME_ODV
unsigned int displayVerbosity() const
#define UQ_ENV_NUM_SUB_ENVIRONMENTS_ODV
#define UQ_ENV_SUB_DISPLAY_ALLOW_ALL_ODV
std::string m_option_rngType
Input file option name for m_rngType.
std::string m_option_subDisplayAllowInter0
Input file option name for m_subDisplayAllowInter0.
boost::program_options::options_description * m_optionsDesc
Environment options description.
void defineMyOptions(boost::program_options::options_description &optionsDesc) const
Define my environment options as the default options.
std::string m_option_seed
Input file option name for m_seed.
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_option_help
Input file option name for flagging helpful printing output.
std::string m_option_subDisplayFileName
Input file option name for m_subDisplayFileName.
#define UQ_ENV_RNG_TYPE_ODV
void scanOptionsValues()
Scans option values from input file.
virtual ~EnvOptionsValues()
Destructor.
int NumProc() const
Returns total number of processes.
std::string m_option_subDisplayFileName
My output filename for sub-screen writing.
int fullRank() const
Returns the process full rank.
#define UQ_ENV_CHECKING_LEVEL_ODV
unsigned int m_checkingLevel
Checking level.
#define queso_require_not_equal_to_msg(expr1, expr2, msg)
~EnvironmentOptions()
Destructor.
#define UQ_ENV_PLATFORM_NAME_ODV
int m_seed
Seed of the random number generator.
std::string m_option_identifyingString
Identifying string.
const MpiComm & fullComm() const
Access function for MpiComm full communicator.
std::ostream & operator<<(std::ostream &os, const BaseEnvironment &obj)
This class provides a suite options one can pass to a QUESO environment.
unsigned int m_syncVerbosity
Synchronized verbosity.
void getMyOptionValues(boost::program_options::options_description &optionsDesc)
Gets the option values of the environment.
unsigned int m_displayVerbosity
Verbosity.
boost::program_options::variables_map & allOptionsMap() const
std::string m_option_identifyingString
Input file option name for m_identifyingString.
std::string m_subDisplayFileName
Output filename for sub-screen writing.
std::string m_option_platformName
Input file option name for m_platformName.
unsigned int m_numSubEnvironments
std::string m_option_subDisplayAllowedSet
Sub-environments that will write to output.
#define UQ_ENV_SUB_DISPLAY_ALLOWED_SET_ODV
std::string m_option_displayVerbosity
Input file option name for m_displayVerbosity.
#define queso_require_equal_to_msg(expr1, expr2, msg)
#define UQ_ENV_SUB_DISPLAY_ALLOW_INTER0_ODV
std::string m_option_rngType
Type of the random number generator.
#define UQ_ENV_NUM_DEBUG_PARAMS_ODV
std::string optionsInputFileName() const
Access to the attribute m_optionsInputFileName, which stores the name of the input file passed by the...
void scanInputFile()
This is the method that parses the input file.
std::string m_option_subDisplayAllowAll
Allows (or not) all sub-environments to write to output file.
EnvOptionsValues & operator=(const EnvOptionsValues &rhs)
Operator for copying the options of an environment.
std::string m_option_syncVerbosity
Input file option name for m_syncVerbosity.
#define queso_require_msg(asserted, msg)
#define UQ_ENV_DISPLAY_VERBOSITY_ODV
std::ofstream * subDisplayFile() const
Access function for m_subDisplayFile (displays file on stream).
#define UQ_ENV_SYNC_VERBOSITY_ODV
unsigned int m_numDebugParams
Number of debug parameters. Unused?
std::string m_option_help
This (virtual) class sets up the environment underlying the use of the QUESO library by an executable...
void copy(const EnvOptionsValues &src)
Makes an exact copy of an existing EnvOptionsValues instance.
std::string m_option_subDisplayAllowInter0
Allows (or not) all inter0 nodes to write to output file.
bool m_subDisplayAllowAll
Allows (or not) all sub-environments to write to output file.
BoostInputOptionsParser * m_parser
EnvOptionsValues m_ov
Instance of EnvOptionsValues, a class with default values for QUESO environment.
std::set< unsigned int > m_subDisplayAllowedSet
Sub-environments that will write to output.
std::string m_option_syncVerbosity
Synchronized verbosity.
std::string m_option_numSubEnvironments
My number of sub-environments.
std::string m_option_checkingLevel
Checking level.
void registerOption(std::string name, T defaultValue, std::string description)
Call this to register an option with the parser.
std::string m_option_subDisplayAllowAll
Input file option name for m_subDisplayAllowAll.
This class reads options one can pass to a QUESO environment through an input file.
void MiscReadDoublesFromString(const std::string &inputString, std::vector< double > &outputDoubles)
std::vector< double > m_debugParams
Debug parameters. Unused?
#define queso_deprecated()
std::string m_option_subDisplayAllowedSet
Input file option name for m_subDisplayAllowedSet.
EnvOptionsValues()
Default constructor.
std::string m_rngType
Type of the random number generator.
std::string m_prefix
Options prefix.
std::string m_platformName
Platform name.
std::string m_identifyingString
Identifying string.
std::string m_option_platformName
Platform name.
std::string m_option_checkingLevel
Input file option name for m_checkingLevel.
std::string m_option_seed
Seed of the random number generator.
bool m_subDisplayAllowInter0
Allows (or not) all inter0 nodes to write to output file.
#define UQ_ENV_IDENTIFYING_STRING_ODV
void getOption(std::string &name, T &value)
Get option name from the parser and set value to the parsed value.
void checkOptions()
Sorts out any inter-option conflicts.
const BaseEnvironment & m_env
Environment.
EnvironmentOptions(const BaseEnvironment &env, const char *prefix)
Default constructor.
std::string m_option_numSubEnvironments
Input file option name for m_numSubEnvironments.
std::string m_option_displayVerbosity
Verbosity.
void print(std::ostream &os) const
Print values of the options chosen.