26 std::vector<MatrixRTCoefficients>& coeff);
28 std::vector<MatrixRTCoefficients>& coeff);
36 std::vector<MatrixRTCoefficients> result(slices.size());
41 for (
auto& coeff : result)
42 resultConvert.push_back(std::make_unique<MatrixRTCoefficients>(coeff));
50 throw std::runtime_error(
"Not implemented");
56 std::vector<MatrixRTCoefficients>& coeff)
58 double mag_k = k.
mag();
59 double n_ref = slices[0].material().refractiveIndex(2 *
M_PI / mag_k).real();
60 double sign_kz = k.
z() > 0.0 ? -1.0 : 1.0;
61 for (
size_t i = 0; i < coeff.size(); ++i) {
62 coeff[i].m_scatt_matrix = slices[i].polarizedReducedPotential(k, n_ref);
63 coeff[i].m_kt = mag_k * slices[i].thickness();
64 coeff[i].m_a = coeff[i].m_scatt_matrix.trace() / 2.0;
66 sqrt(coeff[i].m_a * coeff[i].m_a - coeff[i].m_scatt_matrix.determinant());
67 coeff[i].m_bz = (coeff[i].m_scatt_matrix(0, 0) - coeff[i].m_scatt_matrix(1, 1)) / 2.0;
68 complex_t rad0 = coeff[i].m_a - coeff[i].m_b_mag;
69 complex_t rad1 = coeff[i].m_a + coeff[i].m_b_mag;
72 if (std::abs(rad0) < 1e-40)
74 if (std::abs(rad1) < 1e-40)
77 coeff[i].lambda(0) = sqrt(rad0);
78 coeff[i].lambda(1) = sqrt(rad1);
79 coeff[i].kz = mag_k * coeff[i].lambda * sign_kz;
85 std::vector<MatrixRTCoefficients>& coeff)
87 size_t N = coeff.size();
88 if (coeff[0].lambda == Eigen::Vector2cd::Zero() && N > 1) {
94 coeff[N - 1].initializeBottomLayerPhiPsi();
96 coeff[N - 1].calculateTRMatrices();
98 coeff[0].calculateTRMatrices();
99 for (
int signed_index =
static_cast<int>(N) - 2; signed_index > 0; --signed_index) {
100 size_t i =
static_cast<size_t>(signed_index);
101 double t = slices[i].thickness();
102 coeff[i].calculateTRMatrices();
107 coeff[i].phi_psi_plus = l * coeff[i + 1].phi_psi_plus;
108 coeff[i].phi_psi_min = l * coeff[i + 1].phi_psi_min;
114 coeff[0].phi_psi_plus = coeff[1].phi_psi_plus;
115 coeff[0].phi_psi_min = coeff[1].phi_psi_min;
119 Eigen::Vector2cd T0basisA = coeff[0].T1plus() + coeff[0].T2plus();
120 Eigen::Vector2cd T0basisB = coeff[0].T1min() + coeff[0].T2min();
126 Eigen::Vector4cd phipsitemp = cpA * coeff[0].phi_psi_plus + cpB * coeff[0].phi_psi_min;
127 coeff[0].phi_psi_min = cmA * coeff[0].phi_psi_plus + cmB * coeff[0].phi_psi_min;
128 coeff[0].phi_psi_plus = phipsitemp;
129 Eigen::Vector2cd T0plusV = coeff[0].T1plus() + coeff[0].T2plus();
130 Eigen::Vector2cd T0minV = coeff[0].T1min() + coeff[0].T2min();
133 coeff[0].phi_psi_min = coeff[0].phi_psi_min / T0min;
134 coeff[0].phi_psi_plus = coeff[0].phi_psi_plus / T0plus;
135 for (
size_t i = 1; i < N; ++i) {
136 phipsitemp = (cpA * coeff[i].phi_psi_plus + cpB * coeff[i].phi_psi_min) / T0plus;
137 coeff[i].phi_psi_min =
138 (cmA * coeff[i].phi_psi_plus + cmB * coeff[i].phi_psi_min) / T0min;
139 coeff[i].phi_psi_plus = phipsitemp;
146 size_t N = coeff.size();
147 for (
size_t i = 0; i < N; ++i) {
148 coeff[i].phi_psi_plus.setZero();
149 coeff[i].phi_psi_min.setZero();
150 coeff[i].T1m = Eigen::Matrix4cd::Identity() / 4.0;
151 coeff[i].R1m = coeff[i].T1m;
152 coeff[i].T2m = coeff[i].T1m;
153 coeff[i].R2m = coeff[i].T1m;
159 if (exponent.imag() > -std::log(std::numeric_limits<double>::min()))
161 return std::exp(
I * exponent);
std::complex< double > complex_t
Defines class LayerInterface.
Defines class MultiLayer.
Defines class SpecularMagneticOldStrategy.
double mag() const
Returns magnitude of the vector.
T z() const
Returns z-component in cartesian coordinate system.
std::vector< std::unique_ptr< const ILayerRTCoefficients > > coeffs_t
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...
void CalculateTransferAndBoundary(const std::vector< Slice > &slices, std::vector< MatrixRTCoefficients > &coeff)
complex_t GetImExponential(complex_t exponent)
void CalculateEigenvalues(const std::vector< Slice > &slices, const kvector_t k, std::vector< MatrixRTCoefficients > &coeff)
void SetForNoTransmission(std::vector< MatrixRTCoefficients > &coeff)