From 541406e5a1f4f2036ddce2ec339d2527d2588c14 Mon Sep 17 00:00:00 2001 From: "Joachim Wuttke (h)" <j.wuttke@fz-juelich.de> Date: Wed, 21 Jul 2021 22:38:28 +0200 Subject: [PATCH] Fluxes now declared via 'using' --- Resample/Element/DiffuseElement.h | 3 ++- Resample/Flux/IFlux.h | 5 ----- Resample/Flux/ScalarFlux.h | 1 + Resample/Processed/ProcessedSample.cpp | 1 + Resample/Processed/ProcessedSample.h | 4 +++- Resample/Specular/SpecularMagneticStrategy.cpp | 1 + Resample/Specular/SpecularMagneticStrategy.h | 5 ++++- Resample/Specular/SpecularScalarStrategy.cpp | 2 ++ Resample/Specular/SpecularScalarStrategy.h | 3 ++- Resample/Specular/TransitionMagneticNevot.cpp | 1 + Resample/Specular/TransitionMagneticNevot.h | 9 ++++++--- Resample/Specular/TransitionMagneticTanh.cpp | 1 + Resample/Specular/TransitionMagneticTanh.h | 5 ++++- Tests/UnitTests/Core/Sample/RTTest.cpp | 1 + auto/Wrap/doxygenResample.i | 4 ---- 15 files changed, 29 insertions(+), 17 deletions(-) diff --git a/Resample/Element/DiffuseElement.h b/Resample/Element/DiffuseElement.h index 9ab8fc26a2a..f96dba92787 100644 --- a/Resample/Element/DiffuseElement.h +++ b/Resample/Element/DiffuseElement.h @@ -24,11 +24,12 @@ #include "Base/Vector/Vectors3D.h" #include <memory> -class Fluxes; class IFlux; class IPixel; class WavevectorInfo; +using Fluxes = std::vector<std::unique_ptr<const IFlux>>; + //! Data stucture containing both input and output of a single detector cell. //! @ingroup simulation diff --git a/Resample/Flux/IFlux.h b/Resample/Flux/IFlux.h index 306723bd008..f615b2239dc 100644 --- a/Resample/Flux/IFlux.h +++ b/Resample/Flux/IFlux.h @@ -20,7 +20,6 @@ #ifndef BORNAGAIN_RESAMPLE_FLUX_IFLUX_H #define BORNAGAIN_RESAMPLE_FLUX_IFLUX_H -#include "Base/Types/Complex.h" #include "Base/Vector/EigenCore.h" #include <memory> #include <vector> @@ -46,9 +45,5 @@ public: virtual Eigen::Vector2cd getKz() const = 0; }; -// prefer trivial inheritance over 'using' declaration to allow forward declarations 'class Fluxes' -class Fluxes : public std::vector<std::unique_ptr<const IFlux>> { -}; - #endif // BORNAGAIN_RESAMPLE_FLUX_IFLUX_H #endif // USER_API diff --git a/Resample/Flux/ScalarFlux.h b/Resample/Flux/ScalarFlux.h index e94b7029bac..c82d0bd2efb 100644 --- a/Resample/Flux/ScalarFlux.h +++ b/Resample/Flux/ScalarFlux.h @@ -21,6 +21,7 @@ #define BORNAGAIN_RESAMPLE_FLUX_SCALARFLUX_H #include "Resample/Flux/IFlux.h" +#include "Base/Types/Complex.h" //! Specular reflection and transmission coefficients in a layer in case //! of scalar interactions between the layers and the scattered particle. diff --git a/Resample/Processed/ProcessedSample.cpp b/Resample/Processed/ProcessedSample.cpp index 1aa45709f68..d76fa9b2999 100644 --- a/Resample/Processed/ProcessedSample.cpp +++ b/Resample/Processed/ProcessedSample.cpp @@ -14,6 +14,7 @@ #include "Resample/Processed/ProcessedSample.h" #include "Base/Utils/Assert.h" +#include "Resample/Flux/IFlux.h" #include "Resample/Options/SimulationOptions.h" #include "Resample/Processed/ParticleRegions.h" #include "Resample/Processed/ProcessedLayout.h" diff --git a/Resample/Processed/ProcessedSample.h b/Resample/Processed/ProcessedSample.h index eb3c0c00c7d..1a45d0a46c8 100644 --- a/Resample/Processed/ProcessedSample.h +++ b/Resample/Processed/ProcessedSample.h @@ -25,12 +25,14 @@ #include <memory> #include <vector> -class Fluxes; +class IFlux; class Material; class MultiLayer; class ProcessedLayout; class SimulationOptions; +using Fluxes = std::vector<std::unique_ptr<const IFlux>>; + //! Data structure that contains all the necessary data for scattering calculations. //! //! If the usage of average materials is requested, layers and particles are sliced into multiple diff --git a/Resample/Specular/SpecularMagneticStrategy.cpp b/Resample/Specular/SpecularMagneticStrategy.cpp index 5ecf96b4562..1fa087a03c2 100644 --- a/Resample/Specular/SpecularMagneticStrategy.cpp +++ b/Resample/Specular/SpecularMagneticStrategy.cpp @@ -15,6 +15,7 @@ #include "Resample/Specular/SpecularMagneticStrategy.h" #include "Base/Const/PhysicalConstants.h" #include "Base/Utils/Assert.h" +#include "Resample/Flux/MatrixFlux.h" #include "Resample/Slice/KzComputation.h" #include "Resample/Slice/Slice.h" #include "Resample/Slice/SliceStack.h" diff --git a/Resample/Specular/SpecularMagneticStrategy.h b/Resample/Specular/SpecularMagneticStrategy.h index 28f622428bd..b7176f2c1e2 100644 --- a/Resample/Specular/SpecularMagneticStrategy.h +++ b/Resample/Specular/SpecularMagneticStrategy.h @@ -20,12 +20,15 @@ #ifndef BORNAGAIN_RESAMPLE_SPECULAR_SPECULARMAGNETICSTRATEGY_H #define BORNAGAIN_RESAMPLE_SPECULAR_SPECULARMAGNETICSTRATEGY_H -#include "Resample/Flux/MatrixFlux.h" #include "Sample/Multilayer/RoughnessModels.h" +#include "Base/Vector/Vectors3D.h" +#include <Eigen/Core> #include <memory> #include <vector> +class IFlux; class SliceStack; +using Fluxes = std::vector<std::unique_ptr<const IFlux>>; //! Implements the magnetic Fresnel computation with Nevot-Croce roughness //! diff --git a/Resample/Specular/SpecularScalarStrategy.cpp b/Resample/Specular/SpecularScalarStrategy.cpp index d9ee70cd52d..5cd7a8c95ab 100644 --- a/Resample/Specular/SpecularScalarStrategy.cpp +++ b/Resample/Specular/SpecularScalarStrategy.cpp @@ -16,11 +16,13 @@ #include "Base/Math/Constants.h" #include "Base/Math/Functions.h" #include "Base/Utils/Assert.h" +#include "Resample/Flux/ScalarFlux.h" #include "Resample/Slice/KzComputation.h" #include "Resample/Slice/Slice.h" #include "Resample/Slice/SliceStack.h" #include "Sample/Interface/LayerRoughness.h" #include "Sample/Multilayer/Layer.h" +#include "Sample/Multilayer/RoughnessModels.h" #include <Eigen/Dense> #include <stdexcept> diff --git a/Resample/Specular/SpecularScalarStrategy.h b/Resample/Specular/SpecularScalarStrategy.h index 65365fef312..6dc8680e5d7 100644 --- a/Resample/Specular/SpecularScalarStrategy.h +++ b/Resample/Specular/SpecularScalarStrategy.h @@ -20,13 +20,14 @@ #ifndef BORNAGAIN_RESAMPLE_SPECULAR_SPECULARSCALARSTRATEGY_H #define BORNAGAIN_RESAMPLE_SPECULAR_SPECULARSCALARSTRATEGY_H -#include "Resample/Flux/ScalarFlux.h" #include "Base/Vector/Vectors3D.h" #include "Sample/Multilayer/RoughnessModels.h" #include <memory> #include <vector> +class IFlux; class SliceStack; +using Fluxes = std::vector<std::unique_ptr<const IFlux>>; //! Implements the scalar Fresnel computation //! diff --git a/Resample/Specular/TransitionMagneticNevot.cpp b/Resample/Specular/TransitionMagneticNevot.cpp index 9827f005bc6..1f5513e598e 100644 --- a/Resample/Specular/TransitionMagneticNevot.cpp +++ b/Resample/Specular/TransitionMagneticNevot.cpp @@ -13,6 +13,7 @@ // ************************************************************************************************ #include "Resample/Specular/TransitionMagneticNevot.h" +#include "Resample/Flux/MatrixFlux.h" namespace { diff --git a/Resample/Specular/TransitionMagneticNevot.h b/Resample/Specular/TransitionMagneticNevot.h index 67b7a9099bc..0e851d3b9be 100644 --- a/Resample/Specular/TransitionMagneticNevot.h +++ b/Resample/Specular/TransitionMagneticNevot.h @@ -20,9 +20,10 @@ #ifndef BORNAGAIN_RESAMPLE_SPECULAR_TRANSITIONMAGNETICNEVOT_H #define BORNAGAIN_RESAMPLE_SPECULAR_TRANSITIONMAGNETICNEVOT_H -#include "Resample/Specular/SpecularMagneticStrategy.h" -#include <memory> -#include <vector> +#include <Eigen/Core> +#include <utility> + +class MatrixFlux; //! Implements the magnetic Fresnel computation with Nevot-Croce roughness //! @@ -32,8 +33,10 @@ //! document "Polarized Implementation of the Transfer Matrix Method" namespace Compute::MagneticNevotCroceTransition { + std::pair<Eigen::Matrix2cd, Eigen::Matrix2cd> backwardsSubmatrices(const MatrixFlux& coeff_i, const MatrixFlux& coeff_i1, double sigma); + } #endif // BORNAGAIN_RESAMPLE_SPECULAR_TRANSITIONMAGNETICNEVOT_H diff --git a/Resample/Specular/TransitionMagneticTanh.cpp b/Resample/Specular/TransitionMagneticTanh.cpp index a0414d3a38d..ab6a70b0f32 100644 --- a/Resample/Specular/TransitionMagneticTanh.cpp +++ b/Resample/Specular/TransitionMagneticTanh.cpp @@ -15,6 +15,7 @@ #include "Resample/Specular/TransitionMagneticTanh.h" #include "Base/Math/Constants.h" #include "Base/Math/Functions.h" +#include "Resample/Flux/MatrixFlux.h" namespace { diff --git a/Resample/Specular/TransitionMagneticTanh.h b/Resample/Specular/TransitionMagneticTanh.h index e3a4c386ac8..cd186ea3b18 100644 --- a/Resample/Specular/TransitionMagneticTanh.h +++ b/Resample/Specular/TransitionMagneticTanh.h @@ -20,7 +20,10 @@ #ifndef BORNAGAIN_RESAMPLE_SPECULAR_TRANSITIONMAGNETICTANH_H #define BORNAGAIN_RESAMPLE_SPECULAR_TRANSITIONMAGNETICTANH_H -#include "Resample/Specular/SpecularMagneticStrategy.h" +#include <Eigen/Core> +#include <utility> + +class MatrixFlux; //! Implements the magnetic Fresnel computation with the analytical Tanh roughness //! diff --git a/Tests/UnitTests/Core/Sample/RTTest.cpp b/Tests/UnitTests/Core/Sample/RTTest.cpp index acc0c1fb35c..bfa98264af3 100644 --- a/Tests/UnitTests/Core/Sample/RTTest.cpp +++ b/Tests/UnitTests/Core/Sample/RTTest.cpp @@ -1,4 +1,5 @@ #include "Base/Math/Constants.h" +#include "Resample/Flux/ScalarFlux.h" #include "Resample/Options/SimulationOptions.h" #include "Resample/Processed/ProcessedSample.h" #include "Resample/Specular/SpecularScalarStrategy.h" diff --git a/auto/Wrap/doxygenResample.i b/auto/Wrap/doxygenResample.i index 85bef786790..8aee848cb68 100644 --- a/auto/Wrap/doxygenResample.i +++ b/auto/Wrap/doxygenResample.i @@ -178,10 +178,6 @@ Returns the coherent sum of the four DWBA terms for scalar scattering. "; -// File: classFluxes.xml -%feature("docstring") Fluxes ""; - - // File: classIDWBA.xml %feature("docstring") IDWBA " -- GitLab