queso-0.51.1
Public Attributes | Private Member Functions | Private Attributes | 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...
 
 ~MLSamplingOptions ()
 Destructor. More...
 
I/O methods
void scanOptionsValues ()
 It scans the option values from the options input file. More...
 
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_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 defineMyOptions (po::options_description &optionsDesc) const
 Defines the options for the Multilevel generator of samples as the default options. More...
 
void getMyOptionValues (po::options_description &optionsDesc)
 Gets the sequence options defined to the Multilevel algorithm. More...
 

Private Attributes

const BaseEnvironmentm_env
 
po::options_description * m_optionsDesc
 
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
 

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 67 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 30 of file MLSamplingOptions.C.

31  :
32  m_prefix ((std::string)(prefix) + "ml_" ),
33 #ifdef ML_CODE_HAS_NEW_RESTART_CAPABILITY
34  m_restartOutput_levelPeriod (UQ_ML_SAMPLING_RESTART_OUTPUT_LEVEL_PERIOD_ODV ),
35  m_restartOutput_baseNameForFiles (UQ_ML_SAMPLING_RESTART_OUTPUT_BASE_NAME_FOR_FILES_ODV),
36  m_restartOutput_fileType (UQ_ML_SAMPLING_RESTART_OUTPUT_FILE_TYPE_ODV ),
37  m_restartInput_baseNameForFiles (UQ_ML_SAMPLING_RESTART_INPUT_BASE_NAME_FOR_FILES_ODV ),
38  m_restartInput_fileType (UQ_ML_SAMPLING_RESTART_INPUT_FILE_TYPE_ODV ),
39 #else
43 #endif
45 //m_dataOutputAllowedSet (),
46  m_env (env),
47  m_optionsDesc (new po::options_description("Multilevel sampling options")),
48  m_option_help (m_prefix + "help" ),
49 #ifdef ML_CODE_HAS_NEW_RESTART_CAPABILITY
50  m_option_restartOutput_levelPeriod (m_prefix + "restartOutput_levelPeriod" ),
51  m_option_restartOutput_baseNameForFiles(m_prefix + "restartOutput_baseNameForFiles"),
52  m_option_restartOutput_fileType (m_prefix + "restartOutput_fileType" ),
53  m_option_restartInput_baseNameForFiles (m_prefix + "restartInput_baseNameForFiles" ),
54  m_option_restartInput_fileType (m_prefix + "restartInput_fileType" ),
55 #else
56  m_option_restartInputFileName (m_prefix + "restartInputFileName"),
57  m_option_restartInputFileType (m_prefix + "restartInputFileType"),
58  m_option_restartChainSize (m_prefix + "restartChainSize" ),
59 #endif
60  m_option_dataOutputFileName (m_prefix + "dataOutputFileName" ),
61  m_option_dataOutputAllowedSet (m_prefix + "dataOutputAllowedSet")
62 {
63 }
const BaseEnvironment & m_env
unsigned int m_restartChainSize
Size of restart chain.
po::options_description * m_optionsDesc
#define UQ_ML_SAMPLING_RESTART_INPUT_FILE_TYPE_ODV
std::string m_dataOutputFileName
Name of generic output file.
std::string m_restartInputFileType
Type of restart input file.
std::string m_option_restartInputFileName
std::string m_option_restartInputFileType
std::string m_prefix
Class prefix. (ml)
std::string m_option_dataOutputFileName
#define UQ_ML_SAMPLING_RESTART_INPUT_FILE_NAME_ODV
#define UQ_ML_SAMPLING_RESTART_CHAIN_SIZE_ODV
#define UQ_ML_SAMPLING_DATA_OUTPUT_FILE_NAME_ODV
std::string m_option_dataOutputAllowedSet
std::string m_restartInputFileName
Name of restart input file.
QUESO::MLSamplingOptions::~MLSamplingOptions ( )

Destructor.

Definition at line 65 of file MLSamplingOptions.C.

References m_optionsDesc.

66 {
67  if (m_optionsDesc) delete m_optionsDesc;
68 }
po::options_description * m_optionsDesc

Member Function Documentation

void QUESO::MLSamplingOptions::defineMyOptions ( po::options_description &  optionsDesc) const
private

Defines the options for the Multilevel generator of samples as the default options.

Definition at line 89 of file MLSamplingOptions.C.

References m_option_dataOutputAllowedSet, m_option_dataOutputFileName, m_option_help, m_option_restartChainSize, m_option_restartInputFileName, m_option_restartInputFileType, ML_CODE_HAS_NEW_RESTART_CAPABILITY, 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.

Referenced by scanOptionsValues().

