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

This class provides options for the Multilevel sequence generator if no input file is available. More...

#include <MLSamplingOptions.h>

Public Member Functions

Constructor/Destructor methods
 MLSamplingOptions (const BaseEnvironment &env, const char *prefix)
 Default constructor. More...
 
virtual ~MLSamplingOptions ()
 Destructor. More...
 
I/O methods
void print (std::ostream &os) const
 It prints the option values. More...
 

Public Attributes

std::string m_prefix
 Class prefix. (ml) More...
 
std::string m_help
 If non-empty string, options and values are printed to the output file. More...
 
unsigned int m_restartOutput_levelPeriod
 Period of restart output file (level). More...
 
std::string m_restartOutput_baseNameForFiles
 Base name of restart output file. More...
 
std::string m_restartOutput_fileType
 Type of restart output file. More...
 
std::string m_restartInput_baseNameForFiles
 Base name of restart input file. More...
 
std::string m_restartInput_fileType
 Type of restart input file. More...
 
std::string m_restartInputFileName
 Name of restart input file. More...
 
std::string m_restartInputFileType
 Type of restart input file. More...
 
unsigned int m_restartChainSize
 Size of restart chain. More...
 
std::string m_dataOutputFileName
 Name of generic output file. More...
 
bool m_dataOutputAllowAll
 subEnvs that will write to generic output file More...
 
std::set< unsigned int > m_dataOutputAllowedSet
 

Private Member Functions

void checkOptions (const BaseEnvironment *env)
 

Private Attributes

const BaseEnvironmentm_env
 
BoostInputOptionsParserm_parser
 
std::string m_option_help
 
std::string m_option_restartOutput_levelPeriod
 
std::string m_option_restartOutput_baseNameForFiles
 
std::string m_option_restartOutput_fileType
 
std::string m_option_restartInput_baseNameForFiles
 
std::string m_option_restartInput_fileType
 
std::string m_option_restartInputFileName
 
std::string m_option_restartInputFileType
 
std::string m_option_restartChainSize
 
std::string m_option_dataOutputFileName
 
std::string m_option_dataOutputAllowAll
 
std::string m_option_dataOutputAllowedSet
 

Friends

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

Detailed Description

This class provides options for the Multilevel sequence generator if no input file is available.

Multilevel sequence generator expects options for its methods. This class provides default values for such options if no input file is available.

Definition at line 72 of file MLSamplingOptions.h.

Constructor & Destructor Documentation

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

Default constructor.

Assigns the default suite of options to the Multilevel sequence generator.

Definition at line 31 of file MLSamplingOptions.C.

References checkOptions(), QUESO::BoostInputOptionsParser::getOption(), QUESO::BaseEnvironment::input(), m_dataOutputAllowedSet, m_dataOutputFileName, m_env, m_help, m_option_dataOutputAllowedSet, m_option_dataOutputFileName, m_option_help, m_option_restartChainSize, m_option_restartInput_baseNameForFiles, m_option_restartInput_fileType, m_option_restartInputFileName, m_option_restartInputFileType, m_option_restartOutput_baseNameForFiles, m_option_restartOutput_fileType, m_option_restartOutput_levelPeriod, m_parser, m_restartChainSize, m_restartInput_baseNameForFiles, m_restartInput_fileType, m_restartInputFileName, m_restartInputFileType, m_restartOutput_baseNameForFiles, m_restartOutput_fileType, m_restartOutput_levelPeriod, QUESO::BoostInputOptionsParser::registerOption(), QUESO::BoostInputOptionsParser::scanInputFile(), and QUESO::size.

