queso-0.57.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
QUESO::StatisticalForwardProblemOptions Class Reference

This class reads option values for a Statistical Forward Problem from an input file. More...

#include <StatisticalForwardProblemOptions.h>

Public Member Functions

Constructor/Destructor methods
 StatisticalForwardProblemOptions (const BaseEnvironment &env, const char *prefix)
 Constructor: reads options from the input file. More...
 
 StatisticalForwardProblemOptions (const BaseEnvironment &env, const char *prefix, const SfpOptionsValues &alternativeOptionsValues)
 Constructor: with alternative option values. More...
 
 ~StatisticalForwardProblemOptions ()
 Destructor. More...
 
I/O methods
void scanOptionsValues ()
 It scans the option values from the options input file. More...
 
void print (std::ostream &os) const
 It prints the option values. More...
 

Public Attributes

SfpOptionsValues m_ov
 
std::string m_prefix
 

Private Member Functions

void defineMyOptions (boost::program_options::options_description &optionsDesc) const
 Define my SFP options as the default options. More...
 
void getMyOptionValues (boost::program_options::options_description &optionsDesc)
 Gets the option values of the SFP. More...
 

Private Attributes

const BaseEnvironmentm_env
 
boost::program_options::options_description * m_optionsDesc
 
std::string m_option_help
 
std::string m_option_computeSolution
 
std::string m_option_computeCovariances
 
std::string m_option_computeCorrelations
 
std::string m_option_dataOutputFileName
 
std::string m_option_dataOutputAllowedSet
 
std::string m_option_solver
 

Detailed Description

This class reads option values for a Statistical Forward Problem from an input file.

This class reads the option values for the Statistical Forward Problem (SFP) from an input file provided by the user. The class expects the prefix '<prefix>_fp_'. For instance, if 'prefix' is 'foo_775_', then the constructor will read all options that begin with 'foo_775_fp_'. If the options request data to be written in the output file (MATLAB .m format only, for now), the user can run 'grep zeros <OUTPUT FILE NAME>' after the solution procedure ends in order to check which MATLAB variables are defined and set. The names of the variables are self explanatory.

Definition at line 146 of file StatisticalForwardProblemOptions.h.

Constructor & Destructor Documentation

QUESO::StatisticalForwardProblemOptions::StatisticalForwardProblemOptions ( const BaseEnvironment env,
const char *  prefix 
)

Constructor: reads options from the input file.

QUESO::StatisticalForwardProblemOptions::StatisticalForwardProblemOptions ( const BaseEnvironment env,
const char *  prefix,
const SfpOptionsValues alternativeOptionsValues 
)

Constructor: with alternative option values.

In this constructor, the input options are given by alternativeOptionsValues, rather than the options input file

QUESO::StatisticalForwardProblemOptions::~StatisticalForwardProblemOptions ( )

Destructor.

Definition at line 265 of file StatisticalForwardProblemOptions.C.

266 {
267  queso_deprecated();
268 
269 #ifndef QUESO_DISABLE_BOOST_PROGRAM_OPTIONS
270  if (m_optionsDesc) delete m_optionsDesc;
271 #endif // QUESO_DISABLE_BOOST_PROGRAM_OPTIONS
272 }
boost::program_options::options_description * m_optionsDesc

Member Function Documentation

void QUESO::StatisticalForwardProblemOptions::defineMyOptions ( boost::program_options::options_description &  optionsDesc) const
private

Define my SFP options as the default options.

Definition at line 323 of file StatisticalForwardProblemOptions.C.

