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

Code beautification

parent dee5092f
No related branches found
No related tags found
No related merge requests found
......@@ -18,9 +18,13 @@
#include "SpecularScalarStrategy.h"
#include "SpecularSimulationElement.h"
SpecularComputationTerm::SpecularComputationTerm(std::unique_ptr<ISpecularStrategy> strategy) : m_Strategy(std::move(strategy)) {};
SpecularComputationTerm::SpecularComputationTerm(std::unique_ptr<ISpecularStrategy> strategy)
: m_Strategy(std::move(strategy)){};
SpecularScalarTerm::SpecularScalarTerm(std::unique_ptr<ISpecularStrategy> strategy) : SpecularComputationTerm(std::move(strategy)) {}
SpecularScalarTerm::SpecularScalarTerm(std::unique_ptr<ISpecularStrategy> strategy)
: SpecularComputationTerm(std::move(strategy))
{
}
SpecularComputationTerm::~SpecularComputationTerm() = default;
......@@ -46,11 +50,15 @@ SpecularScalarTerm::~SpecularScalarTerm() = default;
void SpecularScalarTerm::eval(SpecularSimulationElement& elem,
const std::vector<Slice>& slices) const
{
auto coeff = std::make_unique<SpecularScalarStrategy>()->Execute(slices, elem.produceKz(slices));
auto coeff =
std::make_unique<SpecularScalarStrategy>()->Execute(slices, elem.produceKz(slices));
elem.setIntensity(std::norm(coeff.front()->getScalarR()));
}
SpecularMatrixTerm::SpecularMatrixTerm(std::unique_ptr<ISpecularStrategy> strategy) : SpecularComputationTerm(std::move(strategy)) {}
SpecularMatrixTerm::SpecularMatrixTerm(std::unique_ptr<ISpecularStrategy> strategy)
: SpecularComputationTerm(std::move(strategy))
{
}
SpecularMatrixTerm::~SpecularMatrixTerm() = default;
......
......@@ -43,6 +43,7 @@ protected:
virtual void eval(SpecularSimulationElement& elem, const std::vector<Slice>& slices) const = 0;
std::unique_ptr<ISpecularStrategy> m_Strategy;
private:
std::unique_ptr<DelayedProgressCounter> mP_progress_counter;
};
......@@ -51,8 +52,10 @@ class SpecularScalarTerm : public SpecularComputationTerm
{
public:
SpecularScalarTerm(std::unique_ptr<ISpecularStrategy> strategy);
private:
~SpecularScalarTerm() override;
protected:
void eval(SpecularSimulationElement& elem, const std::vector<Slice>& slices) const override;
};
......@@ -61,8 +64,10 @@ class SpecularMatrixTerm : public SpecularComputationTerm
{
public:
SpecularMatrixTerm(std::unique_ptr<ISpecularStrategy> strategy);
private:
~SpecularMatrixTerm() override;
protected:
void eval(SpecularSimulationElement& elem, const std::vector<Slice>& slices) const override;
double intensity(const SpecularSimulationElement& elem,
......
......@@ -19,17 +19,16 @@
#include "SpecularMagneticStrategy.h"
#include <functional>
MatrixFresnelMap::MatrixFresnelMap(std::unique_ptr<ISpecularStrategy> strategy) : IFresnelMap(std::move(strategy)) {};
MatrixFresnelMap::MatrixFresnelMap(std::unique_ptr<ISpecularStrategy> strategy)
: IFresnelMap(std::move(strategy)){};
MatrixFresnelMap::~MatrixFresnelMap() = default;
//! Returns hash value of a 3-vector, computed by exclusive-or of the component hash values.
size_t MatrixFresnelMap::HashKVector::operator()(const kvector_t& kvec) const noexcept
{
return std::hash<double>{}(kvec.x())
^ std::hash<double>{}(kvec.y())
^ std::hash<double>{}(kvec.z());
return std::hash<double>{}(kvec.x()) ^ std::hash<double>{}(kvec.y())
^ std::hash<double>{}(kvec.z());
}
std::unique_ptr<const ILayerRTCoefficients>
......@@ -39,7 +38,7 @@ MatrixFresnelMap::getOutCoefficients(const SimulationElement& sim_element, size_
m_hash_table_out);
}
void MatrixFresnelMap::setSlices(const std::vector<Slice> &slices)
void MatrixFresnelMap::setSlices(const std::vector<Slice>& slices)
{
IFresnelMap::setSlices(slices);
m_inverted_slices.clear();
......@@ -57,7 +56,8 @@ MatrixFresnelMap::getCoefficients(const kvector_t& kvec, size_t layer_index) con
std::unique_ptr<const ILayerRTCoefficients>
MatrixFresnelMap::getCoefficients(const kvector_t& kvec, size_t layer_index,
const std::vector<Slice>& slices, CoefficientHash& hash_table) const
const std::vector<Slice>& slices,
CoefficientHash& hash_table) const
{
if (!m_use_cache) {
auto coeffs = m_Strategy->Execute(slices, kvec);
......
......@@ -19,7 +19,10 @@
#include "Vectors3D.h"
#include <functional>
ScalarFresnelMap::ScalarFresnelMap(std::unique_ptr<ISpecularStrategy> strategy) : IFresnelMap(std::move(strategy)) {}
ScalarFresnelMap::ScalarFresnelMap(std::unique_ptr<ISpecularStrategy> strategy)
: IFresnelMap(std::move(strategy))
{
}
ScalarFresnelMap::~ScalarFresnelMap() = default;
......@@ -46,8 +49,7 @@ ScalarFresnelMap::getCoefficients(const kvector_t& kvec, size_t layer_index) con
return ISpecularStrategy::single_coeff_t(coef_vector[layer_index]->clone());
}
const ISpecularStrategy::coeffs_t&
ScalarFresnelMap::getCoefficientsFromCache(kvector_t kvec) const
const ISpecularStrategy::coeffs_t& ScalarFresnelMap::getCoefficientsFromCache(kvector_t kvec) const
{
std::pair<double, double> k2_theta(kvec.mag2(), kvec.theta());
auto it = m_cache.find(k2_theta);
......
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