32  :
33  m_prefix ((std::string)(prefix) + "ml_" ),
34  m_help (UQ_ML_SAMPLING_HELP),
35 #ifdef ML_CODE_HAS_NEW_RESTART_CAPABILITY
36  m_restartOutput_levelPeriod (UQ_ML_SAMPLING_RESTART_OUTPUT_LEVEL_PERIOD_ODV ),
37  m_restartOutput_baseNameForFiles (UQ_ML_SAMPLING_RESTART_OUTPUT_BASE_NAME_FOR_FILES_ODV),
38  m_restartOutput_fileType (UQ_ML_SAMPLING_RESTART_OUTPUT_FILE_TYPE_ODV ),
39  m_restartInput_baseNameForFiles (UQ_ML_SAMPLING_RESTART_INPUT_BASE_NAME_FOR_FILES_ODV ),
40  m_restartInput_fileType (UQ_ML_SAMPLING_RESTART_INPUT_FILE_TYPE_ODV ),
41 #else
42  m_restartInputFileName (UQ_ML_SAMPLING_RESTART_INPUT_FILE_NAME_ODV),
43  m_restartInputFileType (UQ_ML_SAMPLING_RESTART_INPUT_FILE_TYPE_ODV),
44  m_restartChainSize (UQ_ML_SAMPLING_RESTART_CHAIN_SIZE_ODV ),
45 #endif
46  m_dataOutputFileName (UQ_ML_SAMPLING_DATA_OUTPUT_FILE_NAME_ODV ),
47  //m_dataOutputAllowedSet (),
48  m_env (env),
49 #ifndef QUESO_DISABLE_BOOST_PROGRAM_OPTIONS
50  m_parser(new BoostInputOptionsParser(env.optionsInputFileName())),
51 #endif // QUESO_DISABLE_BOOST_PROGRAM_OPTIONS
52  m_option_help (m_prefix + "help" ),
53 #ifdef ML_CODE_HAS_NEW_RESTART_CAPABILITY
54  m_option_restartOutput_levelPeriod (m_prefix + "restartOutput_levelPeriod" ),
55  m_option_restartOutput_baseNameForFiles(m_prefix + "restartOutput_baseNameForFiles"),
56  m_option_restartOutput_fileType (m_prefix + "restartOutput_fileType" ),
57  m_option_restartInput_baseNameForFiles (m_prefix + "restartInput_baseNameForFiles" ),
58  m_option_restartInput_fileType (m_prefix + "restartInput_fileType" ),
59 #else
60  m_option_restartInputFileName (m_prefix + "restartInputFileName"),
61  m_option_restartInputFileType (m_prefix + "restartInputFileType"),
62  m_option_restartChainSize (m_prefix + "restartChainSize" ),
63 #endif
64  m_option_dataOutputFileName (m_prefix + "dataOutputFileName" ),
65  m_option_dataOutputAllowedSet (m_prefix + "dataOutputAllowedSet")
66 {
67 #ifndef QUESO_DISABLE_BOOST_PROGRAM_OPTIONS
68  m_parser->registerOption<std::string >(m_option_help, UQ_ML_SAMPLING_HELP, "produce help msg for ML sampling options" );
69 #ifdef ML_CODE_HAS_NEW_RESTART_CAPABILITY
70  m_parser->registerOption<unsigned int>(m_option_restartOutput_levelPeriod, UQ_ML_SAMPLING_RESTART_OUTPUT_LEVEL_PERIOD_ODV, "restartOutput_levelPeriod" );
71  m_parser->registerOption<std::string >(m_option_restartOutput_baseNameForFiles, UQ_ML_SAMPLING_RESTART_OUTPUT_BASE_NAME_FOR_FILES_ODV, "restartOutput_baseNameForFiles" );
72  m_parser->registerOption<std::string >(m_option_restartOutput_fileType, UQ_ML_SAMPLING_RESTART_OUTPUT_FILE_TYPE_ODV, "restartOutput_fileType" );
73  m_parser->registerOption<std::string >(m_option_restartInput_baseNameForFiles, UQ_ML_SAMPLING_RESTART_INPUT_BASE_NAME_FOR_FILES_ODV, "restartInput_baseNameForFiles" );
74  m_parser->registerOption<std::string >(m_option_restartInput_fileType, UQ_ML_SAMPLING_RESTART_INPUT_FILE_TYPE_ODV, "restartInput_fileType" );
75 #else
76  m_parser->registerOption<std::string >(m_option_restartInputFileName, UQ_ML_SAMPLING_RESTART_INPUT_FILE_NAME_ODV, "name of restart input file" );
77  m_parser->registerOption<std::string >(m_option_restartInputFileType, UQ_ML_SAMPLING_RESTART_INPUT_FILE_TYPE_ODV, "type of restart input file" );
78  m_parser->registerOption<unsigned int>(m_option_restartChainSize, UQ_ML_SAMPLING_RESTART_CHAIN_SIZE_ODV, "size of restart chain" );
79 #endif
80  m_parser->registerOption<std::string >(m_option_dataOutputFileName, UQ_ML_SAMPLING_DATA_OUTPUT_FILE_NAME_ODV , "name of generic output file" );
81  m_parser->registerOption<std::string >(m_option_dataOutputAllowedSet, UQ_ML_SAMPLING_DATA_OUTPUT_ALLOWED_SET_ODV, "subEnvs that will write to generic output file");
82 
84 
85  m_parser->getOption<std::string >(m_option_help, m_help);
86 #ifdef ML_CODE_HAS_NEW_RESTART_CAPABILITY
92 #else
96 #endif
99 #else
100  m_help = m_env.input()(m_option_help, UQ_ML_SAMPLING_HELP);
101 #ifdef ML_CODE_HAS_NEW_RESTART_CAPABILITY
102  m_restartOutput_levelPeriod = m_env.input()(m_option_restartOutput_levelPeriod, UQ_ML_SAMPLING_RESTART_OUTPUT_LEVEL_PERIOD_ODV);
103  m_restartOutput_baseNameForFiles = m_env.input()(m_option_restartOutput_baseNameForFiles, UQ_ML_SAMPLING_RESTART_OUTPUT_BASE_NAME_FOR_FILES_ODV);
104  m_restartOutput_fileType = m_env.input()(m_option_restartOutput_fileType, UQ_ML_SAMPLING_RESTART_OUTPUT_FILE_TYPE_ODV);
105  m_restartInput_baseNameForFiles = m_env.input()(m_option_restartInput_baseNameForFiles, UQ_ML_SAMPLING_RESTART_INPUT_BASE_NAME_FOR_FILES_ODV);
106  m_restartInput_fileType = m_env.input()(m_option_restartInput_fileType, UQ_ML_SAMPLING_RESTART_INPUT_FILE_TYPE_ODV);
107 #else
108  m_restartInputFileName = m_env.input()(m_option_restartInputFileName, UQ_ML_SAMPLING_RESTART_INPUT_FILE_NAME_ODV);
109  m_restartInputFileType = m_env.input()(m_option_restartInputFileType, UQ_ML_SAMPLING_RESTART_INPUT_FILE_TYPE_ODV);
110  m_restartChainSize = m_env.input()(m_option_restartChainSize, UQ_ML_SAMPLING_RESTART_CHAIN_SIZE_ODV);
111 #endif
112  m_dataOutputFileName = m_env.input()(m_option_dataOutputFileName, UQ_ML_SAMPLING_DATA_OUTPUT_FILE_NAME_ODV );
113 
114  // UQ_ML_SAMPLING_DATA_OUTPUT_ALLOWED_SET_ODV is the empty set (string) by
115  // default
116  unsigned int size = m_env.input().vector_variable_size(m_option_dataOutputAllowedSet);
117  for (unsigned int i = 0; i < size; i++) {
118  // We default to empty set, so the default values are actually never used
119  // here
120  unsigned int allowed = m_env.input()(m_option_dataOutputAllowedSet, i, i);
121  m_dataOutputAllowedSet.insert(allowed);
122  }
123 
124 #endif // QUESO_DISABLE_BOOST_PROGRAM_OPTIONS
125 
126  checkOptions(&env);
127 }
std::set< unsigned int > m_dataOutputAllowedSet
std::string m_option_restartInput_baseNameForFiles
void getOption(const std::string &name, T &value) const
Get option name from the parser and set value to the parsed value.
const BaseEnvironment & m_env
const GetPot & input() const
The GetPot input file parser.
Definition: Environment.C:1149
std::string m_option_restartOutput_baseNameForFiles
void registerOption(const std::string &name, const T &defaultValue, const std::string &description)
Call this to register an option with the parser.
std::string m_restartInput_fileType
Type of restart input file.
std::string m_restartInput_baseNameForFiles
Base name of restart input file.
std::string m_option_restartInputFileName
void scanInputFile()
This is the method that parses the input file.
void checkOptions(const BaseEnvironment *env)
std::string m_restartInputFileName
Name of restart input file.
std::string m_option_dataOutputFileName
unsigned int m_restartOutput_levelPeriod
Period of restart output file (level).
unsigned int m_restartChainSize
Size of restart chain.
std::string m_restartOutput_baseNameForFiles
Base name of restart output file.
std::string m_option_dataOutputAllowedSet
std::string m_dataOutputFileName
Name of generic output file.
std::string m_option_restartInputFileType
std::string m_restartInputFileType
Type of restart input file.
std::string m_restartOutput_fileType
Type of restart output file.
BoostInputOptionsParser * m_parser
std::string m_option_restartOutput_levelPeriod
std::string m_option_restartInput_fileType
std::string m_help
If non-empty string, options and values are printed to the output file.
std::string m_option_restartOutput_fileType
std::string m_prefix
Class prefix. (ml)
QUESO::MLSamplingOptions::~MLSamplingOptions ( )
virtual

