BornAgain  1.19.79
Open-source research software to simulate and fit neutron and x-ray reflectometry and grazing-incidence small-angle scattering
LongBoxGauss.cpp
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file Sample/HardParticle/LongBoxGauss.cpp
6 //! @brief Implements class LongBoxGauss.
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 "Base/Math/Functions.h"
17 #include "Sample/Shapes/BoxNet.h"
18 
19 LongBoxGauss::LongBoxGauss(const std::vector<double> P)
20  : IFormFactor(P)
21  , m_length(m_P[0])
22  , m_width(m_P[1])
23  , m_height(m_P[2])
24 {
25  checkNodeArgs();
26  m_shape3D = std::make_unique<BoxNet>(m_length, m_width, m_height);
27 }
28 
29 LongBoxGauss::LongBoxGauss(double length, double width, double height)
30  : LongBoxGauss(std::vector<double>{length, width, height})
31 {
32 }
33 
35 {
36  complex_t qxL2 = std::pow(m_length * q.x(), 2) / 2.0;
37  complex_t qyWdiv2 = m_width * q.y() / 2.0;
38  complex_t qzHdiv2 = m_height * q.z() / 2.0;
39 
40  return m_height * m_length * m_width * exp_I(qzHdiv2) * std::exp(-qxL2) * Math::sinc(qyWdiv2)
41  * Math::sinc(qzHdiv2);
42 }
Defines class BoxNet.
Defines namespace Math.
Defines class LongBoxGauss.
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
void checkNodeArgs() const
Raises exception if a parameter value is invalid.
Definition: INode.cpp:27
The form factor for a long rectangular box.
Definition: LongBoxGauss.h:23
double height() const
Definition: LongBoxGauss.h:40
complex_t formfactor_at_bottom(C3 q) const override
LongBoxGauss(double length, double width, double height)
const double & m_length
Definition: LongBoxGauss.h:47
double length() const
Definition: LongBoxGauss.h:39
double width() const
Definition: LongBoxGauss.h:41
const double & m_height
Definition: LongBoxGauss.h:49
const double & m_width
Definition: LongBoxGauss.h:48
double sinc(double x)
sinc function:
Definition: Functions.cpp:52