BornAgain  1.19.79
Open-source research software to simulate and fit neutron and x-ray reflectometry and grazing-incidence small-angle scattering
IChiSquaredModule.h
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file Sim/Residual/IChiSquaredModule.h
6 //! @brief Defines 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 
15 #ifndef BORNAGAIN_SIM_RESIDUAL_ICHISQUAREDMODULE_H
16 #define BORNAGAIN_SIM_RESIDUAL_ICHISQUAREDMODULE_H
17 
18 #include "Base/Types/ICloneable.h"
19 #include <memory>
20 
21 class IVarianceFunction;
22 class IIntensityFunction;
23 
24 //! Interface residual calculations.
25 
26 class IChiSquaredModule : public ICloneable {
27 public:
29  ~IChiSquaredModule() override;
30 
31  //! clone method
32  IChiSquaredModule* clone() const override = 0;
33 
34  //! Returns squared function
35  const IVarianceFunction* varianceFunction() const;
36 
37  //! Sets squared function
38  void setVarianceFunction(const IVarianceFunction& variance_function);
39 
40  //! Returns data rescaler.
41  virtual const IIntensityFunction* getIntensityFunction() const;
42 
43  //! Sets data rescaler.
44  virtual void setIntensityFunction(const IIntensityFunction& intensity_function);
45 
46  virtual double residual(double a, double b, double weight) = 0;
47 
48 protected:
50 
51  std::unique_ptr<IVarianceFunction> m_variance_function;
52  std::unique_ptr<IIntensityFunction> m_intensity_function;
53 };
54 
55 #endif // BORNAGAIN_SIM_RESIDUAL_ICHISQUAREDMODULE_H
Defines and implements the standard mix-in ICloneable.
Interface residual calculations.
const IVarianceFunction * varianceFunction() const
Returns squared function.
virtual double residual(double a, double b, double weight)=0
std::unique_ptr< IIntensityFunction > m_intensity_function
std::unique_ptr< IVarianceFunction > m_variance_function
void setVarianceFunction(const IVarianceFunction &variance_function)
Sets squared function.
IChiSquaredModule * clone() const override=0
clone method
virtual const IIntensityFunction * getIntensityFunction() const
Returns data rescaler.
~IChiSquaredModule() override
virtual void setIntensityFunction(const IIntensityFunction &intensity_function)
Sets data rescaler.
Interface for polymorphic classes that should not be copied, except by explicit cloning.
Definition: ICloneable.h:23
Interface for applying arbitrary function to the measured intensity.
Variance function interface.