Destructor.

Definition at line 129 of file MLSamplingOptions.C.

130 {
131 }

Member Function Documentation

void QUESO::MLSamplingOptions::checkOptions ( const BaseEnvironment env)
private

Definition at line 134 of file MLSamplingOptions.C.

References m_help, m_restartOutput_baseNameForFiles, m_restartOutput_levelPeriod, QUESO::queso_require_not_equal_to_msg, and QUESO::BaseEnvironment::subDisplayFile().

Referenced by MLSamplingOptions().

135 {
136  // DM: I'm printing here because I'm not sure where this object is created
137  // in the statistical inverse problem
138  if (m_help != "") {
139  if (env->subDisplayFile()) {
140  *(env->subDisplayFile()) << (*this) << std::endl;
141  }
142  }
143 
144 #ifdef ML_CODE_HAS_NEW_RESTART_CAPABILITY
145  if ((m_restartOutput_levelPeriod > 0)) queso_require_not_equal_to_msg(m_restartOutput_baseNameForFiles, std::string("."), std::string("Option 'restartOutput_levelPeriod' is > 0, but 'restartOutput_baseNameForFiles' is not specified..."));
146 #endif
147 }
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"))
unsigned int m_restartOutput_levelPeriod
Period of restart output file (level).
std::string m_restartOutput_baseNameForFiles
Base name of restart output file.
std::string m_help
If non-empty string, options and values are printed to the output file.
void QUESO::MLSamplingOptions::print ( std::ostream &  os) const

