diff --git a/Core/Aggregate/FormFactorCoherentPart.cpp b/Core/Aggregate/FormFactorCoherentPart.cpp index f2fdeaf9e83074da94d32f92fab187a343e65d7d..fe3ae20107d09eea65f0e9bdc8879f2ec177c2c7 100644 --- a/Core/Aggregate/FormFactorCoherentPart.cpp +++ b/Core/Aggregate/FormFactorCoherentPart.cpp @@ -13,26 +13,33 @@ // ************************************************************************** // #include "FormFactorCoherentPart.h" -#include "IFresnelMap.h" #include "IFormFactor.h" +#include "IFresnelMap.h" +#include "ILayerRTCoefficients.h" #include "SimulationElement.h" #include "WavevectorInfo.h" -#include "ILayerRTCoefficients.h" +FormFactorCoherentPart::FormFactorCoherentPart(IFormFactor* p_ff) : mP_ff(p_ff) {} -FormFactorCoherentPart::FormFactorCoherentPart(IFormFactor* p_ff) - : mP_ff(p_ff) +FormFactorCoherentPart::FormFactorCoherentPart(const FormFactorCoherentPart& other) + : mP_ff(other.mP_ff->clone()), mp_fresnel_map(other.mp_fresnel_map), + m_layer_index(other.m_layer_index) { } -FormFactorCoherentPart::FormFactorCoherentPart(const FormFactorCoherentPart& other) - : mP_ff(other.mP_ff->clone()) - , mp_fresnel_map(other.mp_fresnel_map) - , m_layer_index(other.m_layer_index) +FormFactorCoherentPart& FormFactorCoherentPart::operator=(const FormFactorCoherentPart& other) { + mP_ff.reset(other.mP_ff->clone()); + mp_fresnel_map = other.mp_fresnel_map; + m_layer_index = other.m_layer_index; + return *this; } -FormFactorCoherentPart::~FormFactorCoherentPart() {} +FormFactorCoherentPart& FormFactorCoherentPart::operator=(FormFactorCoherentPart&& other) = default; + +FormFactorCoherentPart::FormFactorCoherentPart(FormFactorCoherentPart&& other) = default; + +FormFactorCoherentPart::~FormFactorCoherentPart() = default; complex_t FormFactorCoherentPart::evaluate(const SimulationElement& sim_element) const { diff --git a/Core/Aggregate/FormFactorCoherentPart.h b/Core/Aggregate/FormFactorCoherentPart.h index 3bbddb845aeab55b739ddb155f0cffe387dfc2b8..9dae33acaa83b501fbc4ffe192cc8d1cb7a0e075 100644 --- a/Core/Aggregate/FormFactorCoherentPart.h +++ b/Core/Aggregate/FormFactorCoherentPart.h @@ -32,7 +32,10 @@ class BA_CORE_API_ FormFactorCoherentPart public: FormFactorCoherentPart(IFormFactor* p_ff); FormFactorCoherentPart(const FormFactorCoherentPart& other); - virtual ~FormFactorCoherentPart(); + FormFactorCoherentPart(FormFactorCoherentPart&& other); + FormFactorCoherentPart& operator=(const FormFactorCoherentPart& other); + FormFactorCoherentPart& operator=(FormFactorCoherentPart&& other); + ~FormFactorCoherentPart(); complex_t evaluate(const SimulationElement& sim_element) const; #ifndef SWIG diff --git a/Core/Aggregate/FormFactorCoherentSum.cpp b/Core/Aggregate/FormFactorCoherentSum.cpp index 3781e4e2edab134eeb7cbc2702815e58f656489a..7c6c21a248e2b22b2c0a0bf41c425394af3816ea 100644 --- a/Core/Aggregate/FormFactorCoherentSum.cpp +++ b/Core/Aggregate/FormFactorCoherentSum.cpp @@ -18,13 +18,6 @@ FormFactorCoherentSum::FormFactorCoherentSum(double abundance) : m_abundance(abundance) {} -FormFactorCoherentSum::~FormFactorCoherentSum() {} - -FormFactorCoherentSum* FormFactorCoherentSum::clone() const -{ - return new FormFactorCoherentSum(m_parts, m_abundance); -} - void FormFactorCoherentSum::addCoherentPart(const FormFactorCoherentPart& part) { m_parts.push_back(part); diff --git a/Core/Aggregate/FormFactorCoherentSum.h b/Core/Aggregate/FormFactorCoherentSum.h index c1a9069524a5af9509801d99a6e379dc9451ed94..9e4046786389b09b1988c05583e1464df010e9d8 100644 --- a/Core/Aggregate/FormFactorCoherentSum.h +++ b/Core/Aggregate/FormFactorCoherentSum.h @@ -15,7 +15,6 @@ #ifndef FORMFACTORCOHERENTSUM_H #define FORMFACTORCOHERENTSUM_H -#include "ICloneable.h" #include "Complex.h" #include "EigenCore.h" #include "FormFactorCoherentPart.h" @@ -26,12 +25,10 @@ class SimulationElement; //! Information about particle form factor and abundance. //! @ingroup formfactors_internal -class BA_CORE_API_ FormFactorCoherentSum : public ICloneable +class BA_CORE_API_ FormFactorCoherentSum { public: FormFactorCoherentSum(double abundance); - virtual ~FormFactorCoherentSum(); - virtual FormFactorCoherentSum* clone() const; void addCoherentPart(const FormFactorCoherentPart& part); diff --git a/Core/Computation/ProcessedLayout.cpp b/Core/Computation/ProcessedLayout.cpp index 25488f011df51505a3fcb1d5398a1e0ab6b003d0..0639c99d84d2f807ce24c99abefe27cb49f91290 100644 --- a/Core/Computation/ProcessedLayout.cpp +++ b/Core/Computation/ProcessedLayout.cpp @@ -38,7 +38,7 @@ ProcessedLayout::ProcessedLayout(const ILayout& layout, const std::vector<Slice> mP_iff.reset(p_iff->clone()); } -ProcessedLayout::ProcessedLayout(ProcessedLayout &&other) +ProcessedLayout::ProcessedLayout(ProcessedLayout&& other) { mp_fresnel_map = other.mp_fresnel_map; m_polarized = other.m_polarized; @@ -59,17 +59,17 @@ double ProcessedLayout::surfaceDensity() const return m_surface_density; } -const SafePointerVector<FormFactorCoherentSum> &ProcessedLayout::formFactorList() const +const std::vector<FormFactorCoherentSum>& ProcessedLayout::formFactorList() const { return m_formfactors; } -const IInterferenceFunction *ProcessedLayout::interferenceFunction() const +const IInterferenceFunction* ProcessedLayout::interferenceFunction() const { return mP_iff.get(); } -std::map<size_t, std::vector<HomogeneousRegion> > ProcessedLayout::regionMap() const +std::map<size_t, std::vector<HomogeneousRegion>> ProcessedLayout::regionMap() const { return m_region_map; } @@ -81,9 +81,9 @@ void ProcessedLayout::collectFormFactors(const ILayout& layout, const std::vecto { double layout_abundance = layout.getTotalAbundance(); for (auto p_particle : layout.particles()) { - auto p_ff_coh = ProcessParticle(*p_particle, slices, z_ref); - p_ff_coh->scaleRelativeAbundance(layout_abundance); - m_formfactors.push_back(p_ff_coh); + auto ff_coh = ProcessParticle(*p_particle, slices, z_ref); + ff_coh.scaleRelativeAbundance(layout_abundance); + m_formfactors.push_back(ff_coh); } double weight = layout.weight(); m_surface_density = weight * layout.totalParticleSurfaceDensity(); @@ -91,16 +91,16 @@ void ProcessedLayout::collectFormFactors(const ILayout& layout, const std::vecto ScaleRegionMap(m_region_map, scale_factor); } -FormFactorCoherentSum* ProcessedLayout::ProcessParticle(const IParticle& particle, - const std::vector<Slice>& slices, - double z_ref) +FormFactorCoherentSum ProcessedLayout::ProcessParticle(const IParticle& particle, + const std::vector<Slice>& slices, + double z_ref) { double abundance = particle.abundance(); auto sliced_ffs = SlicedFormFactorList::CreateSlicedFormFactors(particle, slices, z_ref); auto region_map = sliced_ffs.regionMap(); ScaleRegionMap(region_map, abundance); mergeRegionMap(region_map); - std::unique_ptr<FormFactorCoherentSum> P_result(new FormFactorCoherentSum(abundance)); + auto result = FormFactorCoherentSum(abundance); for (size_t i = 0; i < sliced_ffs.size(); ++i) { auto ff_pair = sliced_ffs[i]; std::unique_ptr<IFormFactor> P_ff_framework; @@ -123,9 +123,9 @@ FormFactorCoherentSum* ProcessedLayout::ProcessParticle(const IParticle& particl auto part = FormFactorCoherentPart(P_ff_framework.release()); part.setSpecularInfo(mp_fresnel_map, slice_index); - P_result->addCoherentPart(part); + result.addCoherentPart(part); } - return P_result.release(); + return result; } void ProcessedLayout::mergeRegionMap( diff --git a/Core/Computation/ProcessedLayout.h b/Core/Computation/ProcessedLayout.h index 6ff8e571f58bc6d9f28792d8bbe0d78f7fcbca2f..de5fe46652fd372d07ce6757efa632d5a44ebd70 100644 --- a/Core/Computation/ProcessedLayout.h +++ b/Core/Computation/ProcessedLayout.h @@ -15,7 +15,6 @@ #ifndef PROCESSEDLAYOUT_H #define PROCESSEDLAYOUT_H -#include "SafePointerVector.h" #include <map> #include <memory> #include <vector> @@ -45,19 +44,19 @@ public: size_t numberOfSlices() const; double surfaceDensity() const; - const SafePointerVector<FormFactorCoherentSum>& formFactorList() const; + const std::vector<FormFactorCoherentSum>& formFactorList() const; const IInterferenceFunction* interferenceFunction() const; std::map<size_t, std::vector<HomogeneousRegion>> regionMap() const; private: void collectFormFactors(const ILayout& layout, const std::vector<Slice>& slices, double z_ref); - FormFactorCoherentSum* ProcessParticle(const IParticle& particle, const std::vector<Slice>& slices, double z_ref); + FormFactorCoherentSum ProcessParticle(const IParticle& particle, const std::vector<Slice>& slices, double z_ref); void mergeRegionMap(const std::map<size_t, std::vector<HomogeneousRegion>>& region_map); const IFresnelMap* mp_fresnel_map; bool m_polarized; size_t m_n_slices; double m_surface_density; - SafePointerVector<FormFactorCoherentSum> m_formfactors; + std::vector<FormFactorCoherentSum> m_formfactors; std::unique_ptr<IInterferenceFunction> mP_iff; std::map<size_t, std::vector<HomogeneousRegion>> m_region_map; }; diff --git a/Core/Multilayer/DecouplingApproximationStrategy.cpp b/Core/Multilayer/DecouplingApproximationStrategy.cpp index e990d865fa2053ef84669f1c611bc2a1296e1e2a..1d2f4a7aaae14c7c9f955d91525ed450ecc66bde 100644 --- a/Core/Multilayer/DecouplingApproximationStrategy.cpp +++ b/Core/Multilayer/DecouplingApproximationStrategy.cpp @@ -43,7 +43,7 @@ double DecouplingApproximationStrategy::scalarCalculation( if (std::isnan(ff.real())) throw Exceptions::RuntimeErrorException( "DecouplingApproximationStrategy::scalarCalculation() -> Error! Amplitude is NaN"); - double fraction = m_formfactor_wrappers[i]->relativeAbundance(); + double fraction = m_formfactor_wrappers[i].relativeAbundance(); amplitude += fraction * ff; intensity += fraction * std::norm(ff); } @@ -67,7 +67,7 @@ double DecouplingApproximationStrategy::polarizedCalculation( throw Exceptions::RuntimeErrorException( "DecouplingApproximationStrategy::polarizedCalculation() -> " "Error! Form factor contains NaN or infinite"); - double fraction = m_formfactor_wrappers[i]->relativeAbundance(); + double fraction = m_formfactor_wrappers[i].relativeAbundance(); mean_amplitude += fraction * ff; mean_intensity += fraction * (ff * polarization_handler.getPolarization() * ff.adjoint()); } diff --git a/Core/Multilayer/IInterferenceFunctionStrategy.cpp b/Core/Multilayer/IInterferenceFunctionStrategy.cpp index 1c88d504c238ecca4375e4ea0282669530eb9abf..88ddfcb93bc7ea082e70f7a20d55ba908cc1581e 100644 --- a/Core/Multilayer/IInterferenceFunctionStrategy.cpp +++ b/Core/Multilayer/IInterferenceFunctionStrategy.cpp @@ -31,7 +31,7 @@ IInterferenceFunctionStrategy::IInterferenceFunctionStrategy(const SimulationOpt IInterferenceFunctionStrategy::~IInterferenceFunctionStrategy() =default; void IInterferenceFunctionStrategy::init( - const SafePointerVector<FormFactorCoherentSum>& weighted_formfactors, + const std::vector<FormFactorCoherentSum>& weighted_formfactors, const IInterferenceFunction* p_iff) { if (weighted_formfactors.size()==0) diff --git a/Core/Multilayer/IInterferenceFunctionStrategy.h b/Core/Multilayer/IInterferenceFunctionStrategy.h index 8f6c2edc343593bd1c51742ff1e3b035bb2a19a4..ab50814e233a315ce8ce1d67e2f4800a49b2bd60 100644 --- a/Core/Multilayer/IInterferenceFunctionStrategy.h +++ b/Core/Multilayer/IInterferenceFunctionStrategy.h @@ -16,9 +16,9 @@ #define IINTERFERENCEFUNCTIONSTRATEGY_H #include "Complex.h" -#include "SafePointerVector.h" #include "SimulationOptions.h" #include <memory> +#include <vector> template <class T> class IntegratorMCMiser; class FormFactorCoherentSum; @@ -45,14 +45,14 @@ public: virtual ~IInterferenceFunctionStrategy(); //! Initializes the object with form factors and an interference function - void init(const SafePointerVector<FormFactorCoherentSum>& weighted_formfactors, + void init(const std::vector<FormFactorCoherentSum>& weighted_formfactors, const IInterferenceFunction* p_iff); //! Calculates the intensity for scalar particles/interactions double evaluate(const SimulationElement& sim_element) const; protected: - SafePointerVector<FormFactorCoherentSum> m_formfactor_wrappers; + std::vector<FormFactorCoherentSum> m_formfactor_wrappers; std::unique_ptr<IInterferenceFunction> mP_iff; SimulationOptions m_options; diff --git a/Core/Multilayer/InterferenceFunctionUtils.cpp b/Core/Multilayer/InterferenceFunctionUtils.cpp index 784a5d7275deefbbbc72e1912053c6543daf3c9b..a2c7970009137b32f6453b6f0369f2baeb400ea1 100644 --- a/Core/Multilayer/InterferenceFunctionUtils.cpp +++ b/Core/Multilayer/InterferenceFunctionUtils.cpp @@ -19,22 +19,22 @@ namespace InterferenceFunctionUtils { std::vector<complex_t> PrecomputeScalarFormFactors( const SimulationElement& sim_element, - const SafePointerVector<FormFactorCoherentSum>& ff_wrappers) + const std::vector<FormFactorCoherentSum>& ff_wrappers) { std::vector<complex_t> result; - for (auto ffw: ff_wrappers) { - result.push_back(ffw->evaluate(sim_element)); + for (auto& ffw: ff_wrappers) { + result.push_back(ffw.evaluate(sim_element)); } return result; } matrixFFVector_t PrecomputePolarizedFormFactors( const SimulationElement& sim_element, - const SafePointerVector<FormFactorCoherentSum>& ff_wrappers) + const std::vector<FormFactorCoherentSum>& ff_wrappers) { matrixFFVector_t result; - for (auto ffw: ff_wrappers) { - result.push_back(ffw->evaluatePol(sim_element)); + for (auto& ffw: ff_wrappers) { + result.push_back(ffw.evaluatePol(sim_element)); } return result; } diff --git a/Core/Multilayer/InterferenceFunctionUtils.h b/Core/Multilayer/InterferenceFunctionUtils.h index 54f4d66337f654e1fe95a07fa14fbe42cbcd92d6..d9a5dcfe4d2a7b499abc56abf797ce308fe66ddc 100644 --- a/Core/Multilayer/InterferenceFunctionUtils.h +++ b/Core/Multilayer/InterferenceFunctionUtils.h @@ -16,7 +16,6 @@ #define INTERFERENCEFUNCTIONUTILS_H #include "Complex.h" -#include "SafePointerVector.h" #include <Eigen/StdVector> #include <vector> @@ -29,10 +28,10 @@ using matrixFFVector_t = std::vector<Eigen::Matrix2cd, Eigen::aligned_allocator< std::vector<complex_t> PrecomputeScalarFormFactors( const SimulationElement& sim_element, - const SafePointerVector<FormFactorCoherentSum>& ff_wrappers); + const std::vector<FormFactorCoherentSum>& ff_wrappers); matrixFFVector_t PrecomputePolarizedFormFactors( const SimulationElement& sim_element, - const SafePointerVector<FormFactorCoherentSum>& ff_wrappers); + const std::vector<FormFactorCoherentSum>& ff_wrappers); } // namespace InterferenceFunctionUtils diff --git a/Core/Multilayer/SSCAHelper.cpp b/Core/Multilayer/SSCAHelper.cpp index 7dd9d8b38403c7f2e992752c2f9308c00abdc9ff..59d6dede3ff39f2a726b47beaa18d83ab80dfd2d 100644 --- a/Core/Multilayer/SSCAHelper.cpp +++ b/Core/Multilayer/SSCAHelper.cpp @@ -17,36 +17,32 @@ #include "FormFactorCoherentSum.h" #include "InterferenceFunctionRadialParaCrystal.h" +SSCAHelper::SSCAHelper(double kappa) : m_kappa(kappa), m_mean_radius{} {} -SSCAHelper::SSCAHelper(double kappa) - : m_kappa(kappa) - , m_mean_radius {} -{} - -void SSCAHelper::init(const SafePointerVector<FormFactorCoherentSum>& ff_wrappers) +void SSCAHelper::init(const std::vector<FormFactorCoherentSum>& ff_wrappers) { m_mean_radius = 0.0; - for (const auto ffw: ff_wrappers) - m_mean_radius += ffw->relativeAbundance() * ffw->radialExtension(); + for (auto& ffw : ff_wrappers) + m_mean_radius += ffw.relativeAbundance() * ffw.radialExtension(); } -complex_t SSCAHelper::getCharacteristicSizeCoupling(double qp, - const SafePointerVector<FormFactorCoherentSum>& ff_wrappers) const +complex_t SSCAHelper::getCharacteristicSizeCoupling( + double qp, const std::vector<FormFactorCoherentSum>& ff_wrappers) const { - complex_t result {}; - for (auto ffw : ff_wrappers) - { - double radial_extension = ffw->radialExtension(); - result += ffw->relativeAbundance()*calculatePositionOffsetPhase(2.0*qp, radial_extension); + complex_t result{}; + for (auto& ffw : ff_wrappers) { + double radial_extension = ffw.radialExtension(); + result += + ffw.relativeAbundance() * calculatePositionOffsetPhase(2.0 * qp, radial_extension); } return result; } -complex_t SSCAHelper::getCharacteristicDistribution( - double qp, const IInterferenceFunction* p_iff) const +complex_t SSCAHelper::getCharacteristicDistribution(double qp, + const IInterferenceFunction* p_iff) const { - const InterferenceFunctionRadialParaCrystal *p_iff_radial - = dynamic_cast<const InterferenceFunctionRadialParaCrystal*>(p_iff); + const InterferenceFunctionRadialParaCrystal* p_iff_radial = + dynamic_cast<const InterferenceFunctionRadialParaCrystal*>(p_iff); if (!p_iff_radial) throw Exceptions::ClassInitializationException("Wrong interference function for SSCA"); return p_iff_radial->FTPDF(qp); @@ -57,15 +53,15 @@ complex_t SSCAHelper::calculatePositionOffsetPhase(double qp, double radial_exte return exp_I(m_kappa * qp * (radial_extension - m_mean_radius)); } -complex_t SSCAHelper::getMeanFormfactorNorm( - double qp, const std::vector<complex_t>& precomputed_ff, - const SafePointerVector<FormFactorCoherentSum>& ff_wrappers) const +complex_t +SSCAHelper::getMeanFormfactorNorm(double qp, const std::vector<complex_t>& precomputed_ff, + const std::vector<FormFactorCoherentSum>& ff_wrappers) const { - complex_t ff_orig=0., ff_conj=0.; // original and conjugated mean formfactor + complex_t ff_orig = 0., ff_conj = 0.; // original and conjugated mean formfactor for (size_t i = 0; i < ff_wrappers.size(); ++i) { - double radial_extension = ff_wrappers[i]->radialExtension(); - complex_t prefac = ff_wrappers[i]->relativeAbundance() - * calculatePositionOffsetPhase(qp, radial_extension); + double radial_extension = ff_wrappers[i].radialExtension(); + complex_t prefac = + ff_wrappers[i].relativeAbundance() * calculatePositionOffsetPhase(qp, radial_extension); ff_orig += prefac * precomputed_ff[i]; ff_conj += prefac * std::conj(precomputed_ff[i]); } @@ -73,16 +69,16 @@ complex_t SSCAHelper::getMeanFormfactorNorm( } void SSCAHelper::getMeanFormfactors( - double qp, Eigen::Matrix2cd& ff_orig, Eigen::Matrix2cd& ff_conj, - const InterferenceFunctionUtils::matrixFFVector_t& precomputed_ff, - const SafePointerVector<FormFactorCoherentSum>& ff_wrappers) const + double qp, Eigen::Matrix2cd& ff_orig, Eigen::Matrix2cd& ff_conj, + const InterferenceFunctionUtils::matrixFFVector_t& precomputed_ff, + const std::vector<FormFactorCoherentSum>& ff_wrappers) const { - ff_orig=Eigen::Matrix2cd::Zero(); - ff_conj=Eigen::Matrix2cd::Zero(); + ff_orig = Eigen::Matrix2cd::Zero(); + ff_conj = Eigen::Matrix2cd::Zero(); for (size_t i = 0; i < ff_wrappers.size(); ++i) { - double radial_extension = ff_wrappers[i]->radialExtension(); - complex_t prefac = ff_wrappers[i]->relativeAbundance() - * calculatePositionOffsetPhase(qp, radial_extension); + double radial_extension = ff_wrappers[i].radialExtension(); + complex_t prefac = + ff_wrappers[i].relativeAbundance() * calculatePositionOffsetPhase(qp, radial_extension); ff_orig += prefac * precomputed_ff[i]; ff_conj += prefac * precomputed_ff[i].adjoint(); } diff --git a/Core/Multilayer/SSCAHelper.h b/Core/Multilayer/SSCAHelper.h index 2328193afb6dfd751b8ad731bdc28686d333d0cb..69729544340837877fad462127023b7ba16d7b0a 100644 --- a/Core/Multilayer/SSCAHelper.h +++ b/Core/Multilayer/SSCAHelper.h @@ -18,7 +18,6 @@ #include "Complex.h" #include "IInterferenceFunctionStrategy.h" #include "InterferenceFunctionUtils.h" -#include "SafePointerVector.h" #include <Eigen/StdVector> class FormFactorCoherentSum; @@ -33,17 +32,17 @@ class SSCAHelper public: SSCAHelper(double kappa); - void init(const SafePointerVector<FormFactorCoherentSum>& ff_wrappers); + void init(const std::vector<FormFactorCoherentSum>& ff_wrappers); complex_t getCharacteristicSizeCoupling(double qp, - const SafePointerVector<FormFactorCoherentSum>& ff_wrappers) const; + const std::vector<FormFactorCoherentSum>& ff_wrappers) const; complex_t getCharacteristicDistribution(double qp, const IInterferenceFunction* p_iff) const; complex_t calculatePositionOffsetPhase(double qp, double radial_extension) const; complex_t getMeanFormfactorNorm(double qp, const std::vector<complex_t>& precomputed_ff, - const SafePointerVector<FormFactorCoherentSum>& ff_wrappers) const; + const std::vector<FormFactorCoherentSum>& ff_wrappers) const; void getMeanFormfactors(double qp, Eigen::Matrix2cd& ff_orig, Eigen::Matrix2cd& ff_conj, const InterferenceFunctionUtils::matrixFFVector_t& precomputed_ff, - const SafePointerVector<FormFactorCoherentSum>& ff_wrappers) const; + const std::vector<FormFactorCoherentSum>& ff_wrappers) const; private: double m_kappa; diff --git a/Core/Multilayer/SSCApproximationStrategy.cpp b/Core/Multilayer/SSCApproximationStrategy.cpp index 6df6bb542e82cf0b2141866e276e0b0f34c93595..2a50c08c21bf23e6d99e25ca22506d2c790e8e68 100644 --- a/Core/Multilayer/SSCApproximationStrategy.cpp +++ b/Core/Multilayer/SSCApproximationStrategy.cpp @@ -42,7 +42,7 @@ double SSCApproximationStrategy::scalarCalculation(const SimulationElement& sim_ auto precomputed_ff = PrecomputeScalarFormFactors(sim_element, m_formfactor_wrappers); for (size_t i = 0; i < m_formfactor_wrappers.size(); ++i) { complex_t ff = precomputed_ff[i]; - double fraction = m_formfactor_wrappers[i]->relativeAbundance(); + double fraction = m_formfactor_wrappers[i].relativeAbundance(); diffuse_intensity += fraction * std::norm(ff); } complex_t mean_ff_norm = m_helper.getMeanFormfactorNorm(qp, precomputed_ff, @@ -63,7 +63,7 @@ double SSCApproximationStrategy::polarizedCalculation(const SimulationElement& s const auto& polarization_handler = sim_element.polarizationHandler(); for (size_t i = 0; i < m_formfactor_wrappers.size(); ++i) { Eigen::Matrix2cd ff = precomputed_ff[i]; - double fraction = m_formfactor_wrappers[i]->relativeAbundance(); + double fraction = m_formfactor_wrappers[i].relativeAbundance(); diffuse_matrix += fraction * (ff * polarization_handler.getPolarization() * ff.adjoint()); } Eigen::Matrix2cd mff_orig, mff_conj; // original and conjugated mean formfactor