queso-0.56.1
Public Attributes | Private Member Functions | Private Attributes | Friends | List of all members
QUESO::SipOptionsValues Class Reference

This class provides options for a Statistical Inverse Problem if no input file is available. More...

#include <StatisticalInverseProblemOptions.h>

Collaboration diagram for QUESO::SipOptionsValues:
Collaboration graph
[legend]

Public Member Functions

Constructor/Destructor methods
 SipOptionsValues ()
 Default constructor. More...
 
 SipOptionsValues (const BaseEnvironment *env, const char *prefix)
 
 SipOptionsValues (const SipOptionsValues &src)
 Copy constructor. More...
 
virtual ~SipOptionsValues ()
 Destructor. More...
 
Set methods
SipOptionsValuesoperator= (const SipOptionsValues &rhs)
 Assignment operator; it copies rhs to this. More...
 

Public Attributes

std::string m_prefix
 
std::string m_help
 If this string is non-empty, options are print to the output file. More...
 
bool m_computeSolution
 
std::string m_dataOutputFileName
 
std::set< unsigned int > m_dataOutputAllowedSet
 
bool m_seedWithMAPEstimator
 
bool m_useOptimizerMonitor
 

Private Member Functions

void copy (const SipOptionsValues &src)
 Copies the option values from src to this. More...
 
void checkOptions ()
 

Private Attributes

BoostInputOptionsParserm_parser
 
std::string m_option_help
 
std::string m_option_computeSolution
 
std::string m_option_dataOutputFileName
 
std::string m_option_dataOutputAllowedSet
 
std::string m_option_seedWithMAPEstimator
 
std::string m_option_useOptimizerMonitor
 

Friends

std::ostream & operator<< (std::ostream &os, const SipOptionsValues &obj)
 

Detailed Description

This class provides options for a Statistical Inverse Problem if no input file is available.

In order to solve a Statistical Inverse Problem (SIP), QUESO expects some options for its methods to be fully defined. This class provides default values for such options if no input file is available.

Definition at line 74 of file StatisticalInverseProblemOptions.h.

Constructor & Destructor Documentation

QUESO::SipOptionsValues::SipOptionsValues ( )

Default constructor.

Assigns the default suite of options to the Statistical Inverse Problem.

Definition at line 40 of file StatisticalInverseProblemOptions.C.

41  :
42  m_prefix("ip_"),
48 //m_dataOutputAllowedSet(),
49 #ifndef DISABLE_BOOST_PROGRAM_OPTIONS
50  m_parser(NULL),
51 #endif // DISABLE_BOOST_PROGRAM_OPTIONS
52  m_option_help (m_prefix + "help" ),
53  m_option_computeSolution (m_prefix + "computeSolution" ),
54  m_option_dataOutputFileName (m_prefix + "dataOutputFileName" ),
55  m_option_dataOutputAllowedSet(m_prefix + "dataOutputAllowedSet"),
56 #ifdef UQ_SIP_READS_SOLVER_OPTION
57  m_option_solver (m_prefix + "solver" ),
58  m_solverString (UQ_SIP_SOLVER_ODV)
59 #endif
60  m_option_seedWithMAPEstimator(m_prefix + "seedWithMAPEstimator"),
61  m_option_useOptimizerMonitor(m_prefix + "useOptimizerMonitor")
62 {
63 }
#define UQ_SIP_COMPUTE_SOLUTION_ODV
#define UQ_SIP_DATA_OUTPUT_FILE_NAME_ODV
#define UQ_SIP_SEEDWITHMAPESTIMATOR
std::string m_help
If this string is non-empty, options are print to the output file.
#define UQ_SIP_USEOPTIMIZERMONITOR
QUESO::SipOptionsValues::SipOptionsValues ( const BaseEnvironment env,
const char *  prefix 
)

Definition at line 65 of file StatisticalInverseProblemOptions.C.

References checkOptions(), QUESO::BoostInputOptionsParser::getOption(), QUESO::BaseEnvironment::input(), m_computeSolution, m_dataOutputAllowedSet, m_dataOutputFileName, m_help, m_option_computeSolution, m_option_dataOutputAllowedSet, m_option_dataOutputFileName, m_option_help, m_option_seedWithMAPEstimator, m_option_useOptimizerMonitor, m_parser, m_seedWithMAPEstimator, m_useOptimizerMonitor, QUESO::BoostInputOptionsParser::registerOption(), QUESO::BoostInputOptionsParser::scanInputFile(), UQ_SIP_COMPUTE_SOLUTION_ODV, UQ_SIP_DATA_OUTPUT_ALLOWED_SET_ODV, UQ_SIP_DATA_OUTPUT_FILE_NAME_ODV, UQ_SIP_HELP, UQ_SIP_SEEDWITHMAPESTIMATOR, UQ_SIP_USEOPTIMIZERMONITOR, and GetPot::vector_variable_size().

