BornAgain  1.19.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 reflection and scattering
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 #ifdef SWIG
16 #error no need to expose this header to Swig
17 #endif
18 
19 #ifndef USER_API
20 #ifndef BORNAGAIN_SAMPLE_RT_SCALARRTCOEFFICIENTS_H
21 #define BORNAGAIN_SAMPLE_RT_SCALARRTCOEFFICIENTS_H
22 
24 
25 //! Specular reflection and transmission coefficients in a layer in case
26 //! of scalar interactions between the layers and the scattered particle.
27 //! @ingroup algorithms_internal
28 
30 public:
32  virtual ~ScalarRTCoefficients() {}
33 
34  virtual ScalarRTCoefficients* clone() const;
35 
36  // The following functions return the transmitted and reflected amplitudes
37  // for different incoming beam polarizations and eigenmodes
38  virtual Eigen::Vector2cd T1plus() const;
39  virtual Eigen::Vector2cd R1plus() const;
40  virtual Eigen::Vector2cd T2plus() const;
41  virtual Eigen::Vector2cd R2plus() const;
42  virtual Eigen::Vector2cd T1min() const;
43  virtual Eigen::Vector2cd R1min() const;
44  virtual Eigen::Vector2cd T2min() const;
45  virtual Eigen::Vector2cd R2min() const;
46  //! Returns z-part of the two wavevector eigenmodes
47  virtual Eigen::Vector2cd getKz() const;
48 
49  // Scalar value getters; these throw errors by default as they should only
50  // be used when the derived object is really scalar
51  virtual complex_t getScalarT() const;
52  virtual complex_t getScalarR() const;
53  virtual complex_t getScalarKz() const { return kz; }
54 
55  //! Signed vertical wavevector component k_z
57 
58  //! Transmission and reflection coefficient
59 
60  //! In the manual called A^{-} = t_r(0) and A^{+} = t_r(1).
61  //! Values of the transmitted/reflected (=down/up propagating) wavefunction
62  //! at top boundary of the layer (resp. at the bottom of the top air/vacuum layer).
63 
64  Eigen::Vector2cd t_r;
65 
66 private:
67  Eigen::Vector2cd m_plus;
68  Eigen::Vector2cd m_min;
69 };
70 
71 // ************************************************************************************************
72 // implementation
73 // ************************************************************************************************
74 
75 #ifdef SWIG
76 #error no need to expose this header to Swig
77 #endif
78 
80 {
81  m_plus(0) = 1.0;
82  m_plus(1) = 0.0;
83  m_min(0) = 0.0;
84  m_min(1) = 1.0;
85  t_r << complex_t(1.0, 0.0), complex_t(0.0, 0.0);
86 }
87 
89 {
90  return new ScalarRTCoefficients(*this);
91 }
92 
93 inline Eigen::Vector2cd ScalarRTCoefficients::T1plus() const
94 {
95  return Eigen::Vector2cd::Zero();
96 }
97 
98 inline Eigen::Vector2cd ScalarRTCoefficients::R1plus() const
99 {
100  return Eigen::Vector2cd::Zero();
101 }
102 
103 inline Eigen::Vector2cd ScalarRTCoefficients::T2plus() const
104 {
105  return m_plus * getScalarT();
106 }
107 
108 inline Eigen::Vector2cd ScalarRTCoefficients::R2plus() const
109 {
110  return m_plus * getScalarR();
111 }
112 
113 inline Eigen::Vector2cd ScalarRTCoefficients::T1min() const
114 {
115  return m_min * getScalarT();
116 }
117 
118 inline Eigen::Vector2cd ScalarRTCoefficients::R1min() const
119 {
120  return m_min * getScalarR();
121 }
122 
123 inline Eigen::Vector2cd ScalarRTCoefficients::T2min() const
124 {
125  return Eigen::Vector2cd::Zero();
126 }
127 
128 inline Eigen::Vector2cd ScalarRTCoefficients::R2min() const
129 {
130  return Eigen::Vector2cd::Zero();
131 }
132 
133 inline Eigen::Vector2cd ScalarRTCoefficients::getKz() const
134 {
135  return (m_plus + m_min) * kz;
136 }
137 
139 {
140  return t_r(1);
141 }
142 
144 {
145  return t_r(0);
146 }
147 
148 #endif // BORNAGAIN_SAMPLE_RT_SCALARRTCOEFFICIENTS_H
149 #endif // USER_API
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