324 {
325  queso_deprecated();
326 
327  optionsDesc.add_options()
328  (m_option_help.c_str(), "produce help message for statistical forward problem")
329  (m_option_computeSolution.c_str(), boost::program_options::value<bool >()->default_value(UQ_SFP_COMPUTE_SOLUTION_ODV ), "compute solution process" )
330  (m_option_computeCovariances.c_str(), boost::program_options::value<bool >()->default_value(UQ_SFP_COMPUTE_COVARIANCES_ODV ), "compute pq covariances" )
331  (m_option_computeCorrelations.c_str(), boost::program_options::value<bool >()->default_value(UQ_SFP_COMPUTE_CORRELATIONS_ODV ), "compute pq correlations" )
332  (m_option_dataOutputFileName.c_str(), boost::program_options::value<std::string>()->default_value(UQ_SFP_DATA_OUTPUT_FILE_NAME_ODV ), "name of data output file" )
333  (m_option_dataOutputAllowedSet.c_str(), boost::program_options::value<std::string>()->default_value(UQ_SFP_DATA_OUTPUT_ALLOWED_SET_ODV), "subEnvs that will write to data output file" )
334 #ifdef UQ_SFP_READS_SOLVER_OPTION
335  (m_option_solver.c_str(), boost::program_options::value<std::string>()->default_value(UQ_SFP_SOLVER_ODV ), "algorithm for propagation" )
336 #endif
337  ;
338 
339  return;
340 }
void QUESO::StatisticalForwardProblemOptions::getMyOptionValues ( boost::program_options::options_description &  optionsDesc)
private

Gets the option values of the SFP.

Definition at line 346 of file StatisticalForwardProblemOptions.C.

References QUESO::MiscReadDoublesFromString().

347 {
348  queso_deprecated();
349 
350  if (m_env.allOptionsMap().count(m_option_help)) {
351  if (m_env.subDisplayFile()) {
352  *m_env.subDisplayFile() << optionsDesc
353  << std::endl;
354  }
355  }
356 
358  m_ov.m_computeSolution = ((const boost::program_options::variable_value&) m_env.allOptionsMap()[m_option_computeSolution]).as<bool>();
359  }
360 
362  m_ov.m_computeCovariances = ((const boost::program_options::variable_value&) m_env.allOptionsMap()[m_option_computeCovariances]).as<bool>();
363  }
364 
366  m_ov.m_computeCorrelations = ((const boost::program_options::variable_value&) m_env.allOptionsMap()[m_option_computeCorrelations]).as<bool>();
367  }
368 
370  m_ov.m_dataOutputFileName = ((const boost::program_options::variable_value&) m_env.allOptionsMap()[m_option_dataOutputFileName]).as<std::string>();
371  }
372 
375  std::vector<double> tmpAllow(0,0.);
376  std::string inputString = m_env.allOptionsMap()[m_option_dataOutputAllowedSet].as<std::string>();
377  MiscReadDoublesFromString(inputString,tmpAllow);
378 
379  if (tmpAllow.size() > 0) {
380  for (unsigned int i = 0; i < tmpAllow.size(); ++i) {
381  m_ov.m_dataOutputAllowedSet.insert((unsigned int) tmpAllow[i]);
382  }
383  }
384  }
385 
386 #ifdef UQ_SFP_READS_SOLVER_OPTION
387  if (m_env.allOptionsMap().count(m_option_solver)) {
388  m_ov.m_solverString = ((const boost::program_options::variable_value&) m_env.allOptionsMap()[m_option_solver]).as<std::string>();
389  }
390 #endif
391 
392  return;
393 }
boost::program_options::variables_map & allOptionsMap() const
Definition: Environment.C:386
std::set< unsigned int > m_dataOutputAllowedSet
void MiscReadDoublesFromString(const std::string &inputString, std::vector< double > &outputDoubles)
Definition: Miscellaneous.C:40
std::ofstream * subDisplayFile() const
Access function for m_subDisplayFile (displays file on stream).
Definition: Environment.C:320
void QUESO::StatisticalForwardProblemOptions::print ( std::ostream &  os) const

It prints the option values.

Definition at line 300 of file StatisticalForwardProblemOptions.C.

Referenced by QUESO::operator<<().

