queso-0.53.0
Public Member Functions | Public Attributes | Private Member Functions | Private Attributes | List of all members
QUESO::ExperimentModelOptions Class Reference

#include <ExperimentModelOptions.h>

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

Public Member Functions

 ExperimentModelOptions (const BaseEnvironment &env, const char *prefix)
 
 ExperimentModelOptions (const BaseEnvironment &env, const char *prefix, const EmOptionsValues &alternativeOptionsValues)
 
 ~ExperimentModelOptions ()
 
void scanOptionsValues ()
 
void print (std::ostream &os) const
 

Public Attributes

EmOptionsValues m_ov
 
std::string m_prefix
 

Private Member Functions

void defineMyOptions (boost::program_options::options_description &optionsDesc) const
 
void getMyOptionValues (boost::program_options::options_description &optionsDesc)
 

Private Attributes

const BaseEnvironmentm_env
 
boost::program_options::options_description * m_optionsDesc
 
std::string m_option_help
 
std::string m_option_Gvalues
 
std::string m_option_a_v
 
std::string m_option_b_v
 
std::string m_option_a_rho_v
 
std::string m_option_b_rho_v
 
std::string m_option_a_y
 
std::string m_option_b_y
 

Detailed Description

Definition at line 82 of file ExperimentModelOptions.h.

Constructor & Destructor Documentation

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

Definition at line 194 of file ExperimentModelOptions.C.

References m_env, QUESO::BaseEnvironment::optionsInputFileName(), queso_deprecated, and queso_require_not_equal_to_msg.

197  :
198  m_ov (),
199  m_prefix ((std::string)(prefix) + "em_"),
200  m_env (env),
201  m_optionsDesc (new boost::program_options::options_description("Experiment model options")),
202  m_option_help (m_prefix + "help" ),
203  m_option_Gvalues(m_prefix + "Gvalues"),
204  m_option_a_v (m_prefix + "a_v" ),
205  m_option_b_v (m_prefix + "b_v" ),
206  m_option_a_rho_v(m_prefix + "a_rho_v"),
207  m_option_b_rho_v(m_prefix + "b_rho_v"),
208  m_option_a_y (m_prefix + "a_y" ),
209  m_option_b_y (m_prefix + "b_y" )
210 {
212 
213  queso_require_not_equal_to_msg(m_env.optionsInputFileName(), "", "this constructor is incompatible with the abscense of an options input file");
214 }
#define queso_require_not_equal_to_msg(expr1, expr2, msg)
Definition: asserts.h:86
std::string optionsInputFileName() const
Access to the attribute m_optionsInputFileName, which stores the name of the input file passed by the...
Definition: Environment.C:307
boost::program_options::options_description * m_optionsDesc
#define queso_deprecated()
Definition: Defines.h:120
QUESO::ExperimentModelOptions::ExperimentModelOptions ( const BaseEnvironment env,
const char *  prefix,
const EmOptionsValues alternativeOptionsValues 
)

Definition at line 216 of file ExperimentModelOptions.C.

References m_env, m_prefix, QUESO::BaseEnvironment::optionsInputFileName(), queso_deprecated, queso_require_equal_to_msg, and QUESO::BaseEnvironment::subDisplayFile().

220  :
221  m_ov (alternativeOptionsValues),
222  m_prefix ((std::string)(prefix) + "em_"),
223  m_env (env),
224  m_optionsDesc (NULL),
225  m_option_help (m_prefix + "help" ),
226  m_option_Gvalues(m_prefix + "Gvalues"),
227  m_option_a_v (m_prefix + "a_v" ),
228  m_option_b_v (m_prefix + "b_v" ),
229  m_option_a_rho_v(m_prefix + "a_rho_v"),
230  m_option_b_rho_v(m_prefix + "b_rho_v"),
231  m_option_a_y (m_prefix + "a_y" ),
232  m_option_b_y (m_prefix + "b_y" )
233 {
235 
236  queso_require_equal_to_msg(m_env.optionsInputFileName(), "", "this constructor is incompatible with the existence of an options input file");
237 
238  if (m_env.subDisplayFile() != NULL) {
239  *m_env.subDisplayFile() << "In ExperimentModelOptions::constructor(2)"
240  << ": after setting values of options with prefix '" << m_prefix
241  << "', state of object is:"
242  << "\n" << *this
243  << std::endl;
244  }
245 }
#define queso_require_equal_to_msg(expr1, expr2, msg)
Definition: asserts.h:85
std::string optionsInputFileName() const
Access to the attribute m_optionsInputFileName, which stores the name of the input file passed by the...
Definition: Environment.C:307
boost::program_options::options_description * m_optionsDesc
std::ofstream * subDisplayFile() const
Access function for m_subDisplayFile (displays file on stream).
Definition: Environment.C:274
#define queso_deprecated()
Definition: Defines.h:120
QUESO::ExperimentModelOptions::~ExperimentModelOptions ( )

