queso-0.57.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
EnvironmentOptions.C
Go to the documentation of this file.
1 //-----------------------------------------------------------------------bl-
2 //--------------------------------------------------------------------------
3 //
4 // QUESO - a library to support the Quantification of Uncertainty
5 // for Estimation, Simulation and Optimization
6 //
7 // Copyright (C) 2008-2017 The PECOS Development Team
8 //
9 // This library is free software; you can redistribute it and/or
10 // modify it under the terms of the Version 2.1 GNU Lesser General
11 // Public License as published by the Free Software Foundation.
12 //
13 // This library is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 // Lesser General Public License for more details.
17 //
18 // You should have received a copy of the GNU Lesser General Public
19 // License along with this library; if not, write to the Free Software
20 // Foundation, Inc. 51 Franklin Street, Fifth Floor,
21 // Boston, MA 02110-1301 USA
22 //
23 //-----------------------------------------------------------------------el-
24 
25 #include <queso/Defines.h>
26 
27 #ifndef QUESO_DISABLE_BOOST_PROGRAM_OPTIONS
28 #include <boost/program_options.hpp>
29 #else
30 #include <queso/getpot.h>
31 #endif // QUESO_DISABLE_BOOST_PROGRAM_OPTIONS
32 
33 #include <queso/EnvironmentOptions.h>
34 #include <queso/Miscellaneous.h>
35 
36 #include <queso/asserts.h>
37 
38 namespace QUESO {
39 
40 // --------------------------------------------------
41 // EnvOptionsValues --------------------------
42 // --------------------------------------------------
43 
44 // Default constructor ------------------------------
46  :
47  m_prefix("env_"),
48  m_help(UQ_ENV_HELP),
49  m_numSubEnvironments(UQ_ENV_NUM_SUB_ENVIRONMENTS_ODV),
50  m_subDisplayFileName(UQ_ENV_SUB_DISPLAY_FILE_NAME_ODV),
51  m_subDisplayAllowAll(UQ_ENV_SUB_DISPLAY_ALLOW_ALL_ODV),
52  m_subDisplayAllowInter0(UQ_ENV_SUB_DISPLAY_ALLOW_INTER0_ODV),
53  //m_subDisplayAllowedSet (),
54  m_displayVerbosity(UQ_ENV_DISPLAY_VERBOSITY_ODV),
55  m_syncVerbosity(UQ_ENV_SYNC_VERBOSITY_ODV),
56  m_checkingLevel(UQ_ENV_CHECKING_LEVEL_ODV),
57  m_rngType(UQ_ENV_RNG_TYPE_ODV),
58  m_seed(UQ_ENV_SEED_ODV),
59  m_platformName(UQ_ENV_PLATFORM_NAME_ODV),
60  m_identifyingString(UQ_ENV_IDENTIFYING_STRING_ODV),
61  m_numDebugParams(UQ_ENV_NUM_DEBUG_PARAMS_ODV),
62  m_debugParams(m_numDebugParams,0.),
63  m_env(NULL),
64 #ifndef QUESO_DISABLE_BOOST_PROGRAM_OPTIONS
65  m_parser(),
66 #endif // QUESO_DISABLE_BOOST_PROGRAM_OPTIONS
67  m_option_help(m_prefix + "help"),
68  m_option_numSubEnvironments(m_prefix + "numSubEnvironments"),
69  m_option_subDisplayFileName(m_prefix + "subDisplayFileName"),
70  m_option_subDisplayAllowAll(m_prefix + "subDisplayAllowAll"),
71  m_option_subDisplayAllowInter0(m_prefix + "subDisplayAllowInter0"),
72  m_option_subDisplayAllowedSet(m_prefix + "subDisplayAllowedSet"),
73  m_option_displayVerbosity(m_prefix + "displayVerbosity"),
74  m_option_syncVerbosity(m_prefix + "syncVerbosity"),
75  m_option_checkingLevel(m_prefix + "checkingLevel"),
76  m_option_rngType(m_prefix + "rngType"),
77  m_option_seed(m_prefix + "seed"),
78  m_option_platformName(m_prefix + "platformName"),
79  m_option_identifyingString(m_prefix + "identifyingString")
80 {
81 }
82 
84  prefix)
85  :
86  m_prefix((std::string) + "env_"),
87  m_help(UQ_ENV_HELP),
88  m_numSubEnvironments(UQ_ENV_NUM_SUB_ENVIRONMENTS_ODV),
89  m_subDisplayFileName(UQ_ENV_SUB_DISPLAY_FILE_NAME_ODV),
90  m_subDisplayAllowAll(UQ_ENV_SUB_DISPLAY_ALLOW_ALL_ODV),
91  m_subDisplayAllowInter0(UQ_ENV_SUB_DISPLAY_ALLOW_INTER0_ODV),
92  //m_subDisplayAllowedSet (),
93  m_displayVerbosity(UQ_ENV_DISPLAY_VERBOSITY_ODV),
94  m_syncVerbosity(UQ_ENV_SYNC_VERBOSITY_ODV),
95  m_checkingLevel(UQ_ENV_CHECKING_LEVEL_ODV),
96  m_rngType(UQ_ENV_RNG_TYPE_ODV),
97  m_seed(UQ_ENV_SEED_ODV),
98  m_platformName(UQ_ENV_PLATFORM_NAME_ODV),
99  m_identifyingString(UQ_ENV_IDENTIFYING_STRING_ODV),
100  m_numDebugParams(UQ_ENV_NUM_DEBUG_PARAMS_ODV),
101  m_debugParams(m_numDebugParams,0.),
102  m_env(env),
103 #ifndef QUESO_DISABLE_BOOST_PROGRAM_OPTIONS
104  m_parser(new BoostInputOptionsParser(env->optionsInputFileName())),
105 #endif // QUESO_DISABLE_BOOST_PROGRAM_OPTIONS
106  m_option_help(m_prefix + "help"),
107  m_option_numSubEnvironments(m_prefix + "numSubEnvironments"),
108  m_option_subDisplayFileName(m_prefix + "subDisplayFileName"),
109  m_option_subDisplayAllowAll(m_prefix + "subDisplayAllowAll"),
110  m_option_subDisplayAllowInter0(m_prefix + "subDisplayAllowInter0"),
111  m_option_subDisplayAllowedSet(m_prefix + "subDisplayAllowedSet"),
112  m_option_displayVerbosity(m_prefix + "displayVerbosity"),
113  m_option_syncVerbosity(m_prefix + "syncVerbosity"),
114  m_option_checkingLevel(m_prefix + "checkingLevel"),
115  m_option_rngType(m_prefix + "rngType"),
116  m_option_seed(m_prefix + "seed"),
117  m_option_platformName(m_prefix + "platformName"),
118  m_option_identifyingString(m_prefix + "identifyingString")
119 {
120 #ifndef QUESO_DISABLE_BOOST_PROGRAM_OPTIONS
121  // Register all options with parser
122  m_parser->registerOption<std::string >(m_option_help, UQ_ENV_HELP, "produce help message for environment");
123  m_parser->registerOption<unsigned int>(m_option_numSubEnvironments, UQ_ENV_NUM_SUB_ENVIRONMENTS_ODV, "number of subEnvironments");
124  m_parser->registerOption<std::string >(m_option_subDisplayFileName, UQ_ENV_SUB_DISPLAY_FILE_NAME_ODV, "output filename for subscreen writing");
125  m_parser->registerOption<bool >(m_option_subDisplayAllowAll, UQ_ENV_SUB_DISPLAY_ALLOW_ALL_ODV, "Allow all processors to write to output file");
126  m_parser->registerOption<bool >(m_option_subDisplayAllowInter0, UQ_ENV_SUB_DISPLAY_ALLOW_INTER0_ODV, "Allow all inter0 nodes to write to output file");
127  m_parser->registerOption<std::string >(m_option_subDisplayAllowedSet, UQ_ENV_SUB_DISPLAY_ALLOWED_SET_ODV, "subEnvs that will write to output file");
128  m_parser->registerOption<unsigned int>(m_option_displayVerbosity, UQ_ENV_DISPLAY_VERBOSITY_ODV, "set verbosity");
129  m_parser->registerOption<unsigned int>(m_option_syncVerbosity, UQ_ENV_SYNC_VERBOSITY_ODV, "set sync verbosity");
130  m_parser->registerOption<unsigned int>(m_option_checkingLevel, UQ_ENV_CHECKING_LEVEL_ODV, "set checking level");
131  m_parser->registerOption<std::string >(m_option_rngType, UQ_ENV_RNG_TYPE_ODV, "set rngType");
132  m_parser->registerOption<int >(m_option_seed, UQ_ENV_SEED_ODV, "set seed");
133  m_parser->registerOption<std::string >(m_option_platformName, UQ_ENV_PLATFORM_NAME_ODV, "platform name");
134  m_parser->registerOption<std::string >(m_option_identifyingString, UQ_ENV_IDENTIFYING_STRING_ODV, "identifying string");
135 
136  // Read the input file
137  m_parser->scanInputFile();
138 
139  m_parser->getOption<std::string >(m_option_help, m_help);
140  m_parser->getOption<unsigned int>(m_option_numSubEnvironments, m_numSubEnvironments);
144  m_parser->getOption<std::set<unsigned int> >(m_option_subDisplayAllowedSet, m_subDisplayAllowedSet);
145  m_parser->getOption<unsigned int>(m_option_displayVerbosity, m_displayVerbosity);
146  m_parser->getOption<unsigned int>(m_option_syncVerbosity, m_syncVerbosity);
147  m_parser->getOption<unsigned int>(m_option_checkingLevel, m_checkingLevel);
148  m_parser->getOption<std::string>(m_option_rngType, m_rngType);
149  m_parser->getOption<int>(m_option_seed, m_seed);
150  m_parser->getOption<std::string>(m_option_platformName, m_platformName);
151  m_parser->getOption<std::string>(m_option_identifyingString, m_identifyingString);
152 #else
153  m_help = m_env->input()(m_option_help, UQ_ENV_HELP);
154  m_numSubEnvironments = m_env->input()(m_option_numSubEnvironments, UQ_ENV_NUM_SUB_ENVIRONMENTS_ODV);
155  m_subDisplayFileName = m_env->input()(m_option_subDisplayFileName, UQ_ENV_SUB_DISPLAY_FILE_NAME_ODV);
156  m_subDisplayAllowAll = m_env->input()(m_option_subDisplayAllowAll, UQ_ENV_SUB_DISPLAY_ALLOW_ALL_ODV);
157  m_subDisplayAllowInter0 = m_env->input()(m_option_subDisplayAllowInter0, UQ_ENV_SUB_DISPLAY_ALLOW_INTER0_ODV);
158 
159  // UQ_ENV_SUB_DISPLAY_ALLOWED_SET_ODV is the empty set (string) by default
160  unsigned int size = m_env->input().vector_variable_size(m_option_subDisplayAllowedSet);
161  for (unsigned int i = 0; i < size; i++) {
162  // We default to empty set, so the default values are actually never
163  // used here
164  unsigned int allowed = m_env->input()(m_option_subDisplayAllowedSet, i, i);
165  m_subDisplayAllowedSet.insert(allowed);
166  }
167 
168  m_displayVerbosity = m_env->input()(m_option_displayVerbosity, UQ_ENV_DISPLAY_VERBOSITY_ODV);
169  m_syncVerbosity = m_env->input()(m_option_syncVerbosity, UQ_ENV_SYNC_VERBOSITY_ODV);
170  m_checkingLevel = m_env->input()(m_option_checkingLevel, UQ_ENV_CHECKING_LEVEL_ODV);
171  m_rngType = m_env->input()(m_option_rngType, UQ_ENV_RNG_TYPE_ODV);
172  m_seed = m_env->input()(m_option_seed, UQ_ENV_SEED_ODV);
173  m_platformName = m_env->input()(m_option_platformName, UQ_ENV_PLATFORM_NAME_ODV);
174  m_identifyingString = m_env->input()(m_option_identifyingString, UQ_ENV_IDENTIFYING_STRING_ODV);
175 #endif // QUESO_DISABLE_BOOST_PROGRAM_OPTIONS
176 
177  checkOptions();
178 }
179 
180 void
182 {
183  // Clear the permitted set of ranks if the user specifies that all are
184  // allowed to display or the Inter0 communicator is allowed to display
185  if (m_subDisplayAllowAll) {
186  // This will get filled by the Environment after the sub communicators are
187  // created
188  m_subDisplayAllowedSet.clear();
189  }
190  else if (m_subDisplayAllowInter0) {
191  m_subDisplayAllowedSet.clear();
192  }
193 }
194 
195 // Copy constructor ---------------------------------
197 {
198  this->copy(src);
199 }
200 
201 // Destructor ---------------------------------------
203 {
204 }
205 
206 // Set methods---------------------------------------
209 {
210  this->copy(rhs);
211  return *this;
212 }
213 // Private methods-----------------------------------
214 void
216 {
225  m_rngType = src.m_rngType;
226  m_seed = src.m_seed;
231 
232  return;
233 }
234 
235 std::ostream& operator<<(std::ostream& os, const EnvOptionsValues & obj)
236 {
237  // Print the parser
238 #ifndef QUESO_DISABLE_BOOST_PROGRAM_OPTIONS
239  os << (*(obj.m_parser)) << std::endl;
240 #else
241  obj.m_env->input().print(os);
242 #endif // QUESO_DISABLE_BOOST_PROGRAM_OPTIONS
243 
244  // Print the option names and current values
245  os << obj.m_option_numSubEnvironments << " = " << obj.m_numSubEnvironments
246  << "\n" << obj.m_option_subDisplayFileName << " = " << obj.m_subDisplayFileName
247  << "\n" << obj.m_option_subDisplayAllowAll << " = " << obj.m_subDisplayAllowAll
248  //<< "\n" << obj.m_option_subDisplayAllowInter0 << " = " << obj.m_subDisplayAllowInter0
249  << "\n" << obj.m_option_subDisplayAllowedSet << " = ";
250  for (std::set<unsigned int>::iterator setIt = obj.m_subDisplayAllowedSet.begin(); setIt != obj.m_subDisplayAllowedSet.end(); ++setIt) {
251  os << *setIt << " ";
252  }
253  os << "\n" << obj.m_option_displayVerbosity << " = " << obj.m_displayVerbosity
254  << "\n" << obj.m_option_syncVerbosity << " = " << obj.m_syncVerbosity
255  << "\n" << obj.m_option_checkingLevel << " = " << obj.m_checkingLevel
256  << "\n" << obj.m_option_rngType << " = " << obj.m_rngType
257  << "\n" << obj.m_option_seed << " = " << obj.m_seed
258  << "\n" << obj.m_option_platformName << " = " << obj.m_platformName
259  << "\n" << obj.m_option_identifyingString << " = " << obj.m_identifyingString
260  //<< "\n" << obj.m_option_numDebugParams << " = " << obj.m_numDebugParams
261  << std::endl;
262  return os;
263 }
264 
265 // --------------------------------------------------
266 // EnvironmentOptions ------------------------
267 // --------------------------------------------------
268 
269 // Default constructor ------------------------------
271  const BaseEnvironment& env,
272  const char* prefix)
273  :
274  m_ov (),
275  m_env (env),
276  m_prefix ((std::string)(prefix) + "env_"),
277 #ifndef QUESO_DISABLE_BOOST_PROGRAM_OPTIONS
278  m_optionsDesc (new boost::program_options::options_description("Environment options")),
279 #endif // QUESO_DISABLE_BOOST_PROGRAM_OPTIONS
280  m_option_help (m_prefix + "help" ),
281  m_option_numSubEnvironments (m_prefix + "numSubEnvironments" ),
282  m_option_subDisplayFileName (m_prefix + "subDisplayFileName" ),
283  m_option_subDisplayAllowAll (m_prefix + "subDisplayAllowAll" ),
284  m_option_subDisplayAllowInter0(m_prefix + "subDisplayAllowInter0"),
285  m_option_subDisplayAllowedSet (m_prefix + "subDisplayAllowedSet" ),
286  m_option_displayVerbosity (m_prefix + "displayVerbosity" ),
287  m_option_syncVerbosity (m_prefix + "syncVerbosity" ),
288  m_option_checkingLevel (m_prefix + "checkingLevel" ),
289  m_option_rngType (m_prefix + "rngType" ),
290  m_option_seed (m_prefix + "seed" ),
291  m_option_platformName (m_prefix + "platformName" ),
292  m_option_identifyingString (m_prefix + "identifyingString" )
293 {
294  queso_deprecated();
295  queso_require_not_equal_to_msg(m_env.optionsInputFileName(), std::string(""), std::string("this constructor is incompatible with the abscense of an options input file"));
296 }
297 // Constructor with alternative values --------------
299  const BaseEnvironment& env,
300  const char* prefix,
301  const EnvOptionsValues& alternativeOptionsValues)
302  :
303  m_ov (alternativeOptionsValues),
304  m_env (env),
305  m_prefix ((std::string)(prefix) + "env_"),
306 #ifndef QUESO_DISABLE_BOOST_PROGRAM_OPTIONS
307  m_optionsDesc (),
308 #endif // QUESO_DISABLE_BOOST_PROGRAM_OPTIONS
309  m_option_help (m_prefix + "help" ),
310  m_option_numSubEnvironments (m_prefix + "numSubEnvironments" ),
311  m_option_subDisplayFileName (m_prefix + "subDisplayFileName" ),
312  m_option_subDisplayAllowAll (m_prefix + "subDisplayAllowAll" ),
313  m_option_subDisplayAllowInter0(m_prefix + "subDisplayAllowInter0"),
314  m_option_subDisplayAllowedSet (m_prefix + "subDisplayAllowedSet" ),
315  m_option_displayVerbosity (m_prefix + "displayVerbosity" ),
316  m_option_syncVerbosity (m_prefix + "syncVerbosity" ),
317  m_option_checkingLevel (m_prefix + "checkingLevel" ),
318  m_option_rngType (m_prefix + "rngType" ),
319  m_option_seed (m_prefix + "seed" ),
320  m_option_platformName (m_prefix + "platformName" ),
321  m_option_identifyingString (m_prefix + "identifyingString" )
322 {
323  queso_deprecated();
324  queso_require_equal_to_msg(m_env.optionsInputFileName(), std::string(""), std::string("this constructor is incompatible with the existence of an options input file"));
325 
326  if (m_env.subDisplayFile() != NULL) {
327  *m_env.subDisplayFile() << "In EnvironmentOptions::constructor(2)"
328  << ": after setting values of options with prefix '" << m_prefix
329  << "', state of object is:"
330  << "\n" << *this
331  << std::endl;
332  }
333 }
334 // Destructor ---------------------------------------
336 {
337  queso_deprecated();
338 }
339 
340 // I/O methods---------------------------------------
341 void
343 {
344  queso_deprecated();
345 #ifndef QUESO_DISABLE_BOOST_PROGRAM_OPTIONS
346  queso_require_msg(m_optionsDesc, "m_optionsDesc variable is NULL");
347 #endif // QUESO_DISABLE_BOOST_PROGRAM_OPTIONS
348 
349 #ifndef QUESO_DISABLE_BOOST_PROGRAM_OPTIONS
353 #endif // QUESO_DISABLE_BOOST_PROGRAM_OPTIONS
354 
355  // 'm_subDisplayOutputFile' is still not available at this moment. Use 'std::cout'
356  //if (m_env.subScreenFile() != NULL) {
357  // *m_env.subScreenFile()
358  if ((m_env.fullRank() == 0) && (m_env.displayVerbosity() >= 3)) {
359  std::cout << "In EnvironmentOptions::scanOptionsValues()"
360  << ": after reading values of options with prefix '" << m_prefix
361  << "', state of object is:"
362  << "\n" << *this
363  << std::endl;
364  }
365 
366  return;
367 }
368 // --------------------------------------------------
369 void
370 EnvironmentOptions::print(std::ostream& os) const
371 {
372  queso_deprecated();
373 
377  //<< "\n" << m_option_subDisplayAllowInter0 << " = " << m_ov.m_subDisplayAllowInter0
378  << "\n" << m_option_subDisplayAllowedSet << " = ";
379  for (std::set<unsigned int>::iterator setIt = m_ov.m_subDisplayAllowedSet.begin(); setIt != m_ov.m_subDisplayAllowedSet.end(); ++setIt) {
380  os << *setIt << " ";
381  }
382  os << "\n" << m_option_displayVerbosity << " = " << m_ov.m_displayVerbosity
383  << "\n" << m_option_syncVerbosity << " = " << m_ov.m_syncVerbosity
384  << "\n" << m_option_checkingLevel << " = " << m_ov.m_checkingLevel
385  << "\n" << m_option_rngType << " = " << m_ov.m_rngType
386  << "\n" << m_option_seed << " = " << m_ov.m_seed
387  << "\n" << m_option_platformName << " = " << m_ov.m_platformName
389  //<< "\n" << m_option_numDebugParams << " = " << m_ov.m_numDebugParams
390  << std::endl;
391  return;
392 }
393 
394 #ifndef QUESO_DISABLE_BOOST_PROGRAM_OPTIONS
395 // Private methods ----------------------------------
396 void
397 EnvironmentOptions::defineMyOptions(boost::program_options::options_description& optionsDesc) const
398 {
399  queso_deprecated();
400 
401 #ifdef QUESO_MEMORY_DEBUGGING
402  std::cout << "In EnvOptions::defineMyOptions(), before add_options()" << std::endl;
403 #endif
404  optionsDesc.add_options()
405  (m_option_help.c_str(), "produce help message for environment" )
406  (m_option_numSubEnvironments.c_str(), boost::program_options::value<unsigned int>()->default_value(UQ_ENV_NUM_SUB_ENVIRONMENTS_ODV), "number of subEnvironments" )
407  (m_option_subDisplayFileName.c_str(), boost::program_options::value<std::string >()->default_value(UQ_ENV_SUB_DISPLAY_FILE_NAME_ODV), "output filename for subscreen writing" )
408  (m_option_subDisplayAllowAll.c_str(), boost::program_options::value<bool >()->default_value(UQ_ENV_SUB_DISPLAY_ALLOW_ALL_ODV), "Allow all processors to write to output file" )
409  (m_option_subDisplayAllowInter0.c_str(), boost::program_options::value<bool >()->default_value(UQ_ENV_SUB_DISPLAY_ALLOW_INTER0_ODV), "Allow all inter0 nodes to write to output file")
410  (m_option_subDisplayAllowedSet.c_str(), boost::program_options::value<std::string >()->default_value(UQ_ENV_SUB_DISPLAY_ALLOWED_SET_ODV), "subEnvs that will write to output file" )
411  (m_option_displayVerbosity.c_str(), boost::program_options::value<unsigned int>()->default_value(UQ_ENV_DISPLAY_VERBOSITY_ODV), "set verbosity" )
412  (m_option_syncVerbosity.c_str(), boost::program_options::value<unsigned int>()->default_value(UQ_ENV_SYNC_VERBOSITY_ODV), "set sync verbosity" )
413  (m_option_checkingLevel.c_str(), boost::program_options::value<unsigned int>()->default_value(UQ_ENV_CHECKING_LEVEL_ODV), "set checking level" )
414  (m_option_rngType.c_str(), boost::program_options::value<std::string >()->default_value(UQ_ENV_RNG_TYPE_ODV), "set rngType" )
415  (m_option_seed.c_str(), boost::program_options::value<int >()->default_value(UQ_ENV_SEED_ODV), "set seed" )
416  (m_option_platformName.c_str(), boost::program_options::value<std::string >()->default_value(UQ_ENV_PLATFORM_NAME_ODV), "platform name" )
417  (m_option_identifyingString.c_str(), boost::program_options::value<std::string >()->default_value(UQ_ENV_IDENTIFYING_STRING_ODV), "identifying string" )
418  //(m_option_numDebugParams.c_str(), boost::program_options::value<unsigned int>()->default_value(UQ_ENV_NUM_DEBUG_PARAMS_ODV), "set number of debug parameters" )
419  ;
420 #ifdef QUESO_MEMORY_DEBUGGING
421  std::cout << "In EnvOptions::defineMyOptions(), after add_options()" << std::endl;
422 #endif
423 
424  return;
425 }
426 // --------------------------------------------------
427 void
428 EnvironmentOptions::getMyOptionValues(boost::program_options::options_description& optionsDesc)
429 {
430  queso_deprecated();
431 
432 #ifdef QUESO_MEMORY_DEBUGGING
433  std::cout << "Entering EnvOptions::getMyOptionsValues()" << std::endl;
434 #endif
435  if (m_env.allOptionsMap().count(m_option_help.c_str())) {
436  // 'm_subDisplayOutputFile' is still not available at this moment. Use 'std::cout'
437  if (m_env.fullRank() == 0) std::cout << optionsDesc
438  << std::endl;
439  }
440 
441  if (m_env.allOptionsMap().count(m_option_numSubEnvironments.c_str())) {
443  }
445  std::cerr << "In BaseEnvironment::getMyOptionValues()"
446  << ": m_env.fullComm().NumProc() = " << m_env.fullComm().NumProc()
447  << ", m_numSubEnvironments = " << m_ov.m_numSubEnvironments
448  << std::endl;
449  }
450  queso_require_equal_to_msg((m_env.fullComm().NumProc()%m_ov.m_numSubEnvironments), 0, "total number of processors in environment must be multiple of the specified number of subEnvironments");
451 
452  if (m_env.allOptionsMap().count(m_option_subDisplayFileName.c_str())) {
454  }
455 
456  if (m_env.allOptionsMap().count(m_option_subDisplayAllowAll.c_str())) {
458  }
459 
460  if (m_env.allOptionsMap().count(m_option_subDisplayAllowInter0.c_str())) {
462  }
463 
466  // The line below is commented because 'm_subId' is not set at this point yet
467  //m_subDisplayAllowedSet.insert((unsigned int) m_subId);
468  }
469  else if (m_ov.m_subDisplayAllowInter0) {
471  }
472  else if (m_env.allOptionsMap().count(m_option_subDisplayAllowedSet.c_str())) {
474  std::vector<double> tmpAllow(0,0.);
475  std::string inputString = m_env.allOptionsMap()[m_option_subDisplayAllowedSet].as<std::string>();
476  MiscReadDoublesFromString(inputString,tmpAllow);
477  //if (m_subDisplayOutputFile) {
478  // *m_subDisplayOutputFile << "In EnvironmentOptions::getMyOptionValues(): allow = ";
479  // for (unsigned int i = 0; i < tmpAllow.size(); ++i) {
480  // *m_subDisplayOutputFile << " " << tmpAllow[i];
481  // }
482  // *m_subDisplayOutputFile << std::endl;
483  //}
484 
485  if (tmpAllow.size() > 0) {
486  for (unsigned int i = 0; i < tmpAllow.size(); ++i) {
487  m_ov.m_subDisplayAllowedSet.insert((unsigned int) tmpAllow[i]);
488  }
489  }
490  }
491 
492  if (m_env.allOptionsMap().count(m_option_displayVerbosity.c_str())) {
494  }
495 
496  if (m_env.allOptionsMap().count(m_option_syncVerbosity.c_str())) {
498  }
499 
500  if (m_env.allOptionsMap().count(m_option_checkingLevel.c_str())) {
502  }
503 
504  if (m_env.allOptionsMap().count(m_option_rngType.c_str())) {
505  m_ov.m_rngType = m_env.allOptionsMap()[m_option_rngType].as<std::string>();
506  }
507 
508  if (m_env.allOptionsMap().count(m_option_seed.c_str())) {
510  }
511 
512  if (m_env.allOptionsMap().count(m_option_platformName.c_str())) {
514  }
515 
516  if (m_env.allOptionsMap().count(m_option_identifyingString.c_str())) {
518  }
519 
520  //if (m_env.allOptionsMap().count(m_option_numDebugParams.c_str())) {
521  // m_numDebugParams = m_env.allOptionsMap()[m_option_numDebugParams].as<unsigned int>();
522  //}
523 
524 #ifdef QUESO_MEMORY_DEBUGGING
525  std::cout << "Leaving EnvOptions::getMyOptionsValues()" << std::endl;
526 #endif
527 
528  return;
529 }
530 #endif // QUESO_DISABLE_BOOST_PROGRAM_OPTIONS
531 
532 // Operator outside class definition ----------------
533 std::ostream& operator<<(std::ostream& os, const EnvironmentOptions& obj)
534 {
535  queso_deprecated();
536 
537  obj.print(os);
538 
539  return os;
540 }
541 
542 } // End namespace QUESO
std::string m_option_checkingLevel
Input file option name for m_checkingLevel.
EnvOptionsValues & operator=(const EnvOptionsValues &rhs)
Operator for copying the options of an environment.
bool m_subDisplayAllowAll
Allows (or not) all sub-environments to write to output file.
virtual ~EnvOptionsValues()
Destructor.
bool m_subDisplayAllowInter0
Allows (or not) all inter0 nodes to write to output file.
void print(std::ostream &os) const
Print values of the options chosen.
EnvOptionsValues m_ov
Instance of EnvOptionsValues, a class with default values for QUESO environment.
unsigned int m_checkingLevel
Checking level.
std::string m_option_syncVerbosity
Synchronized verbosity.
unsigned int m_numDebugParams
Number of debug parameters. Unused?
This (virtual) class sets up the environment underlying the use of the QUESO library by an executable...
Definition: Environment.h:198
boost::program_options::variables_map & allOptionsMap() const
Definition: Environment.C:386
std::string m_option_identifyingString
Input file option name for m_identifyingString.
EnvOptionsValues()
Default constructor.
std::ostream & operator<<(std::ostream &os, const SequenceStatisticalOptions &obj)
std::string m_option_numSubEnvironments
My number of sub-environments.
void scanOptionsValues()
Scans option values from input file.
std::string m_option_checkingLevel
Checking level.
std::string m_option_displayVerbosity
Input file option name for m_displayVerbosity.
const GetPot & input() const
The GetPot input file parser.
Definition: Environment.C:1149
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"))
ScopedPtr< BoostInputOptionsParser >::Type m_parser
std::string m_option_subDisplayAllowedSet
Input file option name for m_subDisplayAllowedSet.
std::string optionsInputFileName() const
Access to the attribute m_optionsInputFileName, which stores the name of the input file passed by the...
Definition: Environment.C:354
std::string m_option_identifyingString
Identifying string.
std::string m_option_seed
Input file option name for m_seed.
std::string m_option_subDisplayFileName
My output filename for sub-screen writing.
std::string m_prefix
Options prefix.
std::string m_platformName
Platform name.
std::string m_option_help
Input file option name for flagging helpful printing output.
std::string m_option_subDisplayFileName
Input file option name for m_subDisplayFileName.
const BaseEnvironment & m_env
Environment.
std::set< unsigned int > m_subDisplayAllowedSet
Sub-environments that will write to output.
std::string m_option_subDisplayAllowedSet
Sub-environments that will write to output.
int fullRank() const
Returns the rank of the MPI process in QUESO&#39;s full communicator.
Definition: Environment.C:268
std::string m_option_platformName
Platform name.
std::string m_option_rngType
Type of the random number generator.
std::string m_option_subDisplayAllowAll
Input file option name for m_subDisplayAllowAll.
std::string m_option_seed
Seed of the random number generator.
void checkOptions()
Sorts out any inter-option conflicts.
EnvironmentOptions(const BaseEnvironment &env, const char *prefix)
Default constructor.
std::string m_option_subDisplayAllowInter0
Input file option name for m_subDisplayAllowInter0.
void defineMyOptions(boost::program_options::options_description &optionsDesc) const
Define my environment options as the default options.
std::string m_option_subDisplayAllowInter0
Allows (or not) all inter0 nodes to write to output file.
void MiscReadDoublesFromString(const std::string &inputString, std::vector< double > &outputDoubles)
Definition: Miscellaneous.C:40
std::string m_rngType
Type of the random number generator.
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:397
std::string m_identifyingString
Identifying string.
std::string m_option_syncVerbosity
Input file option name for m_syncVerbosity.
MonteCarloSGOptions::MonteCarloSGOptions(const BaseEnvironment &env, const char *prefix, const McOptionsValues &alternativeOptionsValues queso_require_equal_to_msg)(m_env.optionsInputFileName(), std::string(""), std::string("this constructor is incompatible with the existence of an options input file"))
void copy(const EnvOptionsValues &src)
Makes an exact copy of an existing EnvOptionsValues instance.
This class provides a suite options one can pass to a QUESO environment.
ScopedPtr< boost::program_options::options_description >::Type m_optionsDesc
Environment options description.
std::string m_option_numSubEnvironments
Input file option name for m_numSubEnvironments.
const BaseEnvironment * m_env
unsigned int m_displayVerbosity
Verbosity.
int NumProc() const
Returns total number of processes.
Definition: MpiComm.C:133
void getMyOptionValues(boost::program_options::options_description &optionsDesc)
Gets the option values of the environment.
unsigned int displayVerbosity() const
Definition: Environment.C:450
std::string m_subDisplayFileName
Output filename for sub-screen writing.
std::string m_option_rngType
Input file option name for m_rngType.
int m_seed
Seed of the random number generator.
std::string m_option_platformName
Input file option name for m_platformName.
const MpiComm & fullComm() const
Access function for the communicator that was passed to QUESO&#39;s environment.
Definition: Environment.C:274
std::vector< double > m_debugParams
Debug parameters. Unused?
unsigned int m_syncVerbosity
Synchronized verbosity.
std::string m_option_displayVerbosity
Verbosity.
std::string m_option_subDisplayAllowAll
Allows (or not) all sub-environments to write to output file.
This class reads options one can pass to a QUESO environment through an input file.
std::ofstream * subDisplayFile() const
Access function for m_subDisplayFile (displays file on stream).
Definition: Environment.C:320

Generated on Tue Jun 5 2018 19:48:54 for queso-0.57.1 by  doxygen 1.8.5