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/StatisticalInverseProblemOptions.h>
34 #include <queso/Miscellaneous.h>
49 m_seedWithMAPEstimator(UQ_SIP_SEEDWITHMAPESTIMATOR),
50 m_useOptimizerMonitor(UQ_SIP_USEOPTIMIZERMONITOR),
52 #ifndef QUESO_DISABLE_BOOST_PROGRAM_OPTIONS
55 m_option_help (m_prefix +
"help" ),
56 m_option_computeSolution (m_prefix +
"computeSolution" ),
57 m_option_dataOutputFileName (m_prefix +
"dataOutputFileName" ),
58 m_option_dataOutputAllowedSet(m_prefix +
"dataOutputAllowedSet"),
59 #ifdef UQ_SIP_READS_SOLVER_OPTION
60 m_option_solver (m_prefix +
"solver" ),
61 m_solverString (UQ_SIP_SOLVER_ODV)
63 m_option_seedWithMAPEstimator(m_prefix +
"seedWithMAPEstimator"),
64 m_option_useOptimizerMonitor(m_prefix +
"useOptimizerMonitor")
71 m_prefix((std::string)(prefix) +
"ip_"),
75 m_seedWithMAPEstimator(UQ_SIP_SEEDWITHMAPESTIMATOR),
76 m_useOptimizerMonitor(UQ_SIP_USEOPTIMIZERMONITOR),
78 #ifndef QUESO_DISABLE_BOOST_PROGRAM_OPTIONS
81 m_option_help (m_prefix +
"help" ),
82 m_option_computeSolution (m_prefix +
"computeSolution" ),
83 m_option_dataOutputFileName (m_prefix +
"dataOutputFileName" ),
84 m_option_dataOutputAllowedSet(m_prefix +
"dataOutputAllowedSet"),
85 #ifdef UQ_SIP_READS_SOLVER_OPTION
86 m_option_solver (m_prefix +
"solver" ),
87 m_solverString (UQ_SIP_SOLVER_ODV)
89 m_option_seedWithMAPEstimator(m_prefix +
"seedWithMAPEstimator"),
90 m_option_useOptimizerMonitor(m_prefix +
"useOptimizerMonitor")
92 #ifndef QUESO_DISABLE_BOOST_PROGRAM_OPTIONS
93 m_parser->registerOption<std::string>(
m_option_help, UQ_SIP_HELP,
"produce help message for statistical inverse problem");
97 #ifdef UQ_SIP_READS_SOLVER_OPTION
109 #ifdef UQ_SIP_READS_SOLVER_OPTION
120 unsigned int size = env->
input().vector_variable_size(m_option_dataOutputAllowedSet);
121 for (
unsigned int i = 0; i <
size; i++) {
128 #ifdef UQ_SIP_READS_SOLVER_OPTION
133 #endif // QUESO_DISABLE_BOOST_PROGRAM_OPTIONS
167 #ifdef UQ_SIP_READS_SOLVER_OPTION
183 #ifdef UQ_SIP_READS_SOLVER_OPTION
200 m_prefix ((std::string)(prefix) +
"ip_"),
202 #ifndef QUESO_DISABLE_BOOST_PROGRAM_OPTIONS
203 m_optionsDesc (new boost::program_options::options_description(
"Statistical Inverse Problem options")),
205 m_option_help (m_prefix +
"help" ),
206 m_option_computeSolution (m_prefix +
"computeSolution" ),
207 m_option_dataOutputFileName (m_prefix +
"dataOutputFileName" ),
208 m_option_dataOutputAllowedSet(m_prefix +
"dataOutputAllowedSet"),
209 #ifdef UQ_SIP_READS_SOLVER_OPTION
210 m_option_solver (m_prefix +
"solver" )
212 m_option_seedWithMAPEstimator(m_prefix +
"seedWithMAPEstimator"),
213 m_option_useOptimizerMonitor(m_prefix +
"useOptimizerMonitor")
225 m_ov (alternativeOptionsValues),
226 m_prefix ((std::string)(prefix) +
"ip_"),
228 #ifndef QUESO_DISABLE_BOOST_PROGRAM_OPTIONS
231 m_option_help (m_prefix +
"help" ),
232 m_option_computeSolution (m_prefix +
"computeSolution" ),
233 m_option_dataOutputFileName (m_prefix +
"dataOutputFileName" ),
234 m_option_dataOutputAllowedSet(m_prefix +
"dataOutputAllowedSet"),
235 #ifdef UQ_SIP_READS_SOLVER_OPTION
236 m_option_solver (m_prefix +
"solver" )
238 m_option_seedWithMAPEstimator(m_prefix +
"seedWithMAPEstimator"),
239 m_option_useOptimizerMonitor(m_prefix +
"useOptimizerMonitor")
247 <<
": after setting values of options with prefix '" <<
m_prefix
248 <<
"', state of object is:"
263 #ifndef QUESO_DISABLE_BOOST_PROGRAM_OPTIONS
264 queso_require_msg(
m_optionsDesc,
"m_optionsDesc variable is NULL");
269 #endif // QUESO_DISABLE_BOOST_PROGRAM_OPTIONS
273 <<
": after reading values of options with prefix '" <<
m_prefix
274 <<
"', state of object is:"
294 #ifdef UQ_SIP_READS_SOLVER_OPTION
304 #ifndef QUESO_DISABLE_BOOST_PROGRAM_OPTIONS
310 optionsDesc.add_options()
311 (
m_option_help.c_str(),
"produce help message for statistical inverse problem")
312 (
m_option_computeSolution.c_str(), boost::program_options::value<bool >()->default_value(UQ_SIP_COMPUTE_SOLUTION_ODV ),
"compute solution process" )
313 (
m_option_dataOutputFileName.c_str(), boost::program_options::value<std::string>()->default_value(UQ_SIP_DATA_OUTPUT_FILE_NAME_ODV ),
"name of data output file" )
314 (
m_option_dataOutputAllowedSet.c_str(), boost::program_options::value<std::string>()->default_value(UQ_SIP_DATA_OUTPUT_ALLOWED_SET_ODV),
"subEnvs that will write to data output file" )
315 #ifdef UQ_SIP_READS_SOLVER_OPTION
316 (
m_option_solver.c_str(), boost::program_options::value<std::string>()->default_value(UQ_SIP_SOLVER_ODV ),
"algorithm for calibration" )
318 (
m_option_seedWithMAPEstimator.c_str(), boost::program_options::value<bool>()->default_value(UQ_SIP_SEEDWITHMAPESTIMATOR),
"toggle optimisation of posterior pdf before sampling")
319 (
m_option_useOptimizerMonitor.c_str(), boost::program_options::value<bool>()->default_value(UQ_SIP_USEOPTIMIZERMONITOR),
"toggle printing of optimisation progress when seed with MAP estimator")
322 #endif // QUESO_DISABLE_BOOST_PROGRAM_OPTIONS
324 #ifndef QUESO_DISABLE_BOOST_PROGRAM_OPTIONS
348 std::vector<double> tmpAllow(0,0.);
352 if (tmpAllow.size() > 0) {
353 for (
unsigned int i = 0; i < tmpAllow.size(); ++i) {
359 #ifdef UQ_SIP_READS_SOLVER_OPTION
373 #endif // QUESO_DISABLE_BOOST_PROGRAM_OPTIONS
void print(std::ostream &os) const
It prints the option values.
std::string m_option_solver
ScopedPtr< boost::program_options::options_description >::Type m_optionsDesc
bool m_useOptimizerMonitor
std::string m_option_dataOutputAllowedSet
ScopedPtr< BoostInputOptionsParser >::Type m_parser
This (virtual) class sets up the environment underlying the use of the QUESO library by an executable...
std::string m_help
If this string is non-empty, options are print to the output file.
void copy(const SipOptionsValues &src)
Copies the option values from src to this.
boost::program_options::variables_map & allOptionsMap() const
std::string m_option_solver
virtual ~SipOptionsValues()
Destructor.
std::set< unsigned int > m_dataOutputAllowedSet
std::ostream & operator<<(std::ostream &os, const SequenceStatisticalOptions &obj)
bool m_seedWithMAPEstimator
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"))
std::string m_option_dataOutputFileName
const BaseEnvironment & m_env
std::string m_option_useOptimizerMonitor
StatisticalInverseProblemOptions(const BaseEnvironment &env, const char *prefix)
Constructor: reads options from the input file.
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_dataOutputFileName
std::string m_option_seedWithMAPEstimator
This class provides options for a Statistical Inverse Problem if no input file is available...
void scanOptionsValues()
It scans the option values from the options input file.
This class reads option values for a Statistical Inverse Problem from an input file.
void getMyOptionValues(boost::program_options::options_description &optionsDesc)
Gets the option values of the SIP.
void MiscReadDoublesFromString(const std::string &inputString, std::vector< double > &outputDoubles)
~StatisticalInverseProblemOptions()
Destructor.
std::string m_dataOutputFileName
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_computeSolution
std::string m_option_help
SipOptionsValues & operator=(const SipOptionsValues &rhs)
Assignment operator; it copies rhs to this.
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_solverString
std::string m_option_dataOutputAllowedSet
std::string m_option_help
std::string m_option_useOptimizerMonitor
std::string m_option_seedWithMAPEstimator
SipOptionsValues()
Default constructor.
void defineMyOptions(boost::program_options::options_description &optionsDesc) const
Define my SIP options as the default options.
std::string m_option_computeSolution
std::ofstream * subDisplayFile() const
Access function for m_subDisplayFile (displays file on stream).