BornAgain  1.19.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 reflection and scattering
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 #ifdef SWIG
16 #error no need to expose this header to Swig
17 #endif
18 
19 #ifndef USER_API
20 #ifndef BORNAGAIN_SAMPLE_SLICE_SLICE_H
21 #define BORNAGAIN_SAMPLE_SLICE_SLICE_H
22 
24 #include <memory>
25 
26 class LayerRoughness;
27 
28 //! Data structure containing the data of a single slice, for calculating the Fresnel coefficients.
29 //!
30 //! @ingroup algorithms_internal
31 
32 class Slice {
33 public:
34  Slice(double thickness, const Material& material);
35  Slice(double thickness, const Material& material, const LayerRoughness& top_roughness);
36  Slice(const Slice& other);
37  Slice(Slice&& other);
38  Slice& operator=(const Slice& other);
39  ~Slice();
40 
41  void setMaterial(const Material& material);
42  const Material& material() const;
43 
44  double thickness() const;
45  const LayerRoughness* topRoughness() const;
46 
47  //! Return the potential term that is used in the one-dimensional Fresnel calculations
48  complex_t scalarReducedPotential(kvector_t k, double n_ref) const;
49 
50 #ifndef SWIG
51  //! Return the potential term that is used in the one-dimensional Fresnel calculations
52  //! in the presence of magnetization
53  Eigen::Matrix2cd polarizedReducedPotential(kvector_t k, double n_ref) const;
54 #endif
55 
56  //! Initializes the magnetic B field from a given ambient field strength H
57  void initBField(kvector_t h_field, double b_z);
58  kvector_t bField() const { return m_B_field; }
59 
60  void invertBField();
61 
62  static constexpr double Magnetic_Permeability = 4e-7 * M_PI;
63 
64 private:
65  double m_thickness;
67  kvector_t m_B_field; //!< cached value of magnetic induction
68  std::unique_ptr<LayerRoughness> m_top_roughness;
69 };
70 
71 #endif // BORNAGAIN_SAMPLE_SLICE_SLICE_H
72 #endif // USER_API
std::complex< double > complex_t
Definition: Complex.h:20
#define M_PI
Definition: Constants.h:44
Defines and implements class Material.
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:32
Slice & operator=(const Slice &other)
Definition: Slice.cpp:51
std::unique_ptr< LayerRoughness > m_top_roughness
Definition: Slice.h:68
kvector_t m_B_field
cached value of magnetic induction
Definition: Slice.h:67
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:84
void invertBField()
Definition: Slice.cpp:102
void setMaterial(const Material &material)
Definition: Slice.cpp:64
kvector_t bField() const
Definition: Slice.h:58
const Material & material() const
Definition: Slice.cpp:69
double thickness() const
Definition: Slice.cpp:74
Slice(double thickness, const Material &material)
Definition: Slice.cpp:19
const LayerRoughness * topRoughness() const
Definition: Slice.cpp:79
Material m_material
Definition: Slice.h:66
double m_thickness
Definition: Slice.h:65
static constexpr double Magnetic_Permeability
Definition: Slice.h:62
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:90
void initBField(kvector_t h_field, double b_z)
Initializes the magnetic B field from a given ambient field strength H.
Definition: Slice.cpp:96