90 {
91  optionsDesc.add_options()
92  (m_option_help.c_str(), "produce help msg for ML sampling options" )
94  (m_option_restartOutput_levelPeriod.c_str(), po::value<unsigned int>()->default_value(UQ_ML_SAMPLING_RESTART_OUTPUT_LEVEL_PERIOD_ODV), "restartOutput_levelPeriod" )
95  (m_option_restartOutput_baseNameForFiles.c_str(), po::value<std::string >()->default_value(UQ_ML_SAMPLING_RESTART_OUTPUT_BASE_NAME_FOR_FILES_ODV), "restartOutput_baseNameForFiles" )
96  (m_option_restartOutput_fileType.c_str(), po::value<std::string >()->default_value(UQ_ML_SAMPLING_RESTART_OUTPUT_FILE_TYPE_ODV), "restartOutput_fileType" )
97  (m_option_restartInput_baseNameForFiles.c_str(), po::value<std::string >()->default_value(UQ_ML_SAMPLING_RESTART_INPUT_BASE_NAME_FOR_FILES_ODV), "restartInput_baseNameForFiles" )
98  (m_option_restartInput_fileType.c_str(), po::value<std::string >()->default_value(UQ_ML_SAMPLING_RESTART_INPUT_FILE_TYPE_ODV), "restartInput_fileType" )
99 #else
100  (m_option_restartInputFileName.c_str(), po::value<std::string >()->default_value(UQ_ML_SAMPLING_RESTART_INPUT_FILE_NAME_ODV), "name of restart input file" )
101  (m_option_restartInputFileType.c_str(), po::value<std::string >()->default_value(UQ_ML_SAMPLING_RESTART_INPUT_FILE_TYPE_ODV), "type of restart input file" )
102  (m_option_restartChainSize.c_str(), po::value<unsigned int>()->default_value(UQ_ML_SAMPLING_RESTART_CHAIN_SIZE_ODV), "size of restart chain" )
103 #endif
104  (m_option_dataOutputFileName.c_str(), po::value<std::string >()->default_value(UQ_ML_SAMPLING_DATA_OUTPUT_FILE_NAME_ODV ), "name of generic output file" )
105  (m_option_dataOutputAllowedSet.c_str(), po::value<std::string >()->default_value(UQ_ML_SAMPLING_DATA_OUTPUT_ALLOWED_SET_ODV), "subEnvs that will write to generic output file")
106  ;
107 
108  return;
109 }
#define UQ_ML_SAMPLING_RESTART_INPUT_FILE_TYPE_ODV
#define UQ_ML_SAMPLING_DATA_OUTPUT_ALLOWED_SET_ODV
std::string m_option_restartInputFileName
std::string m_option_restartInputFileType
std::string m_option_dataOutputFileName
#define ML_CODE_HAS_NEW_RESTART_CAPABILITY
Definition: Defines.h:65
#define UQ_ML_SAMPLING_RESTART_INPUT_FILE_NAME_ODV
#define UQ_ML_SAMPLING_RESTART_CHAIN_SIZE_ODV
#define UQ_ML_SAMPLING_DATA_OUTPUT_FILE_NAME_ODV
std::string m_option_dataOutputAllowedSet
void QUESO::MLSamplingOptions::getMyOptionValues ( po::options_description &  optionsDesc)
private

Gets the sequence options defined to the Multilevel algorithm.

Definition at line 112 of file MLSamplingOptions.C.

References QUESO::BaseEnvironment::allOptionsMap(), m_dataOutputAllowedSet, m_dataOutputFileName, m_env, m_option_dataOutputAllowedSet, m_option_dataOutputFileName, m_option_help, m_option_restartChainSize, m_option_restartInputFileName, m_option_restartInputFileType, m_restartChainSize, m_restartInputFileName, m_restartInputFileType, QUESO::MiscReadDoublesFromString(), QUESO::BaseEnvironment::subDisplayFile(), UQ_FATAL_TEST_MACRO, and QUESO::BaseEnvironment::worldRank().

Referenced by scanOptionsValues().

