diff --git a/Base/Pixel/DiffuseElement.cpp b/Base/Pixel/DiffuseElement.cpp index a9adcc884436831dce88d6279cebbc8791a31973..5e130f80bb49134237a0fe69364bb2ea12bc88e3 100644 --- a/Base/Pixel/DiffuseElement.cpp +++ b/Base/Pixel/DiffuseElement.cpp @@ -20,7 +20,8 @@ DiffuseElement::DiffuseElement(double wavelength, double alpha_i, double phi_i, std::unique_ptr<IPixel> pixel, const Eigen::Matrix2cd& beam_polarization, const Eigen::Matrix2cd& analyzer, bool isSpecular_, - const IFresnelMap* const fresnel_map) + const Fluxes* const fluxes_in, + const Fluxes* const fluxes_out ) : m_polarization(beam_polarization, analyzer) , m_wavelength(wavelength) , m_alpha_i(alpha_i) @@ -29,7 +30,8 @@ DiffuseElement::DiffuseElement(double wavelength, double alpha_i, double phi_i, , m_mean_kf(pixel->getK(0.5, 0.5, m_wavelength)) , m_pixel(std::move(pixel)) , m_is_specular(isSpecular_) - , m_fresnel_map(fresnel_map) + , m_fluxes_in(fluxes_in) + , m_fluxes_out(fluxes_out) , m_intensity(0.0) { } @@ -43,7 +45,8 @@ DiffuseElement::DiffuseElement(const DiffuseElement& other) , m_mean_kf(other.m_mean_kf) , m_pixel(std::move(other.m_pixel->clone())) , m_is_specular(other.m_is_specular) - , m_fresnel_map(other.m_fresnel_map) + , m_fluxes_in(other.m_fluxes_in) + , m_fluxes_out(other.m_fluxes_out) , m_intensity(other.m_intensity) { } @@ -65,7 +68,8 @@ DiffuseElement DiffuseElement::pointElement(double x, double y) const m_polarization.getPolarization(), m_polarization.getAnalyzerOperator(), m_is_specular, - m_fresnel_map}; + m_fluxes_in, + m_fluxes_out}; } kvector_t DiffuseElement::getKi() const diff --git a/Base/Pixel/DiffuseElement.h b/Base/Pixel/DiffuseElement.h index a043dbbdd0457a012dda8aca8eedf924b6dfca63..017ceb4023077e834427b2b9785a0dfd52992800 100644 --- a/Base/Pixel/DiffuseElement.h +++ b/Base/Pixel/DiffuseElement.h @@ -35,15 +35,15 @@ class DiffuseElement { public: DiffuseElement(double wavelength, double alpha_i, double phi_i, std::unique_ptr<IPixel> pixel, const Eigen::Matrix2cd& beam_polarization, const Eigen::Matrix2cd& analyzer, - bool isSpecular_, const IFresnelMap* const fresnel_map = nullptr); + bool isSpecular_, const Fluxes* const fluxes_in = nullptr, + const Fluxes* const fluxes_out = nullptr); DiffuseElement(const DiffuseElement& other); DiffuseElement& operator=(const DiffuseElement&) = delete; ~DiffuseElement(); - void setFresnelMap(const IFresnelMap* const fresnel_map) { m_fresnel_map = fresnel_map; } - const IFresnelMap* fresnelMap() const { return m_fresnel_map; } - void setFluxes(const Fluxes* fluxes_in, const Fluxes* fluxes_out); + const Fluxes& fluxesIn() const { return *m_fluxes_in; } + const Fluxes& fluxesOut() const { return *m_fluxes_out; } //! Returns copy of this DiffuseElement with k_f given by in-pixel coordinate x,y. DiffuseElement pointElement(double x, double y) const; @@ -85,7 +85,6 @@ private: const kvector_t m_mean_kf; //!< cached value of mean_kf const std::unique_ptr<IPixel> m_pixel; const bool m_is_specular; - const IFresnelMap* m_fresnel_map; const Fluxes* m_fluxes_in; const Fluxes* m_fluxes_out; double m_intensity; //!< simulated intensity for detector cell diff --git a/Core/Computation/DWBAComputation.cpp b/Core/Computation/DWBAComputation.cpp index 56a2d2cf56546a950425d8b6d18aa14d1199dd38..58f8849efd467c1a4477efcd14e4d232a161b452 100644 --- a/Core/Computation/DWBAComputation.cpp +++ b/Core/Computation/DWBAComputation.cpp @@ -72,11 +72,9 @@ void DWBAComputation::runProtected() DiffuseElement& ele = *it; const Fluxes fluxes_in = m_re_sample.fluxesIn(ele.getKi()); - const Fluxes fluxes_out = m_re_sample.fluxesOut(ele.getKi()); + const Fluxes fluxes_out = m_re_sample.fluxesOut(ele.getMeanKf()); ele.setFluxes(&fluxes_in, &fluxes_out); - ele.setFresnelMap(m_fresnel_map); - for (auto& contrib : m_layout_contribs) contrib->compute(ele); diff --git a/Core/Contrib/GISASSpecularContribution.cpp b/Core/Contrib/GISASSpecularContribution.cpp index 86c3e77ab7ab4b81fc3dba5acfc4f9890f4d9d24..a9fe61906c42f17ef2c0614bafb374659467c3d2 100644 --- a/Core/Contrib/GISASSpecularContribution.cpp +++ b/Core/Contrib/GISASSpecularContribution.cpp @@ -16,7 +16,6 @@ #include "Base/Pixel/DiffuseElement.h" #include "Base/Utils/Assert.h" #include "Resample/Flux/IFlux.h" -#include "Resample/Fresnel/IFresnelMap.h" GISASSpecularContribution::GISASSpecularContribution() {} @@ -24,9 +23,9 @@ void GISASSpecularContribution::compute(DiffuseElement& ele) const { if (!ele.isSpecular()) return; - const IFresnelMap* const fresnel_map = ele.fresnelMap(); - ASSERT(fresnel_map); - complex_t R = fresnel_map->getInFlux(ele.getKi(), 0)->getScalarR(); + + complex_t R = ele.fluxesIn()[0]->getScalarR(); + double sin_alpha_i = std::abs(std::sin(ele.getAlphaI())); if (sin_alpha_i == 0.0) { ele.setIntensity(0); diff --git a/Resample/FFCompute/IComputePol.cpp b/Resample/FFCompute/IComputePol.cpp index 9cef066f2eeb12eaa4dccc513e6e2ea285761dc8..41af81eb30c0c517a1dbf9b2c2b84a8766633d8f 100644 --- a/Resample/FFCompute/IComputePol.cpp +++ b/Resample/FFCompute/IComputePol.cpp @@ -14,17 +14,10 @@ #include "Resample/FFCompute/IComputePol.h" #include "Base/Pixel/DiffuseElement.h" -#include "Base/Utils/Assert.h" -#include "Resample/Flux/IFlux.h" // required by VS19 compiler -#include "Resample/Fresnel/IFresnelMap.h" +#include "Resample/Flux/IFlux.h" #include "Sample/Material/WavevectorInfo.h" - Eigen::Matrix2cd IComputePol::coherentPolFF(const DiffuseElement& ele) const { - const IFresnelMap* const fresnel_map = ele.fresnelMap(); - ASSERT(fresnel_map); - auto inFlux = fresnel_map->getInFlux(ele.getKi(), m_i_layer); - auto outFlux = fresnel_map->getOutFlux(ele.getMeanKf(), m_i_layer); - return computePolFF({ele}, inFlux, outFlux); + return computePolFF({ele}, ele.fluxesIn()[m_i_layer], ele.fluxesOut()[m_i_layer]); } diff --git a/Resample/FFCompute/IComputeScalar.cpp b/Resample/FFCompute/IComputeScalar.cpp index 8ff039586984e238973d99f46f9f5ceb80e3772b..9b6caf732e79b98216e5d67a7b99304af7ce4f9f 100644 --- a/Resample/FFCompute/IComputeScalar.cpp +++ b/Resample/FFCompute/IComputeScalar.cpp @@ -14,17 +14,10 @@ #include "Resample/FFCompute/IComputeScalar.h" #include "Base/Pixel/DiffuseElement.h" -#include "Base/Utils/Assert.h" -#include "Resample/Flux/IFlux.h" // required by VS19 compiler -#include "Resample/Fresnel/IFresnelMap.h" +#include "Resample/Flux/IFlux.h" #include "Sample/Material/WavevectorInfo.h" - complex_t IComputeScalar::coherentFF(const DiffuseElement& ele) const { - const IFresnelMap* const fresnel_map = ele.fresnelMap(); - ASSERT(fresnel_map); - auto inFlux = fresnel_map->getInFlux(ele.getKi(), m_i_layer); - auto outFlux = fresnel_map->getOutFlux(ele.getMeanKf(), m_i_layer); - return computeFF({ele}, inFlux, outFlux); + return computeFF({ele}, ele.fluxesIn()[m_i_layer], ele.fluxesOut()[m_i_layer]); } diff --git a/auto/Wrap/doxygenBase.i b/auto/Wrap/doxygenBase.i index 8f843029010ac3c287a6253e159b078ef6a85fea..60131dffb8b958f661a86019cd680994cb210187 100644 --- a/auto/Wrap/doxygenBase.i +++ b/auto/Wrap/doxygenBase.i @@ -394,7 +394,7 @@ Data stucture containing both input and output of a single detector cell. C++ includes: DiffuseElement.h "; -%feature("docstring") DiffuseElement::DiffuseElement "DiffuseElement::DiffuseElement(double wavelength, double alpha_i, double phi_i, std::unique_ptr< IPixel > pixel, const Eigen::Matrix2cd &beam_polarization, const Eigen::Matrix2cd &analyzer, bool isSpecular_, const IFresnelMap *const fresnel_map=nullptr) +%feature("docstring") DiffuseElement::DiffuseElement "DiffuseElement::DiffuseElement(double wavelength, double alpha_i, double phi_i, std::unique_ptr< IPixel > pixel, const Eigen::Matrix2cd &beam_polarization, const Eigen::Matrix2cd &analyzer, bool isSpecular_, const Fluxes *const fluxes_in=nullptr, const Fluxes *const fluxes_out=nullptr) "; %feature("docstring") DiffuseElement::DiffuseElement "DiffuseElement::DiffuseElement(const DiffuseElement &other) @@ -403,10 +403,13 @@ C++ includes: DiffuseElement.h %feature("docstring") DiffuseElement::~DiffuseElement "DiffuseElement::~DiffuseElement() "; -%feature("docstring") DiffuseElement::setFresnelMap "void DiffuseElement::setFresnelMap(const IFresnelMap *const fresnel_map) +%feature("docstring") DiffuseElement::setFluxes "void DiffuseElement::setFluxes(const Fluxes *fluxes_in, const Fluxes *fluxes_out) "; -%feature("docstring") DiffuseElement::fresnelMap "const IFresnelMap* DiffuseElement::fresnelMap() const +%feature("docstring") DiffuseElement::fluxesIn "const Fluxes& DiffuseElement::fluxesIn() const +"; + +%feature("docstring") DiffuseElement::fluxesOut "const Fluxes& DiffuseElement::fluxesOut() const "; %feature("docstring") DiffuseElement::pointElement "DiffuseElement DiffuseElement::pointElement(double x, double y) const