301 {
302  queso_deprecated();
303 
308  os << "\n" << m_option_dataOutputAllowedSet << " = ";
309  for (std::set<unsigned int>::iterator setIt = m_ov.m_dataOutputAllowedSet.begin(); setIt != m_ov.m_dataOutputAllowedSet.end(); ++setIt) {
310  os << *setIt << " ";
311  }
312 #ifdef UQ_SFP_READS_SOLVER_OPTION
313  << "\n" << m_option_solver << " = " << m_ov.m_solverString
314 #endif
315  os << std::endl;
316 
317  return;
318 }
std::set< unsigned int > m_dataOutputAllowedSet
void QUESO::StatisticalForwardProblemOptions::scanOptionsValues ( )

It scans the option values from the options input file.

Definition at line 276 of file StatisticalForwardProblemOptions.C.

277 {
278  queso_deprecated();
279 
280 #ifndef QUESO_DISABLE_BOOST_PROGRAM_OPTIONS
281  queso_require_msg(m_optionsDesc, "m_optionsDesc variable is NULL");
282 
286 #endif // QUESO_DISABLE_BOOST_PROGRAM_OPTIONS
287 
288  if (m_env.subDisplayFile() != NULL) {
289  *m_env.subDisplayFile() << "In StatisticalForwardProblemOptions::scanOptionsValues()"
290  << ": after reading values of options with prefix '" << m_prefix
291  << "', state of object is:"
292  << "\n" << *this
293  << std::endl;
294  }
295 
296  return;
297 }
boost::program_options::options_description * m_optionsDesc
void scanInputFileForMyOptions(const boost::program_options::options_description &optionsDesc) const
This method scans the input file provided by the user to QUESO.
Definition: Environment.C:397
void defineMyOptions(boost::program_options::options_description &optionsDesc) const
Define my SFP options as the default options.
void getMyOptionValues(boost::program_options::options_description &optionsDesc)
Gets the option values of the SFP.
std::ofstream * subDisplayFile() const
Access function for m_subDisplayFile (displays file on stream).
Definition: Environment.C:320

Member Data Documentation

const BaseEnvironment& QUESO::StatisticalForwardProblemOptions::m_env
private

Definition at line 184 of file StatisticalForwardProblemOptions.h.

std::string QUESO::StatisticalForwardProblemOptions::m_option_computeCorrelations
private

Definition at line 192 of file StatisticalForwardProblemOptions.h.

std::string QUESO::StatisticalForwardProblemOptions::m_option_computeCovariances
private

Definition at line 191 of file StatisticalForwardProblemOptions.h.

std::string QUESO::StatisticalForwardProblemOptions::m_option_computeSolution
private

Definition at line 190 of file StatisticalForwardProblemOptions.h.

std::string QUESO::StatisticalForwardProblemOptions::m_option_dataOutputAllowedSet
private

Definition at line 194 of file StatisticalForwardProblemOptions.h.

std::string QUESO::StatisticalForwardProblemOptions::m_option_dataOutputFileName
private

Definition at line 193 of file StatisticalForwardProblemOptions.h.

std::string QUESO::StatisticalForwardProblemOptions::m_option_help
private

Definition at line 189 of file StatisticalForwardProblemOptions.h.

std::string QUESO::StatisticalForwardProblemOptions::m_option_solver
private

Definition at line 196 of file StatisticalForwardProblemOptions.h.

boost::program_options::options_description* QUESO::StatisticalForwardProblemOptions::m_optionsDesc
private

Definition at line 187 of file StatisticalForwardProblemOptions.h.

SfpOptionsValues QUESO::StatisticalForwardProblemOptions::m_ov

Definition at line 172 of file StatisticalForwardProblemOptions.h.

std::string QUESO::StatisticalForwardProblemOptions::m_prefix

Definition at line 173 of file StatisticalForwardProblemOptions.h.


The documentation for this class was generated from the following files:

Generated on Tue Jun 5 2018 19:49:36 for queso-0.57.1 by  doxygen 1.8.5