Skip to content
Snippets Groups Projects
Commit 51b5c7fb authored by Beerwerth, Randolf's avatar Beerwerth, Randolf
Browse files

Create SpecularMagneticOldStrategy and enable its use

parent 89efbc9b
No related branches found
No related tags found
No related merge requests found
......@@ -30,7 +30,7 @@ template <class T> auto computeRT(const std::vector<Slice>&, const kvector_t&)
template <>
auto computeRT<MatrixRTCoefficients>(const std::vector<Slice>& slices, const kvector_t& k)
{
return SpecularMagnetic::Execute(slices, k);
return std::make_unique<SpecularMagneticOldStrategy>()->Execute(slices, k);
}
template <>
......
......@@ -31,8 +31,9 @@ complex_t GetImExponential(complex_t exponent);
const complex_t I(0, 1);
}
std::vector<MatrixRTCoefficients> SpecularMagnetic::Execute(const std::vector<Slice>& slices,
const kvector_t k)
std::vector<MatrixRTCoefficients>
SpecularMagneticOldStrategy::Execute(const std::vector<Slice>& slices,
const kvector_t& k) const
{
std::vector<MatrixRTCoefficients> result(slices.size());
CalculateEigenvalues(slices, k, result);
......@@ -40,6 +41,13 @@ std::vector<MatrixRTCoefficients> SpecularMagnetic::Execute(const std::vector<Sl
return result;
}
std::vector<MatrixRTCoefficients>
SpecularMagneticOldStrategy::Execute(const std::vector<Slice>& slices, const std::vector<complex_t>& k) const
{
throw std::runtime_error("Not implemented");
}
namespace {
void CalculateEigenvalues(const std::vector<Slice> &slices, const kvector_t k,
std::vector<MatrixRTCoefficients>& coeff)
......
......@@ -12,8 +12,8 @@
//
// ************************************************************************** //
#ifndef SPECULARMAGNETIC_H
#define SPECULARMAGNETIC_H
#ifndef SPECULARMAGNETICOLDSTRATEGY_H
#define SPECULARMAGNETICOLDSTRATEGY_H
#include "MatrixRTCoefficients.h"
#include "Vectors3D.h"
......@@ -25,12 +25,17 @@ class Slice;
//! the coherent wave solution in a multilayer with magnetization.
//! @ingroup algorithms_internal
namespace SpecularMagnetic
class SpecularMagneticOldStrategy
{
//! Computes refraction angle reflection/transmission coefficients
//! for given sliced multilayer and wavevector k
BA_CORE_API_ std::vector<MatrixRTCoefficients> Execute(const std::vector<Slice>& slices,
const kvector_t k);
}; // namespace SpecularMagnetic
public:
//! Computes refraction angle reflection/transmission coefficients
//! for given sliced multilayer and wavevector k
BA_CORE_API_ std::vector<MatrixRTCoefficients>
Execute(const std::vector<Slice>& slices, const kvector_t& k) const;
#endif // SPECULARMAGNETIC_H
BA_CORE_API_ std::vector<MatrixRTCoefficients>
Execute(const std::vector<Slice>& slices, const std::vector<complex_t>& kz) const;
}; // class SpecularMagneticOldStrategy
#endif // SPECULARMAGNETICOLDSTRATEGY_H
......@@ -29,7 +29,7 @@ TEST_F(SpecularMagneticTest, initial)
mLayer.addLayer(layer0);
SimulationOptions options;
ProcessedSample sample(mLayer, options);
SpecularMagnetic::Execute(sample.slices(), v);
std::make_unique<SpecularMagneticOldStrategy>()->Execute(sample.slices(), v);
}
TEST_F(SpecularMagneticTest, zerofield)
......@@ -66,7 +66,7 @@ TEST_F(SpecularMagneticTest, zerofield)
Eigen::Vector2cd TMS = RTScalar.T1min() + RTScalar.T2min();
Eigen::Vector2cd RMS = RTScalar.R1min() + RTScalar.R2min();
auto coeffs_zerofield = SpecularMagnetic::Execute(sample_zerofield.slices(), k1);
auto coeffs_zerofield = std::make_unique<SpecularMagneticOldStrategy>()->Execute(sample_zerofield.slices(), k1);
MatrixRTCoefficients RTMatrix = coeffs_zerofield[1];
Eigen::Vector2cd TPM = RTMatrix.T1plus() + RTMatrix.T2plus();
Eigen::Vector2cd RPM = RTMatrix.R1plus() + RTMatrix.R2plus();
......@@ -90,7 +90,7 @@ TEST_F(SpecularMagneticTest, zerofield)
TMS = RTScalar.T1min() + RTScalar.T2min();
RMS = RTScalar.R1min() + RTScalar.R2min();
coeffs_zerofield = SpecularMagnetic::Execute(sample_zerofield.slices(), k2);
coeffs_zerofield = std::make_unique<SpecularMagneticOldStrategy>()->Execute(sample_zerofield.slices(), k2);
RTMatrix = coeffs_zerofield[1];
TPM = RTMatrix.T1plus() + RTMatrix.T2plus();
RPM = RTMatrix.R1plus() + RTMatrix.R2plus();
......@@ -114,7 +114,7 @@ TEST_F(SpecularMagneticTest, zerofield)
TMS = RTScalar.T1min() + RTScalar.T2min();
RMS = RTScalar.R1min() + RTScalar.R2min();
coeffs_zerofield = SpecularMagnetic::Execute(sample_zerofield.slices(), k3);
coeffs_zerofield = std::make_unique<SpecularMagneticOldStrategy>()->Execute(sample_zerofield.slices(), k3);
RTMatrix = coeffs_zerofield[1];
TPM = RTMatrix.T1plus() + RTMatrix.T2plus();
RPM = RTMatrix.R1plus() + RTMatrix.R2plus();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment