BornAgain  1.19.79
Open-source research software to simulate and fit neutron and x-ray reflectometry and grazing-incidence small-angle scattering
IChiSquaredModule.cpp
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file Sim/Residual/IChiSquaredModule.cpp
6 //! @brief Implements interface IChiSquaredModule.
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 
18 
20  : m_variance_function(new VarianceSimFunction)
21 {
22 }
23 
25 {
26  return m_variance_function.get();
27 }
28 
30 {
31  if (other.m_variance_function)
32  m_variance_function.reset(other.m_variance_function->clone());
33 
34  if (other.m_intensity_function)
35  m_intensity_function.reset(other.m_intensity_function->clone());
36 }
37 
39 
41 {
42  m_variance_function.reset(variance_function.clone());
43 }
44 
46 {
47  return m_intensity_function.get();
48 }
49 
51 {
52  m_intensity_function.reset(intensity_function.clone());
53 }
Defines interface IChiSquaredModule.
Defines and implements the interface class IIntensityFunction and its child classes IntensityFunction...
Defines IVarianceFunction classes.
Interface residual calculations.
const IVarianceFunction * varianceFunction() const
Returns squared function.
std::unique_ptr< IIntensityFunction > m_intensity_function
std::unique_ptr< IVarianceFunction > m_variance_function
void setVarianceFunction(const IVarianceFunction &variance_function)
Sets squared function.
virtual const IIntensityFunction * getIntensityFunction() const
Returns data rescaler.
~IChiSquaredModule() override
virtual void setIntensityFunction(const IIntensityFunction &intensity_function)
Sets data rescaler.
Interface for applying arbitrary function to the measured intensity.
virtual IIntensityFunction * clone() const =0
Variance function interface.
virtual IVarianceFunction * clone() const =0
Returns max(sim, epsilon)