It prints the option values.

Definition at line 150 of file MLSamplingOptions.C.

References m_dataOutputAllowedSet, m_dataOutputFileName, m_option_dataOutputAllowedSet, m_option_dataOutputFileName, m_option_restartChainSize, m_option_restartInput_baseNameForFiles, m_option_restartInput_fileType, m_option_restartInputFileName, m_option_restartInputFileType, m_option_restartOutput_baseNameForFiles, m_option_restartOutput_fileType, m_option_restartOutput_levelPeriod, m_restartChainSize, m_restartInput_baseNameForFiles, m_restartInput_fileType, m_restartInputFileName, m_restartInputFileType, m_restartOutput_baseNameForFiles, m_restartOutput_fileType, and m_restartOutput_levelPeriod.

Referenced by QUESO::operator<<().

151 {
152 #ifdef ML_CODE_HAS_NEW_RESTART_CAPABILITY
158 #else
161  << "\n" << m_option_restartChainSize << " = " << m_restartChainSize
162 #endif
164  << "\n" << m_option_dataOutputAllowedSet << " = ";
165  for (std::set<unsigned int>::iterator setIt = m_dataOutputAllowedSet.begin(); setIt != m_dataOutputAllowedSet.end(); ++setIt) {
166  os << *setIt << " ";
167  }
168  os << "\n";
169 
170  return;
171 }
std::set< unsigned int > m_dataOutputAllowedSet
std::string m_option_restartInput_baseNameForFiles
std::string m_option_restartOutput_baseNameForFiles
std::string m_restartInput_fileType
Type of restart input file.
std::string m_restartInput_baseNameForFiles
Base name of restart input file.
std::string m_option_restartInputFileName
std::string m_restartInputFileName
Name of restart input file.
std::string m_option_dataOutputFileName
unsigned int m_restartOutput_levelPeriod
Period of restart output file (level).
unsigned int m_restartChainSize
Size of restart chain.
std::string m_restartOutput_baseNameForFiles
Base name of restart output file.
std::string m_option_dataOutputAllowedSet
std::string m_dataOutputFileName
Name of generic output file.
std::string m_option_restartInputFileType
std::string m_restartInputFileType
Type of restart input file.
std::string m_restartOutput_fileType
Type of restart output file.
std::string m_option_restartOutput_levelPeriod
std::string m_option_restartInput_fileType
std::string m_option_restartOutput_fileType

Friends And Related Function Documentation

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

Definition at line 173 of file MLSamplingOptions.C.

174 {
175 #ifndef QUESO_DISABLE_BOOST_PROGRAM_OPTIONS
176  os << (*(obj.m_parser)) << std::endl;
177 #endif // QUESO_DISABLE_BOOST_PROGRAM_OPTIONS
178 
179  obj.print(os);
180  return os;
181 }

Member Data Documentation

bool QUESO::MLSamplingOptions::m_dataOutputAllowAll

subEnvs that will write to generic output file

Definition at line 126 of file MLSamplingOptions.h.

std::set<unsigned int> QUESO::MLSamplingOptions::m_dataOutputAllowedSet

Definition at line 127 of file MLSamplingOptions.h.

Referenced by MLSamplingOptions(), and print().

std::string QUESO::MLSamplingOptions::m_dataOutputFileName

Name of generic output file.

Definition at line 123 of file MLSamplingOptions.h.

Referenced by MLSamplingOptions(), and print().

const BaseEnvironment& QUESO::MLSamplingOptions::m_env
private

