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

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

#include <MLSamplingOptions.h>

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

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...
 
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_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 69 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 32 of file MLSamplingOptions.C.

References checkOptions(), QUESO::BoostInputOptionsParser::getOption(), m_dataOutputAllowedSet, m_dataOutputFileName, m_help, m_option_dataOutputAllowedSet, m_option_dataOutputFileName, m_option_help, m_option_restartChainSize, m_option_restartInputFileName, m_option_restartInputFileType, m_parser, m_restartChainSize, m_restartInputFileName, m_restartInputFileType, QUESO::BoostInputOptionsParser::registerOption(), QUESO::BoostInputOptionsParser::scanInputFile(), UQ_ML_SAMPLING_DATA_OUTPUT_ALLOWED_SET_ODV, UQ_ML_SAMPLING_DATA_OUTPUT_FILE_NAME_ODV, UQ_ML_SAMPLING_RESTART_CHAIN_SIZE_ODV, UQ_ML_SAMPLING_RESTART_INPUT_FILE_NAME_ODV, and UQ_ML_SAMPLING_RESTART_INPUT_FILE_TYPE_ODV.

33  :
34  m_prefix ((std::string)(prefix) + "ml_" ),
35  m_help (UQ_ML_SAMPLING_HELP),
36 #ifdef ML_CODE_HAS_NEW_RESTART_CAPABILITY
37  m_restartOutput_levelPeriod (UQ_ML_SAMPLING_RESTART_OUTPUT_LEVEL_PERIOD_ODV ),
38  m_restartOutput_baseNameForFiles (UQ_ML_SAMPLING_RESTART_OUTPUT_BASE_NAME_FOR_FILES_ODV),
39  m_restartOutput_fileType (UQ_ML_SAMPLING_RESTART_OUTPUT_FILE_TYPE_ODV ),
40  m_restartInput_baseNameForFiles (UQ_ML_SAMPLING_RESTART_INPUT_BASE_NAME_FOR_FILES_ODV ),
41  m_restartInput_fileType (UQ_ML_SAMPLING_RESTART_INPUT_FILE_TYPE_ODV ),
42 #else
46 #endif
48  //m_dataOutputAllowedSet (),
49  m_env (env),
50  m_parser(new BoostInputOptionsParser(env.optionsInputFileName())),
51  m_option_help (m_prefix + "help" ),
52 #ifdef ML_CODE_HAS_NEW_RESTART_CAPABILITY
53  m_option_restartOutput_levelPeriod (m_prefix + "restartOutput_levelPeriod" ),
54  m_option_restartOutput_baseNameForFiles(m_prefix + "restartOutput_baseNameForFiles"),
55  m_option_restartOutput_fileType (m_prefix + "restartOutput_fileType" ),
56  m_option_restartInput_baseNameForFiles (m_prefix + "restartInput_baseNameForFiles" ),
57  m_option_restartInput_fileType (m_prefix + "restartInput_fileType" ),
58 #else
59  m_option_restartInputFileName (m_prefix + "restartInputFileName"),
60  m_option_restartInputFileType (m_prefix + "restartInputFileType"),
61  m_option_restartChainSize (m_prefix + "restartChainSize" ),
62 #endif
63  m_option_dataOutputFileName (m_prefix + "dataOutputFileName" ),
64  m_option_dataOutputAllowedSet (m_prefix + "dataOutputAllowedSet")
65 {
66  m_parser->registerOption<std::string >(m_option_help, UQ_ML_SAMPLING_HELP, "produce help msg for ML sampling options" );
67 #ifdef ML_CODE_HAS_NEW_RESTART_CAPABILITY
68  m_parser->registerOption<unsigned int>(m_option_restartOutput_levelPeriod, UQ_ML_SAMPLING_RESTART_OUTPUT_LEVEL_PERIOD_ODV, "restartOutput_levelPeriod" );
69  m_parser->registerOption<std::string >(m_option_restartOutput_baseNameForFiles, UQ_ML_SAMPLING_RESTART_OUTPUT_BASE_NAME_FOR_FILES_ODV, "restartOutput_baseNameForFiles" );
70  m_parser->registerOption<std::string >(m_option_restartOutput_fileType, UQ_ML_SAMPLING_RESTART_OUTPUT_FILE_TYPE_ODV, "restartOutput_fileType" );
71  m_parser->registerOption<std::string >(m_option_restartInput_baseNameForFiles, UQ_ML_SAMPLING_RESTART_INPUT_BASE_NAME_FOR_FILES_ODV, "restartInput_baseNameForFiles" );
72  m_parser->registerOption<std::string >(m_option_restartInput_fileType, UQ_ML_SAMPLING_RESTART_INPUT_FILE_TYPE_ODV, "restartInput_fileType" );
73 #else
77 #endif
78  m_parser->registerOption<std::string >(m_option_dataOutputFileName, UQ_ML_SAMPLING_DATA_OUTPUT_FILE_NAME_ODV , "name of generic output file" );
79  m_parser->registerOption<std::string >(m_option_dataOutputAllowedSet, UQ_ML_SAMPLING_DATA_OUTPUT_ALLOWED_SET_ODV, "subEnvs that will write to generic output file");
80 
82 
83  m_parser->getOption<std::string >(m_option_help, m_help);
84 #ifdef ML_CODE_HAS_NEW_RESTART_CAPABILITY
85  m_parser->getOption<unsigned int>(m_option_restartOutput_levelPeriod, m_restartOutput_levelPeriod);
86  m_parser->getOption<std::string >(m_option_restartOutput_baseNameForFiles, m_restartOutput_baseNameForFiles);
87  m_parser->getOption<std::string >(m_option_restartOutput_fileType, m_restartOutput_fileType);
88  m_parser->getOption<std::string >(m_option_restartInput_baseNameForFiles, m_restartInput_baseNameForFiles);
89  m_parser->getOption<std::string >(m_option_restartInput_fileType, m_restartInput_fileType);
90 #else
94 #endif
97 
98  checkOptions(&env);
99 }
#define UQ_ML_SAMPLING_RESTART_INPUT_FILE_NAME_ODV
#define UQ_ML_SAMPLING_DATA_OUTPUT_ALLOWED_SET_ODV
std::set< unsigned int > m_dataOutputAllowedSet
std::string m_dataOutputFileName
Name of generic output file.
unsigned int m_restartChainSize
Size of restart chain.
const BaseEnvironment & m_env
void scanInputFile()
This is the method that parses the input file.
std::string m_option_restartInputFileType
std::string m_restartInputFileType
Type of restart input file.
std::string m_option_dataOutputAllowedSet
void registerOption(std::string name, T defaultValue, std::string description)
Call this to register an option with the parser.
std::string m_option_restartInputFileName
std::string m_prefix
Class prefix. (ml)
std::string m_help
If non-empty string, options and values are printed to the output file.
void checkOptions(const BaseEnvironment *env)
#define UQ_ML_SAMPLING_DATA_OUTPUT_FILE_NAME_ODV
std::string m_option_dataOutputFileName
void getOption(std::string &name, T &value)
Get option name from the parser and set value to the parsed value.
#define UQ_ML_SAMPLING_RESTART_INPUT_FILE_TYPE_ODV
std::string m_restartInputFileName
Name of restart input file.
BoostInputOptionsParser * m_parser
#define UQ_ML_SAMPLING_RESTART_CHAIN_SIZE_ODV
QUESO::MLSamplingOptions::~MLSamplingOptions ( )
virtual