113 {
114  if (m_env.allOptionsMap().count(m_option_help.c_str())) {
115  if (m_env.subDisplayFile()) {
116  *m_env.subDisplayFile() << optionsDesc
117  << std::endl;
118  }
119  }
120 
121 #ifdef ML_CODE_HAS_NEW_RESTART_CAPABILITY
122  if (m_env.allOptionsMap().count(m_option_restartOutput_levelPeriod.c_str())) {
123  m_restartOutput_levelPeriod = ((const po::variable_value&) m_env.allOptionsMap()[m_option_restartOutput_levelPeriod.c_str()]).as<unsigned int>();
124  }
125 
126  if (m_env.allOptionsMap().count(m_option_restartOutput_baseNameForFiles.c_str())) {
127  m_restartOutput_baseNameForFiles = ((const po::variable_value&) m_env.allOptionsMap()[m_option_restartOutput_baseNameForFiles.c_str()]).as<std::string>();
128  }
129 
130  UQ_FATAL_TEST_MACRO((m_restartOutput_levelPeriod > 0) && (m_restartOutput_baseNameForFiles == "."),
131  m_env.worldRank(),
132  "MLSamplingOptions::getMyOptionsValues()",
133  "Option 'restartOutput_levelPeriod' is > 0, but 'restartOutput_baseNameForFiles' is not specified...");
134 
135  if (m_env.allOptionsMap().count(m_option_restartOutput_fileType.c_str())) {
136  m_restartOutput_fileType = ((const po::variable_value&) m_env.allOptionsMap()[m_option_restartOutput_fileType.c_str()]).as<std::string>();
137  }
138 
139  if (m_env.allOptionsMap().count(m_option_restartInput_baseNameForFiles.c_str())) {
140  m_restartInput_baseNameForFiles = ((const po::variable_value&) m_env.allOptionsMap()[m_option_restartInput_baseNameForFiles.c_str()]).as<std::string>();
141  }
142 
143  if (m_env.allOptionsMap().count(m_option_restartInput_fileType.c_str())) {
144  m_restartInput_fileType = ((const po::variable_value&) m_env.allOptionsMap()[m_option_restartInput_fileType.c_str()]).as<std::string>();
145  }
146 #else
147  if (m_env.allOptionsMap().count(m_option_restartInputFileName.c_str())) {
148  m_restartInputFileName = ((const po::variable_value&) m_env.allOptionsMap()[m_option_restartInputFileName.c_str()]).as<std::string>();
149  }
150 
151  if (m_env.allOptionsMap().count(m_option_restartInputFileType.c_str())) {
152  m_restartInputFileType = ((const po::variable_value&) m_env.allOptionsMap()[m_option_restartInputFileType.c_str()]).as<std::string>();
153  }
154 
155  if (m_env.allOptionsMap().count(m_option_restartChainSize.c_str())) {
156  m_restartChainSize = ((const po::variable_value&) m_env.allOptionsMap()[m_option_restartChainSize.c_str()]).as<unsigned int>();
157  }
158 #endif
159  if (m_env.allOptionsMap().count(m_option_dataOutputFileName.c_str())) {
160  m_dataOutputFileName = ((const po::variable_value&) m_env.allOptionsMap()[m_option_dataOutputFileName.c_str()]).as<std::string>();
161  }
162 
163  if (m_env.allOptionsMap().count(m_option_dataOutputAllowedSet.c_str())) {
164  m_dataOutputAllowedSet.clear();
165  std::vector<double> tmpAllow(0,0.);
166  std::string inputString = m_env.allOptionsMap()[m_option_dataOutputAllowedSet.c_str()].as<std::string>();
167  MiscReadDoublesFromString(inputString,tmpAllow);
168 
169  if (tmpAllow.size() > 0) {
170  for (unsigned int i = 0; i < tmpAllow.size(); ++i) {
171  m_dataOutputAllowedSet.insert((unsigned int) tmpAllow[i]);
172  }
173  }
174  }
175 
176  return;
177 }
const BaseEnvironment & m_env
unsigned int m_restartChainSize
Size of restart chain.
int worldRank() const
Returns the process world rank.
Definition: Environment.C:235
std::ofstream * subDisplayFile() const
Access function for m_subDisplayFile (displays file on stream).
Definition: Environment.C:305
po::variables_map & allOptionsMap() const
Definition: Environment.C:368
std::string m_dataOutputFileName
Name of generic output file.
void MiscReadDoublesFromString(const std::string &inputString, std::vector< double > &outputDoubles)
Definition: Miscellaneous.C:39
std::string m_restartInputFileType
Type of restart input file.
std::string m_option_restartInputFileName
std::set< unsigned int > m_dataOutputAllowedSet
std::string m_option_restartInputFileType
std::string m_option_dataOutputFileName
#define UQ_FATAL_TEST_MACRO(test, givenRank, where, what)
Definition: Defines.h:223
std::string m_option_dataOutputAllowedSet
std::string m_restartInputFileName
Name of restart input file.
void QUESO::MLSamplingOptions::print ( std::ostream &  os) const

It prints the option values.

Definition at line 180 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<<().

