BornAgain  1.19.79
Open-source research software to simulate and fit neutron and x-ray reflectometry and grazing-incidence small-angle scattering
IProfileRipple.cpp
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file Sample/HardParticle/IProfileRipple.cpp
6 //! @brief Implements interface ISawtoothRipple.
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 
17 #include "Sample/Shapes/BoxNet.h"
20 
21 // ************************************************************************************************
22 // interface IProfileRipple
23 // ************************************************************************************************
24 
25 IProfileRipple::IProfileRipple(const std::vector<double>& PValues)
26  : IFormFactor(PValues)
27  , m_length(m_P[0])
28  , m_width(m_P[1])
29  , m_height(m_P[2])
30 {
31 }
32 
34 {
35  return (m_width + m_length) / 4.0;
36 }
37 
39 {
40  return factor_x(q.x()) * factor_yz(q.y(), q.z());
41 }
42 
43 // ************************************************************************************************
44 // interface IProfileRectangularRipple
45 // ************************************************************************************************
46 
47 IProfileRectangularRipple::IProfileRectangularRipple(const std::vector<double>& PValues)
48  : IProfileRipple(PValues)
49 {
50  m_shape3D = std::make_unique<BoxNet>(m_length, m_width, m_height);
51 }
52 
53 //! Complex form factor.
54 complex_t IProfileRectangularRipple::factor_yz(complex_t qy, complex_t qz) const
55 {
56  return ripples::profile_yz_bar(qy, qz, m_width, m_height);
57 }
58 
59 // ************************************************************************************************
60 // interface ICosineRipple
61 // ************************************************************************************************
62 
63 ICosineRipple::ICosineRipple(const std::vector<double>& PValues)
64  : IProfileRipple(PValues)
65 {
66  m_shape3D = std::make_unique<RippleCosineNet>(m_length, m_width, m_height);
67 }
68 
69 //! Complex form factor.
70 complex_t ICosineRipple::factor_yz(complex_t qy, complex_t qz) const
71 {
73 }
74 
75 // ************************************************************************************************
76 // interface ISawtoothRipple
77 // ************************************************************************************************
78 
79 ISawtoothRipple::ISawtoothRipple(const std::vector<double>& PValues)
80  : IProfileRipple(PValues)
81  , m_asymmetry(m_P[3])
82 {
83  m_shape3D = std::make_unique<RippleSawtoothNet>(m_length, m_width, m_height, m_asymmetry);
84 }
85 
86 //! Complex form factor.
87 complex_t ISawtoothRipple::factor_yz(complex_t qy, complex_t qz) const
88 {
90 }
Defines class BoxNet.
Defines interface classes IProfileRipple, ICosineRipple, ISawtoothRipple.
Defines class RippleCosineNet.
Defines class RippleSawtooth.
Declares computations in namespace ripples.
ICosineRipple(const std::vector< double > &PValues)
complex_t factor_yz(complex_t qy, complex_t qz) const override
Complex form factor.
Abstract base class for Born form factors.
Definition: IFormFactor.h:36
std::unique_ptr< IShape3D > m_shape3D
IShape3D object, used to retrieve vertices (which may be approximate in the case of round shapes)....
Definition: IFormFactor.h:74
complex_t factor_yz(complex_t qy, complex_t qz) const override
Complex form factor.
IProfileRectangularRipple(const std::vector< double > &PValues)
Base class for form factors with a cosine ripple profile in the yz plane.
double radialExtension() const override
Returns the (approximate in some cases) radial size of the particle of this form factor's shape....
IProfileRipple(const std::vector< double > &PValues)
virtual complex_t factor_yz(complex_t qy, complex_t qz) const =0
const double & m_length
const double & m_width
virtual complex_t factor_x(complex_t qx) const =0
complex_t formfactor_at_bottom(C3 q) const override
const double & m_height
const double & m_asymmetry
ISawtoothRipple(const std::vector< double > &PValues)
complex_t factor_yz(complex_t qy, complex_t qz) const override
Complex form factor.
complex_t profile_yz_cosine(complex_t qy, complex_t qz, double width, double height)
Complex form factor of cosine ripple.
Definition: Ripples.cpp:45
complex_t profile_yz_bar(complex_t qy, complex_t qz, double width, double height)
Complex form factor of rectangular ripple (bar).
Definition: Ripples.cpp:36
complex_t profile_yz_triangular(complex_t qy, complex_t qz, double width, double height, double asymmetry)
Complex form factor of triangular ripple.
Definition: Ripples.cpp:72