Destructor.

Definition at line 101 of file MLSamplingOptions.C.

102 {
103 }

Member Function Documentation

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

Definition at line 106 of file MLSamplingOptions.C.

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

Referenced by MLSamplingOptions().

107 {
108  // DM: I'm printing here because I'm not sure where this object is created
109  // in the statistical inverse problem
110  if (m_help != "") {
111  if (env->subDisplayFile()) {
112  *(env->subDisplayFile()) << (*this) << std::endl;
113  }
114  }
115 
116 #ifdef ML_CODE_HAS_NEW_RESTART_CAPABILITY
117  if ((m_restartOutput_levelPeriod > 0)) queso_require_not_equal_to_msg(m_restartOutput_baseNameForFiles, ".", "Option 'restartOutput_levelPeriod' is > 0, but 'restartOutput_baseNameForFiles' is not specified...");
118 #endif
119 }
#define queso_require_not_equal_to_msg(expr1, expr2, msg)
Definition: asserts.h:86
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 122 of file MLSamplingOptions.C.

References m_dataOutputAllowedSet, m_dataOutputFileName, m_option_dataOutputAllowedSet, m_option_dataOutputFileName, m_option_restartChainSize, m_option_restartInputFileName, m_option_restartInputFileType, m_restartChainSize, m_restartInputFileName, and m_restartInputFileType.

