Refactoring #1733

Updated by wuttke over 3 years ago

Currently, SpecularMatrix::calculateUpFromLayer is called within loops

<pre>
... - // scattering from particles
... - for (auto& layer_comp: m_layer_computation)
... - - for (const DecoratedLayerComputation* comp: layer_comp) // loop over layouts
... - - - DecoratedLayerComputation::eval(const SimulationOptions&, ProgressHandler*, bool polarized, [SimulationElement iterators])
... - - - - for (std::vector<SimulationElement>::iterator it = begin_it; it != end_it; ++it)
... - - - - - IInterferenceFunctionStrategy::evaluate(const SimulationElement& sim_element)
... - - - - - - IInterferenceFunctionStrategy1::precomputeParticleFormfactors(const SimulationElement&)
... - - - - - - - for (auto ffw: m_formfactor_wrappers)
... - - - - - - - - FormFactorWrapper::evaluate(const SimulationElement&)
... - - - - - - - - - ScalarSpecularInfoMap::getOutCoefficients(const SimulationElement&)
... - - - - - - - - - - ScalarSpecularInfoMap::getCoefficients(kvector_t kvec)
... - - - - - - - - - - - SpecularMatrix::execute(const MultiLayer&, const kvector_t k, MultiLayerCoeff_t&)
... - - - - - - - - - - - - calculateUpFromLayer(SpecularMatrix::MultiLayerCoeff_t&, sample, kmag, layer_index) <--HERE
... - // scattering from roughness
... - RoughMultiLayerComputation::eval(std::vector<SimulationElement>::iterator begin_it, .. end_it)
... - - for (std::vector<SimulationElement>::iterator it = begin_it; it != end_it; ++it)
... - - - RoughMultiLayerComputation::evaluate(const SimulationElement& sim_element)
... - - - - for (size_t i=0; i<mp_multi_layer->getNumberOfLayers()-1; i++)
... - - - - - RoughMultiLayerComputation::get_sum8terms(size_t ilayer, const SimulationElement& sim_element)
... - - - - - - LayerSpecularInfo::getOutCoefficients(sim_element)
... - - - - - - - ScalarSpecularInfoMap::getOutCoefficients(const SimulationElement&)
... - - - - - - - - ScalarSpecularInfoMap::getCoefficients(kvector_t kvec)
... - - - - - - - - - SpecularMatrix::execute(const MultiLayer&, const kvector_t k, MultiLayerCoeff_t&)
... - - - - - - - - - - calculateUpFromLayer(SpecularMatrix::MultiLayerCoeff_t&, sample, kmag, layer_index) <-- HERE
</pre>

(for full call stack see http://apps.jcns.fz-juelich.de/redmine/projects/bornagain/wiki/GISASSimulation_call_stack).

I see no reason for embedding the RT computation in loops over layers, layouts, formfactors. Precompute the RT coefficients, and store them as members of SimulationElement.

Back