diff --git a/Resample/Processed/ProcessedSample.cpp b/Resample/Processed/ProcessedSample.cpp index 7529b9655a3413f986809f5bb0aefcd897b795d3..0f7130b5cdbe780dd2de8df91858e9ca74f7b331 100644 --- a/Resample/Processed/ProcessedSample.cpp +++ b/Resample/Processed/ProcessedSample.cpp @@ -124,7 +124,7 @@ SliceStack refineStack(const SliceStack& stack, const std::vector<ProcessedLayou SliceStack slicify(const MultiLayer& sample, const SimulationOptions& options) { - SliceStack result; + SliceStack result(sample.roughnessModel()); if (sample.numberOfLayers() == 0) return result; const bool use_slicing = options.useAvgMaterials() && sample.numberOfLayers() > 1; @@ -220,7 +220,7 @@ ProcessedSample ProcessedSample::make(const MultiLayer& sample, const Simulation const SliceStack refined_stack = options.useAvgMaterials() ? refineStack(slices1, layouts) : slices1; - SliceStack reversed_stack; + SliceStack reversed_stack(refined_stack.roughnessModel()); for (Slice slice : refined_stack) { slice.invertBField(); reversed_stack.push_back(slice); diff --git a/Resample/Slice/SliceStack.cpp b/Resample/Slice/SliceStack.cpp index 72a03183460592538496e440381033b917b74be1..41dd5ce17b2f058db8a79b59360ff9f3ea11fbeb 100644 --- a/Resample/Slice/SliceStack.cpp +++ b/Resample/Slice/SliceStack.cpp @@ -14,7 +14,9 @@ #include "Resample/Slice/SliceStack.h" #include "Base/Utils/Assert.h" -#include "Resample/Slice/Slice.h" + +SliceStack::SliceStack(const SliceStack& other) + : std::vector<Slice>((std::vector<Slice>)other), m_roughness_model(other.roughnessModel()) {} void SliceStack::addTopSlice(double zbottom, const Material& material) { diff --git a/Resample/Slice/SliceStack.h b/Resample/Slice/SliceStack.h index 1fc364357b960d57664f672c84f75aa12d2845c4..b33cc5301b23d8892e573683b19db02324ad69d8 100644 --- a/Resample/Slice/SliceStack.h +++ b/Resample/Slice/SliceStack.h @@ -21,6 +21,11 @@ #define BORNAGAIN_RESAMPLE_SLICE_SLICESTACK_H #include "Base/Vector/Vectors3D.h" +#include "Resample/Slice/Slice.h" // TODO move back to cpp file + // - either get rid of m_roughness_model + // - or of inheritance from std::vector + +#include "Sample/Multilayer/RoughnessModels.h" #include <vector> class LayerRoughness; @@ -31,6 +36,9 @@ class Slice; class SliceStack : public std::vector<Slice> { public: + SliceStack(const RoughnessModel roughness_model) : m_roughness_model(roughness_model) {} + SliceStack(const SliceStack& other); + void addTopSlice(double zbottom, const Material& material); void addSlice(double thickness, const Material& material, const LayerRoughness* roughness = nullptr); @@ -41,6 +49,11 @@ public: bool containsMagneticMaterial() const; const LayerRoughness* bottomRoughness(size_t i_slice) const; + + RoughnessModel roughnessModel() const { return m_roughness_model; } + +private: + const RoughnessModel m_roughness_model; }; #endif // BORNAGAIN_RESAMPLE_SLICE_SLICESTACK_H diff --git a/Tests/UnitTests/Core/Fresnel/SpecularScanTest.cpp b/Tests/UnitTests/Core/Fresnel/SpecularScanTest.cpp index f2c57859e3dd6673fe4bcd0b20c6d258f6686112..0e5f0cc4ffb60ba4917f0b984d2e1d481fecdb04 100644 --- a/Tests/UnitTests/Core/Fresnel/SpecularScanTest.cpp +++ b/Tests/UnitTests/Core/Fresnel/SpecularScanTest.cpp @@ -220,7 +220,7 @@ TEST_F(SpecularScanTest, GenerateSimElements) const double offset = 1.; scan2.setOffset(offset); std::vector<SpecularElement> eles3 = scan2.generateDiffuseElements(instrument); - SliceStack slices; + SliceStack slices({}); slices.addTopSlice(0., MaterialBySLD()); for (size_t i = 0; i < eles3.size(); ++i) { const auto generatedKzs = eles3[i].produceKz(slices); diff --git a/auto/Wrap/doxygenResample.i b/auto/Wrap/doxygenResample.i index 03bf4c76c2ff290f402fb38802df2f99d1e50d0b..19207e2b987f00cad64694df402497cb68bba253 100644 --- a/auto/Wrap/doxygenResample.i +++ b/auto/Wrap/doxygenResample.i @@ -697,6 +697,12 @@ A stack of Slices. C++ includes: SliceStack.h "; +%feature("docstring") SliceStack::SliceStack "SliceStack::SliceStack(const RoughnessModel roughness_model) +"; + +%feature("docstring") SliceStack::SliceStack "SliceStack::SliceStack(const SliceStack &other) +"; + %feature("docstring") SliceStack::addTopSlice "void SliceStack::addTopSlice(double zbottom, const Material &material) "; @@ -717,6 +723,9 @@ Adds n times the same slice to the stack. %feature("docstring") SliceStack::bottomRoughness "const LayerRoughness * SliceStack::bottomRoughness(size_t i_slice) const "; +%feature("docstring") SliceStack::roughnessModel "RoughnessModel SliceStack::roughnessModel() const +"; + // File: classSpecularMagneticStrategy.xml %feature("docstring") SpecularMagneticStrategy " @@ -744,17 +753,6 @@ Computes the Fresnel R coefficient for the top layer only Introduced in order to "; -// File: classSpecularScalarNCStrategy.xml -%feature("docstring") SpecularScalarNCStrategy " - -Implements Nevot-Croce roughness for a scaler computation. - -Implements the transition function that includes Nevot-Croce roughness in the computation of the coefficients for coherent wave propagation in a multilayer by applying modified Fresnel coefficients. - -C++ includes: SpecularScalarNCStrategy.h -"; - - // File: classSpecularScalarStrategy.xml %feature("docstring") SpecularScalarStrategy " @@ -762,7 +760,7 @@ Implements the scalar Fresnel computation Implements method 'execute' to compute refraction angles and transmission/reflection coefficients for coherent wave propagation in a multilayer. -Inherited by SpecularScalarNCStrategy, SpecularScalarTanhStrategy +Inherited by SpecularScalarNCStrategy, SpecularScalarTanhStrategy C++ includes: SpecularScalarStrategy.h "; @@ -773,17 +771,6 @@ Computes refraction angles and transmission/reflection coefficients for given co "; -// File: classSpecularScalarTanhStrategy.xml -%feature("docstring") SpecularScalarTanhStrategy " - -Implements an tanh transition function to model roughness in a scaler computation. - -Implements the transition function that includes the analytical roughness model of an tanh interface transition in the computation of the coefficients for coherent wave propagation in a multilayer by applying modified Fresnel coefficients. - -C++ includes: SpecularScalarTanhStrategy.h -"; - - // File: classSSCAStrategy.xml %feature("docstring") SSCAStrategy " @@ -829,7 +816,7 @@ C++ includes: SSCAStrategy.h // File: namespace_0d42.xml -// File: namespace_0d46.xml +// File: namespace_0d44.xml // File: namespaceCompute.xml @@ -1026,24 +1013,12 @@ Get default z limits for generating a material profile. // File: SpecularMagneticTanhStrategy_8h.xml -// File: SpecularScalarNCStrategy_8cpp.xml - - -// File: SpecularScalarNCStrategy_8h.xml - - // File: SpecularScalarStrategy_8cpp.xml // File: SpecularScalarStrategy_8h.xml -// File: SpecularScalarTanhStrategy_8cpp.xml - - -// File: SpecularScalarTanhStrategy_8h.xml - - // File: MultiLayerFuncs_8cpp.xml