Definition at line 130 of file MLSamplingOptions.h.

Referenced by MLSamplingOptions().

std::string QUESO::MLSamplingOptions::m_help

If non-empty string, options and values are printed to the output file.

Definition at line 95 of file MLSamplingOptions.h.

Referenced by checkOptions(), and MLSamplingOptions().

std::string QUESO::MLSamplingOptions::m_option_dataOutputAllowAll
private

Definition at line 149 of file MLSamplingOptions.h.

std::string QUESO::MLSamplingOptions::m_option_dataOutputAllowedSet
private

Definition at line 150 of file MLSamplingOptions.h.

Referenced by MLSamplingOptions(), and print().

std::string QUESO::MLSamplingOptions::m_option_dataOutputFileName
private

Definition at line 148 of file MLSamplingOptions.h.

Referenced by MLSamplingOptions(), and print().

std::string QUESO::MLSamplingOptions::m_option_help
private

Definition at line 136 of file MLSamplingOptions.h.

Referenced by MLSamplingOptions().

std::string QUESO::MLSamplingOptions::m_option_restartChainSize
private

Definition at line 146 of file MLSamplingOptions.h.

Referenced by MLSamplingOptions(), and print().

std::string QUESO::MLSamplingOptions::m_option_restartInput_baseNameForFiles
private

Definition at line 141 of file MLSamplingOptions.h.

Referenced by MLSamplingOptions(), and print().

std::string QUESO::MLSamplingOptions::m_option_restartInput_fileType
private

Definition at line 142 of file MLSamplingOptions.h.

Referenced by MLSamplingOptions(), and print().

std::string QUESO::MLSamplingOptions::m_option_restartInputFileName
private

Definition at line 144 of file MLSamplingOptions.h.

Referenced by MLSamplingOptions(), and print().

std::string QUESO::MLSamplingOptions::m_option_restartInputFileType
private

Definition at line 145 of file MLSamplingOptions.h.

Referenced by MLSamplingOptions(), and print().

std::string QUESO::MLSamplingOptions::m_option_restartOutput_baseNameForFiles
private

Definition at line 139 of file MLSamplingOptions.h.

Referenced by MLSamplingOptions(), and print().

std::string QUESO::MLSamplingOptions::m_option_restartOutput_fileType
private

Definition at line 140 of file MLSamplingOptions.h.

Referenced by MLSamplingOptions(), and print().

std::string QUESO::MLSamplingOptions::m_option_restartOutput_levelPeriod
private

Definition at line 138 of file MLSamplingOptions.h.

Referenced by MLSamplingOptions(), and print().

BoostInputOptionsParser* QUESO::MLSamplingOptions::m_parser
private

Definition at line 133 of file MLSamplingOptions.h.

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

std::string QUESO::MLSamplingOptions::m_prefix

Class prefix. (ml)

Definition at line 92 of file MLSamplingOptions.h.

unsigned int QUESO::MLSamplingOptions::m_restartChainSize

Size of restart chain.

Definition at line 120 of file MLSamplingOptions.h.

Referenced by MLSamplingOptions(), and print().

std::string QUESO::MLSamplingOptions::m_restartInput_baseNameForFiles

Base name of restart input file.

Definition at line 108 of file MLSamplingOptions.h.

Referenced by MLSamplingOptions(), and print().

std::string QUESO::MLSamplingOptions::m_restartInput_fileType

Type of restart input file.

Definition at line 111 of file MLSamplingOptions.h.

Referenced by MLSamplingOptions(), and print().

std::string QUESO::MLSamplingOptions::m_restartInputFileName

Name of restart input file.

Definition at line 114 of file MLSamplingOptions.h.

Referenced by MLSamplingOptions(), and print().

std::string QUESO::MLSamplingOptions::m_restartInputFileType

Type of restart input file.

Definition at line 117 of file MLSamplingOptions.h.

Referenced by MLSamplingOptions(), and print().

std::string QUESO::MLSamplingOptions::m_restartOutput_baseNameForFiles

Base name of restart output file.

Definition at line 102 of file MLSamplingOptions.h.

Referenced by checkOptions(), MLSamplingOptions(), and print().

std::string QUESO::MLSamplingOptions::m_restartOutput_fileType

Type of restart output file.

Definition at line 105 of file MLSamplingOptions.h.

Referenced by MLSamplingOptions(), and print().

unsigned int QUESO::MLSamplingOptions::m_restartOutput_levelPeriod

Period of restart output file (level).

Definition at line 99 of file MLSamplingOptions.h.

Referenced by checkOptions(), MLSamplingOptions(), and print().


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

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