BornAgain
1.18.0
Simulate and fit neutron and x-ray scattering at grazing incidence
RippleCosine.cpp
Go to the documentation of this file.
1
// ************************************************************************** //
2
//
3
// BornAgain: simulate and fit scattering at grazing incidence
4
//
5
//! @file Sample/Shapes/RippleCosine.cpp
6
//! @brief Implements class RippleCosine.
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/Shapes/RippleCosine.h
"
16
17
#include <cmath>
18
19
RippleCosine::RippleCosine
(
double
length
,
double
width
,
double
height
)
20
{
21
size_t
n_y =
IShape::N_Circle
+ 1;
22
double
y_step =
width
/ (
IShape::N_Circle
);
23
m_vertices
.resize(2 * n_y);
24
for
(
size_t
i = 0; i < n_y; ++i) {
25
double
y = i * y_step -
width
/ 2.0;
26
double
z =
height
* (1.0 + std::cos(2.0 *
M_PI
* y /
width
)) / 2.0;
27
m_vertices
[i] =
kvector_t
(
length
/ 2.0, y, z);
28
m_vertices
[n_y + i] =
kvector_t
(-
length
/ 2.0, y, z);
29
}
30
}
31
32
RippleCosine::~RippleCosine
() =
default
;
M_PI
#define M_PI
Definition:
MathConstants.h:39
RippleCosine.h
Defines class RippleCosine.
kvector_t
BasicVector3D< double > kvector_t
Definition:
Vectors3D.h:21
IShape::m_vertices
std::vector< kvector_t > m_vertices
List of vertices initialized during construction.
Definition:
IShape.h:40
IShape::N_Circle
static const size_t N_Circle
Definition:
IShape.h:36
RippleCosine::~RippleCosine
~RippleCosine()
RippleCosine::RippleCosine
RippleCosine(double length, double width, double height)
Definition:
RippleCosine.cpp:19
anonymous_namespace{BoxCompositionBuilder.cpp}::width
const double width
Definition:
BoxCompositionBuilder.cpp:31
anonymous_namespace{BoxCompositionBuilder.cpp}::height
const double height
Definition:
BoxCompositionBuilder.cpp:32
anonymous_namespace{BoxCompositionBuilder.cpp}::length
const double length
Definition:
BoxCompositionBuilder.cpp:30
Sample
Shapes
RippleCosine.cpp
Generated by
1.9.1