BornAgain  1.19.79
Simulate and fit neutron and x-ray scattering at grazing incidence
ResolutionFunctionItems.cpp
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file GUI/Model/Device/ResolutionFunctionItems.cpp
6 //! @brief Implements family of ResolutionFunctionItem
7 //!
8 //! @homepage http://www.bornagainproject.org
9 //! @license GNU General Public License v3 or higher (see COPYING)
10 //! @copyright Forschungszentrum Jülich GmbH 2022
11 //! @authors Scientific Computing Group at MLZ (see CITATION, AUTHORS)
12 //
13 // ************************************************************************************************
14 
16 #include "Device/Resolution/ResolutionFunction2DGaussian.h"
18 
19 std::unique_ptr<IResolutionFunction2D>
21 {
22  return {};
23 }
24 
26 {
27  m_sigmaX.init("Sigma X", "Resolution along horizontal axis", 0.02, Unit::degree, 3,
28  RealLimits::lowerLimited(0.0), "sigmaX");
29  m_sigmaY.init("Sigma Y", "Resolution along vertical axis", 0.02, Unit::degree, 3,
30  RealLimits::lowerLimited(0.0), "sigmaY");
31 }
32 
33 std::unique_ptr<IResolutionFunction2D>
35 {
36  return std::make_unique<ResolutionFunction2DGaussian>(scale * m_sigmaX, scale * m_sigmaY);
37 }
38 
39 void ResolutionFunction2DGaussianItem::setUnit(const std::variant<QString, Unit>& unit)
40 {
41  m_sigmaX.setUnit(unit);
42  m_sigmaY.setUnit(unit);
43 }
44 
46 {
47  s.assertVersion(0);
48  Serialize::rwProperty(s, m_sigmaX);
49  Serialize::rwProperty(s, m_sigmaY);
50 }
Defines family of ResolutionFunctionItem.
Defines class Streamer.
@ degree
void setUnit(const std::variant< QString, Unit > &unit) override
Set the unit of the distributed value.
std::unique_ptr< IResolutionFunction2D > createResolutionFunction(double scale=1.0) const override
std::unique_ptr< IResolutionFunction2D > createResolutionFunction(double scale=1.0) const override
Supports serialization to or deserialization from QXmlStream.
Definition: Streamer.h:36
void assertVersion(unsigned expectedVersion) const
As reader, throws DeserializationException unless the expected version is read. As writer,...
Definition: Streamer.cpp:26
void rwProperty(Streamer &s, DoubleProperty &d)