BornAgain  1.18.0
Simulate and fit neutron and x-ray scattering at grazing incidence
Slice.h
Go to the documentation of this file.
1 // ************************************************************************** //
2 //
3 // BornAgain: simulate and fit scattering at grazing incidence
4 //
5 //! @file Sample/Slice/Slice.h
6 //! @brief Defines 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 #ifndef BORNAGAIN_CORE_MULTILAYER_SLICE_H
16 #define BORNAGAIN_CORE_MULTILAYER_SLICE_H
17 
19 #include <memory>
20 
21 class LayerRoughness;
22 
23 //! Data structure containing the data of a single slice, for calculating the Fresnel coefficients.
24 //!
25 //! @ingroup algorithms_internal
26 
27 class Slice
28 {
29 public:
30  Slice(double thickness, const Material& material);
31  Slice(double thickness, const Material& material, const LayerRoughness& top_roughness);
32  Slice(const Slice& other);
33  Slice(Slice&& other);
34  Slice& operator=(const Slice& other);
35  ~Slice();
36 
37  void setMaterial(const Material& material);
38  Material material() const;
39 
40  double thickness() const;
41  const LayerRoughness* topRoughness() const;
42 
43  //! Return the potential term that is used in the one-dimensional Fresnel calculations
44  complex_t scalarReducedPotential(kvector_t k, double n_ref) const;
45 
46 #ifndef SWIG
47  //! Return the potential term that is used in the one-dimensional Fresnel calculations
48  //! in the presence of magnetization
49  Eigen::Matrix2cd polarizedReducedPotential(kvector_t k, double n_ref) const;
50 #endif
51 
52  //! Initializes the magnetic B field from a given ambient field strength H
53  void initBField(kvector_t h_field, double b_z);
54  kvector_t bField() const { return m_B_field; }
55 
56  void invertBField();
57 
58  static constexpr double Magnetic_Permeability = 4e-7 * M_PI;
59 
60 private:
61  double m_thickness;
63  kvector_t m_B_field; //!< cached value of magnetic induction
64  std::unique_ptr<LayerRoughness> mP_top_roughness;
65 };
66 
67 #endif // BORNAGAIN_CORE_MULTILAYER_SLICE_H
std::complex< double > complex_t
Definition: Complex.h:20
Defines and implements class Material.
#define M_PI
Definition: MathConstants.h:39
A roughness of interface between two layers.
A wrapper for underlying material implementation.
Definition: Material.h:29
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
kvector_t bField() const
Definition: Slice.h:54
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