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

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

#include <StatisticalInverseProblemOptions.h>

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
 
std::string m_solverString
 
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

ScopedPtr
< BoostInputOptionsParser >
::Type 
m_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_solver
 
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 75 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 43 of file StatisticalInverseProblemOptions.C.

44  :
45  m_prefix("ip_"),
46  m_help(UQ_SIP_HELP),
47  m_computeSolution (UQ_SIP_COMPUTE_SOLUTION_ODV ),
48  m_dataOutputFileName (UQ_SIP_DATA_OUTPUT_FILE_NAME_ODV),
49  m_seedWithMAPEstimator(UQ_SIP_SEEDWITHMAPESTIMATOR),
50  m_useOptimizerMonitor(UQ_SIP_USEOPTIMIZERMONITOR),
51 //m_dataOutputAllowedSet(),
52 #ifndef QUESO_DISABLE_BOOST_PROGRAM_OPTIONS
53  m_parser(),
54 #endif // 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)
62 #endif
63  m_option_seedWithMAPEstimator(m_prefix + "seedWithMAPEstimator"),
64  m_option_useOptimizerMonitor(m_prefix + "useOptimizerMonitor")
65 {
66 }
ScopedPtr< BoostInputOptionsParser >::Type m_parser
std::string m_help
If this string is non-empty, options are print to the output file.
QUESO::SipOptionsValues::SipOptionsValues ( const BaseEnvironment env,
const char *  prefix 
)

Definition at line 68 of file StatisticalInverseProblemOptions.C.

References checkOptions(), 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_solver, m_option_useOptimizerMonitor, m_parser, m_seedWithMAPEstimator, QUESO::m_solver, m_useOptimizerMonitor, and QUESO::size.

70  :
71  m_prefix((std::string)(prefix) + "ip_"),
72  m_help(UQ_SIP_HELP),
73  m_computeSolution (UQ_SIP_COMPUTE_SOLUTION_ODV ),
74  m_dataOutputFileName (UQ_SIP_DATA_OUTPUT_FILE_NAME_ODV),
75  m_seedWithMAPEstimator(UQ_SIP_SEEDWITHMAPESTIMATOR),
76  m_useOptimizerMonitor(UQ_SIP_USEOPTIMIZERMONITOR),
77 //m_dataOutputAllowedSet(),
78 #ifndef QUESO_DISABLE_BOOST_PROGRAM_OPTIONS
79  m_parser(new BoostInputOptionsParser(env->optionsInputFileName())),
80 #endif // 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)
88 #endif
89  m_option_seedWithMAPEstimator(m_prefix + "seedWithMAPEstimator"),
90  m_option_useOptimizerMonitor(m_prefix + "useOptimizerMonitor")
91 {
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");
94  m_parser->registerOption<bool >(m_option_computeSolution, UQ_SIP_COMPUTE_SOLUTION_ODV , "compute solution process" );
95  m_parser->registerOption<std::string>(m_option_dataOutputFileName, UQ_SIP_DATA_OUTPUT_FILE_NAME_ODV , "name of data output file" );
96  m_parser->registerOption<std::string>(m_option_dataOutputAllowedSet, UQ_SIP_DATA_OUTPUT_ALLOWED_SET_ODV, "subEnvs that will write to data output file" );
97 #ifdef UQ_SIP_READS_SOLVER_OPTION
98  m_parser->registerOption<std::string>(m_option_solver, UQ_SIP_SOLVER_ODV , "algorithm for calibration" );
99 #endif
100  m_parser->registerOption<bool >(m_option_seedWithMAPEstimator, UQ_SIP_SEEDWITHMAPESTIMATOR , "toggle for seeding chain at MAP" );
101  m_parser->registerOption<bool >(m_option_useOptimizerMonitor, UQ_SIP_USEOPTIMIZERMONITOR , "toggle for using optimizer monitor (prints diagnostics");
102 
103  m_parser->scanInputFile();
104 
105  m_parser->getOption<std::string>(m_option_help, m_help);
108  m_parser->getOption<std::set<unsigned int> >(m_option_dataOutputAllowedSet, m_dataOutputAllowedSet);
109 #ifdef UQ_SIP_READS_SOLVER_OPTION
110  m_parser->getOption<std::string>(m_option_solver, m_solver);
111 #endif
114 #else
115  m_help = env->input()(m_option_help, UQ_SIP_HELP);
116  m_computeSolution = env->input()(m_option_computeSolution, UQ_SIP_COMPUTE_SOLUTION_ODV);
117  m_dataOutputFileName = env->input()(m_option_dataOutputFileName, UQ_SIP_DATA_OUTPUT_FILE_NAME_ODV);
118 
119  // UQ_SIP_DATA_OUTPUT_ALLOWED_SET_ODV is the empty set (string) by default
120  unsigned int size = env->input().vector_variable_size(m_option_dataOutputAllowedSet);
121  for (unsigned int i = 0; i < size; i++) {
122  // We default to empty set, so the default values are actually never
123  // used here
124  unsigned int allowed = env->input()(m_option_dataOutputAllowedSet, i, i);
125  m_dataOutputAllowedSet.insert(allowed);
126  }
127 
128 #ifdef UQ_SIP_READS_SOLVER_OPTION
129  m_solver = env->input()(m_option_solver, UQ_SIP_SOLVER_ODV);
130 #endif
131  m_seedWithMAPEstimator = env->input()(m_option_seedWithMAPEstimator, UQ_SIP_SEEDWITHMAPESTIMATOR);
132  m_useOptimizerMonitor = env->input()(m_option_useOptimizerMonitor, UQ_SIP_USEOPTIMIZERMONITOR);
133 #endif // QUESO_DISABLE_BOOST_PROGRAM_OPTIONS
134 
135  checkOptions();
136 }
ScopedPtr< BoostInputOptionsParser >::Type m_parser
std::string m_help
If this string is non-empty, options are print to the output file.
std::set< unsigned int > m_dataOutputAllowedSet
QUESO::SipOptionsValues::SipOptionsValues ( const SipOptionsValues src)