Definition at line 247 of file ExperimentModelOptions.C.

References m_optionsDesc, and queso_deprecated.

248 {
250 
251  if (m_optionsDesc) delete m_optionsDesc;
252 }
boost::program_options::options_description * m_optionsDesc
#define queso_deprecated()
Definition: Defines.h:120

Member Function Documentation

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

Definition at line 277 of file ExperimentModelOptions.C.

References m_option_a_rho_v, m_option_a_v, m_option_a_y, m_option_b_rho_v, m_option_b_v, m_option_b_y, m_option_Gvalues, m_option_help, queso_deprecated, UQ_EXPERIMENT_MODEL_A_RHO_V_ODV, UQ_EXPERIMENT_MODEL_A_V_ODV, UQ_EXPERIMENT_MODEL_A_Y_ODV, UQ_EXPERIMENT_MODEL_B_RHO_V_ODV, UQ_EXPERIMENT_MODEL_B_V_ODV, UQ_EXPERIMENT_MODEL_B_Y_ODV, and UQ_EXPERIMENT_MODEL_G_VALUES_ODV.

Referenced by scanOptionsValues().

278 {
280 
281  optionsDesc.add_options()
282  (m_option_help.c_str(), "produce help message for experiment model options")
283  (m_option_Gvalues.c_str(), boost::program_options::value<std::string >()->default_value(UQ_EXPERIMENT_MODEL_G_VALUES_ODV), "G values" )
284  (m_option_a_v.c_str(), boost::program_options::value<double >()->default_value(UQ_EXPERIMENT_MODEL_A_V_ODV ), "a_v" )
285  (m_option_b_v.c_str(), boost::program_options::value<double >()->default_value(UQ_EXPERIMENT_MODEL_B_V_ODV ), "b_v" )
286  (m_option_a_rho_v.c_str(), boost::program_options::value<double >()->default_value(UQ_EXPERIMENT_MODEL_A_RHO_V_ODV ), "a_rho_v" )
287  (m_option_b_rho_v.c_str(), boost::program_options::value<double >()->default_value(UQ_EXPERIMENT_MODEL_B_RHO_V_ODV ), "b_rho_v" )
288  (m_option_a_y.c_str(), boost::program_options::value<double >()->default_value(UQ_EXPERIMENT_MODEL_A_Y_ODV ), "a_y" )
289  (m_option_b_y.c_str(), boost::program_options::value<double >()->default_value(UQ_EXPERIMENT_MODEL_B_Y_ODV ), "b_y" )
290  ;
291 
292  return;
293 }
#define UQ_EXPERIMENT_MODEL_A_RHO_V_ODV
#define UQ_EXPERIMENT_MODEL_B_Y_ODV
#define UQ_EXPERIMENT_MODEL_B_RHO_V_ODV
#define queso_deprecated()
Definition: Defines.h:120
#define UQ_EXPERIMENT_MODEL_A_Y_ODV
#define UQ_EXPERIMENT_MODEL_G_VALUES_ODV
#define UQ_EXPERIMENT_MODEL_B_V_ODV
#define UQ_EXPERIMENT_MODEL_A_V_ODV
void QUESO::ExperimentModelOptions::getMyOptionValues ( boost::program_options::options_description &  optionsDesc)
private

Definition at line 296 of file ExperimentModelOptions.C.

References QUESO::BaseEnvironment::allOptionsMap(), QUESO::EmOptionsValues::m_a_rho_v, QUESO::EmOptionsValues::m_a_v, QUESO::EmOptionsValues::m_a_y, QUESO::EmOptionsValues::m_b_rho_v, QUESO::EmOptionsValues::m_b_v, QUESO::EmOptionsValues::m_b_y, m_env, QUESO::EmOptionsValues::m_Gvalues, m_option_a_rho_v, m_option_a_v, m_option_a_y, m_option_b_rho_v, m_option_b_v, m_option_b_y, m_option_Gvalues, m_option_help, m_ov, QUESO::MiscReadDoublesFromString(), queso_deprecated, and QUESO::BaseEnvironment::subDisplayFile().

