From 5750a30b68b8200a5c733f9873afa72a2d7a2e31 Mon Sep 17 00:00:00 2001
From: Mikhail Svechnikov <m.svechnikov@fz-juelich.de>
Date: Thu, 29 Aug 2024 16:07:17 +0200
Subject: [PATCH] rm SliceInterface

---
 .../RoughMultiLayerContribution.cpp           | 28 ++++++-------------
 1 file changed, 8 insertions(+), 20 deletions(-)

diff --git a/Sim/Computation/RoughMultiLayerContribution.cpp b/Sim/Computation/RoughMultiLayerContribution.cpp
index 73d64e8d6a3..091e474fa95 100644
--- a/Sim/Computation/RoughMultiLayerContribution.cpp
+++ b/Sim/Computation/RoughMultiLayerContribution.cpp
@@ -100,18 +100,6 @@ complex_t get_sum8terms(const ReSample& re_sample, size_t i_layer, const Diffuse
     return term1 + term2 + term3 + term4 + term5 + term6 + term7 + term8;
 }
 
-class SliceInterface {
-public:
-    SliceInterface(const Slice& slice)
-        : hig(slice.hig())
-        , topRoughness(slice.topRoughness())
-    {
-        ASSERT(topRoughness);
-    }
-    double hig = 0;
-    const LayerRoughness* topRoughness = nullptr;
-};
-
 } // namespace
 
 double Compute::roughMultiLayerContribution(const ReSample& re_sample, const DiffuseElement& ele)
@@ -125,7 +113,7 @@ double Compute::roughMultiLayerContribution(const ReSample& re_sample, const Dif
     double autocorr_sum = 0;
     double crosscorr_sum = 0;
 
-    std::vector<SliceInterface> roughStack; // only slices with rough top interfaces
+    std::vector<Slice> roughStack; // only slices with rough top interfaces
     std::vector<complex_t> rterm;
     std::vector<complex_t> sterm;
 
@@ -146,12 +134,12 @@ double Compute::roughMultiLayerContribution(const ReSample& re_sample, const Dif
 
     // precompute autocorrelation terms
     for (int i = n_interfaces - 1; i >= 0; i--) {
-        auto* autocorr_model = roughStack[i].topRoughness->autocorrelationModel();
+        auto* autocorr_model = roughStack[i].topRoughness()->autocorrelationModel();
         if (auto* k_corr = dynamic_cast<const K_CorrelationModel*>(autocorr_model)) {
             spectrum[i] = k_corr->spectralFunction(q);
         } else if (auto* lin_growth = dynamic_cast<const LinearGrowthModel*>(autocorr_model)) {
             ASSERT(i < int(n_interfaces - 1));
-            const double thickness = roughStack[i].hig - roughStack[i + 1].hig;
+            const double thickness = roughStack[i].hig() - roughStack[i + 1].hig();
             spectrum[i] = lin_growth->spectralFunction(spectrum[i + 1], thickness, q);
         }
     }
@@ -162,15 +150,15 @@ double Compute::roughMultiLayerContribution(const ReSample& re_sample, const Dif
 
     // precompute crosscorrelation terms
     for (int j = n_interfaces - 2; j >= 0; j--) {
-        const double thickness = roughStack[j].hig - roughStack[j + 1].hig;
+        const double thickness = roughStack[j].hig() - roughStack[j + 1].hig();
         if (auto* spat_freq_cc = dynamic_cast<const SpatialFrequencyCrosscorrelation*>(
-                roughStack[j].topRoughness->crosscorrelationModel())) {
-            const double sigma_up = roughStack[j].topRoughness->sigma();
-            const double sigma_low = roughStack[j + 1].topRoughness->sigma();
+                roughStack[j].topRoughness()->crosscorrelationModel())) {
+            const double sigma_up = roughStack[j].topRoughness()->sigma();
+            const double sigma_low = roughStack[j + 1].topRoughness()->sigma();
             crosscorr_with_interface_below[j] = spat_freq_cc->crosscorrSpectrum(
                 sigma_up, sigma_low, spectrum[j], spectrum[j + 1], thickness, q);
         } else if (auto* lin_growth_autocorr = dynamic_cast<const LinearGrowthModel*>(
-                       roughStack[j].topRoughness->autocorrelationModel())) {
+                       roughStack[j].topRoughness()->autocorrelationModel())) {
             crosscorr_with_interface_below[j] =
                 lin_growth_autocorr->crosscorrSpectrum(spectrum[j + 1], thickness, q);
         }
-- 
GitLab