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/MonteCarloSGOptions.h>
34 #include <queso/Miscellaneous.h>
44 #ifdef QUESO_USES_SEQUENCE_STATISTICAL_OPTIONS
54 m_pseqDataOutputPeriod (UQ_MOC_SG_PSEQ_DATA_OUTPUT_PERIOD_ODV ),
55 m_pseqDataOutputFileName (UQ_MOC_SG_PSEQ_DATA_OUTPUT_FILE_NAME_ODV),
56 m_pseqDataOutputFileType (UQ_MOC_SG_PSEQ_DATA_OUTPUT_FILE_TYPE_ODV),
58 #ifdef QUESO_USES_SEQUENCE_STATISTICAL_OPTIONS
59 m_pseqComputeStats (UQ_MOC_SG_PSEQ_COMPUTE_STATS_ODV ),
61 m_qseqDataInputFileName (UQ_MOC_SG_QSEQ_DATA_INPUT_FILE_NAME_ODV ),
62 m_qseqDataInputFileType (UQ_MOC_SG_QSEQ_DATA_INPUT_FILE_TYPE_ODV ),
63 m_qseqSize (UQ_MOC_SG_QSEQ_SIZE_ODV ),
64 m_qseqDisplayPeriod (UQ_MOC_SG_QSEQ_DISPLAY_PERIOD_ODV ),
65 m_qseqMeasureRunTimes (UQ_MOC_SG_QSEQ_MEASURE_RUN_TIMES_ODV ),
66 m_qseqDataOutputPeriod (UQ_MOC_SG_QSEQ_DATA_OUTPUT_PERIOD_ODV ),
67 m_qseqDataOutputFileName (UQ_MOC_SG_QSEQ_DATA_OUTPUT_FILE_NAME_ODV),
68 m_qseqDataOutputFileType (UQ_MOC_SG_QSEQ_DATA_OUTPUT_FILE_TYPE_ODV),
70 #ifdef QUESO_USES_SEQUENCE_STATISTICAL_OPTIONS
71 m_qseqComputeStats (UQ_MOC_SG_QSEQ_COMPUTE_STATS_ODV ),
72 m_alternativePSsOptionsValues(),
73 m_alternativeQSsOptionsValues(),
75 #ifndef QUESO_DISABLE_BOOST_PROGRAM_OPTIONS
78 m_option_help (m_prefix +
"help" ),
79 m_option_dataOutputFileName (m_prefix +
"dataOutputFileName" ),
80 m_option_dataOutputAllowedSet (m_prefix +
"dataOutputAllowedSet" ),
81 m_option_pseq_dataOutputPeriod (m_prefix +
"pseq_dataOutputPeriod" ),
82 m_option_pseq_dataOutputFileName (m_prefix +
"pseq_dataOutputFileName" ),
83 m_option_pseq_dataOutputFileType (m_prefix +
"pseq_dataOutputFileType" ),
84 m_option_pseq_dataOutputAllowedSet(m_prefix +
"pseq_dataOutputAllowedSet" ),
85 #ifdef QUESO_USES_SEQUENCE_STATISTICAL_OPTIONS
86 m_option_pseq_computeStats (m_prefix +
"pseq_computeStats" ),
88 m_option_qseq_dataInputFileName (m_prefix +
"qseq_dataInputFileName" ),
89 m_option_qseq_dataInputFileType (m_prefix +
"qseq_dataInputFileType" ),
90 m_option_qseq_size (m_prefix +
"qseq_size" ),
91 m_option_qseq_displayPeriod (m_prefix +
"qseq_displayPeriod" ),
92 m_option_qseq_measureRunTimes (m_prefix +
"qseq_measureRunTimes" ),
93 m_option_qseq_dataOutputPeriod (m_prefix +
"qseq_dataOutputPeriod" ),
94 m_option_qseq_dataOutputFileName (m_prefix +
"qseq_dataOutputFileName" ),
95 m_option_qseq_dataOutputFileType (m_prefix +
"qseq_dataOutputFileType" ),
96 m_option_qseq_dataOutputAllowedSet(m_prefix +
"qseq_dataOutputAllowedSet" )
97 #ifdef QUESO_USES_SEQUENCE_STATISTICAL_OPTIONS
99 m_option_qseq_computeStats (m_prefix +
"qseq_computeStats" )
102 #ifdef QUESO_USES_SEQUENCE_STATISTICAL_OPTIONS
103 if (alternativePSsOptionsValues) m_alternativePSsOptionsValues = *alternativePSsOptionsValues;
104 if (alternativeQSsOptionsValues) m_alternativeQSsOptionsValues = *alternativeQSsOptionsValues;
109 #ifdef QUESO_USES_SEQUENCE_STATISTICAL_OPTIONS
113 const BaseEnvironment * env,
const char * prefix
116 m_prefix ((std::string)(prefix) +
"mc_"),
120 m_pseqDataOutputPeriod (UQ_MOC_SG_PSEQ_DATA_OUTPUT_PERIOD_ODV ),
121 m_pseqDataOutputFileName (UQ_MOC_SG_PSEQ_DATA_OUTPUT_FILE_NAME_ODV),
122 m_pseqDataOutputFileType (UQ_MOC_SG_PSEQ_DATA_OUTPUT_FILE_TYPE_ODV),
124 #ifdef QUESO_USES_SEQUENCE_STATISTICAL_OPTIONS
125 m_pseqComputeStats (UQ_MOC_SG_PSEQ_COMPUTE_STATS_ODV ),
127 m_qseqDataInputFileName (UQ_MOC_SG_QSEQ_DATA_INPUT_FILE_NAME_ODV ),
128 m_qseqDataInputFileType (UQ_MOC_SG_QSEQ_DATA_INPUT_FILE_TYPE_ODV ),
129 m_qseqSize (UQ_MOC_SG_QSEQ_SIZE_ODV ),
130 m_qseqDisplayPeriod (UQ_MOC_SG_QSEQ_DISPLAY_PERIOD_ODV ),
131 m_qseqMeasureRunTimes (UQ_MOC_SG_QSEQ_MEASURE_RUN_TIMES_ODV ),
132 m_qseqDataOutputPeriod (UQ_MOC_SG_QSEQ_DATA_OUTPUT_PERIOD_ODV ),
133 m_qseqDataOutputFileName (UQ_MOC_SG_QSEQ_DATA_OUTPUT_FILE_NAME_ODV),
134 m_qseqDataOutputFileType (UQ_MOC_SG_QSEQ_DATA_OUTPUT_FILE_TYPE_ODV),
136 #ifdef QUESO_USES_SEQUENCE_STATISTICAL_OPTIONS
137 m_qseqComputeStats (UQ_MOC_SG_QSEQ_COMPUTE_STATS_ODV ),
138 m_alternativePSsOptionsValues(),
139 m_alternativeQSsOptionsValues(),
141 #ifndef QUESO_DISABLE_BOOST_PROGRAM_OPTIONS
142 m_parser(new BoostInputOptionsParser(env->optionsInputFileName())),
144 m_option_help (m_prefix +
"help" ),
145 m_option_dataOutputFileName (m_prefix +
"dataOutputFileName" ),
146 m_option_dataOutputAllowedSet (m_prefix +
"dataOutputAllowedSet" ),
147 m_option_pseq_dataOutputPeriod (m_prefix +
"pseq_dataOutputPeriod" ),
148 m_option_pseq_dataOutputFileName (m_prefix +
"pseq_dataOutputFileName" ),
149 m_option_pseq_dataOutputFileType (m_prefix +
"pseq_dataOutputFileType" ),
150 m_option_pseq_dataOutputAllowedSet(m_prefix +
"pseq_dataOutputAllowedSet" ),
151 #ifdef QUESO_USES_SEQUENCE_STATISTICAL_OPTIONS
152 m_option_pseq_computeStats (m_prefix +
"pseq_computeStats" ),
154 m_option_qseq_dataInputFileName (m_prefix +
"qseq_dataInputFileName" ),
155 m_option_qseq_dataInputFileType (m_prefix +
"qseq_dataInputFileType" ),
156 m_option_qseq_size (m_prefix +
"qseq_size" ),
157 m_option_qseq_displayPeriod (m_prefix +
"qseq_displayPeriod" ),
158 m_option_qseq_measureRunTimes (m_prefix +
"qseq_measureRunTimes" ),
159 m_option_qseq_dataOutputPeriod (m_prefix +
"qseq_dataOutputPeriod" ),
160 m_option_qseq_dataOutputFileName (m_prefix +
"qseq_dataOutputFileName" ),
161 m_option_qseq_dataOutputFileType (m_prefix +
"qseq_dataOutputFileType" ),
162 m_option_qseq_dataOutputAllowedSet(m_prefix +
"qseq_dataOutputAllowedSet" )
163 #ifdef QUESO_USES_SEQUENCE_STATISTICAL_OPTIONS
165 m_option_qseq_computeStats (m_prefix +
"qseq_computeStats" )
168 #ifdef QUESO_USES_SEQUENCE_STATISTICAL_OPTIONS
169 if (alternativePSsOptionsValues) m_alternativePSsOptionsValues = *alternativePSsOptionsValues;
170 if (alternativeQSsOptionsValues) m_alternativeQSsOptionsValues = *alternativeQSsOptionsValues;
173 #ifndef QUESO_DISABLE_BOOST_PROGRAM_OPTIONS
174 m_parser->registerOption<std::string >(m_option_help, UQ_MOC_SG_HELP ,
"produce help message for Monte Carlo distribution calculator");
175 m_parser->registerOption<std::string >(m_option_dataOutputFileName, UQ_MOC_SG_DATA_OUTPUT_FILE_NAME_ODV ,
"name of generic data output file" );
176 m_parser->registerOption<std::string >(m_option_dataOutputAllowedSet, UQ_MOC_SG_DATA_OUTPUT_ALLOWED_SET_ODV ,
"subEnvs that will write to generic data output file" );
177 m_parser->registerOption<
unsigned int>(m_option_pseq_dataOutputPeriod, UQ_MOC_SG_PSEQ_DATA_OUTPUT_PERIOD_ODV ,
"period of message display during param sequence generation" );
178 m_parser->registerOption<std::string >(m_option_pseq_dataOutputFileName, UQ_MOC_SG_PSEQ_DATA_OUTPUT_FILE_NAME_ODV ,
"name of data output file for parameters" );
179 m_parser->registerOption<std::string >(m_option_pseq_dataOutputFileType, UQ_MOC_SG_PSEQ_DATA_OUTPUT_FILE_TYPE_ODV ,
"type of data output file for parameters" );
180 m_parser->registerOption<std::string >(m_option_pseq_dataOutputAllowedSet, UQ_MOC_SG_PSEQ_DATA_OUTPUT_ALLOWED_SET_ODV,
"subEnvs that will write to data output file for parameters" );
181 #ifdef QUESO_USES_SEQUENCE_STATISTICAL_OPTIONS
182 m_parser->registerOption<
bool >(m_option_pseq_computeStats, UQ_MOC_SG_PSEQ_COMPUTE_STATS_ODV ,
"compute statistics on sequence of parameter" );
184 m_parser->registerOption<std::string >(m_option_qseq_dataInputFileName, UQ_MOC_SG_QSEQ_DATA_INPUT_FILE_NAME_ODV ,
"name of data input file for qois" );
185 m_parser->registerOption<std::string >(m_option_qseq_dataInputFileType, UQ_MOC_SG_QSEQ_DATA_INPUT_FILE_TYPE_ODV ,
"type of data input file for qois" );
186 m_parser->registerOption<
unsigned int>(m_option_qseq_size, UQ_MOC_SG_QSEQ_SIZE_ODV ,
"size of qoi sequence" );
187 m_parser->registerOption<
unsigned int>(m_option_qseq_displayPeriod, UQ_MOC_SG_QSEQ_DISPLAY_PERIOD_ODV ,
"period of message display during qoi sequence generation" );
188 m_parser->registerOption<
bool >(m_option_qseq_measureRunTimes, UQ_MOC_SG_QSEQ_MEASURE_RUN_TIMES_ODV ,
"measure run times" );
189 m_parser->registerOption<
unsigned int>(m_option_qseq_dataOutputPeriod, UQ_MOC_SG_QSEQ_DATA_OUTPUT_PERIOD_ODV ,
"period of message display during qoi sequence generation" );
190 m_parser->registerOption<std::string >(m_option_qseq_dataOutputFileName, UQ_MOC_SG_QSEQ_DATA_OUTPUT_FILE_NAME_ODV ,
"name of data output file for qois" );
191 m_parser->registerOption<std::string >(m_option_qseq_dataOutputFileType, UQ_MOC_SG_QSEQ_DATA_OUTPUT_FILE_TYPE_ODV ,
"type of data output file for qois" );
192 m_parser->registerOption<std::string >(m_option_qseq_dataOutputAllowedSet, UQ_MOC_SG_QSEQ_DATA_OUTPUT_ALLOWED_SET_ODV,
"subEnvs that will write to data output file for qois" );
193 #ifdef QUESO_USES_SEQUENCE_STATISTICAL_OPTIONS
194 m_parser->registerOption<
bool >(m_option_qseq_computeStats, UQ_MOC_SG_QSEQ_COMPUTE_STATS_ODV ,
"compute statistics on sequence of qoi" );
197 m_parser->scanInputFile();
199 m_parser->getOption<std::string >(m_option_help,
m_help);
201 m_parser->getOption<std::set<unsigned int> >(m_option_dataOutputAllowedSet, m_dataOutputAllowedSet);
202 m_parser->getOption<
unsigned int>(m_option_pseq_dataOutputPeriod, m_pseqDataOutputPeriod);
203 m_parser->getOption<std::string >(m_option_pseq_dataOutputFileName, m_pseqDataOutputFileName);
204 m_parser->getOption<std::string >(m_option_pseq_dataOutputFileType, m_pseqDataOutputFileType);
205 m_parser->getOption<std::set<unsigned int> >(m_option_pseq_dataOutputAllowedSet, m_pseqDataOutputAllowedSet);
206 #ifdef QUESO_USES_SEQUENCE_STATISTICAL_OPTIONS
207 m_parser->getOption<
bool >(m_option_pseq_computeStats, m_pseq_computeStats);
209 m_parser->getOption<std::string >(m_option_qseq_dataInputFileName, m_qseqDataInputFileName);
210 m_parser->getOption<std::string >(m_option_qseq_dataInputFileType, m_qseqDataInputFileType);
211 m_parser->getOption<
unsigned int>(m_option_qseq_size, m_qseqSize);
212 m_parser->getOption<
unsigned int>(m_option_qseq_displayPeriod, m_qseqDisplayPeriod);
213 m_parser->getOption<
bool >(m_option_qseq_measureRunTimes, m_qseqMeasureRunTimes);
214 m_parser->getOption<
unsigned int>(m_option_qseq_dataOutputPeriod, m_qseqDataOutputPeriod);
215 m_parser->getOption<std::string >(m_option_qseq_dataOutputFileName, m_qseqDataOutputFileName);
216 m_parser->getOption<std::string >(m_option_qseq_dataOutputFileType, m_qseqDataOutputFileType);
217 m_parser->getOption<std::set<unsigned int> >(m_option_qseq_dataOutputAllowedSet, m_qseqDataOutputAllowedSet);
218 #ifdef QUESO_USES_SEQUENCE_STATISTICAL_OPTIONS
219 m_parser->getOption<
bool >(m_option_qseq_computeStats, m_qseq_computeStats);
222 m_help = env->input()(m_option_help, UQ_MOC_SG_HELP);
223 m_dataOutputFileName = env->input()(m_option_dataOutputFileName, UQ_MOC_SG_DATA_OUTPUT_FILE_NAME_ODV);
226 unsigned int size = env->input().vector_variable_size(m_option_dataOutputAllowedSet);
227 for (
unsigned int i = 0; i <
size; i++) {
230 unsigned int allowed = env->input()(m_option_dataOutputAllowedSet, i, i);
231 m_dataOutputAllowedSet.insert(allowed);
234 m_pseqDataOutputPeriod = env->input()(m_option_pseq_dataOutputPeriod, UQ_MOC_SG_PSEQ_DATA_OUTPUT_PERIOD_ODV);
235 m_pseqDataOutputFileName = env->input()(m_option_pseq_dataOutputFileName, UQ_MOC_SG_PSEQ_DATA_OUTPUT_FILE_NAME_ODV);
236 m_pseqDataOutputFileType = env->input()(m_option_pseq_dataOutputFileType, UQ_MOC_SG_PSEQ_DATA_OUTPUT_FILE_TYPE_ODV);
239 size = env->input().vector_variable_size(m_option_pseq_dataOutputAllowedSet);
240 for (
unsigned int i = 0; i <
size; i++) {
243 unsigned int allowed = env->input()(m_option_pseq_dataOutputAllowedSet, i, i);
244 m_pseqDataOutputAllowedSet.insert(allowed);
247 #ifdef QUESO_USES_SEQUENCE_STATISTICAL_OPTIONS
248 m_pseq_computeStats = env->input()(m_option_pseq_computeStats, UQ_MOC_SG_PSEQ_COMPUTE_STATS_ODV);
250 m_qseqDataInputFileName = env->input()(m_option_qseq_dataInputFileName, UQ_MOC_SG_QSEQ_DATA_INPUT_FILE_NAME_ODV);
251 m_qseqDataInputFileType = env->input()(m_option_qseq_dataInputFileType, UQ_MOC_SG_QSEQ_DATA_INPUT_FILE_TYPE_ODV);
252 m_qseqSize = env->input()(m_option_qseq_size, UQ_MOC_SG_QSEQ_SIZE_ODV);
253 m_qseqDisplayPeriod = env->input()(m_option_qseq_displayPeriod, UQ_MOC_SG_QSEQ_DISPLAY_PERIOD_ODV);
254 m_qseqMeasureRunTimes = env->input()(m_option_qseq_measureRunTimes, UQ_MOC_SG_QSEQ_MEASURE_RUN_TIMES_ODV);
255 m_qseqDataOutputPeriod = env->input()(m_option_qseq_dataOutputPeriod, UQ_MOC_SG_QSEQ_DATA_OUTPUT_PERIOD_ODV);
256 m_qseqDataOutputFileName = env->input()(m_option_qseq_dataOutputFileName, UQ_MOC_SG_QSEQ_DATA_OUTPUT_FILE_NAME_ODV);
257 m_qseqDataOutputFileType = env->input()(m_option_qseq_dataOutputFileType, UQ_MOC_SG_QSEQ_DATA_OUTPUT_FILE_TYPE_ODV);
260 size = env->input().vector_variable_size(m_option_qseq_dataOutputAllowedSet);
261 for (
unsigned int i = 0; i <
size; i++) {
264 unsigned int allowed = env->input()(m_option_qseq_dataOutputAllowedSet, i, i);
265 m_qseqDataOutputAllowedSet.insert(allowed);
268 #ifdef QUESO_USES_SEQUENCE_STATISTICAL_OPTIONS
269 m_qseq_computeStats = env->input()(m_option_qseq_computeStats, UQ_MOC_SG_QSEQ_COMPUTE_STATS_ODV);
271 #endif // QUESO_DISABLE_BOOST_PROGRAM_OPTIONS
280 McOptionsValues::~McOptionsValues()
306 #ifdef QUESO_USES_SEQUENCE_STATISTICAL_OPTIONS
318 #ifdef QUESO_USES_SEQUENCE_STATISTICAL_OPTIONS
322 #ifdef QUESO_USES_SEQUENCE_STATISTICAL_OPTIONS
332 #ifndef QUESO_DISABLE_BOOST_PROGRAM_OPTIONS
333 os << (*(obj.
m_parser)) << std::endl;
334 #endif // QUESO_DISABLE_BOOST_PROGRAM_OPTIONS
349 #ifdef QUESO_USES_SEQUENCE_STATISTICAL_OPTIONS
364 #ifdef QUESO_USES_SEQUENCE_STATISTICAL_OPTIONS
376 MonteCarloSGOptions::MonteCarloSGOptions(
377 const BaseEnvironment& env,
380 #ifdef QUESO_USES_SEQUENCE_STATISTICAL_OPTIONS
382 m_pseqStatisticalOptionsObj (NULL),
383 m_qseqStatisticalOptionsObj (NULL),
387 m_prefix ((std::string)(prefix) +
"mc_"),
389 #ifndef QUESO_DISABLE_BOOST_PROGRAM_OPTIONS
390 m_optionsDesc (new boost::program_options::options_description(
"Monte Carlo options")),
392 m_option_help (m_prefix +
"help" ),
393 m_option_dataOutputFileName (m_prefix +
"dataOutputFileName" ),
394 m_option_dataOutputAllowedSet (m_prefix +
"dataOutputAllowedSet" ),
395 m_option_pseq_dataOutputPeriod (m_prefix +
"pseq_dataOutputPeriod" ),
396 m_option_pseq_dataOutputFileName (m_prefix +
"pseq_dataOutputFileName" ),
397 m_option_pseq_dataOutputFileType (m_prefix +
"pseq_dataOutputFileType" ),
398 m_option_pseq_dataOutputAllowedSet(m_prefix +
"pseq_dataOutputAllowedSet" ),
399 #ifdef QUESO_USES_SEQUENCE_STATISTICAL_OPTIONS
400 m_option_pseq_computeStats (m_prefix +
"pseq_computeStats" ),
402 m_option_qseq_dataInputFileName (m_prefix +
"qseq_dataInputFileName" ),
403 m_option_qseq_dataInputFileType (m_prefix +
"qseq_dataInputFileType" ),
404 m_option_qseq_size (m_prefix +
"qseq_size" ),
405 m_option_qseq_displayPeriod (m_prefix +
"qseq_displayPeriod" ),
406 m_option_qseq_measureRunTimes (m_prefix +
"qseq_measureRunTimes" ),
407 m_option_qseq_dataOutputPeriod (m_prefix +
"qseq_dataOutputPeriod" ),
408 m_option_qseq_dataOutputFileName (m_prefix +
"qseq_dataOutputFileName" ),
409 m_option_qseq_dataOutputFileType (m_prefix +
"qseq_dataOutputFileType" ),
410 m_option_qseq_dataOutputAllowedSet(m_prefix +
"qseq_dataOutputAllowedSet" )
411 #ifdef QUESO_USES_SEQUENCE_STATISTICAL_OPTIONS
413 m_option_qseq_computeStats (m_prefix +
"qseq_computeStats" )
417 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"));
420 MonteCarloSGOptions::MonteCarloSGOptions(
421 const BaseEnvironment& env,
423 const McOptionsValues& alternativeOptionsValues)
425 m_ov (alternativeOptionsValues),
426 #ifdef QUESO_USES_SEQUENCE_STATISTICAL_OPTIONS
427 m_pseqStatisticalOptionsObj (NULL),
428 m_qseqStatisticalOptionsObj (NULL),
430 m_prefix ((std::string)(prefix) +
"mc_"),
432 #ifndef QUESO_DISABLE_BOOST_PROGRAM_OPTIONS
433 m_optionsDesc (NULL),
435 m_option_help (m_prefix +
"help" ),
436 m_option_dataOutputFileName (m_prefix +
"dataOutputFileName" ),
437 m_option_dataOutputAllowedSet (m_prefix +
"dataOutputAllowedSet" ),
438 m_option_pseq_dataOutputPeriod (m_prefix +
"pseq_dataOutputPeriod" ),
439 m_option_pseq_dataOutputFileName (m_prefix +
"pseq_dataOutputFileName" ),
440 m_option_pseq_dataOutputFileType (m_prefix +
"pseq_dataOutputFileType" ),
441 m_option_pseq_dataOutputAllowedSet(m_prefix +
"pseq_dataOutputAllowedSet"),
442 #ifdef QUESO_USES_SEQUENCE_STATISTICAL_OPTIONS
443 m_option_pseq_computeStats (m_prefix +
"pseq_computeStats" ),
445 m_option_qseq_dataInputFileName (m_prefix +
"qseq_dataInputFileName" ),
446 m_option_qseq_dataInputFileType (m_prefix +
"qseq_dataInputFileType" ),
447 m_option_qseq_size (m_prefix +
"qseq_size" ),
448 m_option_qseq_displayPeriod (m_prefix +
"qseq_displayPeriod" ),
449 m_option_qseq_measureRunTimes (m_prefix +
"qseq_measureRunTimes" ),
450 m_option_qseq_dataOutputPeriod (m_prefix +
"qseq_dataOutputPeriod" ),
451 m_option_qseq_dataOutputFileName (m_prefix +
"qseq_dataOutputFileName" ),
452 m_option_qseq_dataOutputFileType (m_prefix +
"qseq_dataOutputFileType" ),
453 m_option_qseq_dataOutputAllowedSet(m_prefix +
"qseq_dataOutputAllowedSet")
454 #ifdef QUESO_USES_SEQUENCE_STATISTICAL_OPTIONS
456 m_option_qseq_computeStats (m_prefix +
"qseq_computeStats" )
460 queso_require_equal_to_msg(m_env.optionsInputFileName(), std::string(
""), std::string(
"this constructor is incompatible with the existence of an options input file"));
462 if (m_env.subDisplayFile() != NULL) {
463 *m_env.
subDisplayFile() <<
"In MonteCarloSGOptions::constructor(2)"
464 <<
": after setting values of options with prefix '" << m_prefix
465 <<
"', state of object is:"
471 #ifdef QUESO_USES_SEQUENCE_STATISTICAL_OPTIONS
472 if (m_ov.m_pseqComputeStats) m_pseqStatisticalOptionsObj =
474 if (m_ov.m_qseqComputeStats) m_qseqStatisticalOptionsObj =
479 MonteCarloSGOptions::~MonteCarloSGOptions()
483 #ifdef QUESO_USES_SEQUENCE_STATISTICAL_OPTIONS
484 if (m_pseqStatisticalOptionsObj)
delete m_pseqStatisticalOptionsObj;
485 if (m_qseqStatisticalOptionsObj)
delete m_qseqStatisticalOptionsObj;
487 #ifndef QUESO_DISABLE_BOOST_PROGRAM_OPTIONS
488 if (m_optionsDesc )
delete m_optionsDesc;
489 #endif // QUESO_DISABLE_BOOST_PROGRAM_OPTIONS
493 MonteCarloSGOptions::scanOptionsValues()
497 #ifndef QUESO_DISABLE_BOOST_PROGRAM_OPTIONS
498 queso_require_msg(m_optionsDesc,
"m_optionsDesc variable is NULL");
500 defineMyOptions (*m_optionsDesc);
501 m_env.scanInputFileForMyOptions(*m_optionsDesc);
502 getMyOptionValues (*m_optionsDesc);
503 #endif // QUESO_DISABLE_BOOST_PROGRAM_OPTIONS
505 if (m_env.subDisplayFile() != NULL) {
506 *m_env.subDisplayFile() <<
"In MonteCarloSGOptions::scanOptionsValues()"
507 <<
": after reading values of options with prefix '" << m_prefix
508 <<
"', state of object is:"
514 #ifdef QUESO_USES_SEQUENCE_STATISTICAL_OPTIONS
515 if (m_ov.m_pseqComputeStats) m_pseqStatisticalOptionsObj =
517 if (m_ov.m_qseqComputeStats) m_qseqStatisticalOptionsObj =
523 #ifndef QUESO_DISABLE_BOOST_PROGRAM_OPTIONS
525 MonteCarloSGOptions::defineMyOptions(boost::program_options::options_description& optionsDesc)
const
529 optionsDesc.add_options()
530 (m_option_help.c_str(),
"produce help message for Monte Carlo distribution calculator")
531 (m_option_dataOutputFileName.c_str(), boost::program_options::value<std::string >()->default_value(UQ_MOC_SG_DATA_OUTPUT_FILE_NAME_ODV ),
"name of generic data output file" )
532 (m_option_dataOutputAllowedSet.c_str(), boost::program_options::value<std::string >()->default_value(UQ_MOC_SG_DATA_OUTPUT_ALLOWED_SET_ODV ),
"subEnvs that will write to generic data output file" )
533 (m_option_pseq_dataOutputPeriod.c_str(), boost::program_options::value<unsigned int>()->default_value(UQ_MOC_SG_PSEQ_DATA_OUTPUT_PERIOD_ODV ),
"period of message display during param sequence generation" )
534 (m_option_pseq_dataOutputFileName.c_str(), boost::program_options::value<std::string >()->default_value(UQ_MOC_SG_PSEQ_DATA_OUTPUT_FILE_NAME_ODV ),
"name of data output file for parameters" )
535 (m_option_pseq_dataOutputFileType.c_str(), boost::program_options::value<std::string >()->default_value(UQ_MOC_SG_PSEQ_DATA_OUTPUT_FILE_TYPE_ODV ),
"type of data output file for parameters" )
536 (m_option_pseq_dataOutputAllowedSet.c_str(), boost::program_options::value<std::string >()->default_value(UQ_MOC_SG_PSEQ_DATA_OUTPUT_ALLOWED_SET_ODV),
"subEnvs that will write to data output file for parameters" )
537 #ifdef QUESO_USES_SEQUENCE_STATISTICAL_OPTIONS
538 (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" )
540 (m_option_qseq_dataInputFileName.c_str(), boost::program_options::value<std::string >()->default_value(UQ_MOC_SG_QSEQ_DATA_INPUT_FILE_NAME_ODV ),
"name of data input file for qois" )
541 (m_option_qseq_dataInputFileType.c_str(), boost::program_options::value<std::string >()->default_value(UQ_MOC_SG_QSEQ_DATA_INPUT_FILE_TYPE_ODV ),
"type of data input file for qois" )
542 (m_option_qseq_size.c_str(), boost::program_options::value<unsigned int>()->default_value(UQ_MOC_SG_QSEQ_SIZE_ODV ),
"size of qoi sequence" )
543 (m_option_qseq_displayPeriod.c_str(), boost::program_options::value<unsigned int>()->default_value(UQ_MOC_SG_QSEQ_DISPLAY_PERIOD_ODV ),
"period of message display during qoi sequence generation" )
544 (m_option_qseq_measureRunTimes.c_str(), boost::program_options::value<bool >()->default_value(UQ_MOC_SG_QSEQ_MEASURE_RUN_TIMES_ODV ),
"measure run times" )
545 (m_option_qseq_dataOutputPeriod.c_str(), boost::program_options::value<unsigned int>()->default_value(UQ_MOC_SG_QSEQ_DATA_OUTPUT_PERIOD_ODV ),
"period of message display during qoi sequence generation" )
546 (m_option_qseq_dataOutputFileName.c_str(), boost::program_options::value<std::string >()->default_value(UQ_MOC_SG_QSEQ_DATA_OUTPUT_FILE_NAME_ODV ),
"name of data output file for qois" )
547 (m_option_qseq_dataOutputFileType.c_str(), boost::program_options::value<std::string >()->default_value(UQ_MOC_SG_QSEQ_DATA_OUTPUT_FILE_TYPE_ODV ),
"type of data output file for qois" )
548 (m_option_qseq_dataOutputAllowedSet.c_str(), boost::program_options::value<std::string >()->default_value(UQ_MOC_SG_QSEQ_DATA_OUTPUT_ALLOWED_SET_ODV),
"subEnvs that will write to data output file for qois" )
549 #ifdef QUESO_USES_SEQUENCE_STATISTICAL_OPTIONS
550 (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" )
558 MonteCarloSGOptions::getMyOptionValues(boost::program_options::options_description& optionsDesc)
562 if (m_env.allOptionsMap().count(m_option_help)) {
563 if (m_env.subDisplayFile()) {
564 *m_env.subDisplayFile() << optionsDesc
569 if (m_env.allOptionsMap().count(m_option_dataOutputFileName)) {
570 m_ov.m_dataOutputFileName = ((
const boost::program_options::variable_value&) m_env.allOptionsMap()[m_option_dataOutputFileName]).as<std::string>();
573 if (m_env.allOptionsMap().count(m_option_dataOutputAllowedSet)) {
574 m_ov.m_dataOutputAllowedSet.clear();
575 std::vector<double> tmpAllow(0,0.);
576 std::string inputString = m_env.allOptionsMap()[m_option_dataOutputAllowedSet].as<std::string>();
579 if (tmpAllow.size() > 0) {
580 for (
unsigned int i = 0; i < tmpAllow.size(); ++i) {
581 m_ov.m_dataOutputAllowedSet.insert((
unsigned int) tmpAllow[i]);
586 if (m_env.allOptionsMap().count(m_option_pseq_dataOutputPeriod)) {
587 m_ov.m_pseqDataOutputPeriod = ((
const boost::program_options::variable_value&) m_env.allOptionsMap()[m_option_pseq_dataOutputPeriod]).as<unsigned int>();
590 if (m_env.allOptionsMap().count(m_option_pseq_dataOutputFileName)) {
591 m_ov.m_pseqDataOutputFileName = ((
const boost::program_options::variable_value&) m_env.allOptionsMap()[m_option_pseq_dataOutputFileName]).as<std::string>();
594 if (m_env.allOptionsMap().count(m_option_pseq_dataOutputFileType)) {
595 m_ov.m_pseqDataOutputFileType = ((
const boost::program_options::variable_value&) m_env.allOptionsMap()[m_option_pseq_dataOutputFileType]).as<std::string>();
598 if (m_env.allOptionsMap().count(m_option_pseq_dataOutputAllowedSet)) {
599 m_ov.m_pseqDataOutputAllowedSet.clear();
600 std::vector<double> tmpAllow(0,0.);
601 std::string inputString = m_env.allOptionsMap()[m_option_pseq_dataOutputAllowedSet].as<std::string>();
604 if (tmpAllow.size() > 0) {
605 for (
unsigned int i = 0; i < tmpAllow.size(); ++i) {
606 m_ov.m_pseqDataOutputAllowedSet.insert((
unsigned int) tmpAllow[i]);
611 #ifdef QUESO_USES_SEQUENCE_STATISTICAL_OPTIONS
612 if (m_env.allOptionsMap().count(m_option_pseq_computeStats)) {
613 m_ov.m_pseqComputeStats = ((
const boost::program_options::variable_value&) m_env.allOptionsMap()[m_option_pseq_computeStats]).as<bool>();
616 if (m_env.allOptionsMap().count(m_option_qseq_dataInputFileName)) {
617 m_ov.m_qseqDataInputFileName = ((
const boost::program_options::variable_value&) m_env.allOptionsMap()[m_option_qseq_dataInputFileName]).as<std::string>();
620 if (m_env.allOptionsMap().count(m_option_qseq_dataInputFileType)) {
621 m_ov.m_qseqDataInputFileType = ((
const boost::program_options::variable_value&) m_env.allOptionsMap()[m_option_qseq_dataInputFileType]).as<std::string>();
624 if (m_env.allOptionsMap().count(m_option_qseq_size)) {
625 m_ov.m_qseqSize = ((
const boost::program_options::variable_value&) m_env.allOptionsMap()[m_option_qseq_size]).as<unsigned int>();
628 if (m_env.allOptionsMap().count(m_option_qseq_displayPeriod)) {
629 m_ov.m_qseqDisplayPeriod = ((
const boost::program_options::variable_value&) m_env.allOptionsMap()[m_option_qseq_displayPeriod]).as<unsigned int>();
632 if (m_env.allOptionsMap().count(m_option_qseq_measureRunTimes)) {
633 m_ov.m_qseqMeasureRunTimes = ((
const boost::program_options::variable_value&) m_env.allOptionsMap()[m_option_qseq_measureRunTimes]).as<bool>();
636 if (m_env.allOptionsMap().count(m_option_qseq_dataOutputPeriod)) {
637 m_ov.m_qseqDataOutputPeriod = ((
const boost::program_options::variable_value&) m_env.allOptionsMap()[m_option_qseq_dataOutputPeriod]).as<unsigned int>();
640 if (m_env.allOptionsMap().count(m_option_qseq_dataOutputFileName)) {
641 m_ov.m_qseqDataOutputFileName = ((
const boost::program_options::variable_value&) m_env.allOptionsMap()[m_option_qseq_dataOutputFileName]).as<std::string>();
644 if (m_env.allOptionsMap().count(m_option_qseq_dataOutputFileType)) {
645 m_ov.m_qseqDataOutputFileType = ((
const boost::program_options::variable_value&) m_env.allOptionsMap()[m_option_qseq_dataOutputFileType]).as<std::string>();
648 if (m_env.allOptionsMap().count(m_option_qseq_dataOutputAllowedSet)) {
649 m_ov.m_qseqDataOutputAllowedSet.clear();
650 std::vector<double> tmpAllow(0,0.);
651 std::string inputString = m_env.allOptionsMap()[m_option_qseq_dataOutputAllowedSet].as<std::string>();
654 if (tmpAllow.size() > 0) {
655 for (
unsigned int i = 0; i < tmpAllow.size(); ++i) {
656 m_ov.m_qseqDataOutputAllowedSet.insert((
unsigned int) tmpAllow[i]);
661 #ifdef QUESO_USES_SEQUENCE_STATISTICAL_OPTIONS
662 if (m_env.allOptionsMap().count(m_option_qseq_computeStats)) {
663 m_ov.m_qseqComputeStats = ((
const boost::program_options::variable_value&) m_env.allOptionsMap()[m_option_qseq_computeStats]).as<bool>();
668 #endif // QUESO_DISABLE_BOOST_PROGRAM_OPTIONS
671 MonteCarloSGOptions::print(std::ostream& os)
const
675 os << m_option_dataOutputFileName <<
" = " << m_ov.m_dataOutputFileName
676 <<
"\n" << m_option_dataOutputAllowedSet <<
" = ";
677 for (std::set<unsigned int>::iterator setIt = m_ov.m_dataOutputAllowedSet.begin(); setIt != m_ov.m_dataOutputAllowedSet.end(); ++setIt) {
680 os <<
"\n" << m_option_pseq_dataOutputPeriod <<
" = " << m_ov.m_pseqDataOutputPeriod
681 <<
"\n" << m_option_pseq_dataOutputFileName <<
" = " << m_ov.m_pseqDataOutputFileName
682 <<
"\n" << m_option_pseq_dataOutputFileType <<
" = " << m_ov.m_pseqDataOutputFileType
683 <<
"\n" << m_option_pseq_dataOutputAllowedSet <<
" = ";
684 for (std::set<unsigned int>::iterator setIt = m_ov.m_pseqDataOutputAllowedSet.begin(); setIt != m_ov.m_pseqDataOutputAllowedSet.end(); ++setIt) {
688 #ifdef QUESO_USES_SEQUENCE_STATISTICAL_OPTIONS
689 <<
"\n" << m_option_pseq_computeStats <<
" = " << m_ov.m_pseqComputeStats
691 <<
"\n" << m_option_qseq_dataInputFileName <<
" = " << m_ov.m_qseqDataInputFileName
692 <<
"\n" << m_option_qseq_dataInputFileType <<
" = " << m_ov.m_qseqDataInputFileType
693 <<
"\n" << m_option_qseq_size <<
" = " << m_ov.m_qseqSize
694 <<
"\n" << m_option_qseq_displayPeriod <<
" = " << m_ov.m_qseqDisplayPeriod
695 <<
"\n" << m_option_qseq_measureRunTimes <<
" = " << m_ov.m_qseqMeasureRunTimes
696 <<
"\n" << m_option_qseq_dataOutputPeriod <<
" = " << m_ov.m_qseqDataOutputPeriod
697 <<
"\n" << m_option_qseq_dataOutputFileName <<
" = " << m_ov.m_qseqDataOutputFileName
698 <<
"\n" << m_option_qseq_dataOutputFileType <<
" = " << m_ov.m_qseqDataOutputFileType
699 <<
"\n" << m_option_qseq_dataOutputAllowedSet <<
" = ";
700 for (std::set<unsigned int>::iterator setIt = m_ov.m_qseqDataOutputAllowedSet.begin(); setIt != m_ov.m_qseqDataOutputAllowedSet.end(); ++setIt) {
703 #ifdef QUESO_USES_SEQUENCE_STATISTICAL_OPTIONS
704 os <<
"\n" << m_option_qseq_computeStats <<
" = " << m_ov.m_qseqComputeStats;
std::string m_option_pseq_dataOutputFileName
std::ostream & operator<<(std::ostream &os, const SequenceStatisticalOptions &obj)
std::string m_option_pseq_computeStats
std::string m_pseqDataOutputFileType
std::set< unsigned int > m_qseqDataOutputAllowedSet
std::string m_option_qseq_dataInputFileType
A templated class that stores statistical options (optionally read from an input file) ...
This class provides options for the Monte Carlo sequence generator if no input file is available...
std::string m_option_pseq_dataOutputFileType
std::string m_qseqDataOutputFileName
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"))
std::string m_dataOutputFileName
std::string m_qseqDataInputFileType
std::string m_option_dataOutputAllowedSet
std::string m_option_qseq_displayPeriod
unsigned int m_qseqDisplayPeriod
std::string m_option_qseq_dataOutputFileName
unsigned int m_qseqDataOutputPeriod
std::set< unsigned int > m_pseqDataOutputAllowedSet
BoostInputOptionsParser * m_parser
std::string m_option_qseq_measureRunTimes
McOptionsValues()
Default constructor.
SsOptionsValues m_alternativeQSsOptionsValues
std::string m_option_pseq_dataOutputAllowedSet
std::string m_pseqDataOutputFileName
SsOptionsValues m_alternativePSsOptionsValues
void MiscReadDoublesFromString(const std::string &inputString, std::vector< double > &outputDoubles)
std::string m_option_dataOutputFileName
std::string m_option_qseq_dataInputFileName
std::set< unsigned int > m_dataOutputAllowedSet
std::string m_option_qseq_size
void print(std::ostream &os) const
It prints the option values.
std::string m_option_pseq_dataOutputPeriod
std::string m_qseqDataInputFileName
std::string m_option_qseq_dataOutputPeriod
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"))
std::string m_option_qseq_dataOutputFileType
unsigned int m_pseqDataOutputPeriod
bool m_qseqMeasureRunTimes
std::string m_option_qseq_dataOutputAllowedSet
std::string m_qseqDataOutputFileType
std::string m_option_qseq_computeStats
std::ofstream * subDisplayFile() const
Access function for m_subDisplayFile (displays file on stream).
This class reads the options for the Monte Carlo sequence generator from an input file...
A templated class that stores default statistical options for a sequence of vectors, e.g. a Markov chain, a Monte Carlo input sequence, or a Monte Carlo output sequence.