Referenced by scanOptionsValues().

297 {
299 
300  if (m_env.allOptionsMap().count(m_option_help)) {
301  if (m_env.subDisplayFile()) {
302  *m_env.subDisplayFile() << optionsDesc
303  << std::endl;
304  }
305  }
306 
307  std::vector<double> tmpValues(0,0.);
308  if (m_env.allOptionsMap().count(m_option_Gvalues)) {
309  std::string inputString = ((const boost::program_options::variable_value&) m_env.allOptionsMap()[m_option_Gvalues]).as<std::string>();
310  MiscReadDoublesFromString(inputString,tmpValues);
311  //if (m_env.subDisplayFile()) {
312  // *m_env.subDisplayFile() << "In ExperimentModelOptions::getMyOptionValues(): tmpValues =";
313  // for (unsigned int i = 0; i < tmpValues.size(); ++i) {
314  // *m_env.subDisplayFile() << " " << tmpValues[i];
315  // }
316  // *m_env.subDisplayFile() << std::endl;
317  //}
318  unsigned int tmpSize = tmpValues.size();
319  m_ov.m_Gvalues.clear();
320  m_ov.m_Gvalues.resize(tmpSize,0);
321  for (unsigned int i = 0; i < tmpSize; ++i) {
322  m_ov.m_Gvalues[i] = (unsigned int) tmpValues[i];
323  }
324  }
325 
326  if (m_env.allOptionsMap().count(m_option_a_v)) {
327  m_ov.m_a_v = ((const boost::program_options::variable_value&) m_env.allOptionsMap()[m_option_a_v]).as<double>();
328  }
329 
330  if (m_env.allOptionsMap().count(m_option_b_v)) {
331  m_ov.m_b_v = ((const boost::program_options::variable_value&) m_env.allOptionsMap()[m_option_b_v]).as<double>();
332  }
333 
334  if (m_env.allOptionsMap().count(m_option_a_rho_v)) {
335  m_ov.m_a_rho_v = ((const boost::program_options::variable_value&) m_env.allOptionsMap()[m_option_a_rho_v]).as<double>();
336  }
337 
338  if (m_env.allOptionsMap().count(m_option_b_rho_v)) {
339  m_ov.m_b_rho_v = ((const boost::program_options::variable_value&) m_env.allOptionsMap()[m_option_b_rho_v]).as<double>();
340  }
341 
342  if (m_env.allOptionsMap().count(m_option_a_y)) {
343  m_ov.m_a_y = ((const boost::program_options::variable_value&) m_env.allOptionsMap()[m_option_a_y]).as<double>();
344  }
345 
346  if (m_env.allOptionsMap().count(m_option_b_y)) {
347  m_ov.m_b_y = ((const boost::program_options::variable_value&) m_env.allOptionsMap()[m_option_b_y]).as<double>();
348  }
349 
350  return;
351 }
boost::program_options::variables_map & allOptionsMap() const
Definition: Environment.C:336
std::ofstream * subDisplayFile() const
Access function for m_subDisplayFile (displays file on stream).
Definition: Environment.C:274
void MiscReadDoublesFromString(const std::string &inputString, std::vector< double > &outputDoubles)
Definition: Miscellaneous.C:40
#define queso_deprecated()
Definition: Defines.h:120
std::vector< unsigned int > m_Gvalues
void QUESO::ExperimentModelOptions::print ( std::ostream &  os) const

Definition at line 354 of file ExperimentModelOptions.C.

References QUESO::EmOptionsValues::m_a_rho_v, QUESO::EmOptionsValues::m_a_v, QUESO::EmOptionsValues::m_a_y, QUESO::EmOptionsValues::m_b_rho_v, QUESO::EmOptionsValues::m_b_v, QUESO::EmOptionsValues::m_b_y, QUESO::EmOptionsValues::m_Gvalues, m_option_a_rho_v, m_option_a_v, m_option_a_y, m_option_b_rho_v, m_option_b_v, m_option_b_y, m_option_Gvalues, m_ov, and queso_deprecated.

Referenced by QUESO::operator<<().

