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

Move code from namespace into SpecularScalarStrategy

parent 85b5658c
No related branches found
No related tags found
No related merge requests found
......@@ -25,17 +25,6 @@
namespace
{
Eigen::Vector2cd transition(complex_t kzi, complex_t kzi1, double sigma, double thickness,
const Eigen::Vector2cd& t_r1);
std::vector<ScalarRTCoefficients> computeTR(const std::vector<Slice>& slices,
const std::vector<complex_t>& kz);
void setZeroBelow(std::vector<ScalarRTCoefficients>& coeff, size_t current_layer);
bool calculateUpFromLayer(std::vector<ScalarRTCoefficients>& coeff,
const std::vector<Slice>& slices, const std::vector<complex_t>& kz,
size_t layer_index);
size_t bisectRTcomputation(std::vector<ScalarRTCoefficients>& coeff,
const std::vector<Slice>& slices, const std::vector<complex_t>& kz,
const size_t lgood, const size_t lbad, const size_t l);
const LayerRoughness* GetBottomRoughness(const std::vector<Slice>& slices,
const size_t slice_index);
......@@ -62,10 +51,8 @@ SpecularScalarStrategy::Execute(const std::vector<Slice>& slices, const std::vec
return result;
}
namespace
{
Eigen::Vector2cd transition(complex_t kzi, complex_t kzi1, double sigma, double thickness,
const Eigen::Vector2cd& t_r1)
Eigen::Vector2cd SpecularScalarStrategy::transition(complex_t kzi, complex_t kzi1, double sigma, double thickness,
const Eigen::Vector2cd& t_r1) const
{
complex_t roughness = 1;
if (sigma > 0.0) {
......@@ -86,8 +73,8 @@ Eigen::Vector2cd transition(complex_t kzi, complex_t kzi1, double sigma, double
return result;
}
std::vector<ScalarRTCoefficients> computeTR(const std::vector<Slice>& slices,
const std::vector<complex_t>& kz)
std::vector<ScalarRTCoefficients> SpecularScalarStrategy::computeTR(const std::vector<Slice>& slices,
const std::vector<complex_t>& kz) const
{
const size_t N = slices.size();
std::vector<ScalarRTCoefficients> coeff(N);
......@@ -136,7 +123,7 @@ std::vector<ScalarRTCoefficients> computeTR(const std::vector<Slice>& slices,
return coeff;
}
void setZeroBelow(std::vector<ScalarRTCoefficients>& coeff, size_t current_layer)
void SpecularScalarStrategy::setZeroBelow(std::vector<ScalarRTCoefficients>& coeff, size_t current_layer)
{
size_t N = coeff.size();
for (size_t i = current_layer + 1; i < N; ++i) {
......@@ -144,9 +131,9 @@ void setZeroBelow(std::vector<ScalarRTCoefficients>& coeff, size_t current_layer
}
}
bool calculateUpFromLayer(std::vector<ScalarRTCoefficients>& coeff,
bool SpecularScalarStrategy::calculateUpFromLayer(std::vector<ScalarRTCoefficients>& coeff,
const std::vector<Slice>& slices, const std::vector<complex_t>& kz,
size_t slice_index)
size_t slice_index) const
{
coeff[slice_index + 1].t_r(0) = 1.0;
coeff[slice_index + 1].t_r(1) = 0.0;
......@@ -166,9 +153,9 @@ bool calculateUpFromLayer(std::vector<ScalarRTCoefficients>& coeff,
//! Recursive bisection to determine the number of the deepest layer where RT computation
//! can be started without running into overflow.
//! Computes coeff, and returns largest possible start layer index.
size_t bisectRTcomputation(std::vector<ScalarRTCoefficients>& coeff,
size_t SpecularScalarStrategy::bisectRTcomputation(std::vector<ScalarRTCoefficients>& coeff,
const std::vector<Slice>& slices, const std::vector<complex_t>& kz,
const size_t lgood, const size_t lbad, const size_t l)
const size_t lgood, const size_t lbad, const size_t l) const
{
if (calculateUpFromLayer(coeff, slices, kz, l)) {
// success => highest valid l must be in l..lbad-1
......@@ -187,10 +174,11 @@ size_t bisectRTcomputation(std::vector<ScalarRTCoefficients>& coeff,
}
}
namespace {
const LayerRoughness* GetBottomRoughness(const std::vector<Slice>& slices, const size_t slice_index)
{
if (slice_index + 1 < slices.size())
return slices[slice_index + 1].topRoughness();
return nullptr;
}
} // unnamed namespace
}
......@@ -42,6 +42,24 @@ public:
//! Roughness is modelled by tanh profile [see e.g. Phys. Rev. B, vol. 47 (8), p. 4385 (1993)].
virtual ISpecularStrategy::coeffs_t Execute(const std::vector<Slice>& slices,
const std::vector<complex_t>& kz) const override;
private:
virtual Eigen::Vector2cd transition(complex_t kzi, complex_t kzi1, double sigma, double thickness,
const Eigen::Vector2cd& t_r1) const;
std::vector<ScalarRTCoefficients> computeTR(const std::vector<Slice>& slices,
const std::vector<complex_t>& kz) const;
static void setZeroBelow(std::vector<ScalarRTCoefficients>& coeff, size_t current_layer);
bool calculateUpFromLayer(std::vector<ScalarRTCoefficients>& coeff,
const std::vector<Slice>& slices, const std::vector<complex_t>& kz,
size_t slice_index) const;
size_t bisectRTcomputation(std::vector<ScalarRTCoefficients>& coeff,
const std::vector<Slice>& slices, const std::vector<complex_t>& kz,
const size_t lgood, const size_t lbad, const size_t l) const;
};
#endif // SPECULARSCALARSTRATEGY_H
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