BornAgain  1.18.0
Simulate and fit neutron and x-ray scattering at grazing incidence
IterationInfo.cpp
Go to the documentation of this file.
1 // ************************************************************************** //
2 //
3 // BornAgain: simulate and fit scattering at grazing incidence
4 //
5 //! @file Core/Fitting/IterationInfo.cpp
6 //! @brief Implements class IterationInfo.
7 //!
8 //! @homepage http://www.bornagainproject.org
9 //! @license GNU General Public License v3 or higher (see COPYING)
10 //! @copyright Forschungszentrum Jülich GmbH 2018
11 //! @authors Scientific Computing Group at MLZ (see CITATION, AUTHORS)
12 //
13 // ************************************************************************** //
14 
16 
17 IterationInfo::IterationInfo() : m_chi2(0.0), m_iteration_count(0) {}
18 
19 void IterationInfo::update(const Fit::Parameters& params, double chi2)
20 {
21  m_current_parameters = params;
22  m_chi2 = chi2;
24 }
25 
27 {
28  return m_iteration_count;
29 }
30 
31 double IterationInfo::chi2() const
32 {
33  return m_chi2;
34 }
35 
37 {
38  return m_current_parameters;
39 }
40 
41 std::map<std::string, double> IterationInfo::parameterMap() const
42 {
43  std::map<std::string, double> result;
44 
45  for (const auto& par : m_current_parameters)
46  result.insert(std::make_pair(par.name(), par.value()));
47 
48  return result;
49 }
Defines class IterationInfo.
A collection of fit parameters.
Definition: Parameters.h:28
Fit::Parameters m_current_parameters
Definition: IterationInfo.h:44
std::map< std::string, double > parameterMap() const
Returns map of fit parameter names and its current values.
Fit::Parameters parameters() const
unsigned iterationCount() const
Returns current number of minimizer iterations.
void update(const Fit::Parameters &params, double chi2)
double chi2() const
unsigned m_iteration_count
Definition: IterationInfo.h:45