355 {
357 
358  os << "\n" << m_option_Gvalues << " = ";
359  for (unsigned int i = 0; i < m_ov.m_Gvalues.size(); ++i) {
360  os << m_ov.m_Gvalues[i] << " ";
361  }
362  os << "\n" << m_option_a_v << " = " << m_ov.m_a_v
363  << "\n" << m_option_b_v << " = " << m_ov.m_b_v
364  << "\n" << m_option_a_rho_v << " = " << m_ov.m_a_rho_v
365  << "\n" << m_option_b_rho_v << " = " << m_ov.m_b_rho_v
366  << "\n" << m_option_a_y << " = " << m_ov.m_a_y
367  << "\n" << m_option_b_y << " = " << m_ov.m_b_y
368  << std::endl;
369 
370  return;
371 }
#define queso_deprecated()
Definition: Defines.h:120
std::vector< unsigned int > m_Gvalues
void QUESO::ExperimentModelOptions::scanOptionsValues ( )

Definition at line 255 of file ExperimentModelOptions.C.

References defineMyOptions(), getMyOptionValues(), m_env, m_optionsDesc, m_prefix, queso_deprecated, queso_require_msg, QUESO::BaseEnvironment::scanInputFileForMyOptions(), and QUESO::BaseEnvironment::subDisplayFile().

256 {
258 
259  queso_require_msg(m_optionsDesc, "m_optionsDesc variable is NULL");
260 
264 
265  if (m_env.subDisplayFile() != NULL) {
266  *m_env.subDisplayFile() << "In ExperimentModelOptions::scanOptionsValues()"
267  << ": after reading values of options with prefix '" << m_prefix
268  << "', state of object is:"
269  << "\n" << *this
270  << std::endl;
271  }
272 
273  return;
274 }
void defineMyOptions(boost::program_options::options_description &optionsDesc) const
void getMyOptionValues(boost::program_options::options_description &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:345
#define queso_require_msg(asserted, msg)
Definition: asserts.h:69
boost::program_options::options_description * m_optionsDesc
std::ofstream * subDisplayFile() const
Access function for m_subDisplayFile (displays file on stream).
Definition: Environment.C:274
#define queso_deprecated()
Definition: Defines.h:120

Member Data Documentation

const BaseEnvironment& QUESO::ExperimentModelOptions::m_env
private
std::string QUESO::ExperimentModelOptions::m_option_a_rho_v
private

Definition at line 106 of file ExperimentModelOptions.h.

Referenced by defineMyOptions(), getMyOptionValues(), and print().

std::string QUESO::ExperimentModelOptions::m_option_a_v
private

Definition at line 104 of file ExperimentModelOptions.h.

Referenced by defineMyOptions(), getMyOptionValues(), and print().

std::string QUESO::ExperimentModelOptions::m_option_a_y
private

Definition at line 108 of file ExperimentModelOptions.h.

Referenced by defineMyOptions(), getMyOptionValues(), and print().

std::string QUESO::ExperimentModelOptions::m_option_b_rho_v
private

Definition at line 107 of file ExperimentModelOptions.h.

Referenced by defineMyOptions(), getMyOptionValues(), and print().

std::string QUESO::ExperimentModelOptions::m_option_b_v
private

Definition at line 105 of file ExperimentModelOptions.h.

Referenced by defineMyOptions(), getMyOptionValues(), and print().

std::string QUESO::ExperimentModelOptions::m_option_b_y
private

Definition at line 109 of file ExperimentModelOptions.h.

Referenced by defineMyOptions(), getMyOptionValues(), and print().

std::string QUESO::ExperimentModelOptions::m_option_Gvalues
private

Definition at line 103 of file ExperimentModelOptions.h.

Referenced by defineMyOptions(), getMyOptionValues(), and print().

std::string QUESO::ExperimentModelOptions::m_option_help
private

Definition at line 102 of file ExperimentModelOptions.h.

Referenced by defineMyOptions(), and getMyOptionValues().

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

Definition at line 101 of file ExperimentModelOptions.h.

Referenced by scanOptionsValues(), and ~ExperimentModelOptions().

EmOptionsValues QUESO::ExperimentModelOptions::m_ov

Definition at line 92 of file ExperimentModelOptions.h.

Referenced by getMyOptionValues(), and print().

std::string QUESO::ExperimentModelOptions::m_prefix

Definition at line 93 of file ExperimentModelOptions.h.

Referenced by ExperimentModelOptions(), and scanOptionsValues().


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

Generated on Thu Jun 11 2015 13:52:34 for queso-0.53.0 by  doxygen 1.8.5