25 #include <boost/program_options.hpp>
27 #include <queso/MonteCarloSGOptions.h>
28 #include <queso/Miscellaneous.h>
38 #ifdef QUESO_USES_SEQUENCE_STATISTICAL_OPTIONS
39 const SsOptionsValues* alternativePSsOptionsValues,
40 const SsOptionsValues* alternativeQSsOptionsValues
52 #ifdef QUESO_USES_SEQUENCE_STATISTICAL_OPTIONS
64 #ifdef QUESO_USES_SEQUENCE_STATISTICAL_OPTIONS
66 m_alternativePSsOptionsValues(),
67 m_alternativeQSsOptionsValues(),
70 m_option_help (m_prefix +
"help" ),
71 m_option_dataOutputFileName (m_prefix +
"dataOutputFileName" ),
72 m_option_dataOutputAllowedSet (m_prefix +
"dataOutputAllowedSet" ),
73 m_option_pseq_dataOutputPeriod (m_prefix +
"pseq_dataOutputPeriod" ),
74 m_option_pseq_dataOutputFileName (m_prefix +
"pseq_dataOutputFileName" ),
75 m_option_pseq_dataOutputFileType (m_prefix +
"pseq_dataOutputFileType" ),
76 m_option_pseq_dataOutputAllowedSet(m_prefix +
"pseq_dataOutputAllowedSet" ),
77 #ifdef QUESO_USES_SEQUENCE_STATISTICAL_OPTIONS
78 m_option_pseq_computeStats (m_prefix +
"pseq_computeStats" ),
80 m_option_qseq_dataInputFileName (m_prefix +
"qseq_dataInputFileName" ),
81 m_option_qseq_dataInputFileType (m_prefix +
"qseq_dataInputFileType" ),
82 m_option_qseq_size (m_prefix +
"qseq_size" ),
83 m_option_qseq_displayPeriod (m_prefix +
"qseq_displayPeriod" ),
84 m_option_qseq_measureRunTimes (m_prefix +
"qseq_measureRunTimes" ),
85 m_option_qseq_dataOutputPeriod (m_prefix +
"qseq_dataOutputPeriod" ),
86 m_option_qseq_dataOutputFileName (m_prefix +
"qseq_dataOutputFileName" ),
87 m_option_qseq_dataOutputFileType (m_prefix +
"qseq_dataOutputFileType" ),
88 m_option_qseq_dataOutputAllowedSet(m_prefix +
"qseq_dataOutputAllowedSet" )
89 #ifdef QUESO_USES_SEQUENCE_STATISTICAL_OPTIONS
91 m_option_qseq_computeStats (m_prefix +
"qseq_computeStats" )
94 #ifdef QUESO_USES_SEQUENCE_STATISTICAL_OPTIONS
95 if (alternativePSsOptionsValues) m_alternativePSsOptionsValues = *alternativePSsOptionsValues;
96 if (alternativeQSsOptionsValues) m_alternativeQSsOptionsValues = *alternativeQSsOptionsValues;
101 #ifdef QUESO_USES_SEQUENCE_STATISTICAL_OPTIONS
102 const SsOptionsValues* alternativePSsOptionsValues,
103 const SsOptionsValues* alternativeQSsOptionsValues,
108 m_prefix ((std::string)(prefix) +
"mc_"),
116 #ifdef QUESO_USES_SEQUENCE_STATISTICAL_OPTIONS
128 #ifdef QUESO_USES_SEQUENCE_STATISTICAL_OPTIONS
130 m_alternativePSsOptionsValues(),
131 m_alternativeQSsOptionsValues(),
134 m_option_help (m_prefix +
"help" ),
135 m_option_dataOutputFileName (m_prefix +
"dataOutputFileName" ),
136 m_option_dataOutputAllowedSet (m_prefix +
"dataOutputAllowedSet" ),
137 m_option_pseq_dataOutputPeriod (m_prefix +
"pseq_dataOutputPeriod" ),
138 m_option_pseq_dataOutputFileName (m_prefix +
"pseq_dataOutputFileName" ),
139 m_option_pseq_dataOutputFileType (m_prefix +
"pseq_dataOutputFileType" ),
140 m_option_pseq_dataOutputAllowedSet(m_prefix +
"pseq_dataOutputAllowedSet" ),
141 #ifdef QUESO_USES_SEQUENCE_STATISTICAL_OPTIONS
142 m_option_pseq_computeStats (m_prefix +
"pseq_computeStats" ),
144 m_option_qseq_dataInputFileName (m_prefix +
"qseq_dataInputFileName" ),
145 m_option_qseq_dataInputFileType (m_prefix +
"qseq_dataInputFileType" ),
146 m_option_qseq_size (m_prefix +
"qseq_size" ),
147 m_option_qseq_displayPeriod (m_prefix +
"qseq_displayPeriod" ),
148 m_option_qseq_measureRunTimes (m_prefix +
"qseq_measureRunTimes" ),
149 m_option_qseq_dataOutputPeriod (m_prefix +
"qseq_dataOutputPeriod" ),
150 m_option_qseq_dataOutputFileName (m_prefix +
"qseq_dataOutputFileName" ),
151 m_option_qseq_dataOutputFileType (m_prefix +
"qseq_dataOutputFileType" ),
152 m_option_qseq_dataOutputAllowedSet(m_prefix +
"qseq_dataOutputAllowedSet" )
153 #ifdef QUESO_USES_SEQUENCE_STATISTICAL_OPTIONS
155 m_option_qseq_computeStats (m_prefix +
"qseq_computeStats" )
158 #ifdef QUESO_USES_SEQUENCE_STATISTICAL_OPTIONS
159 if (alternativePSsOptionsValues) m_alternativePSsOptionsValues = *alternativePSsOptionsValues;
160 if (alternativeQSsOptionsValues) m_alternativeQSsOptionsValues = *alternativeQSsOptionsValues;
170 #ifdef QUESO_USES_SEQUENCE_STATISTICAL_OPTIONS
182 #ifdef QUESO_USES_SEQUENCE_STATISTICAL_OPTIONS
195 #ifdef QUESO_USES_SEQUENCE_STATISTICAL_OPTIONS
207 #ifdef QUESO_USES_SEQUENCE_STATISTICAL_OPTIONS
244 #ifdef QUESO_USES_SEQUENCE_STATISTICAL_OPTIONS
245 m_pseqComputeStats = src.m_pseqComputeStats;
256 #ifdef QUESO_USES_SEQUENCE_STATISTICAL_OPTIONS
257 m_qseqComputeStats = src.m_qseqComputeStats;
260 #ifdef QUESO_USES_SEQUENCE_STATISTICAL_OPTIONS
261 m_alternativePSsOptionsValues = src.m_alternativePSsOptionsValues;
262 m_alternativeQSsOptionsValues = src.m_alternativeQSsOptionsValues;
270 os << (*(obj.
m_parser)) << std::endl;
285 #ifdef QUESO_USES_SEQUENCE_STATISTICAL_OPTIONS
286 <<
"\n" << obj.m_option_pseq_computeStats <<
" = " << obj.m_pseqComputeStats
300 #ifdef QUESO_USES_SEQUENCE_STATISTICAL_OPTIONS
301 os <<
"\n" << obj.m_option_qseq_computeStats <<
" = " << obj.m_qseqComputeStats;
316 #ifdef QUESO_USES_SEQUENCE_STATISTICAL_OPTIONS
318 m_pseqStatisticalOptionsObj (NULL),
319 m_qseqStatisticalOptionsObj (NULL),
323 m_prefix ((std::string)(prefix) +
"mc_"),
325 m_optionsDesc (new boost::program_options::options_description(
"Monte Carlo options")),
326 m_option_help (m_prefix +
"help" ),
327 m_option_dataOutputFileName (m_prefix +
"dataOutputFileName" ),
328 m_option_dataOutputAllowedSet (m_prefix +
"dataOutputAllowedSet" ),
329 m_option_pseq_dataOutputPeriod (m_prefix +
"pseq_dataOutputPeriod" ),
330 m_option_pseq_dataOutputFileName (m_prefix +
"pseq_dataOutputFileName" ),
331 m_option_pseq_dataOutputFileType (m_prefix +
"pseq_dataOutputFileType" ),
332 m_option_pseq_dataOutputAllowedSet(m_prefix +
"pseq_dataOutputAllowedSet" ),
333 #ifdef QUESO_USES_SEQUENCE_STATISTICAL_OPTIONS
334 m_option_pseq_computeStats (m_prefix +
"pseq_computeStats" ),
336 m_option_qseq_dataInputFileName (m_prefix +
"qseq_dataInputFileName" ),
337 m_option_qseq_dataInputFileType (m_prefix +
"qseq_dataInputFileType" ),
338 m_option_qseq_size (m_prefix +
"qseq_size" ),
339 m_option_qseq_displayPeriod (m_prefix +
"qseq_displayPeriod" ),
340 m_option_qseq_measureRunTimes (m_prefix +
"qseq_measureRunTimes" ),
341 m_option_qseq_dataOutputPeriod (m_prefix +
"qseq_dataOutputPeriod" ),
342 m_option_qseq_dataOutputFileName (m_prefix +
"qseq_dataOutputFileName" ),
343 m_option_qseq_dataOutputFileType (m_prefix +
"qseq_dataOutputFileType" ),
344 m_option_qseq_dataOutputAllowedSet(m_prefix +
"qseq_dataOutputAllowedSet" )
345 #ifdef QUESO_USES_SEQUENCE_STATISTICAL_OPTIONS
347 m_option_qseq_computeStats (m_prefix +
"qseq_computeStats" )
359 m_ov (alternativeOptionsValues),
360 #ifdef QUESO_USES_SEQUENCE_STATISTICAL_OPTIONS
361 m_pseqStatisticalOptionsObj (NULL),
362 m_qseqStatisticalOptionsObj (NULL),
364 m_prefix ((std::string)(prefix) +
"mc_"),
366 m_optionsDesc (NULL),
367 m_option_help (m_prefix +
"help" ),
368 m_option_dataOutputFileName (m_prefix +
"dataOutputFileName" ),
369 m_option_dataOutputAllowedSet (m_prefix +
"dataOutputAllowedSet" ),
370 m_option_pseq_dataOutputPeriod (m_prefix +
"pseq_dataOutputPeriod" ),
371 m_option_pseq_dataOutputFileName (m_prefix +
"pseq_dataOutputFileName" ),
372 m_option_pseq_dataOutputFileType (m_prefix +
"pseq_dataOutputFileType" ),
373 m_option_pseq_dataOutputAllowedSet(m_prefix +
"pseq_dataOutputAllowedSet"),
374 #ifdef QUESO_USES_SEQUENCE_STATISTICAL_OPTIONS
375 m_option_pseq_computeStats (m_prefix +
"pseq_computeStats" ),
377 m_option_qseq_dataInputFileName (m_prefix +
"qseq_dataInputFileName" ),
378 m_option_qseq_dataInputFileType (m_prefix +
"qseq_dataInputFileType" ),
379 m_option_qseq_size (m_prefix +
"qseq_size" ),
380 m_option_qseq_displayPeriod (m_prefix +
"qseq_displayPeriod" ),
381 m_option_qseq_measureRunTimes (m_prefix +
"qseq_measureRunTimes" ),
382 m_option_qseq_dataOutputPeriod (m_prefix +
"qseq_dataOutputPeriod" ),
383 m_option_qseq_dataOutputFileName (m_prefix +
"qseq_dataOutputFileName" ),
384 m_option_qseq_dataOutputFileType (m_prefix +
"qseq_dataOutputFileType" ),
385 m_option_qseq_dataOutputAllowedSet(m_prefix +
"qseq_dataOutputAllowedSet")
386 #ifdef QUESO_USES_SEQUENCE_STATISTICAL_OPTIONS
388 m_option_qseq_computeStats (m_prefix +
"qseq_computeStats" )
396 <<
": after setting values of options with prefix '" <<
m_prefix
397 <<
"', state of object is:"
403 #ifdef QUESO_USES_SEQUENCE_STATISTICAL_OPTIONS
404 if (
m_ov.m_pseqComputeStats) m_pseqStatisticalOptionsObj =
405 new SequenceStatisticalOptions(
m_env,
m_prefix +
"pseq_",
m_ov.m_alternativePSsOptionsValues);
406 if (
m_ov.m_qseqComputeStats) m_qseqStatisticalOptionsObj =
407 new SequenceStatisticalOptions(
m_env,
m_prefix +
"qseq_",
m_ov.m_alternativeQSsOptionsValues);
415 #ifdef QUESO_USES_SEQUENCE_STATISTICAL_OPTIONS
416 if (m_pseqStatisticalOptionsObj)
delete m_pseqStatisticalOptionsObj;
417 if (m_qseqStatisticalOptionsObj)
delete m_qseqStatisticalOptionsObj;
434 <<
": after reading values of options with prefix '" <<
m_prefix
435 <<
"', state of object is:"
441 #ifdef QUESO_USES_SEQUENCE_STATISTICAL_OPTIONS
442 if (
m_ov.m_pseqComputeStats) m_pseqStatisticalOptionsObj =
444 if (
m_ov.m_qseqComputeStats) m_qseqStatisticalOptionsObj =
455 optionsDesc.add_options()
456 (
m_option_help.c_str(),
"produce help message for Monte Carlo distribution calculator")
463 #ifdef QUESO_USES_SEQUENCE_STATISTICAL_OPTIONS
464 (m_option_pseq_computeStats.c_str(), boost::program_options::value<bool >()->default_value(
UQ_MOC_SG_PSEQ_COMPUTE_STATS_ODV ),
"compute statistics on sequence of parameter" )
475 #ifdef QUESO_USES_SEQUENCE_STATISTICAL_OPTIONS
476 (m_option_qseq_computeStats.c_str(), boost::program_options::value<bool >()->default_value(
UQ_MOC_SG_QSEQ_COMPUTE_STATS_ODV ),
"compute statistics on sequence of qoi" )
501 std::vector<double> tmpAllow(0,0.);
505 if (tmpAllow.size() > 0) {
506 for (
unsigned int i = 0; i < tmpAllow.size(); ++i) {
526 std::vector<double> tmpAllow(0,0.);
530 if (tmpAllow.size() > 0) {
531 for (
unsigned int i = 0; i < tmpAllow.size(); ++i) {
537 #ifdef QUESO_USES_SEQUENCE_STATISTICAL_OPTIONS
539 m_ov.m_pseqComputeStats = ((
const boost::program_options::variable_value&)
m_env.
allOptionsMap()[m_option_pseq_computeStats]).as<bool>();
576 std::vector<double> tmpAllow(0,0.);
580 if (tmpAllow.size() > 0) {
581 for (
unsigned int i = 0; i < tmpAllow.size(); ++i) {
587 #ifdef QUESO_USES_SEQUENCE_STATISTICAL_OPTIONS
589 m_ov.m_qseqComputeStats = ((
const boost::program_options::variable_value&)
m_env.
allOptionsMap()[m_option_qseq_computeStats]).as<bool>();
613 #ifdef QUESO_USES_SEQUENCE_STATISTICAL_OPTIONS
614 <<
"\n" << m_option_pseq_computeStats <<
" = " <<
m_ov.m_pseqComputeStats
628 #ifdef QUESO_USES_SEQUENCE_STATISTICAL_OPTIONS
629 os <<
"\n" << m_option_qseq_computeStats <<
" = " <<
m_ov.m_qseqComputeStats;
std::string m_option_qseq_dataInputFileName
std::string m_option_qseq_size
std::string m_option_dataOutputFileName
std::string m_option_qseq_dataOutputFileType
std::string m_option_qseq_dataOutputAllowedSet
void scanOptionsValues()
It scans the option values from the options input file.
void scanInputFileForMyOptions(const boost::program_options::options_description &optionsDesc) const
This method scans the input file provided by the user to QUESO.
#define UQ_MOC_SG_QSEQ_COMPUTE_STATS_ODV
std::string m_option_pseq_dataOutputFileType
BoostInputOptionsParser * m_parser
std::string m_qseqDataOutputFileType
#define UQ_MOC_SG_QSEQ_DATA_INPUT_FILE_TYPE_ODV
std::string m_option_help
std::string m_option_pseq_dataOutputFileType
std::string m_option_qseq_dataOutputFileName
#define queso_require_not_equal_to_msg(expr1, expr2, msg)
#define UQ_MOC_SG_DATA_OUTPUT_FILE_NAME_ODV
std::string m_option_qseq_dataOutputFileName
std::string m_option_qseq_displayPeriod
std::string m_option_pseq_dataOutputFileName
#define UQ_MOC_SG_PSEQ_COMPUTE_STATS_ODV
std::ostream & operator<<(std::ostream &os, const BaseEnvironment &obj)
std::string m_option_dataOutputAllowedSet
std::string m_dataOutputFileName
boost::program_options::variables_map & allOptionsMap() const
#define UQ_MOC_SG_PSEQ_DATA_OUTPUT_PERIOD_ODV
unsigned int m_qseqDataOutputPeriod
#define UQ_MOC_SG_PSEQ_DATA_OUTPUT_FILE_TYPE_ODV
std::string m_option_help
std::set< unsigned int > m_pseqDataOutputAllowedSet
std::string m_option_dataOutputAllowedSet
std::string m_option_qseq_dataOutputPeriod
#define UQ_MOC_SG_QSEQ_DATA_OUTPUT_ALLOWED_SET_ODV
std::string m_option_dataOutputFileName
This class provides options for the Monte Carlo sequence generator if no input file is available...
#define queso_require_equal_to_msg(expr1, expr2, msg)
std::string m_pseqDataOutputFileName
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_pseq_dataOutputPeriod
void print(std::ostream &os) const
It prints the option values.
#define queso_require_msg(asserted, msg)
#define UQ_MOC_SG_QSEQ_DATA_OUTPUT_PERIOD_ODV
#define UQ_MOC_SG_QSEQ_DISPLAY_PERIOD_ODV
std::string m_option_qseq_dataOutputPeriod
void copy(const McOptionsValues &src)
Copies the option values from src to this.
McOptionsValues()
Default constructor.
std::ofstream * subDisplayFile() const
Access function for m_subDisplayFile (displays file on stream).
#define UQ_MOC_SG_QSEQ_MEASURE_RUN_TIMES_ODV
std::string m_option_pseq_dataOutputFileName
This (virtual) class sets up the environment underlying the use of the QUESO library by an executable...
boost::program_options::options_description * m_optionsDesc
#define UQ_MOC_SG_QSEQ_SIZE_ODV
#define UQ_MOC_SG_PSEQ_DATA_OUTPUT_ALLOWED_SET_ODV
void registerOption(std::string name, T defaultValue, std::string description)
Call this to register an option with the parser.
McOptionsValues & operator=(const McOptionsValues &rhs)
Assignment operator; it copies rhs to this.
const BaseEnvironment & m_env
#define UQ_MOC_SG_QSEQ_DATA_OUTPUT_FILE_TYPE_ODV
std::string m_qseqDataOutputFileName
#define UQ_MOC_SG_QSEQ_DATA_OUTPUT_FILE_NAME_ODV
unsigned int m_pseqDataOutputPeriod
unsigned int m_qseqDisplayPeriod
#define UQ_MOC_SG_PSEQ_DATA_OUTPUT_FILE_NAME_ODV
void MiscReadDoublesFromString(const std::string &inputString, std::vector< double > &outputDoubles)
~MonteCarloSGOptions()
Destructor.
std::string m_option_qseq_displayPeriod
#define queso_deprecated()
std::string m_help
If non-empty string, print options and values to output file.
This class reads the options for the Monte Carlo sequence generator from an input file...
std::string m_qseqDataInputFileName
std::string m_option_qseq_dataInputFileType
#define UQ_MOC_SG_QSEQ_DATA_INPUT_FILE_NAME_ODV
std::string m_option_qseq_dataInputFileType
std::string m_option_qseq_measureRunTimes
std::string m_option_qseq_dataOutputAllowedSet
virtual ~McOptionsValues()
Destructor.
std::set< unsigned int > m_dataOutputAllowedSet
std::string m_option_pseq_dataOutputPeriod
std::string m_option_pseq_dataOutputAllowedSet
std::set< unsigned int > m_qseqDataOutputAllowedSet
#define UQ_MOC_SG_DATA_OUTPUT_ALLOWED_SET_ODV
std::string m_option_qseq_dataOutputFileType
std::string m_qseqDataInputFileType
std::string m_option_qseq_measureRunTimes
void defineMyOptions(boost::program_options::options_description &optionsDesc) const
Defines the options for the Monte Carlo sequence generator as the default options.
void getMyOptionValues(boost::program_options::options_description &optionsDesc)
Gets the sequence options.
MonteCarloSGOptions(const BaseEnvironment &env, const char *prefix)
Constructor: reads options from the input file.
void getOption(std::string &name, T &value)
Get option name from the parser and set value to the parsed value.
std::string m_option_qseq_dataInputFileName
std::string m_pseqDataOutputFileType
std::string m_option_pseq_dataOutputAllowedSet
bool m_qseqMeasureRunTimes
std::string m_option_qseq_size