BornAgain
1.19.79
Open-source research software to simulate and fit neutron and x-ray reflectometry and grazing-incidence small-angle scattering
Box.cpp
Go to the documentation of this file.
1
// ************************************************************************************************
2
//
3
// BornAgain: simulate and fit reflection and scattering
4
//
5
//! @file Sample/HardParticle/Box.cpp
6
//! @brief Implements class Box.
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
#include "
Sample/HardParticle/Box.h
"
16
#include "
Base/Math/Functions.h
"
17
18
Box::Box
(
const
std::vector<double> P)
19
:
IFormFactorPrism
(P)
20
, m_length(m_P[0])
21
, m_width(m_P[1])
22
, m_height(m_P[2])
23
{
24
checkNodeArgs
();
25
double
a =
m_length
/ 2;
26
double
b =
m_width
/ 2;
27
std::vector<R3> V{{a, b, 0.}, {-a, b, 0.}, {-a, -b, 0.}, {a, -b, 0}};
28
setPrism
(
true
, V);
29
}
30
31
Box::Box
(
double
length,
double
width,
double
height)
32
:
Box
(std::vector<double>{
length
,
width
,
height
})
33
{
34
}
35
36
complex_t
Box::formfactor_at_bottom
(C3 q)
const
37
{
38
complex_t qzHdiv2 =
m_height
/ 2 * q.z();
39
return
m_length
*
m_width
*
m_height
*
Math::sinc
(
m_length
/ 2 * q.x())
40
*
Math::sinc
(
m_width
/ 2 * q.y()) *
Math::sinc
(qzHdiv2) * exp_I(qzHdiv2);
41
}
Box.h
Defines class Box.
Functions.h
Defines namespace Math.
Box
A rectangular prism (parallelepiped).
Definition:
Box.h:23
Box::width
double width() const
Definition:
Box.h:40
Box::Box
Box(double length, double width, double height)
Definition:
Box.cpp:31
Box::m_length
const double & m_length
Definition:
Box.h:48
Box::m_height
const double & m_height
Definition:
Box.h:50
Box::length
double length() const
Definition:
Box.h:39
Box::m_width
const double & m_width
Definition:
Box.h:49
Box::height
double height() const override
Definition:
Box.h:41
Box::formfactor_at_bottom
complex_t formfactor_at_bottom(C3 q) const override
Definition:
Box.cpp:36
IFormFactorPrism
A prism with a polygonal base, for form factor computation.
Definition:
IFormFactorPrism.h:31
IFormFactorPrism::setPrism
void setPrism(bool symmetry_Ci, const std::vector< R3 > &vertices)
Definition:
IFormFactorPrism.cpp:26
INode::checkNodeArgs
void checkNodeArgs() const
Raises exception if a parameter value is invalid.
Definition:
INode.cpp:27
Math::sinc
double sinc(double x)
sinc function:
Definition:
Functions.cpp:52
Sample
HardParticle
Box.cpp
Generated by
1.9.1