181 {
182 #ifdef ML_CODE_HAS_NEW_RESTART_CAPABILITY
183  os << m_option_restartOutput_levelPeriod << " = " << m_restartOutput_levelPeriod
184  << "\n" << m_option_restartOutput_baseNameForFiles << " = " << m_restartOutput_baseNameForFiles
185  << "\n" << m_option_restartOutput_fileType << " = " << m_restartOutput_fileType
186  << "\n" << m_option_restartInput_baseNameForFiles << " = " << m_restartInput_baseNameForFiles
187  << "\n" << m_option_restartInput_fileType << " = " << m_restartInput_fileType
188 #else
191  << "\n" << m_option_restartChainSize << " = " << m_restartChainSize
192 #endif
194  << "\n" << m_option_dataOutputAllowedSet << " = ";
195  for (std::set<unsigned int>::iterator setIt = m_dataOutputAllowedSet.begin(); setIt != m_dataOutputAllowedSet.end(); ++setIt) {
196  os << *setIt << " ";
197  }
198  os << "\n";
199 
200  return;
201 }
unsigned int m_restartChainSize
Size of restart chain.
std::string m_dataOutputFileName
Name of generic output file.
std::string m_restartInputFileType
Type of restart input file.
std::string m_option_restartInputFileName
std::set< unsigned int > m_dataOutputAllowedSet
std::string m_option_restartInputFileType
std::string m_option_dataOutputFileName
std::string m_option_dataOutputAllowedSet
std::string m_restartInputFileName
Name of restart input file.
void QUESO::MLSamplingOptions::scanOptionsValues ( )

It scans the option values from the options input file.

Definition at line 71 of file MLSamplingOptions.C.

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

Referenced by QUESO::MLSampling< P_V, P_M >::MLSampling().

72 {
76 
77  if (m_env.subDisplayFile() != NULL) {
78  *m_env.subDisplayFile() << "In MLSamplingOptions::scanOptionsValues()"
79  << ": after getting values of options with prefix '" << m_prefix
80  << "', state of object is:"
81  << "\n" << *this
82  << std::endl;
83  }
84 
85  return;
86 }
const BaseEnvironment & m_env
std::ofstream * subDisplayFile() const
Access function for m_subDisplayFile (displays file on stream).
Definition: Environment.C:305
po::options_description * m_optionsDesc
std::string m_prefix
Class prefix. (ml)
void getMyOptionValues(po::options_description &optionsDesc)
Gets the sequence options defined to the Multilevel algorithm.
void defineMyOptions(po::options_description &optionsDesc) const
Defines the options for the Multilevel generator of samples as the default options.
void scanInputFileForMyOptions(const po::options_description &optionsDesc) const
This method scans the input file provided by the user to QUESO.
Definition: Environment.C:378

Member Data Documentation

bool QUESO::MLSamplingOptions::m_dataOutputAllowAll

subEnvs that will write to generic output file

Definition at line 121 of file MLSamplingOptions.h.

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

Definition at line 122 of file MLSamplingOptions.h.

Referenced by getMyOptionValues(), and print().

std::string QUESO::MLSamplingOptions::m_dataOutputFileName

Name of generic output file.

Definition at line 118 of file MLSamplingOptions.h.

Referenced by getMyOptionValues(), and print().

const BaseEnvironment& QUESO::MLSamplingOptions::m_env
private

Definition at line 131 of file MLSamplingOptions.h.

Referenced by getMyOptionValues(), and scanOptionsValues().

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

Definition at line 147 of file MLSamplingOptions.h.

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

Definition at line 148 of file MLSamplingOptions.h.

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

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

Definition at line 146 of file MLSamplingOptions.h.

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

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

Definition at line 134 of file MLSamplingOptions.h.

Referenced by defineMyOptions(), and getMyOptionValues().

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

Definition at line 144 of file MLSamplingOptions.h.

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

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

Definition at line 142 of file MLSamplingOptions.h.

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

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

Definition at line 143 of file MLSamplingOptions.h.

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

po::options_description* QUESO::MLSamplingOptions::m_optionsDesc
private

Definition at line 132 of file MLSamplingOptions.h.

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

std::string QUESO::MLSamplingOptions::m_prefix

Class prefix. (ml)

Definition at line 90 of file MLSamplingOptions.h.

Referenced by scanOptionsValues().

unsigned int QUESO::MLSamplingOptions::m_restartChainSize

Size of restart chain.

Definition at line 115 of file MLSamplingOptions.h.

Referenced by getMyOptionValues(), and print().

std::string QUESO::MLSamplingOptions::m_restartInputFileName

Name of restart input file.

Definition at line 109 of file MLSamplingOptions.h.

Referenced by getMyOptionValues(), and print().

std::string QUESO::MLSamplingOptions::m_restartInputFileType

Type of restart input file.

Definition at line 112 of file MLSamplingOptions.h.

Referenced by getMyOptionValues(), and print().


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

Generated on Thu Apr 23 2015 19:26:18 for queso-0.51.1 by  doxygen 1.8.5