BornAgain  1.19.79
Open-source research software to simulate and fit neutron and x-ray reflectometry and grazing-incidence small-angle scattering
IterationInfo.cpp
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file Sim/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 
18  : m_chi2(0.0)
19  , m_iteration_count(0)
20 {
21 }
22 
23 void IterationInfo::update(const mumufit::Parameters& params, double chi2)
24 {
25  m_current_parameters = params;
26  m_chi2 = chi2;
28 }
29 
31 {
32  return m_iteration_count;
33 }
34 
35 double IterationInfo::chi2() const
36 {
37  return m_chi2;
38 }
39 
41 {
42  return m_current_parameters;
43 }
44 
45 std::map<std::string, double> IterationInfo::parameterMap() const
46 {
47  std::map<std::string, double> result;
48 
49  for (const auto& par : m_current_parameters)
50  result.insert(std::make_pair(par.name(), par.value()));
51 
52  return result;
53 }
Defines class IterationInfo.
void update(const mumufit::Parameters &params, double chi2)
std::map< std::string, double > parameterMap() const
Returns map of fit parameter names and its current values.
unsigned iterationCount() const
Returns current number of minimizer iterations.
mumufit::Parameters parameters() const
mumufit::Parameters m_current_parameters
Definition: IterationInfo.h:43
double chi2() const
unsigned m_iteration_count
Definition: IterationInfo.h:44
A collection of fit parameters.
Definition: Parameters.h:26