Skip to content
Snippets Groups Projects
Commit f66c38dc authored by Wuttke, Joachim's avatar Wuttke, Joachim
Browse files

ditto for DWBAComputation

parent 9de01052
No related branches found
No related tags found
1 merge request!1318merge functions in main computation
......@@ -24,12 +24,8 @@
#include "Sim/Contrib/RoughMultiLayerContribution.h"
DWBAComputation::DWBAComputation(const ReSample& re_sample, const SimulationOptions& options,
ProgressHandler& progress,
std::vector<DiffuseElement>::iterator begin_it,
std::vector<DiffuseElement>::iterator end_it)
ProgressHandler& progress)
: IComputation(re_sample, options, progress)
, m_begin_it(begin_it)
, m_end_it(end_it)
{
}
......@@ -40,24 +36,20 @@ DWBAComputation::~DWBAComputation() = default;
// For roughness: (scattering cross-section of area S)/S
// For specular peak: |R|^2 * sin(alpha_i) / solid_angle
// This allows them to be added and normalized together to the beam afterwards
void DWBAComputation::runProtected()
void DWBAComputation::run(DiffuseElement& ele)
{
for (auto it = m_begin_it; it != m_end_it; ++it) {
DiffuseElement& ele = *it;
const Fluxes fluxes_in = m_re_sample.fluxesIn(ele.getKi());
const Fluxes fluxes_out = m_re_sample.fluxesOut(ele.meanKf());
ele.setFluxes(&fluxes_in, &fluxes_out);
const Fluxes fluxes_in = m_re_sample.fluxesIn(ele.getKi());
const Fluxes fluxes_out = m_re_sample.fluxesOut(ele.meanKf());
ele.setFluxes(&fluxes_in, &fluxes_out);
for (const ReLayout* relayout : m_re_sample.relayouts())
compute::dwbaContribution(*relayout, ele);
for (const ReLayout* relayout : m_re_sample.relayouts())
compute::dwbaContribution(*relayout, ele);
if (m_re_sample.hasRoughness())
compute::roughMultiLayerContribution(m_re_sample, ele);
if (m_re_sample.hasRoughness())
compute::roughMultiLayerContribution(m_re_sample, ele);
if (m_options.includeSpecular())
compute::gisasSpecularContribution(ele);
if (m_options.includeSpecular())
compute::gisasSpecularContribution(ele);
stepProgress();
}
stepProgress();
}
......@@ -37,14 +37,10 @@ class SimulationOptions;
class DWBAComputation : public IComputation {
public:
DWBAComputation(const ReSample& re_sample, const SimulationOptions& options,
ProgressHandler& progress, std::vector<DiffuseElement>::iterator begin_it,
std::vector<DiffuseElement>::iterator end_it);
ProgressHandler& progress);
~DWBAComputation() override;
void runProtected() override;
private:
std::vector<DiffuseElement>::iterator m_begin_it, m_end_it;
void run(DiffuseElement& ele);
};
#endif // BORNAGAIN_SIM_COMPUTATION_DWBACOMPUTATION_H
......@@ -147,9 +147,8 @@ void OffspecSimulation::initDistributionHandler()
void OffspecSimulation::runComputation(const ReSample& re_sample, size_t iElement)
{
const auto& begin = m_eles.begin() + static_cast<long>(iElement);
DWBAComputation(re_sample, options(), progress(), begin, begin + static_cast<long>(1))
.runProtected();
DiffuseElement& ele = *(m_eles.begin() + static_cast<long>(iElement));
DWBAComputation(re_sample, options(), progress()).run(ele);
}
void OffspecSimulation::normalize(size_t start, size_t n_elements)
......
......@@ -120,9 +120,8 @@ void ScatteringSimulation::initElementVector()
void ScatteringSimulation::runComputation(const ReSample& re_sample, size_t iElement)
{
const auto& begin = m_eles.begin() + static_cast<long>(iElement);
DWBAComputation(re_sample, options(), progress(), begin, begin + static_cast<long>(1))
.runProtected();
DiffuseElement& ele = *(m_eles.begin() + static_cast<long>(iElement));
DWBAComputation(re_sample, options(), progress()).run(ele);
}
void ScatteringSimulation::normalize(size_t start, size_t n_elements)
......
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