BornAgain  1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
SpecularMagneticStrategy.h
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file Sample/Specular/SpecularMagneticStrategy.h
6 //! @brief Defines class SpecularMagneticStrategy.
7 //!
8 //! @homepage http://www.bornagainproject.org
9 //! @license GNU General Public License v3 or higher (see COPYING)
10 //! @copyright Forschungszentrum Jülich GmbH 2020
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_SPECULAR_SPECULARMAGNETICSTRATEGY_H
21 #define BORNAGAIN_SAMPLE_SPECULAR_SPECULARMAGNETICSTRATEGY_H
22 
25 #include <memory>
26 #include <vector>
27 
28 class Slice;
29 
30 //! Implements the magnetic Fresnel computation with Nevot-Croce roughness
31 //!
32 //! Implements the transfer matrix formalism for the calculation of wave
33 //! amplitudes of the coherent wave solution in a multilayer with magnetization.
34 //! For a description, see internal
35 //! document "Polarized Implementation of the Transfer Matrix Method"
36 //!
37 //! @ingroup algorithms_internal
39 public:
40  // TODO remove once external test code is not needed anmyore
41  // for the moment i need them!
42  using coefficient_entry_type = Eigen::Matrix2cd;
44  using coefficient_pointer_type = std::unique_ptr<const coefficient_type>;
45  using coeffs_t = std::vector<coefficient_pointer_type>;
46 
47  //! Computes refraction angle reflection/transmission coefficients
48  //! for given sliced multilayer and wavevector k
49  ISpecularStrategy::coeffs_t Execute(const std::vector<Slice>& slices, const kvector_t& k) const;
50 
51  //! Computes refraction angle reflection/transmission coefficients
52  //! for given sliced multilayer and a set of kz projections corresponding to each slice
53  ISpecularStrategy::coeffs_t Execute(const std::vector<Slice>& slices,
54  const std::vector<complex_t>& kz) const;
55 
56  //! Computes the Fresnel R coefficient for the top layer only
57  //! Introduced in order to speed up pure reflectivity computations
58  virtual std::variant<complex_t, Eigen::Matrix2cd>
59  computeTopLayerR(const std::vector<Slice>& slices,
60  const std::vector<complex_t>& kzs) const override;
61 
62 private:
63  std::vector<MatrixRTCoefficients> computeTR(const std::vector<Slice>& slices,
64  const std::vector<complex_t>& kzs) const;
65 
66  virtual std::pair<Eigen::Matrix2cd, Eigen::Matrix2cd>
68  const MatrixRTCoefficients& coeff_i1, double sigma) const = 0;
69 
70  void calculateUpwards(std::vector<MatrixRTCoefficients>& coeff,
71  const std::vector<Slice>& slices) const;
72 };
73 
74 #endif // BORNAGAIN_SAMPLE_SPECULAR_SPECULARMAGNETICSTRATEGY_H
75 #endif // USER_API
Defines and implements class ISpecularStrategy.
Defines class MatrixRTCoefficients.
Interface for the Fresnel computations, both in the scalar and magnetic case.
std::vector< std::unique_ptr< const ILayerRTCoefficients > > coeffs_t
Specular reflection and transmission coefficients in a layer in case of magnetic interactions between...
Data structure containing the data of a single slice, for calculating the Fresnel coefficients.
Definition: Slice.h:32
Implements the magnetic Fresnel computation with Nevot-Croce roughness.
virtual std::variant< complex_t, Eigen::Matrix2cd > computeTopLayerR(const std::vector< Slice > &slices, const std::vector< complex_t > &kzs) const override
Computes the Fresnel R coefficient for the top layer only Introduced in order to speed up pure reflec...
ISpecularStrategy::coeffs_t Execute(const std::vector< Slice > &slices, const kvector_t &k) const
Computes refraction angle reflection/transmission coefficients for given sliced multilayer and waveve...
virtual std::pair< Eigen::Matrix2cd, Eigen::Matrix2cd > computeBackwardsSubmatrices(const MatrixRTCoefficients &coeff_i, const MatrixRTCoefficients &coeff_i1, double sigma) const =0
std::unique_ptr< const coefficient_type > coefficient_pointer_type
std::vector< MatrixRTCoefficients > computeTR(const std::vector< Slice > &slices, const std::vector< complex_t > &kzs) const
void calculateUpwards(std::vector< MatrixRTCoefficients > &coeff, const std::vector< Slice > &slices) const