67  :
68  m_prefix((std::string)(prefix) + "ip_"),
74 //m_dataOutputAllowedSet(),
75 #ifndef DISABLE_BOOST_PROGRAM_OPTIONS
76  m_parser(new BoostInputOptionsParser(env->optionsInputFileName())),
77 #endif // DISABLE_BOOST_PROGRAM_OPTIONS
78  m_option_help (m_prefix + "help" ),
79  m_option_computeSolution (m_prefix + "computeSolution" ),
80  m_option_dataOutputFileName (m_prefix + "dataOutputFileName" ),
81  m_option_dataOutputAllowedSet(m_prefix + "dataOutputAllowedSet"),
82 #ifdef UQ_SIP_READS_SOLVER_OPTION
83  m_option_solver (m_prefix + "solver" ),
84  m_solverString (UQ_SIP_SOLVER_ODV)
85 #endif
86  m_option_seedWithMAPEstimator(m_prefix + "seedWithMAPEstimator"),
87  m_option_useOptimizerMonitor(m_prefix + "useOptimizerMonitor")
88 {
89 #ifndef DISABLE_BOOST_PROGRAM_OPTIONS
90  m_parser->registerOption<std::string>(m_option_help, UQ_SIP_HELP, "produce help message for statistical inverse problem");
91  m_parser->registerOption<bool >(m_option_computeSolution, UQ_SIP_COMPUTE_SOLUTION_ODV , "compute solution process" );
92  m_parser->registerOption<std::string>(m_option_dataOutputFileName, UQ_SIP_DATA_OUTPUT_FILE_NAME_ODV , "name of data output file" );
93  m_parser->registerOption<std::string>(m_option_dataOutputAllowedSet, UQ_SIP_DATA_OUTPUT_ALLOWED_SET_ODV, "subEnvs that will write to data output file" );
94 #ifdef UQ_SIP_READS_SOLVER_OPTION
95  m_parser->registerOption<std::string>(m_option_solver, UQ_SIP_SOLVER_ODV , "algorithm for calibration" );
96 #endif
97  m_parser->registerOption<bool >(m_option_seedWithMAPEstimator, UQ_SIP_SEEDWITHMAPESTIMATOR , "toggle for seeding chain at MAP" );
98  m_parser->registerOption<bool >(m_option_useOptimizerMonitor, UQ_SIP_USEOPTIMIZERMONITOR , "toggle for using optimizer monitor (prints diagnostics");
99 
101 
102  m_parser->getOption<std::string>(m_option_help, m_help);
106 #ifdef UQ_SIP_READS_SOLVER_OPTION
107  m_parser->getOption<std::string>(m_option_solver, m_solver);
108 #endif
111 #else
112  m_help = env->input()(m_option_help, UQ_SIP_HELP);
115 
116  // UQ_SIP_DATA_OUTPUT_ALLOWED_SET_ODV is the empty set (string) by default
117  unsigned int size = env->input().vector_variable_size(m_option_dataOutputAllowedSet);
118  for (unsigned int i = 0; i < size; i++) {
119  // We default to empty set, so the default values are actually never
120  // used here
121  unsigned int allowed = env->input()(m_option_dataOutputAllowedSet, i, i);
122  m_dataOutputAllowedSet.insert(allowed);
123  }
124 
125 #ifdef UQ_SIP_READS_SOLVER_OPTION
126  m_solver = env->input()(m_option_solver, UQ_SIP_SOLVER_ODV);
127 #endif
130 #endif // DISABLE_BOOST_PROGRAM_OPTIONS
131 
132  checkOptions();
133 }
#define UQ_SIP_COMPUTE_SOLUTION_ODV
void getOption(std::string &name, T &value)
Get option name from the parser and set value to the parsed value.
void scanInputFile()
This is the method that parses the input file.
std::set< unsigned int > m_dataOutputAllowedSet
#define UQ_SIP_DATA_OUTPUT_ALLOWED_SET_ODV
#define UQ_SIP_DATA_OUTPUT_FILE_NAME_ODV
void registerOption(std::string name, T defaultValue, std::string description)
Call this to register an option with the parser.
#define UQ_SIP_SEEDWITHMAPESTIMATOR
std::string m_help
If this string is non-empty, options are print to the output file.
#define UQ_SIP_USEOPTIMIZERMONITOR
QUESO::SipOptionsValues::SipOptionsValues ( const SipOptionsValues src)

Copy constructor.

It assigns the same options values from src to this.

Definition at line 135 of file StatisticalInverseProblemOptions.C.

References copy().

136 {
137  this->copy(src);
138 }
void copy(const SipOptionsValues &src)
Copies the option values from src to this.
QUESO::SipOptionsValues::~SipOptionsValues ( )
virtual

Destructor.

