BornAgain  1.18.0
Simulate and fit neutron and x-ray scattering at grazing incidence
Slice.cpp
Go to the documentation of this file.
1 // ************************************************************************** //
2 //
3 // BornAgain: simulate and fit scattering at grazing incidence
4 //
5 //! @file Sample/Slice/Slice.cpp
6 //! @brief Implements class Slice.
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/Slice/Slice.h"
18 
19 Slice::Slice(double thickness, const Material& material)
20  : m_thickness{thickness}, m_material{material}, m_B_field{}, mP_top_roughness{nullptr}
21 {
22 }
23 
24 Slice::Slice(double thickness, const Material& material, const LayerRoughness& top_roughness)
25  : m_thickness{thickness}, m_material{material}, m_B_field{}, mP_top_roughness{
26  top_roughness.clone()}
27 {
28 }
29 
30 Slice::Slice(const Slice& other)
31  : m_thickness{other.m_thickness}, m_material{other.m_material}, m_B_field{other.m_B_field},
32  mP_top_roughness{}
33 {
34  if (other.mP_top_roughness) {
35  mP_top_roughness.reset(other.mP_top_roughness->clone());
36  }
37 }
38 
40  : m_thickness{other.m_thickness}, m_material{std::move(other.m_material)},
41  m_B_field{other.m_B_field}, mP_top_roughness{std::move(other.mP_top_roughness)}
42 {
43 }
44 
46 {
47  m_thickness = other.m_thickness;
48  m_material = other.m_material;
49  m_B_field = other.m_B_field;
50  if (other.mP_top_roughness) {
51  mP_top_roughness.reset(other.mP_top_roughness->clone());
52  }
53  return *this;
54 }
55 
56 Slice::~Slice() = default;
57 
58 void Slice::setMaterial(const Material& material)
59 {
61 }
62 
64 {
65  return m_material;
66 }
67 
68 double Slice::thickness() const
69 {
70  return m_thickness;
71 }
72 
74 {
75  return mP_top_roughness.get();
76 }
77 
79 {
80  complex_t n = m_material.refractiveIndex(2.0 * M_PI / k.mag());
81  return MaterialUtils::ScalarReducedPotential(n, k, n_ref);
82 }
83 
84 Eigen::Matrix2cd Slice::polarizedReducedPotential(kvector_t k, double n_ref) const
85 {
86  complex_t n = m_material.refractiveIndex(2.0 * M_PI / k.mag());
88 }
89 
90 void Slice::initBField(kvector_t h_field, double b_z)
91 {
93  m_B_field.setZ(b_z);
94 }
95 
97 {
99 }
std::complex< double > complex_t
Definition: Complex.h:20
Defines class LayerRoughness.
Declares functions in namespace MaterialUtils.
#define M_PI
Definition: MathConstants.h:39
Defines class Slice.
double mag() const
Returns magnitude of the vector.
void setZ(const T &a)
Sets z-component in cartesian coordinate system.
Definition: BasicVector3D.h:75
A roughness of interface between two layers.
A wrapper for underlying material implementation.
Definition: Material.h:29
kvector_t magnetization() const
Get the magnetization (in A/m)
Definition: Material.cpp:79
complex_t refractiveIndex(double wavelength) const
Returns refractive index.
Definition: Material.cpp:49
Data structure containing the data of a single slice, for calculating the Fresnel coefficients.
Definition: Slice.h:28
Slice & operator=(const Slice &other)
Definition: Slice.cpp:45
kvector_t m_B_field
cached value of magnetic induction
Definition: Slice.h:63
complex_t scalarReducedPotential(kvector_t k, double n_ref) const
Return the potential term that is used in the one-dimensional Fresnel calculations.
Definition: Slice.cpp:78
Material material() const
Definition: Slice.cpp:63
void invertBField()
Definition: Slice.cpp:96
void setMaterial(const Material &material)
Definition: Slice.cpp:58
std::unique_ptr< LayerRoughness > mP_top_roughness
Definition: Slice.h:64
double thickness() const
Definition: Slice.cpp:68
Slice(double thickness, const Material &material)
Definition: Slice.cpp:19
const LayerRoughness * topRoughness() const
Definition: Slice.cpp:73
Material m_material
Definition: Slice.h:62
double m_thickness
Definition: Slice.h:61
static constexpr double Magnetic_Permeability
Definition: Slice.h:58
Eigen::Matrix2cd polarizedReducedPotential(kvector_t k, double n_ref) const
Return the potential term that is used in the one-dimensional Fresnel calculations in the presence of...
Definition: Slice.cpp:84
void initBField(kvector_t h_field, double b_z)
Initializes the magnetic B field from a given ambient field strength H.
Definition: Slice.cpp:90
complex_t ScalarReducedPotential(complex_t n, kvector_t k, double n_ref)
Function for calculating the reduced potential, used for obtaining the Fresnel coefficients (non-pola...
Eigen::Matrix2cd PolarizedReducedPotential(complex_t n, kvector_t b_field, kvector_t k, double n_ref)
Function for calculating the reduced potential, used for obtaining the Fresnel coefficients (polarize...