25 #include <queso/Defines.h>
27 #ifndef QUESO_DISABLE_BOOST_PROGRAM_OPTIONS
28 #include <boost/program_options.hpp>
30 #include <queso/getpot.h>
31 #endif // QUESO_DISABLE_BOOST_PROGRAM_OPTIONS
33 #include <queso/EnvironmentOptions.h>
34 #include <queso/Miscellaneous.h>
36 #include <queso/asserts.h>
49 m_numSubEnvironments(UQ_ENV_NUM_SUB_ENVIRONMENTS_ODV),
50 m_subDisplayFileName(UQ_ENV_SUB_DISPLAY_FILE_NAME_ODV),
51 m_subDisplayAllowAll(UQ_ENV_SUB_DISPLAY_ALLOW_ALL_ODV),
52 m_subDisplayAllowInter0(UQ_ENV_SUB_DISPLAY_ALLOW_INTER0_ODV),
54 m_displayVerbosity(UQ_ENV_DISPLAY_VERBOSITY_ODV),
55 m_syncVerbosity(UQ_ENV_SYNC_VERBOSITY_ODV),
56 m_checkingLevel(UQ_ENV_CHECKING_LEVEL_ODV),
57 m_rngType(UQ_ENV_RNG_TYPE_ODV),
58 m_seed(UQ_ENV_SEED_ODV),
59 m_platformName(UQ_ENV_PLATFORM_NAME_ODV),
60 m_identifyingString(UQ_ENV_IDENTIFYING_STRING_ODV),
61 m_numDebugParams(UQ_ENV_NUM_DEBUG_PARAMS_ODV),
62 m_debugParams(m_numDebugParams,0.),
64 #ifndef QUESO_DISABLE_BOOST_PROGRAM_OPTIONS
67 m_option_help(m_prefix +
"help"),
68 m_option_numSubEnvironments(m_prefix +
"numSubEnvironments"),
69 m_option_subDisplayFileName(m_prefix +
"subDisplayFileName"),
70 m_option_subDisplayAllowAll(m_prefix +
"subDisplayAllowAll"),
71 m_option_subDisplayAllowInter0(m_prefix +
"subDisplayAllowInter0"),
72 m_option_subDisplayAllowedSet(m_prefix +
"subDisplayAllowedSet"),
73 m_option_displayVerbosity(m_prefix +
"displayVerbosity"),
74 m_option_syncVerbosity(m_prefix +
"syncVerbosity"),
75 m_option_checkingLevel(m_prefix +
"checkingLevel"),
76 m_option_rngType(m_prefix +
"rngType"),
77 m_option_seed(m_prefix +
"seed"),
78 m_option_platformName(m_prefix +
"platformName"),
79 m_option_identifyingString(m_prefix +
"identifyingString")
86 m_prefix((std::string) +
"env_"),
88 m_numSubEnvironments(UQ_ENV_NUM_SUB_ENVIRONMENTS_ODV),
89 m_subDisplayFileName(UQ_ENV_SUB_DISPLAY_FILE_NAME_ODV),
90 m_subDisplayAllowAll(UQ_ENV_SUB_DISPLAY_ALLOW_ALL_ODV),
91 m_subDisplayAllowInter0(UQ_ENV_SUB_DISPLAY_ALLOW_INTER0_ODV),
93 m_displayVerbosity(UQ_ENV_DISPLAY_VERBOSITY_ODV),
94 m_syncVerbosity(UQ_ENV_SYNC_VERBOSITY_ODV),
95 m_checkingLevel(UQ_ENV_CHECKING_LEVEL_ODV),
96 m_rngType(UQ_ENV_RNG_TYPE_ODV),
97 m_seed(UQ_ENV_SEED_ODV),
98 m_platformName(UQ_ENV_PLATFORM_NAME_ODV),
99 m_identifyingString(UQ_ENV_IDENTIFYING_STRING_ODV),
100 m_numDebugParams(UQ_ENV_NUM_DEBUG_PARAMS_ODV),
101 m_debugParams(m_numDebugParams,0.),
103 #ifndef QUESO_DISABLE_BOOST_PROGRAM_OPTIONS
106 m_option_help(m_prefix +
"help"),
107 m_option_numSubEnvironments(m_prefix +
"numSubEnvironments"),
108 m_option_subDisplayFileName(m_prefix +
"subDisplayFileName"),
109 m_option_subDisplayAllowAll(m_prefix +
"subDisplayAllowAll"),
110 m_option_subDisplayAllowInter0(m_prefix +
"subDisplayAllowInter0"),
111 m_option_subDisplayAllowedSet(m_prefix +
"subDisplayAllowedSet"),
112 m_option_displayVerbosity(m_prefix +
"displayVerbosity"),
113 m_option_syncVerbosity(m_prefix +
"syncVerbosity"),
114 m_option_checkingLevel(m_prefix +
"checkingLevel"),
115 m_option_rngType(m_prefix +
"rngType"),
116 m_option_seed(m_prefix +
"seed"),
117 m_option_platformName(m_prefix +
"platformName"),
118 m_option_identifyingString(m_prefix +
"identifyingString")
120 #ifndef QUESO_DISABLE_BOOST_PROGRAM_OPTIONS
122 m_parser->registerOption<std::string >(
m_option_help, UQ_ENV_HELP,
"produce help message for environment");
160 unsigned int size =
m_env->
input().vector_variable_size(m_option_subDisplayAllowedSet);
161 for (
unsigned int i = 0; i <
size; i++) {
175 #endif // QUESO_DISABLE_BOOST_PROGRAM_OPTIONS
238 #ifndef QUESO_DISABLE_BOOST_PROGRAM_OPTIONS
239 os << (*(obj.
m_parser)) << std::endl;
242 #endif // QUESO_DISABLE_BOOST_PROGRAM_OPTIONS
276 m_prefix ((std::string)(prefix) +
"env_"),
277 #ifndef QUESO_DISABLE_BOOST_PROGRAM_OPTIONS
278 m_optionsDesc (new boost::program_options::options_description(
"Environment options")),
280 m_option_help (m_prefix +
"help" ),
281 m_option_numSubEnvironments (m_prefix +
"numSubEnvironments" ),
282 m_option_subDisplayFileName (m_prefix +
"subDisplayFileName" ),
283 m_option_subDisplayAllowAll (m_prefix +
"subDisplayAllowAll" ),
284 m_option_subDisplayAllowInter0(m_prefix +
"subDisplayAllowInter0"),
285 m_option_subDisplayAllowedSet (m_prefix +
"subDisplayAllowedSet" ),
286 m_option_displayVerbosity (m_prefix +
"displayVerbosity" ),
287 m_option_syncVerbosity (m_prefix +
"syncVerbosity" ),
288 m_option_checkingLevel (m_prefix +
"checkingLevel" ),
289 m_option_rngType (m_prefix +
"rngType" ),
290 m_option_seed (m_prefix +
"seed" ),
291 m_option_platformName (m_prefix +
"platformName" ),
292 m_option_identifyingString (m_prefix +
"identifyingString" )
303 m_ov (alternativeOptionsValues),
305 m_prefix ((std::string)(prefix) +
"env_"),
306 #ifndef QUESO_DISABLE_BOOST_PROGRAM_OPTIONS
309 m_option_help (m_prefix +
"help" ),
310 m_option_numSubEnvironments (m_prefix +
"numSubEnvironments" ),
311 m_option_subDisplayFileName (m_prefix +
"subDisplayFileName" ),
312 m_option_subDisplayAllowAll (m_prefix +
"subDisplayAllowAll" ),
313 m_option_subDisplayAllowInter0(m_prefix +
"subDisplayAllowInter0"),
314 m_option_subDisplayAllowedSet (m_prefix +
"subDisplayAllowedSet" ),
315 m_option_displayVerbosity (m_prefix +
"displayVerbosity" ),
316 m_option_syncVerbosity (m_prefix +
"syncVerbosity" ),
317 m_option_checkingLevel (m_prefix +
"checkingLevel" ),
318 m_option_rngType (m_prefix +
"rngType" ),
319 m_option_seed (m_prefix +
"seed" ),
320 m_option_platformName (m_prefix +
"platformName" ),
321 m_option_identifyingString (m_prefix +
"identifyingString" )
328 <<
": after setting values of options with prefix '" <<
m_prefix
329 <<
"', state of object is:"
345 #ifndef QUESO_DISABLE_BOOST_PROGRAM_OPTIONS
346 queso_require_msg(
m_optionsDesc,
"m_optionsDesc variable is NULL");
347 #endif // QUESO_DISABLE_BOOST_PROGRAM_OPTIONS
349 #ifndef QUESO_DISABLE_BOOST_PROGRAM_OPTIONS
353 #endif // QUESO_DISABLE_BOOST_PROGRAM_OPTIONS
359 std::cout <<
"In EnvironmentOptions::scanOptionsValues()"
360 <<
": after reading values of options with prefix '" <<
m_prefix
361 <<
"', state of object is:"
394 #ifndef QUESO_DISABLE_BOOST_PROGRAM_OPTIONS
401 #ifdef QUESO_MEMORY_DEBUGGING
402 std::cout <<
"In EnvOptions::defineMyOptions(), before add_options()" << std::endl;
404 optionsDesc.add_options()
405 (
m_option_help.c_str(),
"produce help message for environment" )
406 (
m_option_numSubEnvironments.c_str(), boost::program_options::value<unsigned int>()->default_value(UQ_ENV_NUM_SUB_ENVIRONMENTS_ODV),
"number of subEnvironments" )
407 (
m_option_subDisplayFileName.c_str(), boost::program_options::value<std::string >()->default_value(UQ_ENV_SUB_DISPLAY_FILE_NAME_ODV),
"output filename for subscreen writing" )
408 (
m_option_subDisplayAllowAll.c_str(), boost::program_options::value<bool >()->default_value(UQ_ENV_SUB_DISPLAY_ALLOW_ALL_ODV),
"Allow all processors to write to output file" )
409 (
m_option_subDisplayAllowInter0.c_str(), boost::program_options::value<bool >()->default_value(UQ_ENV_SUB_DISPLAY_ALLOW_INTER0_ODV),
"Allow all inter0 nodes to write to output file")
410 (
m_option_subDisplayAllowedSet.c_str(), boost::program_options::value<std::string >()->default_value(UQ_ENV_SUB_DISPLAY_ALLOWED_SET_ODV),
"subEnvs that will write to output file" )
411 (
m_option_displayVerbosity.c_str(), boost::program_options::value<unsigned int>()->default_value(UQ_ENV_DISPLAY_VERBOSITY_ODV),
"set verbosity" )
412 (
m_option_syncVerbosity.c_str(), boost::program_options::value<unsigned int>()->default_value(UQ_ENV_SYNC_VERBOSITY_ODV),
"set sync verbosity" )
413 (
m_option_checkingLevel.c_str(), boost::program_options::value<unsigned int>()->default_value(UQ_ENV_CHECKING_LEVEL_ODV),
"set checking level" )
414 (
m_option_rngType.c_str(), boost::program_options::value<std::string >()->default_value(UQ_ENV_RNG_TYPE_ODV),
"set rngType" )
415 (
m_option_seed.c_str(), boost::program_options::value<int >()->default_value(UQ_ENV_SEED_ODV),
"set seed" )
416 (
m_option_platformName.c_str(), boost::program_options::value<std::string >()->default_value(UQ_ENV_PLATFORM_NAME_ODV),
"platform name" )
417 (
m_option_identifyingString.c_str(), boost::program_options::value<std::string >()->default_value(UQ_ENV_IDENTIFYING_STRING_ODV),
"identifying string" )
420 #ifdef QUESO_MEMORY_DEBUGGING
421 std::cout <<
"In EnvOptions::defineMyOptions(), after add_options()" << std::endl;
432 #ifdef QUESO_MEMORY_DEBUGGING
433 std::cout <<
"Entering EnvOptions::getMyOptionsValues()" << std::endl;
445 std::cerr <<
"In BaseEnvironment::getMyOptionValues()"
474 std::vector<double> tmpAllow(0,0.);
485 if (tmpAllow.size() > 0) {
486 for (
unsigned int i = 0; i < tmpAllow.size(); ++i) {
524 #ifdef QUESO_MEMORY_DEBUGGING
525 std::cout <<
"Leaving EnvOptions::getMyOptionsValues()" << std::endl;
530 #endif // QUESO_DISABLE_BOOST_PROGRAM_OPTIONS
std::string m_option_checkingLevel
Input file option name for m_checkingLevel.
EnvOptionsValues & operator=(const EnvOptionsValues &rhs)
Operator for copying the options of an environment.
bool m_subDisplayAllowAll
Allows (or not) all sub-environments to write to output file.
virtual ~EnvOptionsValues()
Destructor.
bool m_subDisplayAllowInter0
Allows (or not) all inter0 nodes to write to output file.
void print(std::ostream &os) const
Print values of the options chosen.
EnvOptionsValues m_ov
Instance of EnvOptionsValues, a class with default values for QUESO environment.
unsigned int m_checkingLevel
Checking level.
std::string m_option_syncVerbosity
Synchronized verbosity.
unsigned int m_numDebugParams
Number of debug parameters. Unused?
This (virtual) class sets up the environment underlying the use of the QUESO library by an executable...
boost::program_options::variables_map & allOptionsMap() const
std::string m_option_identifyingString
Input file option name for m_identifyingString.
EnvOptionsValues()
Default constructor.
std::ostream & operator<<(std::ostream &os, const SequenceStatisticalOptions &obj)
std::string m_option_numSubEnvironments
My number of sub-environments.
void scanOptionsValues()
Scans option values from input file.
std::string m_option_checkingLevel
Checking level.
std::string m_option_displayVerbosity
Input file option name for m_displayVerbosity.
const GetPot & input() const
The GetPot input file parser.
MonteCarloSGOptions::MonteCarloSGOptions(const BaseEnvironment &env, const char *prefix queso_require_not_equal_to_msg)(m_env.optionsInputFileName(), std::string(""), std::string("this constructor is incompatible with the absence of an options input file"))
ScopedPtr< BoostInputOptionsParser >::Type m_parser
std::string m_option_subDisplayAllowedSet
Input file option name for m_subDisplayAllowedSet.
std::string optionsInputFileName() const
Access to the attribute m_optionsInputFileName, which stores the name of the input file passed by the...
std::string m_option_identifyingString
Identifying string.
std::string m_option_seed
Input file option name for m_seed.
std::string m_option_subDisplayFileName
My output filename for sub-screen writing.
std::string m_prefix
Options prefix.
std::string m_platformName
Platform name.
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.
const BaseEnvironment & m_env
Environment.
std::set< unsigned int > m_subDisplayAllowedSet
Sub-environments that will write to output.
std::string m_option_subDisplayAllowedSet
Sub-environments that will write to output.
int fullRank() const
Returns the rank of the MPI process in QUESO's full communicator.
std::string m_option_platformName
Platform name.
std::string m_option_rngType
Type of the random number generator.
std::string m_option_subDisplayAllowAll
Input file option name for m_subDisplayAllowAll.
std::string m_option_seed
Seed of the random number generator.
void checkOptions()
Sorts out any inter-option conflicts.
EnvironmentOptions(const BaseEnvironment &env, const char *prefix)
Default constructor.
std::string m_option_subDisplayAllowInter0
Input file option name for m_subDisplayAllowInter0.
void defineMyOptions(boost::program_options::options_description &optionsDesc) const
Define my environment options as the default options.
std::string m_option_subDisplayAllowInter0
Allows (or not) all inter0 nodes to write to output file.
void MiscReadDoublesFromString(const std::string &inputString, std::vector< double > &outputDoubles)
unsigned int m_numSubEnvironments
std::string m_rngType
Type of the random number generator.
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
std::string m_identifyingString
Identifying string.
std::string m_option_syncVerbosity
Input file option name for m_syncVerbosity.
~EnvironmentOptions()
Destructor.
MonteCarloSGOptions::MonteCarloSGOptions(const BaseEnvironment &env, const char *prefix, const McOptionsValues &alternativeOptionsValues queso_require_equal_to_msg)(m_env.optionsInputFileName(), std::string(""), std::string("this constructor is incompatible with the existence of an options input file"))
void copy(const EnvOptionsValues &src)
Makes an exact copy of an existing EnvOptionsValues instance.
This class provides a suite options one can pass to a QUESO environment.
ScopedPtr< boost::program_options::options_description >::Type m_optionsDesc
Environment options description.
std::string m_option_numSubEnvironments
Input file option name for m_numSubEnvironments.
const BaseEnvironment * m_env
unsigned int m_displayVerbosity
Verbosity.
int NumProc() const
Returns total number of processes.
void getMyOptionValues(boost::program_options::options_description &optionsDesc)
Gets the option values of the environment.
unsigned int displayVerbosity() const
std::string m_subDisplayFileName
Output filename for sub-screen writing.
std::string m_option_rngType
Input file option name for m_rngType.
int m_seed
Seed of the random number generator.
std::string m_option_platformName
Input file option name for m_platformName.
const MpiComm & fullComm() const
Access function for the communicator that was passed to QUESO's environment.
std::vector< double > m_debugParams
Debug parameters. Unused?
unsigned int m_syncVerbosity
Synchronized verbosity.
std::string m_option_displayVerbosity
Verbosity.
std::string m_option_subDisplayAllowAll
Allows (or not) all sub-environments to write to output file.
This class reads options one can pass to a QUESO environment through an input file.
std::ofstream * subDisplayFile() const
Access function for m_subDisplayFile (displays file on stream).