Skip to content
Snippets Groups Projects
Commit 88edea01 authored by Yurov, Dmitry's avatar Yurov, Dmitry
Browse files

Deploy new simulation elements in specular simulations

parent 489b33b2
No related branches found
No related tags found
No related merge requests found
......@@ -16,7 +16,7 @@
#include "IComputationUtils.h"
#include "MultiLayer.h"
#include "ProgressHandler.h"
#include "SpecularSimulationElement.h"
#include "SpecularSimulationElement_.h"
static_assert(std::is_copy_constructible<SpecularComputation>::value == false,
"SpecularComputation should not be copy constructible");
......
......@@ -20,6 +20,7 @@
#include "SpecularComputationTerm.h"
class MultiLayer;
class SpecularSimulationElement_;
//! Performs a single-threaded specular computation with given sample.
//!
......@@ -29,7 +30,7 @@ class MultiLayer;
class SpecularComputation : public IComputation
{
using SpecularElementIter = std::vector<SpecularSimulationElement>::iterator;
using SpecularElementIter = std::vector<SpecularSimulationElement_>::iterator;
public:
SpecularComputation(const MultiLayer& multilayer, const SimulationOptions& options,
......
......@@ -16,7 +16,7 @@
#include "DelayedProgressCounter.h"
#include "ScalarRTCoefficients.h"
#include "SpecularMatrix.h"
#include "SpecularSimulationElement.h"
#include "SpecularSimulationElement_.h"
SpecularComputationTerm::SpecularComputationTerm()
{}
......@@ -28,13 +28,13 @@ void SpecularComputationTerm::setProgressHandler(ProgressHandler* p_progress)
mP_progress_counter.reset(new DelayedProgressCounter(p_progress, 100));
}
void SpecularComputationTerm::compute(SpecularSimulationElement& elem,
void SpecularComputationTerm::compute(SpecularSimulationElement_& elem,
const MultiLayer& sample) const
{
if (!elem.isCalculated())
return;
std::vector<ScalarRTCoefficients> coeff = SpecularMatrix::execute(sample, elem.getKi());
auto coeff = SpecularMatrix::execute(sample, elem.produceKz(sample));
elem.setIntensity(std::norm(coeff[0].getScalarR()));
if (mP_progress_counter)
......
......@@ -20,7 +20,7 @@
class DelayedProgressCounter;
class MultiLayer;
class ProgressHandler;
class SpecularSimulationElement;
class SpecularSimulationElement_;
//! Computes the specular scattering.
//! Used by SpecularComputation.
......@@ -33,7 +33,7 @@ public:
~SpecularComputationTerm();
void setProgressHandler(ProgressHandler* p_progress);
void compute(SpecularSimulationElement& elem, const MultiLayer& sample) const;
void compute(SpecularSimulationElement_& elem, const MultiLayer& sample) const;
private:
std::unique_ptr<DelayedProgressCounter> mP_progress_counter;
......
......@@ -26,6 +26,7 @@
#include "RealParameter.h"
#include "SpecularComputation.h"
#include "SpecularDetector1D.h"
#include "SpecularSimulationElement_.h"
#include "UnitConverter1D.h"
namespace
......@@ -144,10 +145,10 @@ void SpecularSimulation::initSimulationElementVector()
m_cache.resize(m_sim_elements.size(), 0);
}
std::vector<SpecularSimulationElement>
std::vector<SpecularSimulationElement_>
SpecularSimulation::generateSimulationElements(const Beam& beam)
{
std::vector<SpecularSimulationElement> result;
std::vector<SpecularSimulationElement_> result;
const double wavelength = beam.getWavelength();
const double angle_shift = beam.getAlpha();
......@@ -160,7 +161,7 @@ SpecularSimulation::generateSimulationElements(const Beam& beam)
result.reserve(axis_size);
for (size_t i = 0; i < axis_size; ++i) {
double result_angle = incidentAngle(i) + angle_shift;
result.emplace_back(wavelength, -result_angle);
result.emplace_back(wavelength, /*d_wl*/ 0.0, result_angle, /*d_angle*/ 0.0);
auto& sim_element = result.back();
sim_element.setPolarizationHandler(handler);
if (!alpha_limits.isInRange(result_angle))
......@@ -224,7 +225,7 @@ void SpecularSimulation::initialize()
void SpecularSimulation::normalizeIntensity(size_t index, double beam_intensity)
{
auto& element = m_sim_elements[index];
const double alpha_i = -element.getAlphaI();
const double alpha_i = incidentAngle(index);
const auto footprint = m_instrument.getBeam().footprintFactor();
if (footprint != nullptr)
beam_intensity *= footprint->calculate(alpha_i);
......
......@@ -18,7 +18,6 @@
#include "Simulation.h"
#include "ILayerRTCoefficients.h"
#include "OutputData.h"
#include "SpecularSimulationElement.h"
class IAxis;
class IComputation;
......@@ -27,6 +26,7 @@ class ISample;
class IMultiLayerBuilder;
class MultiLayer;
class Histogram1D;
class SpecularSimulationElement_;
//! Main class to run a specular simulation.
//! @ingroup simulation
......@@ -78,7 +78,7 @@ private:
void initSimulationElementVector() override;
//! Generate simulation elements for given beam
std::vector<SpecularSimulationElement> generateSimulationElements(const Beam& beam);
std::vector<SpecularSimulationElement_> generateSimulationElements(const Beam& beam);
//! Generate a single threaded computation for a given range of simulation elements
//! @param start Index of the first element to include into computation
......@@ -113,7 +113,7 @@ private:
void setRawResults(const std::vector<double>& raw_data) override;
std::unique_ptr<IAxis> m_coordinate_axis;
std::vector<SpecularSimulationElement> m_sim_elements;
std::vector<SpecularSimulationElement_> m_sim_elements;
std::vector<double> m_cache;
};
......
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