SourceXtractorPlusPlus  0.13
Please provide a description of the project.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
LegacyModelFittingConfig.cpp
Go to the documentation of this file.
1 
17 /*
18  * ModelFittingConfig.cpp
19  *
20  * Created on: May 17, 2017
21  * Author: mschefer
22  */
23 
26 
27 using namespace Euclid::Configuration;
28 namespace po = boost::program_options;
29 
30 namespace SourceXtractor {
31 
32 static const std::string MFIT_MAX_ITERATIONS {"model-fitting-iterations"};
33 static const std::string MFIT_ENGINE {"model-fitting-engine"};
34 
35 LegacyModelFittingConfig::LegacyModelFittingConfig(long manager_id) : Configuration(manager_id), m_max_iterations(1000) {
36 }
37 
40 
41  return {{"Model Fitting",
42  {
43  {MFIT_MAX_ITERATIONS.c_str(), po::value<int>()->default_value(1000),
44  "Maximum number of iterations allowed for model fitting"},
45  {MFIT_ENGINE.c_str(), po::value<std::string>()->default_value(default_engine),
46  "Least squares engine"}
47  }
48  }};
49 }
50 
51 void LegacyModelFittingConfig::initialize(const UserValues& args) {
52  m_max_iterations = args.at(MFIT_MAX_ITERATIONS).as<int>();
53  if (m_max_iterations <= 0) {
54  throw Elements::Exception() << "Invalid " << MFIT_MAX_ITERATIONS << " value: " << m_max_iterations;
55  }
57 }
58 
59 } /* namespace SourceXtractor */
60 
61 
STL class.
STL class.
T at(T...args)
static const std::string MFIT_ENGINE
static const std::string MFIT_MAX_ITERATIONS
std::map< std::string, OptionDescriptionList > getProgramOptions() override
T c_str(T...args)
void initialize(const UserValues &args) override