Skip to content

Commit

Permalink
Granular Options handling: cleanup pass
Browse files Browse the repository at this point in the history
Finish up libqueso#569:
 * Add default ctor to all Options classes and always init defaults
   and m_env
 * Always initialize BoostInputOptionsParser since operator<< may
   dereference it (there remains a bug w.r.t. same in copy ctors, but
   not going to take time on it as no current use cases and code is
   deprecated)
  • Loading branch information
briadam committed Oct 16, 2017
1 parent a746a80 commit 4d3fa43
Show file tree
Hide file tree
Showing 12 changed files with 60 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/core/inc/InfiniteDimensionalMCMCSamplerOptions.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ namespace QUESO {
class InfiniteDimensionalMCMCSamplerOptions
{
public:
//! Constructor
InfiniteDimensionalMCMCSamplerOptions();

//! Given prefix, read the input file for parameters named prefix_*
InfiniteDimensionalMCMCSamplerOptions(const BaseEnvironment& env, const char* prefix);

Expand Down
3 changes: 3 additions & 0 deletions src/core/src/EnvironmentOptions.C
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ namespace QUESO {
EnvOptionsValues::EnvOptionsValues()
:
m_env(NULL)
#ifndef QUESO_DISABLE_BOOST_PROGRAM_OPTIONS
, m_parser(new BoostInputOptionsParser())
#endif // QUESO_DISABLE_BOOST_PROGRAM_OPTIONS
{
this->set_defaults();
this->set_prefix("");
Expand Down
11 changes: 11 additions & 0 deletions src/core/src/InfiniteDimensionalMCMCSamplerOptions.C
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,17 @@

namespace QUESO {

InfiniteDimensionalMCMCSamplerOptions::InfiniteDimensionalMCMCSamplerOptions()
:
#ifndef QUESO_DISABLE_BOOST_PROGRAM_OPTIONS
m_parser(new BoostInputOptionsParser()),
#endif // QUESO_DISABLE_BOOST_PROGRAM_OPTIONS
m_env(NULL)
{
this->set_defaults();
this->set_prefix("");
}

InfiniteDimensionalMCMCSamplerOptions::InfiniteDimensionalMCMCSamplerOptions(
const BaseEnvironment& env,
const char * prefix)
Expand Down
3 changes: 3 additions & 0 deletions src/core/src/OptimizerOptions.C
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ namespace QUESO {
OptimizerOptions::OptimizerOptions()
:
m_env(NULL)
#ifndef QUESO_DISABLE_BOOST_PROGRAM_OPTIONS
, m_parser(new BoostInputOptionsParser())
#endif // QUESO_DISABLE_BOOST_PROGRAM_OPTIONS
{
this->set_defaults();
this->set_prefix("");
Expand Down
3 changes: 3 additions & 0 deletions src/stats/inc/MLSamplingLevelOptions.h
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,9 @@ class MLSamplingLevelOptions
public:
//! @name Constructor/Destructor methods
//@{
//! Constructor
MLSamplingLevelOptions();

//! Constructor: reads options from the input file.
MLSamplingLevelOptions(const BaseEnvironment& env, const char* prefix);

Expand Down
3 changes: 3 additions & 0 deletions src/stats/inc/MLSamplingOptions.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ class MLSamplingOptions
//@{
//! Default constructor.
/*! Assigns the default suite of options to the Multilevel sequence generator.*/
MLSamplingOptions();

//! Parsing constructor.
MLSamplingOptions(const BaseEnvironment& env, const char* prefix);

//! Set default values for parameter options
Expand Down
11 changes: 11 additions & 0 deletions src/stats/src/MLSamplingLevelOptions.C
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,17 @@

namespace QUESO {

MLSamplingLevelOptions::MLSamplingLevelOptions()
:
m_env(NULL)
#ifndef QUESO_DISABLE_BOOST_PROGRAM_OPTIONS
, m_parser(new BoostInputOptionsParser())
#endif // QUESO_DISABLE_BOOST_PROGRAM_OPTIONS
{
this->set_defaults();
this->set_prefix("");
}

MLSamplingLevelOptions::MLSamplingLevelOptions(
const BaseEnvironment& env,
const char* prefix)
Expand Down
11 changes: 11 additions & 0 deletions src/stats/src/MLSamplingOptions.C
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,17 @@

namespace QUESO {

MLSamplingOptions::MLSamplingOptions()
:
m_env(NULL)
#ifndef QUESO_DISABLE_BOOST_PROGRAM_OPTIONS
, m_parser(new BoostInputOptionsParser())
#endif // QUESO_DISABLE_BOOST_PROGRAM_OPTIONS
{
this->set_defaults();
this->set_prefix("");
}

MLSamplingOptions::
MLSamplingOptions(const BaseEnvironment& env, const char* prefix)
{
Expand Down
3 changes: 3 additions & 0 deletions src/stats/src/MetropolisHastingsSGOptions.C
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ MhOptionsValues::MhOptionsValues(
)
:
m_env(NULL)
#ifndef QUESO_DISABLE_BOOST_PROGRAM_OPTIONS
, m_parser(new BoostInputOptionsParser())
#endif // QUESO_DISABLE_BOOST_PROGRAM_OPTIONS
{
#ifdef QUESO_USES_SEQUENCE_STATISTICAL_OPTIONS
if (alternativeRawSsOptionsValues ) m_alternativeRawSsOptionsValues = *alternativeRawSsOptionsValues;
Expand Down
3 changes: 3 additions & 0 deletions src/stats/src/MonteCarloSGOptions.C
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ McOptionsValues::McOptionsValues(
const SsOptionsValues* alternativeQSsOptionsValues
#endif
)
#ifndef QUESO_DISABLE_BOOST_PROGRAM_OPTIONS
: m_parser(new BoostInputOptionsParser())
#endif // QUESO_DISABLE_BOOST_PROGRAM_OPTIONS
{
#ifdef QUESO_USES_SEQUENCE_STATISTICAL_OPTIONS
if (alternativePSsOptionsValues) m_alternativePSsOptionsValues = *alternativePSsOptionsValues;
Expand Down
3 changes: 3 additions & 0 deletions src/stats/src/StatisticalForwardProblemOptions.C
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ namespace QUESO {

// Default constructor -----------------------------
SfpOptionsValues::SfpOptionsValues()
#ifndef QUESO_DISABLE_BOOST_PROGRAM_OPTIONS
: m_parser(new BoostInputOptionsParser())
#endif // QUESO_DISABLE_BOOST_PROGRAM_OPTIONS
{
this->set_defaults();
this->set_prefix("");
Expand Down
3 changes: 3 additions & 0 deletions src/stats/src/StatisticalInverseProblemOptions.C
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ namespace QUESO {

// Default constructor -----------------------------
SipOptionsValues::SipOptionsValues()
#ifndef QUESO_DISABLE_BOOST_PROGRAM_OPTIONS
: m_parser(new BoostInputOptionsParser())
#endif // QUESO_DISABLE_BOOST_PROGRAM_OPTIONS
{
this->set_defaults();
this->set_prefix("");
Expand Down

0 comments on commit 4d3fa43

Please sign in to comment.