23 DepthProbeComputationTerm::DepthProbeComputationTerm(
const ProcessedSample* p_sample)
28 DepthProbeComputationTerm::~DepthProbeComputationTerm() =
default;
30 void DepthProbeComputationTerm::setProgressHandler(
ProgressHandler* p_progress)
32 mP_progress_counter = std::make_unique<DelayedProgressCounter>(p_progress, 100);
37 if (elem.isCalculated()) {
38 const IAxis& z_positions = *elem.getZPositions();
39 const size_t n_z = z_positions.
size();
40 const size_t n_layers = mp_sample->numberOfSlices();
41 size_t start_z_ind = n_z;
42 std::valarray<double> intensities(0.0, n_z);
44 double z_layer_bottom(0.0);
45 double z_layer_top(0.0);
46 for (
size_t i_layer = 0; i_layer < n_layers && start_z_ind != 0; ++i_layer) {
47 z_layer_bottom = mp_sample->sliceBottomZ(i_layer);
48 z_layer_top = mp_sample->sliceTopZ(i_layer);
51 const auto p_coefficients = mp_sample->fresnelMap()->
getInCoefficients(elem, i_layer);
52 const complex_t R = p_coefficients->getScalarR();
53 const complex_t T = p_coefficients->getScalarT();
54 const complex_t kz_out = p_coefficients->getScalarKz();
55 const complex_t kz_in = -kz_out;
58 size_t ip1_z = start_z_ind;
59 for (; ip1_z > 0; --ip1_z) {
60 const size_t i_z = ip1_z - 1;
61 if (i_layer + 1 != n_layers && z_positions[i_z] <= z_layer_bottom)
63 const double local_position = z_positions[i_z] - z_layer_top;
64 intensities[i_z] = std::norm(R *
exp_I(kz_out * local_position)
65 + T *
exp_I(kz_in * local_position));
69 elem.setIntensities(std::move(intensities));
71 if (mP_progress_counter) {
72 mP_progress_counter->stepProgress();
complex_t exp_I(complex_t z)
Returns exp(I*z), where I is the imaginary unit.
Defines class DelayedProgressCounter.
Defines functor DepthProbeComputationTerm.
Defines class DepthProbeElement.
Defines class IFresnelMap.
Defines and implements class ILayerRTCoefficients.
Defines class ProcessedSample.
Interface for one-dimensional axes.
virtual size_t size() const =0
retrieve the number of bins
std::unique_ptr< const ILayerRTCoefficients > getInCoefficients(const T &sim_element, size_t layer_index) const
Retrieves the amplitude coefficients for an incoming wavevector.
Data structure that contains all the necessary data for scattering calculations.
Maintains information about progress of a computation.