BornAgain  1.18.0
Simulate and fit neutron and x-ray scattering at grazing incidence
ScalarRTCoefficients.h
Go to the documentation of this file.
1 // ************************************************************************** //
2 //
3 // BornAgain: simulate and fit scattering at grazing incidence
4 //
5 //! @file Sample/RT/ScalarRTCoefficients.h
6 //! @brief Defines class ScalarRTCoefficients.
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_RT_SCALARRTCOEFFICIENTS_H
16 #define BORNAGAIN_CORE_RT_SCALARRTCOEFFICIENTS_H
17 
19 
20 //! Specular reflection and transmission coefficients in a layer in case
21 //! of scalar interactions between the layers and the scattered particle.
22 //! @ingroup algorithms_internal
23 
25 {
26 public:
28  virtual ~ScalarRTCoefficients() {}
29 
30  virtual ScalarRTCoefficients* clone() const;
31 
32  // The following functions return the transmitted and reflected amplitudes
33  // for different incoming beam polarizations and eigenmodes
34  virtual Eigen::Vector2cd T1plus() const;
35  virtual Eigen::Vector2cd R1plus() const;
36  virtual Eigen::Vector2cd T2plus() const;
37  virtual Eigen::Vector2cd R2plus() const;
38  virtual Eigen::Vector2cd T1min() const;
39  virtual Eigen::Vector2cd R1min() const;
40  virtual Eigen::Vector2cd T2min() const;
41  virtual Eigen::Vector2cd R2min() const;
42  //! Returns z-part of the two wavevector eigenmodes
43  virtual Eigen::Vector2cd getKz() const;
44 
45  // Scalar value getters; these throw errors by default as they should only
46  // be used when the derived object is really scalar
47  virtual complex_t getScalarT() const;
48  virtual complex_t getScalarR() const;
49  virtual complex_t getScalarKz() const { return kz; }
50 
51  //! Signed vertical wavevector component k_z
53 
54  //! Transmission and reflection coefficient
55 
56  //! In the manual called A^{-} = t_r(0) and A^{+} = t_r(1).
57  //! Values of the transmitted/reflected (=down/up propagating) wavefunction
58  //! at top boundary of the layer (resp. at the bottom of the top air/vacuum layer).
59 
60  Eigen::Vector2cd t_r;
61 
62 private:
63  Eigen::Vector2cd m_plus;
64  Eigen::Vector2cd m_min;
65 };
66 
67 // ************************************************************************** //
68 // implementation
69 // ************************************************************************** //
70 
72 {
73  m_plus(0) = 1.0;
74  m_plus(1) = 0.0;
75  m_min(0) = 0.0;
76  m_min(1) = 1.0;
77  t_r << complex_t(1.0, 0.0), complex_t(0.0, 0.0);
78 }
79 
81 {
82  return new ScalarRTCoefficients(*this);
83 }
84 
85 inline Eigen::Vector2cd ScalarRTCoefficients::T1plus() const
86 {
87  return Eigen::Vector2cd::Zero();
88 }
89 
90 inline Eigen::Vector2cd ScalarRTCoefficients::R1plus() const
91 {
92  return Eigen::Vector2cd::Zero();
93 }
94 
95 inline Eigen::Vector2cd ScalarRTCoefficients::T2plus() const
96 {
97  return m_plus * getScalarT();
98 }
99 
100 inline Eigen::Vector2cd ScalarRTCoefficients::R2plus() const
101 {
102  return m_plus * getScalarR();
103 }
104 
105 inline Eigen::Vector2cd ScalarRTCoefficients::T1min() const
106 {
107  return m_min * getScalarT();
108 }
109 
110 inline Eigen::Vector2cd ScalarRTCoefficients::R1min() const
111 {
112  return m_min * getScalarR();
113 }
114 
115 inline Eigen::Vector2cd ScalarRTCoefficients::T2min() const
116 {
117  return Eigen::Vector2cd::Zero();
118 }
119 
120 inline Eigen::Vector2cd ScalarRTCoefficients::R2min() const
121 {
122  return Eigen::Vector2cd::Zero();
123 }
124 
125 inline Eigen::Vector2cd ScalarRTCoefficients::getKz() const
126 {
127  return (m_plus + m_min) * kz;
128 }
129 
131 {
132  return t_r(1);
133 }
134 
136 {
137  return t_r(0);
138 }
139 
140 #endif // BORNAGAIN_CORE_RT_SCALARRTCOEFFICIENTS_H
std::complex< double > complex_t
Definition: Complex.h:20
Defines and implements class ILayerRTCoefficients.
Interface to access reflection/transmission coefficients.
Specular reflection and transmission coefficients in a layer in case of scalar interactions between t...
virtual Eigen::Vector2cd T2min() const
virtual complex_t getScalarR() const
virtual Eigen::Vector2cd T1min() const
virtual ScalarRTCoefficients * clone() const
Eigen::Vector2cd t_r
Transmission and reflection coefficient.
virtual Eigen::Vector2cd T2plus() const
complex_t kz
Signed vertical wavevector component k_z.
virtual Eigen::Vector2cd R1plus() const
virtual Eigen::Vector2cd getKz() const
Returns z-part of the two wavevector eigenmodes.
virtual complex_t getScalarT() const
Scalar value getters; these throw errors by default as they should only be used when the derived obje...
virtual complex_t getScalarKz() const
virtual Eigen::Vector2cd R1min() const
virtual Eigen::Vector2cd R2min() const
virtual Eigen::Vector2cd T1plus() const
The following functions return the transmitted and reflected amplitudes for different incoming beam p...
virtual Eigen::Vector2cd R2plus() const