Referenced by QUESO::operator<<().

123 {
124 #ifdef ML_CODE_HAS_NEW_RESTART_CAPABILITY
125  os << m_option_restartOutput_levelPeriod << " = " << m_restartOutput_levelPeriod
126  << "\n" << m_option_restartOutput_baseNameForFiles << " = " << m_restartOutput_baseNameForFiles
127  << "\n" << m_option_restartOutput_fileType << " = " << m_restartOutput_fileType
128  << "\n" << m_option_restartInput_baseNameForFiles << " = " << m_restartInput_baseNameForFiles
129  << "\n" << m_option_restartInput_fileType << " = " << m_restartInput_fileType
130 #else
133  << "\n" << m_option_restartChainSize << " = " << m_restartChainSize
134 #endif
136  << "\n" << m_option_dataOutputAllowedSet << " = ";
137  for (std::set<unsigned int>::iterator setIt = m_dataOutputAllowedSet.begin(); setIt != m_dataOutputAllowedSet.end(); ++setIt) {
138  os << *setIt << " ";
139  }
140  os << "\n";
141 
142  return;
143 }
std::set< unsigned int > m_dataOutputAllowedSet
std::string m_dataOutputFileName
Name of generic output file.
unsigned int m_restartChainSize
Size of restart chain.
std::string m_option_restartInputFileType
std::string m_restartInputFileType
Type of restart input file.
std::string m_option_dataOutputAllowedSet
std::string m_option_restartInputFileName
std::string m_option_dataOutputFileName
std::string m_restartInputFileName
Name of restart input file.

Friends And Related Function Documentation

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

Definition at line 145 of file MLSamplingOptions.C.

146 {
147  os << (*(obj.m_parser)) << std::endl;
148 
149  obj.print(os);
150  return os;
151 }

Member Data Documentation

bool QUESO::MLSamplingOptions::m_dataOutputAllowAll

subEnvs that will write to generic output file

Definition at line 123 of file MLSamplingOptions.h.

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

Definition at line 124 of file MLSamplingOptions.h.

Referenced by MLSamplingOptions(), and print().

std::string QUESO::MLSamplingOptions::m_dataOutputFileName

Name of generic output file.

Definition at line 120 of file MLSamplingOptions.h.

Referenced by MLSamplingOptions(), and print().

const BaseEnvironment& QUESO::MLSamplingOptions::m_env
private

Definition at line 127 of file MLSamplingOptions.h.

std::string QUESO::MLSamplingOptions::m_help

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

Definition at line 92 of file MLSamplingOptions.h.

Referenced by checkOptions(), and MLSamplingOptions().

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

Definition at line 144 of file MLSamplingOptions.h.

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

Definition at line 145 of file MLSamplingOptions.h.

Referenced by MLSamplingOptions(), and print().

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

Definition at line 143 of file MLSamplingOptions.h.

Referenced by MLSamplingOptions(), and print().

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

Definition at line 131 of file MLSamplingOptions.h.

Referenced by MLSamplingOptions().

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

Definition at line 141 of file MLSamplingOptions.h.

Referenced by MLSamplingOptions(), and print().

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

Definition at line 139 of file MLSamplingOptions.h.

Referenced by MLSamplingOptions(), and print().

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

Definition at line 140 of file MLSamplingOptions.h.

Referenced by MLSamplingOptions(), and print().

BoostInputOptionsParser* QUESO::MLSamplingOptions::m_parser
private

Definition at line 129 of file MLSamplingOptions.h.

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

std::string QUESO::MLSamplingOptions::m_prefix

Class prefix. (ml)

Definition at line 89 of file MLSamplingOptions.h.

unsigned int QUESO::MLSamplingOptions::m_restartChainSize

Size of restart chain.

Definition at line 117 of file MLSamplingOptions.h.

Referenced by MLSamplingOptions(), and print().

std::string QUESO::MLSamplingOptions::m_restartInputFileName

Name of restart input file.

Definition at line 111 of file MLSamplingOptions.h.

Referenced by MLSamplingOptions(), and print().

std::string QUESO::MLSamplingOptions::m_restartInputFileType

Type of restart input file.

Definition at line 114 of file MLSamplingOptions.h.

Referenced by MLSamplingOptions(), and print().


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

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