Copy constructor.

It assigns the same options values from src to this.

Definition at line 138 of file StatisticalInverseProblemOptions.C.

References copy().

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

Destructor.

Definition at line 143 of file StatisticalInverseProblemOptions.C.

144 {
145 }

Member Function Documentation

void QUESO::SipOptionsValues::checkOptions ( )
private

Definition at line 156 of file StatisticalInverseProblemOptions.C.

Referenced by SipOptionsValues().

157 {
158  // Nothing
159 }
void QUESO::SipOptionsValues::copy ( const SipOptionsValues src)
private

Copies the option values from src to this.

Definition at line 162 of file StatisticalInverseProblemOptions.C.

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

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

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

Assignment operator; it copies rhs to this.

Definition at line 149 of file StatisticalInverseProblemOptions.C.

References copy().

150 {
151  this->copy(rhs);
152  return *this;
153 }
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 175 of file StatisticalInverseProblemOptions.C.

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

Member Data Documentation

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

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

Definition at line 102 of file StatisticalInverseProblemOptions.h.

Referenced by SipOptionsValues().

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

Definition at line 121 of file StatisticalInverseProblemOptions.h.

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

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

Definition at line 123 of file StatisticalInverseProblemOptions.h.

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

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

Definition at line 122 of file StatisticalInverseProblemOptions.h.

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

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

Definition at line 120 of file StatisticalInverseProblemOptions.h.

Referenced by SipOptionsValues().

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

Definition at line 127 of file StatisticalInverseProblemOptions.h.

Referenced by SipOptionsValues().

std::string QUESO::SipOptionsValues::m_option_solver
private

Definition at line 125 of file StatisticalInverseProblemOptions.h.

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

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

Definition at line 128 of file StatisticalInverseProblemOptions.h.

Referenced by SipOptionsValues().

ScopedPtr<BoostInputOptionsParser>::Type QUESO::SipOptionsValues::m_parser
private

Definition at line 116 of file StatisticalInverseProblemOptions.h.

Referenced by SipOptionsValues().

std::string QUESO::SipOptionsValues::m_prefix

Definition at line 99 of file StatisticalInverseProblemOptions.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