BornAgain  1.18.0
Simulate and fit neutron and x-ray scattering at grazing incidence
IIntensityFunction.cpp
Go to the documentation of this file.
1 // ************************************************************************** //
2 //
3 // BornAgain: simulate and fit scattering at grazing incidence
4 //
5 //! @file Device/Intensity/IIntensityFunction.cpp
6 //! @brief Implements the classes IntensityFunctionLog, IntensityFunctionSqrt
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 #include <cmath>
17 #include <limits>
18 
20 
22 {
23  return new IntensityFunctionLog;
24 }
25 
26 double IntensityFunctionLog::evaluate(double value) const
27 {
28  return value > 0 ? std::log(value) : std::numeric_limits<double>::lowest();
29 }
30 
32 {
33  return new IntensityFunctionSqrt;
34 }
35 
36 double IntensityFunctionSqrt::evaluate(double value) const
37 {
38  return value > 0 ? std::sqrt(value) : std::numeric_limits<double>::lowest();
39 }
Defines and implements the interface class IIntensityFunction and its child classes IntensityFunction...
virtual ~IIntensityFunction()
Algorithm for applying log function to the measured intensity.
virtual IntensityFunctionLog * clone() const
virtual double evaluate(double value) const
Algorithm for applying sqrt function to the measured intensity.
virtual IntensityFunctionSqrt * clone() const
virtual double evaluate(double value) const