Definition at line 140 of file StatisticalInverseProblemOptions.C.

141 {
142 }

Member Function Documentation

void QUESO::SipOptionsValues::checkOptions ( )
private

Definition at line 153 of file StatisticalInverseProblemOptions.C.

Referenced by SipOptionsValues().

154 {
155  // Nothing
156 }
void QUESO::SipOptionsValues::copy ( const SipOptionsValues src)
private

Copies the option values from src to this.

Definition at line 159 of file StatisticalInverseProblemOptions.C.

References m_computeSolution, m_dataOutputAllowedSet, m_dataOutputFileName, m_seedWithMAPEstimator, and m_useOptimizerMonitor.

Referenced by operator=(), and SipOptionsValues().

160 {
161  m_computeSolution = src.m_computeSolution;
162  m_dataOutputFileName = src.m_dataOutputFileName;
163  m_dataOutputAllowedSet = src.m_dataOutputAllowedSet;
164 #ifdef UQ_SIP_READS_SOLVER_OPTION
165  m_solverString = src.m_solverString;
166 #endif
167  m_seedWithMAPEstimator = src.m_seedWithMAPEstimator;
168  m_useOptimizerMonitor = src.m_useOptimizerMonitor;
169 }
std::set< unsigned int > m_dataOutputAllowedSet
SipOptionsValues & QUESO::SipOptionsValues::operator= ( const SipOptionsValues rhs)

Assignment operator; it copies rhs to this.

Definition at line 146 of file StatisticalInverseProblemOptions.C.

References copy().

147 {
148  this->copy(rhs);
149  return *this;
150 }
void copy(const SipOptionsValues &src)
Copies the option values from src to this.

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  os,
const SipOptionsValues obj 
)
friend

Definition at line 172 of file StatisticalInverseProblemOptions.C.

173 {
174  os << "\n" << obj.m_option_computeSolution << " = " << obj.m_computeSolution
175  << "\n" << obj.m_option_dataOutputFileName << " = " << obj.m_dataOutputFileName;
176  os << "\n" << obj.m_option_dataOutputAllowedSet << " = ";
177  for (std::set<unsigned int>::iterator setIt = obj.m_dataOutputAllowedSet.begin(); setIt != obj.m_dataOutputAllowedSet.end(); ++setIt) {
178  os << *setIt << " ";
179  }
180 #ifdef UQ_SIP_READS_SOLVER_OPTION
181  << "\n" << obj.m_option_solver << " = " << obj.m_solverString
182 #endif
183  os << std::endl;
184  return os;
185 }

Member Data Documentation

bool QUESO::SipOptionsValues::m_computeSolution
std::set<unsigned int> QUESO::SipOptionsValues::m_dataOutputAllowedSet
std::string QUESO::SipOptionsValues::m_dataOutputFileName
std::string QUESO::SipOptionsValues::m_help

If this string is non-empty, options are print to the output file.

Definition at line 101 of file StatisticalInverseProblemOptions.h.

Referenced by SipOptionsValues(), and QUESO::StatisticalInverseProblem< P_V, P_M >::StatisticalInverseProblem().

std::string QUESO::SipOptionsValues::m_option_computeSolution
private

Definition at line 120 of file StatisticalInverseProblemOptions.h.

Referenced by QUESO::operator<<(), and SipOptionsValues().

std::string QUESO::SipOptionsValues::m_option_dataOutputAllowedSet
private

Definition at line 122 of file StatisticalInverseProblemOptions.h.

Referenced by QUESO::operator<<(), and SipOptionsValues().

std::string QUESO::SipOptionsValues::m_option_dataOutputFileName
private

Definition at line 121 of file StatisticalInverseProblemOptions.h.

Referenced by QUESO::operator<<(), and SipOptionsValues().

std::string QUESO::SipOptionsValues::m_option_help
private

Definition at line 119 of file StatisticalInverseProblemOptions.h.

Referenced by SipOptionsValues().

std::string QUESO::SipOptionsValues::m_option_seedWithMAPEstimator
private

Definition at line 126 of file StatisticalInverseProblemOptions.h.

Referenced by SipOptionsValues().

std::string QUESO::SipOptionsValues::m_option_useOptimizerMonitor
private

Definition at line 127 of file StatisticalInverseProblemOptions.h.

Referenced by SipOptionsValues().

BoostInputOptionsParser* QUESO::SipOptionsValues::m_parser
private

Definition at line 115 of file StatisticalInverseProblemOptions.h.

Referenced by SipOptionsValues().

std::string QUESO::SipOptionsValues::m_prefix
bool QUESO::SipOptionsValues::m_seedWithMAPEstimator
bool QUESO::SipOptionsValues::m_useOptimizerMonitor

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

Generated on Thu Dec 15 2016 13:23:16 for queso-0.56.1 by  doxygen 1.8.5