diff --git a/Base/Pixel/IPixel.h b/Base/Pixel/IPixel.h index 614b9ef03e885705709794e8cadf50493d366725..94ad46176f0506123e789d2c29440fba7305c1f0 100644 --- a/Base/Pixel/IPixel.h +++ b/Base/Pixel/IPixel.h @@ -3,7 +3,7 @@ // BornAgain: simulate and fit scattering at grazing incidence // //! @file Base/Pixel/IPixel.h -//! @brief Defines pure virtual interface IPixel (has no cpp file) +//! @brief Defines and implements pure virtual interface IPixel. //! //! @homepage http://www.bornagainproject.org //! @license GNU General Public License v3 or higher (see COPYING) @@ -18,6 +18,7 @@ #include "Base/Vector/Vectors3D.h" //! Interface for a function that maps [0,1]x[0,1] to the kvectors in a pixel. +//! Pure virtual base class for SphericalPixel and RectangularPixel. //! @ingroup detector class IPixel diff --git a/Base/Pixel/SimulationElement.cpp b/Base/Pixel/SimulationElement.cpp index 25d31821ee4202d15fa6393ff36201a3e0165df3..630dc6878e3928811613d667cfd5bd9b62e222be 100644 --- a/Base/Pixel/SimulationElement.cpp +++ b/Base/Pixel/SimulationElement.cpp @@ -13,50 +13,40 @@ // ************************************************************************** // #include "Base/Pixel/SimulationElement.h" +#include "Base/Pixel/IPixel.h" SimulationElement::SimulationElement(double wavelength, double alpha_i, double phi_i, - std::unique_ptr<IPixel> pixel) - : m_wavelength(wavelength), m_alpha_i(alpha_i), m_phi_i(phi_i), - m_k_i(vecOfLambdaAlphaPhi(m_wavelength, m_alpha_i, m_phi_i)), - m_mean_kf(pixel->getK(0.5, 0.5, m_wavelength)), m_intensity(0.0), mP_pixel(std::move(pixel)), - m_is_specular(false) + std::unique_ptr<IPixel> pixel, + const Eigen::Matrix2cd& beam_polarization, + const Eigen::Matrix2cd& analyzer, bool isSpecular_) + : m_polarization(beam_polarization, analyzer), m_wavelength(wavelength), m_alpha_i(alpha_i), + m_phi_i(phi_i), m_k_i(vecOfLambdaAlphaPhi(m_wavelength, m_alpha_i, m_phi_i)), + m_mean_kf(pixel->getK(0.5, 0.5, m_wavelength)), m_pixel(std::move(pixel)), + m_is_specular(isSpecular_), m_intensity(0.0) { } SimulationElement::SimulationElement(const SimulationElement& other) : m_polarization(other.m_polarization), m_wavelength(other.m_wavelength), m_alpha_i(other.m_alpha_i), m_phi_i(other.m_phi_i), m_k_i(other.m_k_i), - m_mean_kf(other.m_mean_kf), m_intensity(other.m_intensity), m_is_specular(other.isSpecular()) + m_mean_kf(other.m_mean_kf), m_pixel(std::move(other.m_pixel->clone())), + m_is_specular(other.m_is_specular), m_intensity(other.m_intensity) { - mP_pixel.reset(other.mP_pixel->clone()); } -SimulationElement::SimulationElement(const SimulationElement& other, double x, double y) - : m_polarization(other.m_polarization), m_wavelength(other.m_wavelength), - m_alpha_i(other.m_alpha_i), m_phi_i(other.m_phi_i), m_k_i(other.m_k_i), - m_mean_kf(other.m_mean_kf), m_intensity(other.m_intensity), m_is_specular(other.isSpecular()) -{ - mP_pixel.reset(other.mP_pixel->createZeroSizePixel(x, y)); - m_mean_kf = mP_pixel->getK(0.5, 0.5, m_wavelength); -} - -SimulationElement::SimulationElement(SimulationElement&& other) noexcept - : m_polarization(std::move(other.m_polarization)), m_wavelength(other.m_wavelength), - m_alpha_i(other.m_alpha_i), m_phi_i(other.m_phi_i), m_k_i(std::move(other.m_k_i)), - m_mean_kf(other.m_mean_kf), m_intensity(other.m_intensity), - mP_pixel(std::move(other.mP_pixel)), m_is_specular(other.isSpecular()) -{ -} +SimulationElement::SimulationElement(SimulationElement&&) = default; -SimulationElement::~SimulationElement() = default; // here because of forward declared members +SimulationElement::~SimulationElement() = default; -SimulationElement& SimulationElement::operator=(const SimulationElement& other) +SimulationElement SimulationElement::pointElement(double x, double y) const { - if (this != &other) { - SimulationElement tmp(other); - tmp.swapContent(*this); - } - return *this; + return {m_wavelength, + m_alpha_i, + m_phi_i, + std::unique_ptr<IPixel>(m_pixel->createZeroSizePixel(x, y)), // TODO simplify + m_polarization.getPolarization(), + m_polarization.getAnalyzerOperator(), + m_is_specular}; } kvector_t SimulationElement::getKi() const @@ -73,7 +63,7 @@ kvector_t SimulationElement::getMeanKf() const //! In-pixel coordinates take values from 0 to 1. kvector_t SimulationElement::getKf(double x, double y) const { - return mP_pixel->getK(x, y, m_wavelength); + return m_pixel->getK(x, y, m_wavelength); } kvector_t SimulationElement::getMeanQ() const @@ -85,20 +75,7 @@ kvector_t SimulationElement::getMeanQ() const //! In-pixel coordinates take values from 0 to 1. kvector_t SimulationElement::getQ(double x, double y) const { - return getKi() - mP_pixel->getK(x, y, m_wavelength); -} - -void SimulationElement::swapContent(SimulationElement& other) -{ - m_polarization.swapContent(other.m_polarization); - std::swap(m_wavelength, other.m_wavelength); - std::swap(m_alpha_i, other.m_alpha_i); - std::swap(m_phi_i, other.m_phi_i); - std::swap(m_k_i, other.m_k_i); - std::swap(m_mean_kf, other.m_mean_kf); - std::swap(m_intensity, other.m_intensity); - std::swap(mP_pixel, other.mP_pixel); - std::swap(m_is_specular, other.m_is_specular); + return getKi() - m_pixel->getK(x, y, m_wavelength); } double SimulationElement::getAlpha(double x, double y) const @@ -113,10 +90,10 @@ double SimulationElement::getPhi(double x, double y) const double SimulationElement::getIntegrationFactor(double x, double y) const { - return mP_pixel->getIntegrationFactor(x, y); + return m_pixel->getIntegrationFactor(x, y); } double SimulationElement::getSolidAngle() const { - return mP_pixel->getSolidAngle(); + return m_pixel->getSolidAngle(); } diff --git a/Base/Pixel/SimulationElement.h b/Base/Pixel/SimulationElement.h index 26b2cbff2dec2f379a0fed4eee2557a362966791..d063c2ffafd40b6b539c240f82fc6a5a188c9a02 100644 --- a/Base/Pixel/SimulationElement.h +++ b/Base/Pixel/SimulationElement.h @@ -15,9 +15,9 @@ #ifndef BORNAGAIN_CORE_PIXEL_SIMULATIONELEMENT_H #define BORNAGAIN_CORE_PIXEL_SIMULATIONELEMENT_H -#include "Base/Pixel/IPixel.h" #include "Base/Pixel/PolarizationHandler.h" #include "Base/Types/Complex.h" +#include "Base/Vector/Vectors3D.h" #include <memory> class IPixel; @@ -28,30 +28,17 @@ class IPixel; class SimulationElement { public: + SimulationElement() = delete; SimulationElement(double wavelength, double alpha_i, double phi_i, - std::unique_ptr<IPixel> pixel); + std::unique_ptr<IPixel> pixel, const Eigen::Matrix2cd& beam_polarization, + const Eigen::Matrix2cd& analyzer, bool isSpecular_); SimulationElement(const SimulationElement& other); - SimulationElement& operator=(const SimulationElement& other); - - //! Construct SimulationElement from other element and restrict k_f to specific value in - //! the original detector pixel - SimulationElement(const SimulationElement& other, double x, double y); - - SimulationElement(SimulationElement&& other) noexcept; - + SimulationElement(SimulationElement&& other); + SimulationElement& operator=(const SimulationElement&) = delete; ~SimulationElement(); - //! Sets the polarization density matrix (in spin basis along z-axis) - void setPolarization(const Eigen::Matrix2cd& polarization) - { - m_polarization.setPolarization(polarization); - } - - //! Sets the polarization analyzer operator (in spin basis along z-axis) - void setAnalyzerOperator(const Eigen::Matrix2cd& polarization_operator) - { - m_polarization.setAnalyzerOperator(polarization_operator); - } + //! Returns copy of this SimulationElement with k_f given by in-pixel coordinate x,y. + SimulationElement pointElement(double x, double y) const; //! Returns assigned PolarizationHandler const PolarizationHandler& polarizationHandler() const { return m_polarization; } @@ -76,24 +63,21 @@ public: double getAlpha(double x, double y) const; double getPhi(double x, double y) const; - //! Set specularity indication on/off. - void setSpecular(bool is_specular) { m_is_specular = is_specular; } - //! Tells if simulation element corresponds to a specular peak bool isSpecular() const { return m_is_specular; } private: - void swapContent(SimulationElement& other); - kvector_t getKf(double x, double y) const; - PolarizationHandler m_polarization; - double m_wavelength, m_alpha_i, m_phi_i; //!< wavelength and angles of beam - kvector_t m_k_i; //!< cached value of k_i - kvector_t m_mean_kf; //!< cached value of mean_kf - double m_intensity; //!< simulated intensity for detector cell - std::unique_ptr<IPixel> mP_pixel; - bool m_is_specular; + const PolarizationHandler m_polarization; + const double m_wavelength; //!< wavelength of beam + const double m_alpha_i; //!< incident grazing angle + const double m_phi_i; //!< incident angle in xy plane + const kvector_t m_k_i; //!< cached value of k_i + const kvector_t m_mean_kf; //!< cached value of mean_kf + mutable std::unique_ptr<IPixel> m_pixel; + const bool m_is_specular; + double m_intensity; //!< simulated intensity for detector cell }; #endif // BORNAGAIN_CORE_PIXEL_SIMULATIONELEMENT_H diff --git a/Base/Utils/Assert.h b/Base/Utils/Assert.h index 3a28667e87fdd92b0a8e3539114e5854a7c78fc8..6ccd4fccc3646b19612c65ffb410808030c06161 100644 --- a/Base/Utils/Assert.h +++ b/Base/Utils/Assert.h @@ -20,12 +20,14 @@ // For an alternative implementation that calls qFatal, see Base/Utils/Assert.h < 29oct20. -#include <stdexcept> #include <sstream> +#include <stdexcept> -#define ASSERT(condition) if (!(condition)) { \ - std::stringstream msg; \ - msg << "Assertion " << (#condition) << " failed in " << __FILE__ << ", line " << __LINE__; \ - throw std::runtime_error(msg.str()); } +#define ASSERT(condition) \ + if (!(condition)) { \ + std::stringstream msg; \ + msg << "Assertion " << (#condition) << " failed in " << __FILE__ << ", line " << __LINE__; \ + throw std::runtime_error(msg.str()); \ + } #endif // BORNAGAIN_BASE_UTILS_ASSERT_H diff --git a/Base/Utils/IntegratorMCMiser.h b/Base/Utils/IntegratorMCMiser.h index 06f3dddccc09f83faf234d1f1cd25dc00400d3fe..33aaf1fb6ac2ce02bf40150633b9cdf7f8363f1f 100644 --- a/Base/Utils/IntegratorMCMiser.h +++ b/Base/Utils/IntegratorMCMiser.h @@ -56,7 +56,7 @@ private: auto mf = static_cast<miser_integrand<T>>(p_cb->m_member_function); return (p_cb->m_object_pointer->*mf)(d_array, dim, p_cb->m_data); } - const T* mp_object; + const T* m_object; miser_integrand<T> m_member_function; size_t m_dim; //!< dimension of the integration gsl_monte_miser_state* m_gsl_workspace; @@ -84,8 +84,7 @@ P_integrator_miser<T> make_integrator_miser(const T* object, miser_integrand<T> template <class T> IntegratorMCMiser<T>::IntegratorMCMiser(const T* p_object, miser_integrand<T> p_member_function, size_t dim) - : mp_object(p_object), m_member_function(p_member_function), - m_dim(dim), m_gsl_workspace{nullptr} + : m_object(p_object), m_member_function(p_member_function), m_dim(dim), m_gsl_workspace{nullptr} { m_gsl_workspace = gsl_monte_miser_alloc(m_dim); @@ -105,7 +104,7 @@ template <class T> double IntegratorMCMiser<T>::integrate(double* min_array, double* max_array, void* params, size_t nbr_points) { - CallBackHolder cb = {mp_object, m_member_function, params}; + CallBackHolder cb = {m_object, m_member_function, params}; gsl_monte_function f; f.f = StaticCallBack; diff --git a/Base/Vector/Vectors3D.h b/Base/Vector/Vectors3D.h index 85030143fe073542f09e6e054909becb5f8ecb67..c09b5268eeb9e39a2e7179288bf0d48ae0a53856 100644 --- a/Base/Vector/Vectors3D.h +++ b/Base/Vector/Vectors3D.h @@ -3,7 +3,7 @@ // BornAgain: simulate and fit scattering at grazing incidence // //! @file Base/Vector/Vectors3D.h -//! @brief Defines basic vectors in R^3 and C^3. +//! @brief Defines basic vectors in Z^3, R^3, C^3. //! //! @homepage http://www.bornagainproject.org //! @license GNU General Public License v3 or higher (see COPYING) diff --git a/Core/Computation/DWBAComputation.cpp b/Core/Computation/DWBAComputation.cpp index 5a5208188c8d482427191cbd6e427f1ead91f1fa..36d257e3038b61921dd64ab6f40c86525a2322e9 100644 --- a/Core/Computation/DWBAComputation.cpp +++ b/Core/Computation/DWBAComputation.cpp @@ -34,16 +34,16 @@ DWBAComputation::DWBAComputation(const MultiLayer& multilayer, const SimulationO std::vector<SimulationElement>::iterator end_it) : IComputation(multilayer, options, progress), m_begin_it(begin_it), m_end_it(end_it) { - auto p_fresnel_map = mP_processed_sample->fresnelMap(); - bool polarized = mP_processed_sample->containsMagneticMaterial(); - for (const auto& layout : mP_processed_sample->layouts()) { + auto p_fresnel_map = m_processed_sample->fresnelMap(); + bool polarized = m_processed_sample->containsMagneticMaterial(); + for (const auto& layout : m_processed_sample->layouts()) { m_single_computation.addLayoutComputation( new ParticleLayoutComputation(&layout, m_sim_options, polarized)); } // scattering from rough surfaces in DWBA - if (mP_processed_sample->hasRoughness()) + if (m_processed_sample->hasRoughness()) m_single_computation.setRoughnessComputation( - new RoughMultiLayerComputation(mP_processed_sample.get())); + new RoughMultiLayerComputation(m_processed_sample.get())); if (m_sim_options.includeSpecular()) m_single_computation.setSpecularBinComputation(new GISASSpecularComputation(p_fresnel_map)); } @@ -57,11 +57,11 @@ DWBAComputation::~DWBAComputation() = default; // This allows them to be added and normalized together to the beam afterwards void DWBAComputation::runProtected() { - if (!mp_progress->alive()) + if (!m_progress->alive()) return; - m_single_computation.setProgressHandler(mp_progress); + m_single_computation.setProgressHandler(m_progress); for (auto it = m_begin_it; it != m_end_it; ++it) { - if (!mp_progress->alive()) + if (!m_progress->alive()) break; m_single_computation.compute(*it); } diff --git a/Core/Computation/DWBASingleComputation.cpp b/Core/Computation/DWBASingleComputation.cpp index a6d3b2c177dcdae2abb2bf0c8318a25bc70d3bbe..c164087acb68e2b4c96d342e5d68697871dc1921 100644 --- a/Core/Computation/DWBASingleComputation.cpp +++ b/Core/Computation/DWBASingleComputation.cpp @@ -26,7 +26,7 @@ DWBASingleComputation::DWBASingleComputation(DWBASingleComputation&&) = default; void DWBASingleComputation::setProgressHandler(ProgressHandler* p_progress) { - mP_progress_counter = std::make_unique<DelayedProgressCounter>(p_progress, 100); + m_progress_counter = std::make_unique<DelayedProgressCounter>(p_progress, 100); } void DWBASingleComputation::addLayoutComputation(ParticleLayoutComputation* p_layout_comp) @@ -37,12 +37,12 @@ void DWBASingleComputation::addLayoutComputation(ParticleLayoutComputation* p_la void DWBASingleComputation::setRoughnessComputation(RoughMultiLayerComputation* p_roughness_comp) { - mP_roughness_comp.reset(p_roughness_comp); + m_roughness_comp.reset(p_roughness_comp); } void DWBASingleComputation::setSpecularBinComputation(GISASSpecularComputation* p_spec_comp) { - mP_spec_comp.reset(p_spec_comp); + m_spec_comp.reset(p_spec_comp); } void DWBASingleComputation::compute(SimulationElement& elem) const @@ -50,14 +50,14 @@ void DWBASingleComputation::compute(SimulationElement& elem) const for (auto& layout_comp : m_layout_comps) { layout_comp->compute(elem); } - if (mP_roughness_comp) { // also check absence of matrix RT coefficients - mP_roughness_comp->compute(elem); + if (m_roughness_comp) { // also check absence of matrix RT coefficients + m_roughness_comp->compute(elem); } - if (mP_spec_comp) { // also check absence of matrix RT coefficients - mP_spec_comp->compute(elem); + if (m_spec_comp) { // also check absence of matrix RT coefficients + m_spec_comp->compute(elem); } - if (mP_progress_counter) { - mP_progress_counter->stepProgress(); + if (m_progress_counter) { + m_progress_counter->stepProgress(); } } diff --git a/Core/Computation/DWBASingleComputation.h b/Core/Computation/DWBASingleComputation.h index 5c03bba3996d8e9cc1cd6fa5b97f82289709392d..dc00b0ffbce62534a0189b4716277832c1937545 100644 --- a/Core/Computation/DWBASingleComputation.h +++ b/Core/Computation/DWBASingleComputation.h @@ -53,9 +53,9 @@ public: private: std::vector<std::unique_ptr<ParticleLayoutComputation>> m_layout_comps; - std::unique_ptr<RoughMultiLayerComputation> mP_roughness_comp; - std::unique_ptr<GISASSpecularComputation> mP_spec_comp; - std::unique_ptr<DelayedProgressCounter> mP_progress_counter; + std::unique_ptr<RoughMultiLayerComputation> m_roughness_comp; + std::unique_ptr<GISASSpecularComputation> m_spec_comp; + std::unique_ptr<DelayedProgressCounter> m_progress_counter; std::map<size_t, std::vector<HomogeneousRegion>> m_region_map; }; diff --git a/Core/Computation/DelayedProgressCounter.cpp b/Core/Computation/DelayedProgressCounter.cpp index f738af660698ba838d70c7340fc5e476a49630c0..6946615c747431356f65037e2ac15232daf2b041 100644 --- a/Core/Computation/DelayedProgressCounter.cpp +++ b/Core/Computation/DelayedProgressCounter.cpp @@ -16,7 +16,7 @@ #include "Core/Computation/ProgressHandler.h" DelayedProgressCounter::DelayedProgressCounter(ProgressHandler* p_progress, size_t interval) - : mp_progress(p_progress), m_interval(interval), m_count(0) + : m_progress(p_progress), m_interval(interval), m_count(0) { } @@ -24,7 +24,7 @@ void DelayedProgressCounter::stepProgress() { ++m_count; if (m_count == m_interval) { - mp_progress->incrementDone(m_interval); + m_progress->incrementDone(m_interval); m_count = 0; } } diff --git a/Core/Computation/DelayedProgressCounter.h b/Core/Computation/DelayedProgressCounter.h index 0a06a6a028e942e46c3ecc1113ee7433b7c78f0a..c45e33fc0958c63a38bcc744f997ecb7fb0661a8 100644 --- a/Core/Computation/DelayedProgressCounter.h +++ b/Core/Computation/DelayedProgressCounter.h @@ -31,7 +31,7 @@ public: void stepProgress(); private: - ProgressHandler* mp_progress; + ProgressHandler* m_progress; const size_t m_interval; size_t m_count; }; diff --git a/Core/Computation/DepthProbeComputation.cpp b/Core/Computation/DepthProbeComputation.cpp index ccdfb64b1ea87ec562d734fe8a19f9c7e57a4db2..27a4a3f6e72df463fb6e0454d14812e80dadfbc5 100644 --- a/Core/Computation/DepthProbeComputation.cpp +++ b/Core/Computation/DepthProbeComputation.cpp @@ -28,7 +28,7 @@ DepthProbeComputation::DepthProbeComputation(const MultiLayer& multilayer, DepthProbeElementIter begin_it, DepthProbeElementIter end_it) : IComputation(multilayer, options, progress), m_begin_it(begin_it), m_end_it(end_it), - m_computation_term(mP_processed_sample.get()) + m_computation_term(m_processed_sample.get()) { } @@ -36,9 +36,9 @@ DepthProbeComputation::~DepthProbeComputation() = default; void DepthProbeComputation::runProtected() { - if (!mp_progress->alive()) + if (!m_progress->alive()) return; - m_computation_term.setProgressHandler(mp_progress); + m_computation_term.setProgressHandler(m_progress); for (auto it = m_begin_it; it != m_end_it; ++it) { m_computation_term.compute(*it); } diff --git a/Core/Computation/DepthProbeComputationTerm.cpp b/Core/Computation/DepthProbeComputationTerm.cpp index 792e78de69ca68df789519dec68d4daea1c9ebf8..9e28c7d066f57443e7201564b77d17820d23131c 100644 --- a/Core/Computation/DepthProbeComputationTerm.cpp +++ b/Core/Computation/DepthProbeComputationTerm.cpp @@ -21,7 +21,7 @@ #include "Sample/RT/ILayerRTCoefficients.h" DepthProbeComputationTerm::DepthProbeComputationTerm(const ProcessedSample* p_sample) - : mp_sample{p_sample} + : m_sample{p_sample} { } @@ -29,7 +29,7 @@ DepthProbeComputationTerm::~DepthProbeComputationTerm() = default; void DepthProbeComputationTerm::setProgressHandler(ProgressHandler* p_progress) { - mP_progress_counter = std::make_unique<DelayedProgressCounter>(p_progress, 100); + m_progress_counter = std::make_unique<DelayedProgressCounter>(p_progress, 100); } void DepthProbeComputationTerm::compute(DepthProbeElement& elem) const @@ -37,18 +37,18 @@ void DepthProbeComputationTerm::compute(DepthProbeElement& elem) const if (elem.isCalculated()) { const IAxis& z_positions = *elem.getZPositions(); const size_t n_z = z_positions.size(); - const size_t n_layers = mp_sample->numberOfSlices(); + const size_t n_layers = m_sample->numberOfSlices(); size_t start_z_ind = n_z; std::valarray<double> intensities(0.0, n_z); double z_layer_bottom(0.0); double z_layer_top(0.0); for (size_t i_layer = 0; i_layer < n_layers && start_z_ind != 0; ++i_layer) { - z_layer_bottom = mp_sample->sliceBottomZ(i_layer); - z_layer_top = mp_sample->sliceTopZ(i_layer); + z_layer_bottom = m_sample->sliceBottomZ(i_layer); + z_layer_top = m_sample->sliceTopZ(i_layer); // get R & T coefficients for current layer - const auto p_coefficients = mp_sample->fresnelMap()->getInCoefficients(elem, i_layer); + const auto p_coefficients = m_sample->fresnelMap()->getInCoefficients(elem, i_layer); const complex_t R = p_coefficients->getScalarR(); const complex_t T = p_coefficients->getScalarT(); const complex_t kz_out = p_coefficients->getScalarKz(); @@ -68,7 +68,7 @@ void DepthProbeComputationTerm::compute(DepthProbeElement& elem) const } elem.setIntensities(std::move(intensities)); } - if (mP_progress_counter) { - mP_progress_counter->stepProgress(); + if (m_progress_counter) { + m_progress_counter->stepProgress(); } } diff --git a/Core/Computation/DepthProbeComputationTerm.h b/Core/Computation/DepthProbeComputationTerm.h index acf6dd738a808a1529141d33b29fce3a9737510e..a99518c2d59e9b45760718b51670f5a9580e935a 100644 --- a/Core/Computation/DepthProbeComputationTerm.h +++ b/Core/Computation/DepthProbeComputationTerm.h @@ -33,8 +33,8 @@ public: void compute(DepthProbeElement& elem) const; private: - const ProcessedSample* mp_sample; - std::unique_ptr<DelayedProgressCounter> mP_progress_counter; + const ProcessedSample* m_sample; + std::unique_ptr<DelayedProgressCounter> m_progress_counter; }; #endif // BORNAGAIN_CORE_COMPUTATION_DEPTHPROBECOMPUTATIONTERM_H diff --git a/Core/Computation/GISASSpecularComputation.cpp b/Core/Computation/GISASSpecularComputation.cpp index 7fd23a2d7d79710108a8b57587b6ca4ad1cb3a0e..fb54c3bb481f992864de145e14e9661fc7a612a1 100644 --- a/Core/Computation/GISASSpecularComputation.cpp +++ b/Core/Computation/GISASSpecularComputation.cpp @@ -18,7 +18,7 @@ #include "Sample/RT/ILayerRTCoefficients.h" GISASSpecularComputation::GISASSpecularComputation(const IFresnelMap* p_fresnel_map) - : mp_fresnel_map{p_fresnel_map} + : m_fresnel_map{p_fresnel_map} { } @@ -26,7 +26,7 @@ void GISASSpecularComputation::compute(SimulationElement& elem) const { if (!elem.isSpecular()) return; - complex_t R = mp_fresnel_map->getInCoefficients(elem, 0)->getScalarR(); + complex_t R = m_fresnel_map->getInCoefficients(elem, 0)->getScalarR(); double sin_alpha_i = std::abs(std::sin(elem.getAlphaI())); if (sin_alpha_i == 0.0) sin_alpha_i = 1.0; diff --git a/Core/Computation/GISASSpecularComputation.h b/Core/Computation/GISASSpecularComputation.h index eb7e8a6450cbcc43d750708307bcaf06316f708d..40e5830d616577626e83cc2aafd17343873952cf 100644 --- a/Core/Computation/GISASSpecularComputation.h +++ b/Core/Computation/GISASSpecularComputation.h @@ -29,7 +29,7 @@ public: void compute(SimulationElement& elem) const; private: - const IFresnelMap* mp_fresnel_map; + const IFresnelMap* m_fresnel_map; }; #endif // BORNAGAIN_CORE_COMPUTATION_GISASSPECULARCOMPUTATION_H diff --git a/Core/Computation/IComputation.cpp b/Core/Computation/IComputation.cpp index 4464d0e51a5c24b2524e1cbb8cef53c8b61b77d2..f04364d92b56eb7a4986668c513e24be730d7e59 100644 --- a/Core/Computation/IComputation.cpp +++ b/Core/Computation/IComputation.cpp @@ -20,8 +20,8 @@ IComputation::IComputation(const MultiLayer& sample, const SimulationOptions& options, ProgressHandler& progress) - : m_sim_options(options), mp_progress(&progress), - mP_processed_sample(std::make_unique<ProcessedSample>(sample, options)) + : m_sim_options(options), m_progress(&progress), + m_processed_sample(std::make_unique<ProcessedSample>(sample, options)) { } diff --git a/Core/Computation/IComputation.h b/Core/Computation/IComputation.h index 0cef8bba27afaf4e82882bf9bb4dc99c92f4436c..d1b93abae5374df85f68ecc1fe0c35124d0a86a2 100644 --- a/Core/Computation/IComputation.h +++ b/Core/Computation/IComputation.h @@ -45,9 +45,9 @@ public: protected: SimulationOptions m_sim_options; - ProgressHandler* mp_progress; + ProgressHandler* m_progress; ComputationStatus m_status; - std::unique_ptr<ProcessedSample> mP_processed_sample; + std::unique_ptr<ProcessedSample> m_processed_sample; private: virtual void runProtected() = 0; diff --git a/Core/Computation/LayoutStrategyBuilder.cpp b/Core/Computation/LayoutStrategyBuilder.cpp index 243bbeae968667179e824456319407b57f3705dc..aed5f7f0b411ad35ae2ae4b714b554d9008b0c7c 100644 --- a/Core/Computation/LayoutStrategyBuilder.cpp +++ b/Core/Computation/LayoutStrategyBuilder.cpp @@ -21,7 +21,7 @@ LayoutStrategyBuilder::LayoutStrategyBuilder(const ProcessedLayout* p_layout, const SimulationOptions& sim_params, bool polarized) - : mp_layout(p_layout), m_sim_params(sim_params), m_polarized(polarized) + : m_layout(p_layout), m_sim_params(sim_params), m_polarized(polarized) { createStrategy(); } @@ -31,25 +31,25 @@ LayoutStrategyBuilder::~LayoutStrategyBuilder() = default; IInterferenceFunctionStrategy* LayoutStrategyBuilder::releaseStrategy() { - return mP_strategy.release(); + return m_strategy.release(); } //! Returns a new strategy object that is able to calculate the scattering for fixed k_f. void LayoutStrategyBuilder::createStrategy() { - const IInterferenceFunction* p_iff = mp_layout->interferenceFunction(); - if (p_iff && mp_layout->numberOfSlices() > 1 && !p_iff->supportsMultilayer()) + const IInterferenceFunction* p_iff = m_layout->interferenceFunction(); + if (p_iff && m_layout->numberOfSlices() > 1 && !p_iff->supportsMultilayer()) throw std::runtime_error("LayoutStrategyBuilder::checkInterferenceFunction: " "interference function does not support multiple layers"); auto p_radial_para = dynamic_cast<const InterferenceFunctionRadialParaCrystal*>(p_iff); if (p_radial_para && p_radial_para->kappa() > 0.0) { double kappa = p_radial_para->kappa(); - mP_strategy = std::make_unique<SSCApproximationStrategy>(m_sim_params, kappa, m_polarized); + m_strategy = std::make_unique<SSCApproximationStrategy>(m_sim_params, kappa, m_polarized); } else { - mP_strategy = std::make_unique<DecouplingApproximationStrategy>(m_sim_params, m_polarized); + m_strategy = std::make_unique<DecouplingApproximationStrategy>(m_sim_params, m_polarized); } - if (!mP_strategy) + if (!m_strategy) throw Exceptions::ClassInitializationException("Could not create appropriate strategy"); - mP_strategy->init(mp_layout->formFactorList(), p_iff); + m_strategy->init(m_layout->formFactorList(), p_iff); } diff --git a/Core/Computation/LayoutStrategyBuilder.h b/Core/Computation/LayoutStrategyBuilder.h index aa75464bfc550f89eb46d97036d6069d6be97e29..d8534628886c599813d812cce68508f56e7479b5 100644 --- a/Core/Computation/LayoutStrategyBuilder.h +++ b/Core/Computation/LayoutStrategyBuilder.h @@ -38,10 +38,10 @@ public: private: void createStrategy(); - const ProcessedLayout* mp_layout; + const ProcessedLayout* m_layout; SimulationOptions m_sim_params; bool m_polarized; //!< polarized computation required? - std::unique_ptr<IInterferenceFunctionStrategy> mP_strategy; + std::unique_ptr<IInterferenceFunctionStrategy> m_strategy; }; #endif // BORNAGAIN_CORE_COMPUTATION_LAYOUTSTRATEGYBUILDER_H diff --git a/Core/Computation/ParticleLayoutComputation.cpp b/Core/Computation/ParticleLayoutComputation.cpp index 53185caf4dcbb0a06e75c7d9d85915ba840cf865..4df104ffc713c4ffbc2e7205f68f7ef76c08a3eb 100644 --- a/Core/Computation/ParticleLayoutComputation.cpp +++ b/Core/Computation/ParticleLayoutComputation.cpp @@ -21,10 +21,10 @@ ParticleLayoutComputation::ParticleLayoutComputation(const ProcessedLayout* p_layout, const SimulationOptions& options, bool polarized) - : mp_layout(p_layout) + : m_layout(p_layout) { LayoutStrategyBuilder builder(p_layout, options, polarized); - mP_strategy.reset(builder.releaseStrategy()); + m_strategy.reset(builder.releaseStrategy()); m_region_map = p_layout->regionMap(); m_surface_density = p_layout->surfaceDensity(); } @@ -34,11 +34,11 @@ ParticleLayoutComputation::~ParticleLayoutComputation() = default; void ParticleLayoutComputation::compute(SimulationElement& elem) const { double alpha_f = elem.getAlphaMean(); - size_t n_layers = mp_layout->numberOfSlices(); + size_t n_layers = m_layout->numberOfSlices(); if (n_layers > 1 && alpha_f < 0) { return; // zero for transmission with multilayers (n>1) } else { - elem.addIntensity(mP_strategy->evaluate(elem) * m_surface_density); + elem.addIntensity(m_strategy->evaluate(elem) * m_surface_density); } } diff --git a/Core/Computation/ParticleLayoutComputation.h b/Core/Computation/ParticleLayoutComputation.h index b7e6ba1851fd4b8db83e94b84e0f8862223d9349..3380b36c7371f2de0773d86446aff1e73591878d 100644 --- a/Core/Computation/ParticleLayoutComputation.h +++ b/Core/Computation/ParticleLayoutComputation.h @@ -42,8 +42,8 @@ public: void mergeRegionMap(std::map<size_t, std::vector<HomogeneousRegion>>& region_map) const; private: - const ProcessedLayout* mp_layout; - std::unique_ptr<const IInterferenceFunctionStrategy> mP_strategy; + const ProcessedLayout* m_layout; + std::unique_ptr<const IInterferenceFunctionStrategy> m_strategy; double m_surface_density; std::map<size_t, std::vector<HomogeneousRegion>> m_region_map; }; diff --git a/Core/Computation/ProcessedLayout.cpp b/Core/Computation/ProcessedLayout.cpp index e0839a2a2146a80b426dff473aeb6f265ef022a6..1a8947691810df66176382414c69c3298070ae63 100644 --- a/Core/Computation/ProcessedLayout.cpp +++ b/Core/Computation/ProcessedLayout.cpp @@ -30,22 +30,22 @@ void ScaleRegionMap(std::map<size_t, std::vector<HomogeneousRegion>>& region_map ProcessedLayout::ProcessedLayout(const ILayout& layout, const std::vector<Slice>& slices, double z_ref, const IFresnelMap* p_fresnel_map, bool polarized) - : mp_fresnel_map(p_fresnel_map), m_polarized(polarized) + : m_fresnel_map(p_fresnel_map), m_polarized(polarized) { m_n_slices = slices.size(); collectFormFactors(layout, slices, z_ref); if (auto p_iff = layout.interferenceFunction()) - mP_iff.reset(p_iff->clone()); + m_iff.reset(p_iff->clone()); } ProcessedLayout::ProcessedLayout(ProcessedLayout&& other) { - mp_fresnel_map = other.mp_fresnel_map; + m_fresnel_map = other.m_fresnel_map; m_polarized = other.m_polarized; m_n_slices = other.m_n_slices; m_surface_density = other.m_surface_density; m_formfactors = std::move(other.m_formfactors); - mP_iff = std::move(other.mP_iff); + m_iff = std::move(other.m_iff); m_region_map = std::move(other.m_region_map); } @@ -66,7 +66,7 @@ const std::vector<FormFactorCoherentSum>& ProcessedLayout::formFactorList() cons const IInterferenceFunction* ProcessedLayout::interferenceFunction() const { - return mP_iff.get(); + return m_iff.get(); } std::map<size_t, std::vector<HomogeneousRegion>> ProcessedLayout::regionMap() const @@ -121,7 +121,7 @@ FormFactorCoherentSum ProcessedLayout::ProcessParticle(const IParticle& particle P_ff_framework->setAmbientMaterial(slice_material); auto part = FormFactorCoherentPart(P_ff_framework.release()); - part.setSpecularInfo(mp_fresnel_map, slice_index); + part.setSpecularInfo(m_fresnel_map, slice_index); result.addCoherentPart(part); } diff --git a/Core/Computation/ProcessedLayout.h b/Core/Computation/ProcessedLayout.h index a74094cba7c70aaeeef84db06458f98487999fb8..e4071c55998140a38e6783ff4e90b92bced09081 100644 --- a/Core/Computation/ProcessedLayout.h +++ b/Core/Computation/ProcessedLayout.h @@ -53,12 +53,12 @@ private: 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; + const IFresnelMap* m_fresnel_map; bool m_polarized; size_t m_n_slices; double m_surface_density; std::vector<FormFactorCoherentSum> m_formfactors; - std::unique_ptr<IInterferenceFunction> mP_iff; + std::unique_ptr<IInterferenceFunction> m_iff; std::map<size_t, std::vector<HomogeneousRegion>> m_region_map; }; diff --git a/Core/Computation/ProcessedSample.cpp b/Core/Computation/ProcessedSample.cpp index dbd20ffc3e618af52a87ac0cd19b5ca9bf6bbf5b..a88a32891b0b92d9b85dfdb6166cf88e38d8f3d9 100644 --- a/Core/Computation/ProcessedSample.cpp +++ b/Core/Computation/ProcessedSample.cpp @@ -42,7 +42,7 @@ ProcessedSample::ProcessedSample(const MultiLayer& sample, const SimulationOptio m_ext_field{sample.externalField()} { initSlices(sample, options); - mP_fresnel_map = CreateFresnelMap(sample, m_slices, options); + m_fresnel_map = CreateFresnelMap(sample, m_slices, options); initBFields(); initLayouts(sample); initFresnelMap(options); @@ -62,7 +62,7 @@ const std::vector<Slice>& ProcessedSample::slices() const const std::vector<Slice>& ProcessedSample::averageSlices() const { - return mP_fresnel_map->slices(); + return m_fresnel_map->slices(); } const std::vector<ProcessedLayout>& ProcessedSample::layouts() const @@ -72,7 +72,7 @@ const std::vector<ProcessedLayout>& ProcessedSample::layouts() const const IFresnelMap* ProcessedSample::fresnelMap() const { - return mP_fresnel_map.get(); + return m_fresnel_map.get(); } double ProcessedSample::crossCorrelationLength() const @@ -214,7 +214,7 @@ void ProcessedSample::initLayouts(const MultiLayer& sample) z_ref -= MultiLayerUtils::LayerThickness(sample, i - 1); auto p_layer = sample.layer(i); for (auto p_layout : p_layer->layouts()) { - m_layouts.emplace_back(*p_layout, m_slices, z_ref, mP_fresnel_map.get(), m_polarized); + m_layouts.emplace_back(*p_layout, m_slices, z_ref, m_fresnel_map.get(), m_polarized); mergeRegionMap(m_layouts.back().regionMap()); } } @@ -269,9 +269,9 @@ void ProcessedSample::mergeRegionMap( void ProcessedSample::initFresnelMap(const SimulationOptions& sim_options) { if (sim_options.useAvgMaterials()) { - mP_fresnel_map->setSlices(CreateAverageMaterialSlices(m_slices, m_region_map)); + m_fresnel_map->setSlices(CreateAverageMaterialSlices(m_slices, m_region_map)); } else { - mP_fresnel_map->setSlices(m_slices); + m_fresnel_map->setSlices(m_slices); } } diff --git a/Core/Computation/ProcessedSample.h b/Core/Computation/ProcessedSample.h index 09cfa045685ac020a92184a7df569d041dfdbe60..a52dbf183a79b0bb84c6c14dcaffdd0ead541fe0 100644 --- a/Core/Computation/ProcessedSample.h +++ b/Core/Computation/ProcessedSample.h @@ -67,7 +67,7 @@ private: void initBFields(); void mergeRegionMap(const std::map<size_t, std::vector<HomogeneousRegion>>& region_map); void initFresnelMap(const SimulationOptions& sim_options); - std::unique_ptr<IFresnelMap> mP_fresnel_map; + std::unique_ptr<IFresnelMap> m_fresnel_map; std::vector<Slice> m_slices; double m_top_z; bool m_polarized; diff --git a/Core/Computation/RoughMultiLayerComputation.cpp b/Core/Computation/RoughMultiLayerComputation.cpp index 0922ddf058bdd76e0c566b87aff2032b599ad840..46df387a997035103e7c2a98b104dda47f9977d6 100644 --- a/Core/Computation/RoughMultiLayerComputation.cpp +++ b/Core/Computation/RoughMultiLayerComputation.cpp @@ -41,7 +41,7 @@ complex_t h_min(complex_t z) } // namespace RoughMultiLayerComputation::RoughMultiLayerComputation(const ProcessedSample* p_sample) - : mp_sample{p_sample} + : m_sample{p_sample} { } @@ -49,7 +49,7 @@ void RoughMultiLayerComputation::compute(SimulationElement& elem) const { if (elem.getAlphaMean() < 0.0) return; - auto n_slices = mp_sample->numberOfSlices(); + auto n_slices = m_sample->numberOfSlices(); kvector_t q = elem.getMeanQ(); double wavelength = elem.getWavelength(); double autocorr(0.0); @@ -63,17 +63,17 @@ void RoughMultiLayerComputation::compute(SimulationElement& elem) const sterm[i] = get_sum8terms(i, elem); } for (size_t i = 0; i + 1 < n_slices; i++) { - const LayerRoughness* rough = mp_sample->bottomRoughness(i); + const LayerRoughness* rough = m_sample->bottomRoughness(i); if (rough) autocorr += std::norm(rterm[i]) * std::norm(sterm[i]) * rough->getSpectralFun(q); } // cross correlation between layers - if (mp_sample->crossCorrelationLength() != 0.0) { + if (m_sample->crossCorrelationLength() != 0.0) { for (size_t j = 0; j < n_slices - 1; j++) { for (size_t k = 0; k < n_slices - 1; k++) { if (j == k) continue; - crosscorr += rterm[j] * sterm[j] * mp_sample->crossCorrSpectralFun(q, j, k) + crosscorr += rterm[j] * sterm[j] * m_sample->crossCorrSpectralFun(q, j, k) * std::conj(rterm[k]) * std::conj(sterm[k]); } } @@ -84,7 +84,7 @@ void RoughMultiLayerComputation::compute(SimulationElement& elem) const complex_t RoughMultiLayerComputation::get_refractive_term(size_t ilayer, double wavelength) const { - auto& slices = mp_sample->slices(); + auto& slices = m_sample->slices(); return slices[ilayer].material().refractiveIndex2(wavelength) - slices[ilayer + 1].material().refractiveIndex2(wavelength); } @@ -92,8 +92,8 @@ complex_t RoughMultiLayerComputation::get_refractive_term(size_t ilayer, double complex_t RoughMultiLayerComputation::get_sum8terms(size_t ilayer, const SimulationElement& sim_element) const { - auto& slices = mp_sample->slices(); - auto p_fresnel_map = mp_sample->fresnelMap(); + auto& slices = m_sample->slices(); + auto p_fresnel_map = m_sample->fresnelMap(); const auto P_in_plus = p_fresnel_map->getInCoefficients(sim_element, ilayer); const auto P_out_plus = p_fresnel_map->getOutCoefficients(sim_element, ilayer); @@ -120,7 +120,7 @@ complex_t RoughMultiLayerComputation::get_sum8terms(size_t ilayer, complex_t qz4_minus = -qz1_minus; double sigma(0.0); - if (const LayerRoughness* roughness = mp_sample->bottomRoughness(ilayer)) + if (const LayerRoughness* roughness = m_sample->bottomRoughness(ilayer)) sigma = roughness->getSigma(); complex_t term1 = T_in_plus * T_out_plus * h_plus(qz1_plus * sigma); complex_t term2 = T_in_plus * R_out_plus * h_plus(qz2_plus * sigma); diff --git a/Core/Computation/RoughMultiLayerComputation.h b/Core/Computation/RoughMultiLayerComputation.h index 22034bcf973c3c4c21b46803329b121127e4f84b..6e5185a19c7e617e6b5d8bf24fcdbdf4e6d48e45 100644 --- a/Core/Computation/RoughMultiLayerComputation.h +++ b/Core/Computation/RoughMultiLayerComputation.h @@ -32,7 +32,7 @@ public: void compute(SimulationElement& elem) const; private: - const ProcessedSample* mp_sample; + const ProcessedSample* m_sample; complex_t get_refractive_term(size_t ilayer, double wavelength) const; complex_t get_sum8terms(size_t ilayer, const SimulationElement& sim_element) const; }; diff --git a/Core/Computation/SpecularComputation.cpp b/Core/Computation/SpecularComputation.cpp index f87e831d749add92bd58646f133d0b45aa191ec7..e618d639823ebe9a0457796a4d2a32f11cab3844 100644 --- a/Core/Computation/SpecularComputation.cpp +++ b/Core/Computation/SpecularComputation.cpp @@ -17,7 +17,7 @@ #include "Core/Computation/ProgressHandler.h" #include "Core/Computation/SpecularComputationTerm.h" #include "Core/Computation/SpecularStrategyBuilder.h" -#include "Sample/Slice/SpecularSimulationElement.h" +#include "Core/Scan/SpecularSimulationElement.h" static_assert(std::is_copy_constructible<SpecularComputation>::value == false, "SpecularComputation should not be copy constructible"); @@ -30,8 +30,8 @@ SpecularComputation::SpecularComputation(const MultiLayer& multilayer, SpecularElementIter end_it) : IComputation(multilayer, options, progress), m_begin_it(begin_it), m_end_it(end_it) { - if (mP_processed_sample->containsMagneticMaterial() - || mP_processed_sample->externalField() != kvector_t{}) + if (m_processed_sample->containsMagneticMaterial() + || m_processed_sample->externalField() != kvector_t{}) m_computation_term.reset( new SpecularMatrixTerm(SpecularStrategyBuilder::build(multilayer, true))); else @@ -43,11 +43,11 @@ SpecularComputation::~SpecularComputation() = default; void SpecularComputation::runProtected() { - if (!mp_progress->alive()) + if (!m_progress->alive()) return; - m_computation_term->setProgressHandler(mp_progress); - auto& slices = mP_processed_sample->averageSlices(); + m_computation_term->setProgressHandler(m_progress); + auto& slices = m_processed_sample->averageSlices(); for (auto it = m_begin_it; it != m_end_it; ++it) m_computation_term->computeIntensity(*it, slices); } diff --git a/Core/Computation/SpecularComputation.h b/Core/Computation/SpecularComputation.h index ffadf252cec3ff4398b35abc11a2384e979662e4..9812c882f9b04c0f88ac839e6c2ec50b07a7e8df 100644 --- a/Core/Computation/SpecularComputation.h +++ b/Core/Computation/SpecularComputation.h @@ -41,8 +41,8 @@ private: void runProtected() override; //! these iterators define the span of detector bins this simulation will work on - SpecularElementIter m_begin_it, m_end_it; - std::unique_ptr<SpecularComputationTerm> m_computation_term; + const SpecularElementIter m_begin_it, m_end_it; + mutable std::unique_ptr<SpecularComputationTerm> m_computation_term; }; #endif // BORNAGAIN_CORE_COMPUTATION_SPECULARCOMPUTATION_H diff --git a/Core/Computation/SpecularComputationTerm.cpp b/Core/Computation/SpecularComputationTerm.cpp index 9f31a54ad76a7cb794e615af481bec4bd9ad627d..a6bb6ead90bdc3be76d1c9b92ef426a15b31ccca 100644 --- a/Core/Computation/SpecularComputationTerm.cpp +++ b/Core/Computation/SpecularComputationTerm.cpp @@ -15,7 +15,7 @@ #include "Core/Computation/SpecularComputationTerm.h" #include "Core/Computation/DelayedProgressCounter.h" #include "Sample/RT/ILayerRTCoefficients.h" -#include "Sample/Slice/SpecularSimulationElement.h" +#include "Core/Scan/SpecularSimulationElement.h" // ************************************************************************** // // class SpecularComputationTerm @@ -33,7 +33,7 @@ SpecularComputationTerm::~SpecularComputationTerm() = default; void SpecularComputationTerm::setProgressHandler(ProgressHandler* p_progress) { - mP_progress_counter = std::make_unique<DelayedProgressCounter>(p_progress, 100); + m_progress_counter = std::make_unique<DelayedProgressCounter>(p_progress, 100); } void SpecularComputationTerm::computeIntensity(SpecularSimulationElement& elem, @@ -44,8 +44,8 @@ void SpecularComputationTerm::computeIntensity(SpecularSimulationElement& elem, eval(elem, slices); - if (mP_progress_counter) - mP_progress_counter->stepProgress(); + if (m_progress_counter) + m_progress_counter->stepProgress(); } // ************************************************************************** // diff --git a/Core/Computation/SpecularComputationTerm.h b/Core/Computation/SpecularComputationTerm.h index d102a188c2a19596fc0619ea48894b55ab3dae77..04f125ac261cb8926646d078e7c26d996e3fabbb 100644 --- a/Core/Computation/SpecularComputationTerm.h +++ b/Core/Computation/SpecularComputationTerm.h @@ -50,7 +50,7 @@ protected: std::unique_ptr<ISpecularStrategy> m_Strategy; private: - std::unique_ptr<DelayedProgressCounter> mP_progress_counter; + std::unique_ptr<DelayedProgressCounter> m_progress_counter; }; //! Computes the specular scattering for a scalar sample diff --git a/Core/Export/SimulationToPython.cpp b/Core/Export/SimulationToPython.cpp index f7f84d998d94212a2e04b25553fbcfcf38b7bece..a12c0de7bc1af033a33c86efb2e9c973ea513be6 100644 --- a/Core/Export/SimulationToPython.cpp +++ b/Core/Export/SimulationToPython.cpp @@ -19,6 +19,7 @@ #include "Core/Computation/PoissonNoiseBackground.h" #include "Core/Export/INodeUtils.h" #include "Core/Export/SampleToPython.h" +#include "Core/Scan/ISpecularScan.h" #include "Core/Simulation/GISASSimulation.h" #include "Core/Simulation/OffSpecSimulation.h" #include "Core/Simulation/SpecularSimulation.h" @@ -30,7 +31,6 @@ #include "Device/Instrument/PyFmt2.h" #include "Device/Resolution/ConvolutionDetectorResolution.h" #include "Device/Resolution/ResolutionFunction2DGaussian.h" -#include "Core/Scan/ISpecularScan.h" #include "Param/Varia/ParameterUtils.h" #include "Param/Varia/PyFmtLimits.h" #include <iomanip> diff --git a/Core/Scan/AngularSpecScan.cpp b/Core/Scan/AngularSpecScan.cpp index 0b34e2b93c3e4b93ecbc64702340111c0ce406c0..c89d8566509ecd4957bcc6ec76b850b499aa5069 100644 --- a/Core/Scan/AngularSpecScan.cpp +++ b/Core/Scan/AngularSpecScan.cpp @@ -19,7 +19,7 @@ #include "Device/Beam/IFootprintFactor.h" #include "Device/Resolution/ScanResolution.h" #include "Param/Distrib/RangedDistributions.h" -#include "Sample/Slice/SpecularSimulationElement.h" +#include "Core/Scan/SpecularSimulationElement.h" namespace { @@ -44,8 +44,7 @@ extractValues(std::vector<std::vector<ParameterSample>> samples, } // namespace AngularSpecScan::AngularSpecScan(double wl, std::vector<double> inc_angle) - : m_wl(wl), - m_inc_angle(std::make_unique<PointwiseAxis>("inc_angles", std::move(inc_angle))), + : m_wl(wl), m_inc_angle(std::make_unique<PointwiseAxis>("inc_angles", std::move(inc_angle))), m_wl_resolution(ScanResolution::scanEmptyResolution()), m_inc_resolution(ScanResolution::scanEmptyResolution()) { @@ -80,7 +79,8 @@ AngularSpecScan* AngularSpecScan::clone() const AngularSpecScan::~AngularSpecScan() = default; -std::vector<SpecularSimulationElement> AngularSpecScan::generateSimulationElements() const +std::vector<SpecularSimulationElement> +AngularSpecScan::generateSimulationElements(const Instrument& instrument) const { const auto wls = extractValues(applyWlResolution(), [](const ParameterSample& sample) { return sample.value; }); @@ -94,8 +94,8 @@ std::vector<SpecularSimulationElement> AngularSpecScan::generateSimulationElemen const double inc = incs[i][k]; for (size_t j = 0, size_wls = wls[i].size(); j < size_wls; ++j) { const double wl = wls[i][j]; - result.emplace_back( - SpecularSimulationElement(wl, -inc, wl >= 0 && inc >= 0 && inc <= M_PI_2)); + result.emplace_back(SpecularSimulationElement( + wl, -inc, instrument, wl >= 0 && inc >= 0 && inc <= M_PI_2)); } } } diff --git a/Core/Scan/AngularSpecScan.h b/Core/Scan/AngularSpecScan.h index 9933f308f4eaff5bcc14e9c5e1449a7ee0cbf36a..5ccb3e12b140a160095c64f216cbc3d4aea9f26f 100644 --- a/Core/Scan/AngularSpecScan.h +++ b/Core/Scan/AngularSpecScan.h @@ -40,7 +40,8 @@ public: #ifndef SWIG //! Generates simulation elements for specular simulations - std::vector<SpecularSimulationElement> generateSimulationElements() const override; + std::vector<SpecularSimulationElement> + generateSimulationElements(const Instrument& instrument) const override; //! Returns coordinate axis assigned to the data holder virtual const IAxis* coordinateAxis() const override { return m_inc_angle.get(); } @@ -115,8 +116,8 @@ private: DistrOutput applyWlResolution() const; DistrOutput applyIncResolution() const; - double m_wl; - std::unique_ptr<IAxis> m_inc_angle; + const double m_wl; + const std::unique_ptr<IAxis> m_inc_angle; std::unique_ptr<IFootprintFactor> m_footprint; std::unique_ptr<ScanResolution> m_wl_resolution; diff --git a/Core/Scan/ISpecularScan.h b/Core/Scan/ISpecularScan.h index c68d3b7613b17ba78f5b088668be7ac2b9c90eef..9093d0b4da3fac8b91311ae9b73b0bc665a100f3 100644 --- a/Core/Scan/ISpecularScan.h +++ b/Core/Scan/ISpecularScan.h @@ -23,6 +23,7 @@ class IAxis; class IFootprintFactor; +class Instrument; class SpecularSimulationElement; //! Pure virtual base class for all types of specular scans. @@ -34,7 +35,8 @@ public: #ifndef SWIG //! Generates simulation elements for specular simulations - virtual std::vector<SpecularSimulationElement> generateSimulationElements() const = 0; + virtual std::vector<SpecularSimulationElement> + generateSimulationElements(const Instrument& instrument) const = 0; //! Returns coordinate axis assigned to the data holder virtual const IAxis* coordinateAxis() const = 0; diff --git a/Core/Scan/QSpecScan.cpp b/Core/Scan/QSpecScan.cpp index 11acfccfa6be825b42d13940fe6103098b1e1cd9..21656e7f4cf92e9615550f5ead49d5dddcc4c514 100644 --- a/Core/Scan/QSpecScan.cpp +++ b/Core/Scan/QSpecScan.cpp @@ -18,7 +18,7 @@ #include "Base/Utils/PyFmt.h" #include "Device/Resolution/ScanResolution.h" #include "Param/Distrib/RangedDistributions.h" -#include "Sample/Slice/SpecularSimulationElement.h" +#include "Core/Scan/SpecularSimulationElement.h" QSpecScan::QSpecScan(std::vector<double> qs_nm) : m_qs(std::make_unique<PointwiseAxis>("qs", std::move(qs_nm))), @@ -28,8 +28,7 @@ QSpecScan::QSpecScan(std::vector<double> qs_nm) } QSpecScan::QSpecScan(const IAxis& qs_nm) - : m_qs(qs_nm.clone()), - m_resolution(ScanResolution::scanEmptyResolution()) + : m_qs(qs_nm.clone()), m_resolution(ScanResolution::scanEmptyResolution()) { checkInitialization(); } @@ -51,14 +50,15 @@ QSpecScan* QSpecScan::clone() const } //! Generates simulation elements for specular simulations -std::vector<SpecularSimulationElement> QSpecScan::generateSimulationElements() const +std::vector<SpecularSimulationElement> +QSpecScan::generateSimulationElements(const Instrument& instrument) const { const std::vector<double> qz = generateQzVector(); std::vector<SpecularSimulationElement> result; result.reserve(qz.size()); for (size_t i = 0, size = qz.size(); i < size; ++i) - result.emplace_back(SpecularSimulationElement(-qz[i] / 2.0, qz[i] >= 0)); + result.emplace_back(SpecularSimulationElement(-qz[i] / 2.0, instrument, qz[i] >= 0)); return result; } diff --git a/Core/Scan/QSpecScan.h b/Core/Scan/QSpecScan.h index 7b09ac54e3c72b2b9b4b6cd6c3e4f0554770c210..768d33ec85b3e6fc219bc31625754d036c8ecb00 100644 --- a/Core/Scan/QSpecScan.h +++ b/Core/Scan/QSpecScan.h @@ -42,7 +42,8 @@ public: #ifndef SWIG //! Generates simulation elements for specular simulations - std::vector<SpecularSimulationElement> generateSimulationElements() const override; + std::vector<SpecularSimulationElement> + generateSimulationElements(const Instrument& instrument) const override; //! Returns coordinate axis assigned to the data holder virtual const IAxis* coordinateAxis() const override { return m_qs.get(); } @@ -88,7 +89,7 @@ private: std::vector<double> generateQzVector() const; std::vector<std::vector<ParameterSample>> applyQResolution() const; - std::unique_ptr<IAxis> m_qs; + const std::unique_ptr<IAxis> m_qs; std::unique_ptr<ScanResolution> m_resolution; mutable std::vector<std::vector<ParameterSample>> m_q_res_cache; }; diff --git a/Sample/Slice/SpecularSimulationElement.cpp b/Core/Scan/SpecularSimulationElement.cpp similarity index 64% rename from Sample/Slice/SpecularSimulationElement.cpp rename to Core/Scan/SpecularSimulationElement.cpp index 5868be2d9651795e864ec177eb0a5894ad21f2cb..a1de5e7f48f9e00c591ee752f9351900b8397031 100644 --- a/Sample/Slice/SpecularSimulationElement.cpp +++ b/Core/Scan/SpecularSimulationElement.cpp @@ -2,7 +2,7 @@ // // BornAgain: simulate and fit scattering at grazing incidence // -//! @file Sample/Slice/SpecularSimulationElement.cpp +//! @file Core/Scan/SpecularSimulationElement.cpp //! @brief Implements the class SpecularSimulationElement. //! //! @homepage http://www.bornagainproject.org @@ -12,11 +12,16 @@ // // ************************************************************************** // -#include "Sample/Slice/SpecularSimulationElement.h" +#include "Core/Scan/SpecularSimulationElement.h" +#include "Device/Detector/IDetector.h" +#include "Device/Instrument/Instrument.h" #include "Sample/Slice/KzComputation.h" -SpecularSimulationElement::SpecularSimulationElement(double kz, bool computable) - : m_intensity(0.0), m_computable(computable), +SpecularSimulationElement::SpecularSimulationElement(double kz, + const Instrument& instrument, bool computable) + : m_polarization(instrument.getBeam().getPolarization(), + instrument.detector().detectionProperties().analyzerOperator()), + m_intensity(0.0), m_computable(computable), m_kz_computation([kz](const std::vector<Slice>& slices) { return KzComputation::computeKzFromSLDs(slices, kz); }) @@ -24,8 +29,10 @@ SpecularSimulationElement::SpecularSimulationElement(double kz, bool computable) } SpecularSimulationElement::SpecularSimulationElement(double wavelength, double alpha, - bool computable) - : m_intensity(0.0), m_computable(computable), + const Instrument& instrument, bool computable) + : m_polarization(instrument.getBeam().getPolarization(), + instrument.detector().detectionProperties().analyzerOperator()), + m_intensity(0.0), m_computable(computable), m_kz_computation( [k = vecOfLambdaAlphaPhi(wavelength, alpha, 0.0)](const std::vector<Slice>& slices) { return KzComputation::computeKzFromRefIndices(slices, k); @@ -47,29 +54,7 @@ SpecularSimulationElement::SpecularSimulationElement(SpecularSimulationElement&& SpecularSimulationElement::~SpecularSimulationElement() = default; -SpecularSimulationElement& -SpecularSimulationElement::operator=(const SpecularSimulationElement& other) -{ - if (this != &other) { - SpecularSimulationElement tmp(other); - tmp.swapContent(*this); - } - return *this; -} - -void SpecularSimulationElement::setPolarizationHandler(const PolarizationHandler& handler) -{ - m_polarization = handler; -} - std::vector<complex_t> SpecularSimulationElement::produceKz(const std::vector<Slice>& slices) { return m_kz_computation(slices); } - -void SpecularSimulationElement::swapContent(SpecularSimulationElement& other) -{ - m_polarization.swapContent(other.m_polarization); - std::swap(m_intensity, other.m_intensity); - m_kz_computation.swap(other.m_kz_computation); -} diff --git a/Sample/Slice/SpecularSimulationElement.h b/Core/Scan/SpecularSimulationElement.h similarity index 79% rename from Sample/Slice/SpecularSimulationElement.h rename to Core/Scan/SpecularSimulationElement.h index c3c31758700f608b5d12841a6fac8cc62739e4af..88d06d5dc034695c6739513a701037a041b5d021 100644 --- a/Sample/Slice/SpecularSimulationElement.h +++ b/Core/Scan/SpecularSimulationElement.h @@ -2,7 +2,7 @@ // // BornAgain: simulate and fit scattering at grazing incidence // -//! @file Sample/Slice/SpecularSimulationElement.h +//! @file Core/Scan/SpecularSimulationElement.h //! @brief Declares the class SpecularSimulationElement. //! //! @homepage http://www.bornagainproject.org @@ -21,6 +21,7 @@ #include <memory> #include <vector> +class Instrument; class Slice; //! Data stucture containing both input and output of a single image pixel for specular simulation. @@ -29,18 +30,16 @@ class Slice; class SpecularSimulationElement { public: - SpecularSimulationElement(double kz, bool computable); - SpecularSimulationElement(double wavelength, double alpha, bool computable); + SpecularSimulationElement(double kz, const Instrument& instrument, bool computable); + SpecularSimulationElement(double wavelength, double alpha, const Instrument& instrument, + bool computable); SpecularSimulationElement(const SpecularSimulationElement& other); SpecularSimulationElement(SpecularSimulationElement&& other) noexcept; ~SpecularSimulationElement(); - SpecularSimulationElement& operator=(const SpecularSimulationElement& other); - - //! Assigns PolarizationHandler. - void setPolarizationHandler(const PolarizationHandler& handler); + SpecularSimulationElement& operator=(const SpecularSimulationElement& other) = delete; //! Returns assigned PolarizationHandler. const PolarizationHandler& polarizationHandler() const { return m_polarization; } @@ -55,12 +54,10 @@ public: std::vector<complex_t> produceKz(const std::vector<Slice>& slices); private: - void swapContent(SpecularSimulationElement& other); - - PolarizationHandler m_polarization; + const PolarizationHandler m_polarization; double m_intensity; //!< simulated intensity for detector cell const bool m_computable; - std::function<std::vector<complex_t>(const std::vector<Slice>&)> m_kz_computation; + const std::function<std::vector<complex_t>(const std::vector<Slice>&)> m_kz_computation; }; #endif // BORNAGAIN_CORE_MULTILAYER_SPECULARSIMULATIONELEMENT_H diff --git a/Core/Scan/UnitConverter1D.cpp b/Core/Scan/UnitConverter1D.cpp index 09569a64a53fd93036148c8503dec6b7a9f99920..0c36cc75718c512579a1b22399817deba43b08ea 100644 --- a/Core/Scan/UnitConverter1D.cpp +++ b/Core/Scan/UnitConverter1D.cpp @@ -16,10 +16,10 @@ #include "Base/Axis/PointwiseAxis.h" #include "Base/Const/MathConstants.h" #include "Base/Const/Units.h" -#include "Device/Beam/Beam.h" -#include "Device/Data/OutputData.h" #include "Core/Scan/AngularSpecScan.h" #include "Core/Scan/QSpecScan.h" +#include "Device/Beam/Beam.h" +#include "Device/Data/OutputData.h" #include "Device/Unit/AxisNames.h" namespace diff --git a/Core/Simulation/DepthProbeSimulation.cpp b/Core/Simulation/DepthProbeSimulation.cpp index d3f10b808158fd5b16f469b199c23fdf61fec0aa..ca9a9c1d7e9b07612c34af385b2c55f807ed9502 100644 --- a/Core/Simulation/DepthProbeSimulation.cpp +++ b/Core/Simulation/DepthProbeSimulation.cpp @@ -147,8 +147,7 @@ void DepthProbeSimulation::setBeamParameters(double lambda, const IAxis& alpha_a void DepthProbeSimulation::initSimulationElementVector() { - const auto& beam = instrument().getBeam(); - m_sim_elements = generateSimulationElements(beam); + m_sim_elements = generateSimulationElements(instrument().getBeam()); if (!m_cache.empty()) return; diff --git a/Core/Simulation/GISASSimulation.cpp b/Core/Simulation/GISASSimulation.cpp index a71f9be94b067c967e5e63e014b374cb7c676d86..b9a185fe6408c958f8ba891be36737de4d972f05 100644 --- a/Core/Simulation/GISASSimulation.cpp +++ b/Core/Simulation/GISASSimulation.cpp @@ -65,8 +65,7 @@ GISASSimulation::GISASSimulation(const GISASSimulation& other) : Simulation2D(ot void GISASSimulation::initSimulationElementVector() { - auto beam = instrument().getBeam(); - m_sim_elements = generateSimulationElements(beam); + m_sim_elements = generateSimulationElements(instrument().getBeam()); if (m_cache.empty()) m_cache.resize(m_sim_elements.size(), 0.0); } diff --git a/Core/Simulation/OffSpecSimulation.cpp b/Core/Simulation/OffSpecSimulation.cpp index 8ae936d202a54958ab68dca8f4890e343a637f20..c650fc6e58ddbe632de72c4377b338df94f27268 100644 --- a/Core/Simulation/OffSpecSimulation.cpp +++ b/Core/Simulation/OffSpecSimulation.cpp @@ -36,20 +36,20 @@ void OffSpecSimulation::prepareSimulation() size_t OffSpecSimulation::numberOfSimulationElements() const { checkInitialization(); - return Simulation2D::numberOfSimulationElements() * mP_alpha_i_axis->size(); + return Simulation2D::numberOfSimulationElements() * m_alpha_i_axis->size(); } SimulationResult OffSpecSimulation::result() const { auto data = std::unique_ptr<OutputData<double>>(m_intensity_map.clone()); OffSpecularConverter converter(instrument().detector2D(), instrument().getBeam(), - *mP_alpha_i_axis); + *m_alpha_i_axis); return SimulationResult(*data, converter); } void OffSpecSimulation::setBeamParameters(double wavelength, const IAxis& alpha_axis, double phi_i) { - mP_alpha_i_axis.reset(alpha_axis.clone()); + m_alpha_i_axis.reset(alpha_axis.clone()); if (alpha_axis.size() < 1) throw Exceptions::ClassInitializationException("OffSpecSimulation::prepareSimulation() " "-> Error. Incoming alpha range size < 1."); @@ -60,7 +60,7 @@ void OffSpecSimulation::setBeamParameters(double wavelength, const IAxis& alpha_ const IAxis* OffSpecSimulation::beamAxis() const { - return mP_alpha_i_axis.get(); + return m_alpha_i_axis.get(); } std::unique_ptr<IUnitConverter> OffSpecSimulation::createUnitConverter() const @@ -76,13 +76,13 @@ std::unique_ptr<IUnitConverter> OffSpecSimulation::createUnitConverter() const size_t OffSpecSimulation::intensityMapSize() const { checkInitialization(); - return mP_alpha_i_axis->size() * instrument().getDetectorAxis(1).size(); + return m_alpha_i_axis->size() * instrument().getDetectorAxis(1).size(); } OffSpecSimulation::OffSpecSimulation(const OffSpecSimulation& other) : Simulation2D(other) { - if (other.mP_alpha_i_axis) - mP_alpha_i_axis.reset(other.mP_alpha_i_axis->clone()); + if (other.m_alpha_i_axis) + m_alpha_i_axis.reset(other.m_alpha_i_axis->clone()); m_intensity_map.copyFrom(other.m_intensity_map); initialize(); } @@ -94,14 +94,14 @@ void OffSpecSimulation::initSimulationElementVector() const double wavelength = beam.getWavelength(); const double phi_i = beam.getPhi(); - for (size_t i = 0; i < mP_alpha_i_axis->size(); ++i) { + for (size_t i = 0; i < m_alpha_i_axis->size(); ++i) { // Incoming angle by convention defined as positive: - double alpha_i = mP_alpha_i_axis->getBin(i).getMidPoint(); + double alpha_i = m_alpha_i_axis->getBin(i).getMidPoint(); double total_alpha = alpha_i; beam.setCentralK(wavelength, total_alpha, phi_i); - auto sim_elements_i = generateSimulationElements(beam); - m_sim_elements.insert(m_sim_elements.end(), std::make_move_iterator(sim_elements_i.begin()), - std::make_move_iterator(sim_elements_i.end())); + std::vector<SimulationElement> sim_elements_i = generateSimulationElements(beam); + for (auto ele : sim_elements_i) + m_sim_elements.emplace_back(ele); } if (m_cache.empty()) m_cache.resize(m_sim_elements.size(), 0.0); @@ -131,15 +131,15 @@ void OffSpecSimulation::transferResultsToIntensityMap() throw Exceptions::RuntimeErrorException( "OffSpecSimulation::transferResultsToIntensityMap: " "intensity map size does not conform to number of calculated intensities"); - for (size_t i = 0; i < mP_alpha_i_axis->size(); ++i) + for (size_t i = 0; i < m_alpha_i_axis->size(); ++i) transferDetectorImage(i); } void OffSpecSimulation::updateIntensityMap() { m_intensity_map.clear(); - if (mP_alpha_i_axis) - m_intensity_map.addAxis(*mP_alpha_i_axis); + if (m_alpha_i_axis) + m_intensity_map.addAxis(*m_alpha_i_axis); size_t detector_dimension = instrument().getDetectorDimension(); if (detector_dimension == 2) m_intensity_map.addAxis(instrument().getDetectorAxis(1)); @@ -163,7 +163,7 @@ void OffSpecSimulation::transferDetectorImage(size_t index) void OffSpecSimulation::checkInitialization() const { - if (!mP_alpha_i_axis || mP_alpha_i_axis->size() < 1) + if (!m_alpha_i_axis || m_alpha_i_axis->size() < 1) throw Exceptions::ClassInitializationException("OffSpecSimulation::checkInitialization() " "Incoming alpha range not configured."); if (instrument().getDetectorDimension() != 2) diff --git a/Core/Simulation/OffSpecSimulation.h b/Core/Simulation/OffSpecSimulation.h index fda22bedebb64e60f7b305be197fce39e6faf973..9b11eaed2d3b1490eea24dd6af27243c9b61a16a 100644 --- a/Core/Simulation/OffSpecSimulation.h +++ b/Core/Simulation/OffSpecSimulation.h @@ -73,7 +73,7 @@ private: size_t numberOfSimulationElements() const final; //! Normalize, apply detector resolution and transfer detector image corresponding to - //! alpha_i = mp_alpha_i_axis->getBin(index) + //! alpha_i = m_alpha_i_axis->getBin(index) void transferDetectorImage(size_t index); //! Check correct number of axes @@ -81,7 +81,7 @@ private: void initialize(); - std::unique_ptr<IAxis> mP_alpha_i_axis; + std::unique_ptr<IAxis> m_alpha_i_axis; OutputData<double> m_intensity_map; }; diff --git a/Core/Simulation/Simulation2D.cpp b/Core/Simulation/Simulation2D.cpp index 854aa239da73596054ee7d5ad70951d73d700a58..7024aaa263f171ece76bad15aedd096d4e96cef8 100644 --- a/Core/Simulation/Simulation2D.cpp +++ b/Core/Simulation/Simulation2D.cpp @@ -100,11 +100,9 @@ std::vector<SimulationElement> Simulation2D::generateSimulationElements(const Be result.reserve(N); for (size_t element_index = 0; element_index < N; ++element_index) { SimulationElement element(wavelength, alpha_i, phi_i, - m_detector_context->createPixel(element_index)); - element.setPolarization(beam_polarization); - element.setAnalyzerOperator(analyzer_operator); - if (m_detector_context->detectorIndex(element_index) == spec_index) - element.setSpecular(true); + m_detector_context->createPixel(element_index), beam_polarization, + analyzer_operator, + m_detector_context->detectorIndex(element_index) == spec_index); result.emplace_back(std::move(element)); } return result; diff --git a/Core/Simulation/SpecularSimulation.cpp b/Core/Simulation/SpecularSimulation.cpp index 14e319511ee9b60eec5674f975d2c5faeff2e166..282aab9c1bfa81f2d6cd8c4dd39d29e0e021b3bc 100644 --- a/Core/Simulation/SpecularSimulation.cpp +++ b/Core/Simulation/SpecularSimulation.cpp @@ -16,15 +16,15 @@ #include "Base/Axis/PointwiseAxis.h" #include "Core/Computation/IBackground.h" #include "Core/Computation/SpecularComputation.h" +#include "Core/Scan/AngularSpecScan.h" +#include "Core/Scan/UnitConverter1D.h" #include "Device/Beam/IFootprintFactor.h" #include "Device/Detector/SpecularDetector1D.h" #include "Device/Histo/Histogram1D.h" -#include "Core/Scan/AngularSpecScan.h" -#include "Core/Scan/UnitConverter1D.h" #include "Param/Base/ParameterPool.h" #include "Param/Base/RealParameter.h" #include "Param/Distrib/Distributions.h" -#include "Sample/Slice/SpecularSimulationElement.h" +#include "Core/Scan/SpecularSimulationElement.h" namespace { @@ -47,22 +47,11 @@ std::unique_ptr<AngularSpecScan> mangledScan(const AngularSpecScan& scan, const std::vector<SpecularSimulationElement> generateSimulationElements(const Instrument& instrument, const ISpecularScan& scan) { - std::vector<SpecularSimulationElement> result; - - // TODO: remove if-else statement when pointwise resolution is implemented + // TODO: remove if statement when pointwise resolution is implemented if (const auto* aScan = dynamic_cast<const AngularSpecScan*>(&scan)) - result = mangledScan(*aScan, instrument.getBeam())->generateSimulationElements(); - else - result = scan.generateSimulationElements(); - - // add polarization and analyzer operators - const auto& polarization = instrument.getBeam().getPolarization(); - const auto& analyzer = instrument.detector().detectionProperties().analyzerOperator(); + return mangledScan(*aScan, instrument.getBeam())->generateSimulationElements(instrument); - for (auto& elem : result) - elem.setPolarizationHandler({polarization, analyzer}); - - return result; + return scan.generateSimulationElements(instrument); } } // namespace diff --git a/Core/Simulation/StandardSimulations.cpp b/Core/Simulation/StandardSimulations.cpp index 45c916a0505e107b4c678f74e9cab922ae5dbc5d..ab34fe6828842aca798f09c1c9e65455f05171e0 100644 --- a/Core/Simulation/StandardSimulations.cpp +++ b/Core/Simulation/StandardSimulations.cpp @@ -15,6 +15,8 @@ #include "Core/Simulation/StandardSimulations.h" #include "Base/Const/Units.h" #include "Core/Computation/ConstantBackground.h" +#include "Core/Scan/AngularSpecScan.h" +#include "Core/Scan/QSpecScan.h" #include "Core/Simulation/DepthProbeSimulation.h" #include "Core/Simulation/GISASSimulation.h" #include "Core/Simulation/OffSpecSimulation.h" @@ -29,8 +31,6 @@ #include "Device/Mask/Rectangle.h" #include "Device/Resolution/ResolutionFunction2DGaussian.h" #include "Device/Resolution/ScanResolution.h" -#include "Core/Scan/AngularSpecScan.h" -#include "Core/Scan/QSpecScan.h" #include "Param/Base/RealParameter.h" #include "Param/Distrib/Distributions.h" #include "Param/Distrib/RangedDistributions.h" diff --git a/Core/Simulation/UnitConverterUtils.cpp b/Core/Simulation/UnitConverterUtils.cpp index bad833a2f3dc3ebdabc4ce3cc39c38bad24619a5..d4f4b5bd87df416f6cfe17475a75394d3e3bd3d0 100644 --- a/Core/Simulation/UnitConverterUtils.cpp +++ b/Core/Simulation/UnitConverterUtils.cpp @@ -13,6 +13,7 @@ // ************************************************************************** // #include "Core/Simulation/UnitConverterUtils.h" +#include "Core/Scan/UnitConverter1D.h" #include "Core/Simulation/DepthProbeSimulation.h" #include "Core/Simulation/GISASSimulation.h" #include "Core/Simulation/OffSpecSimulation.h" @@ -20,7 +21,6 @@ #include "Device/Detector/RectangularDetector.h" #include "Device/Detector/SimpleUnitConverters.h" #include "Device/Detector/SphericalDetector.h" -#include "Core/Scan/UnitConverter1D.h" std::unique_ptr<OutputData<double>> UnitConverterUtils::createOutputData(const IUnitConverter& converter, Axes::Units units) diff --git a/Device/Data/OutputData.h b/Device/Data/OutputData.h index 6e8b86adc117f6def42b458c5591f39eac8978a8..905392c0ef5a657d1e4c83de6d1224ab833a0dff 100644 --- a/Device/Data/OutputData.h +++ b/Device/Data/OutputData.h @@ -61,8 +61,8 @@ public: //! Returns total size of data buffer (product of bin number in every dimension). size_t getAllocatedSize() const { - if (mp_ll_data) - return mp_ll_data->getTotalSize(); + if (m_ll_data) + return m_ll_data->getTotalSize(); return 0; } @@ -194,15 +194,15 @@ public: //! indexed accessor T& operator[](size_t index) { - ASSERT(mp_ll_data); - return (*mp_ll_data)[index]; + ASSERT(m_ll_data); + return (*m_ll_data)[index]; } //! indexed accessor (const) const T& operator[](size_t index) const { - ASSERT(mp_ll_data); - return (*mp_ll_data)[index]; + ASSERT(m_ll_data); + return (*m_ll_data)[index]; } // helpers @@ -232,14 +232,14 @@ private: bool axisNameExists(const std::string& axis_name) const; SafePointerVector<IAxis> m_value_axes; - LLData<T>* mp_ll_data; + LLData<T>* m_ll_data; }; // --------------------------------------------------------------------- // // Implementation // --------------------------------------------------------------------- // -template <class T> OutputData<T>::OutputData() : m_value_axes(), mp_ll_data(nullptr) +template <class T> OutputData<T>::OutputData() : m_value_axes(), m_ll_data(nullptr) { allocate(); } @@ -247,14 +247,14 @@ template <class T> OutputData<T>::OutputData() : m_value_axes(), mp_ll_data(null template <class T> OutputData<T>::~OutputData() { clear(); - delete mp_ll_data; + delete m_ll_data; } template <class T> OutputData<T>* OutputData<T>::clone() const { OutputData<T>* ret = new OutputData<T>(); ret->m_value_axes = m_value_axes; - (*ret->mp_ll_data) = *mp_ll_data; + (*ret->m_ll_data) = *m_ll_data; return ret; } @@ -262,10 +262,10 @@ template <class T> void OutputData<T>::copyFrom(const OutputData<T>& other) { clear(); m_value_axes = other.m_value_axes; - delete mp_ll_data; - mp_ll_data = 0; - if (other.mp_ll_data) - mp_ll_data = new LLData<T>(*other.mp_ll_data); + delete m_ll_data; + m_ll_data = 0; + if (other.m_ll_data) + m_ll_data = new LLData<T>(*other.m_ll_data); } template <class T> template <class U> void OutputData<T>::copyShapeFrom(const OutputData<U>& other) @@ -281,7 +281,7 @@ template <class T> OutputData<double>* OutputData<T>::meanValues() const auto* ret = new OutputData<double>(); ret->copyShapeFrom(*this); ret->allocate(); - for (size_t i = 0; i < mp_ll_data->getTotalSize(); ++i) + for (size_t i = 0; i < m_ll_data->getTotalSize(); ++i) (*ret)[i] = getValue(i); return ret; } @@ -323,10 +323,10 @@ template <class T> const IAxis& OutputData<T>::getAxis(const std::string& axis_n template <class T> inline std::vector<size_t> OutputData<T>::getAllSizes() const { - ASSERT(mp_ll_data); + ASSERT(m_ll_data); std::vector<size_t> result; for (size_t i = 0; i < getRank(); ++i) { - int dim = mp_ll_data->getDimensions()[i]; + int dim = m_ll_data->getDimensions()[i]; result.push_back(dim); } return result; @@ -334,10 +334,10 @@ template <class T> inline std::vector<size_t> OutputData<T>::getAllSizes() const template <class T> inline std::vector<T> OutputData<T>::getRawDataVector() const { - ASSERT(mp_ll_data); + ASSERT(m_ll_data); std::vector<T> result; for (size_t i = 0; i < getAllocatedSize(); ++i) - result.push_back((*mp_ll_data)[i]); + result.push_back((*m_ll_data)[i]); return result; } @@ -355,14 +355,14 @@ template <class T> typename OutputData<T>::const_iterator OutputData<T>::begin() template <class T> std::vector<int> OutputData<T>::getAxesBinIndices(size_t global_index) const { - ASSERT(mp_ll_data); + ASSERT(m_ll_data); size_t remainder = global_index; std::vector<int> result; - result.resize(mp_ll_data->getRank()); - for (size_t i = 0; i < mp_ll_data->getRank(); ++i) { - result[mp_ll_data->getRank() - 1 - i] = - (int)(remainder % m_value_axes[mp_ll_data->getRank() - 1 - i]->size()); - remainder /= m_value_axes[mp_ll_data->getRank() - 1 - i]->size(); + result.resize(m_ll_data->getRank()); + for (size_t i = 0; i < m_ll_data->getRank(); ++i) { + result[m_ll_data->getRank() - 1 - i] = + (int)(remainder % m_value_axes[m_ll_data->getRank() - 1 - i]->size()); + remainder /= m_value_axes[m_ll_data->getRank() - 1 - i]->size(); } return result; } @@ -370,10 +370,10 @@ template <class T> std::vector<int> OutputData<T>::getAxesBinIndices(size_t glob template <class T> size_t OutputData<T>::getAxisBinIndex(size_t global_index, size_t i_selected_axis) const { - ASSERT(mp_ll_data); + ASSERT(m_ll_data); size_t remainder(global_index); - for (size_t i = 0; i < mp_ll_data->getRank(); ++i) { - size_t i_axis = mp_ll_data->getRank() - 1 - i; + for (size_t i = 0; i < m_ll_data->getRank(); ++i) { + size_t i_axis = m_ll_data->getRank() - 1 - i; size_t result = remainder % m_value_axes[i_axis]->size(); if (i_selected_axis == i_axis) return result; @@ -392,14 +392,14 @@ size_t OutputData<T>::getAxisBinIndex(size_t global_index, const std::string& ax template <class T> size_t OutputData<T>::toGlobalIndex(const std::vector<unsigned>& axes_indices) const { - ASSERT(mp_ll_data); - if (axes_indices.size() != mp_ll_data->getRank()) + ASSERT(m_ll_data); + if (axes_indices.size() != m_ll_data->getRank()) throw Exceptions::LogicErrorException( "size_t OutputData<T>::toGlobalIndex() -> " "Error! Number of coordinates must match rank of data structure"); size_t result = 0; size_t step_size = 1; - for (size_t i = mp_ll_data->getRank(); i > 0; --i) { + for (size_t i = m_ll_data->getRank(); i > 0; --i) { if (axes_indices[i - 1] >= m_value_axes[i - 1]->size()) { std::ostringstream message; message << "size_t OutputData<T>::toGlobalIndex() -> Error. Index "; @@ -417,14 +417,14 @@ size_t OutputData<T>::toGlobalIndex(const std::vector<unsigned>& axes_indices) c template <class T> size_t OutputData<T>::findGlobalIndex(const std::vector<double>& coordinates) const { - ASSERT(mp_ll_data); - if (coordinates.size() != mp_ll_data->getRank()) + ASSERT(m_ll_data); + if (coordinates.size() != m_ll_data->getRank()) throw Exceptions::LogicErrorException( "OutputData<T>::findClosestIndex() -> " "Error! Number of coordinates must match rank of data structure"); std::vector<unsigned> axes_indexes; - axes_indexes.resize(mp_ll_data->getRank()); - for (size_t i = 0; i < mp_ll_data->getRank(); ++i) + axes_indexes.resize(m_ll_data->getRank()); + for (size_t i = 0; i < m_ll_data->getRank(); ++i) axes_indexes[i] = static_cast<unsigned>(m_value_axes[i]->findClosestIndex(coordinates[i])); return toGlobalIndex(axes_indexes); } @@ -466,8 +466,8 @@ Bin1D OutputData<T>::getAxisBin(size_t global_index, const std::string& axis_nam template <class T> inline T OutputData<T>::totalSum() const { - ASSERT(mp_ll_data); - return mp_ll_data->getTotalSum(); + ASSERT(m_ll_data); + return m_ll_data->getTotalSum(); } template <class T> void OutputData<T>::clear() @@ -478,18 +478,18 @@ template <class T> void OutputData<T>::clear() template <class T> void OutputData<T>::setAllTo(const T& value) { - if (!mp_ll_data) + if (!m_ll_data) throw Exceptions::ClassInitializationException( "OutputData::setAllTo() -> Error! Low-level data object was not yet initialized."); - mp_ll_data->setAll(value); + m_ll_data->setAll(value); } template <class T> void OutputData<T>::scaleAll(const T& factor) { - if (!mp_ll_data) + if (!m_ll_data) throw Exceptions::ClassInitializationException( "OutputData::scaleAll() -> Error! Low-level data object was not yet initialized."); - mp_ll_data->scaleAll(factor); + m_ll_data->scaleAll(factor); } template <class T> void OutputData<T>::setAxisSizes(size_t rank, int* n_dims) @@ -505,30 +505,30 @@ template <class T> void OutputData<T>::setAxisSizes(size_t rank, int* n_dims) template <class T> const OutputData<T>& OutputData<T>::operator+=(const OutputData<T>& right) { - ASSERT(mp_ll_data); - *this->mp_ll_data += *right.mp_ll_data; + ASSERT(m_ll_data); + *this->m_ll_data += *right.m_ll_data; return *this; } template <class T> const OutputData<T>& OutputData<T>::operator-=(const OutputData<T>& right) { - ASSERT(mp_ll_data); - *this->mp_ll_data -= *right.mp_ll_data; + ASSERT(m_ll_data); + *this->m_ll_data -= *right.m_ll_data; return *this; } template <class T> const OutputData<T>& OutputData<T>::operator*=(const OutputData<T>& right) { - ASSERT(mp_ll_data); - *this->mp_ll_data *= *right.mp_ll_data; + ASSERT(m_ll_data); + *this->m_ll_data *= *right.m_ll_data; return *this; } template <class T> bool OutputData<T>::isInitialized() const { - if (!mp_ll_data) + if (!m_ll_data) return false; - if (getRank() != mp_ll_data->getRank()) + if (getRank() != m_ll_data->getRank()) return false; if (!getRank()) return false; @@ -537,22 +537,22 @@ template <class T> bool OutputData<T>::isInitialized() const template <class T> const OutputData<T>& OutputData<T>::operator/=(const OutputData<T>& right) { - ASSERT(mp_ll_data); - *this->mp_ll_data /= *right.mp_ll_data; + ASSERT(m_ll_data); + *this->m_ll_data /= *right.m_ll_data; return *this; } template <class T> void OutputData<T>::allocate() { - delete mp_ll_data; + delete m_ll_data; size_t rank = m_value_axes.size(); int* dims = new int[rank]; for (size_t i = 0; i < rank; ++i) { dims[i] = (int)getAxis(i).size(); } - mp_ll_data = new LLData<T>(rank, dims); + m_ll_data = new LLData<T>(rank, dims); T default_value = {}; - mp_ll_data->setAll(default_value); + m_ll_data->setAll(default_value); delete[] dims; } @@ -563,13 +563,13 @@ template <class T> inline void OutputData<T>::setRawDataVector(const std::vector "OutputData<T>::setRawDataVector() -> Error! " "setRawDataVector can only be called with a data vector of the correct size."); for (size_t i = 0; i < getAllocatedSize(); ++i) - (*mp_ll_data)[i] = data_vector[i]; + (*m_ll_data)[i] = data_vector[i]; } template <class T> inline void OutputData<T>::setRawDataArray(const T* source) { for (size_t i = 0; i < getAllocatedSize(); ++i) - (*mp_ll_data)[i] = source[i]; + (*m_ll_data)[i] = source[i]; } //! Returns true if object have same dimensions diff --git a/Device/Data/OutputDataIterator.h b/Device/Data/OutputDataIterator.h index 65b75a94cb16668860ce191665333c7855911872..0dd65d58a7cd2408f3ef34e63b715a56963dda4a 100644 --- a/Device/Data/OutputDataIterator.h +++ b/Device/Data/OutputDataIterator.h @@ -65,7 +65,7 @@ public: size_t getIndex() const { return m_current_index; } //! Returns container pointer - TContainer* getContainer() const { return mp_output_data; } + TContainer* getContainer() const { return m_output_data; } //! Swaps iterators void swap(OutputDataIterator<TValue, TContainer>& other); @@ -83,7 +83,7 @@ public: private: size_t m_current_index; - TContainer* mp_output_data; + TContainer* m_output_data; }; //! make Swappable @@ -105,14 +105,14 @@ bool operator!=(const OutputDataIterator<TValue1, TContainer1>& left, const OutputDataIterator<TValue2, TContainer2>& right); template <class TValue, class TContainer> -OutputDataIterator<TValue, TContainer>::OutputDataIterator() : m_current_index(0), mp_output_data(0) +OutputDataIterator<TValue, TContainer>::OutputDataIterator() : m_current_index(0), m_output_data(0) { } template <class TValue, class TContainer> OutputDataIterator<TValue, TContainer>::OutputDataIterator(TContainer* p_output_data, size_t start_at_index) - : m_current_index(start_at_index), mp_output_data(p_output_data) + : m_current_index(start_at_index), m_output_data(p_output_data) { } @@ -120,18 +120,18 @@ template <class TValue, class TContainer> template <class TValue2, class TContainer2> OutputDataIterator<TValue, TContainer>::OutputDataIterator( const OutputDataIterator<TValue2, TContainer2>& other) - : m_current_index(0), mp_output_data(0) + : m_current_index(0), m_output_data(0) { - mp_output_data = static_cast<TContainer*>(other.getContainer()); + m_output_data = static_cast<TContainer*>(other.getContainer()); m_current_index = other.getIndex(); } template <class TValue, class TContainer> OutputDataIterator<TValue, TContainer>::OutputDataIterator( const OutputDataIterator<TValue, TContainer>& other) - : m_current_index(0), mp_output_data(0) + : m_current_index(0), m_output_data(0) { - mp_output_data = other.getContainer(); + m_output_data = other.getContainer(); m_current_index = other.getIndex(); } @@ -162,7 +162,7 @@ OutputDataIterator<TValue, TContainer>::~OutputDataIterator() template <class TValue, class TContainer> OutputDataIterator<TValue, TContainer>& OutputDataIterator<TValue, TContainer>::operator++() { - if (m_current_index < mp_output_data->getAllocatedSize()) { + if (m_current_index < m_output_data->getAllocatedSize()) { ++m_current_index; } return *this; @@ -179,20 +179,20 @@ OutputDataIterator<TValue, TContainer> OutputDataIterator<TValue, TContainer>::o template <class TValue, class TContainer> TValue& OutputDataIterator<TValue, TContainer>::operator*() const { - return (*mp_output_data)[m_current_index]; + return (*m_output_data)[m_current_index]; } template <class TValue, class TContainer> TValue* OutputDataIterator<TValue, TContainer>::operator->() const { - return &((*mp_output_data)[m_current_index]); + return &((*m_output_data)[m_current_index]); } template <class TValue, class TContainer> void OutputDataIterator<TValue, TContainer>::swap(OutputDataIterator<TValue, TContainer>& other) { std::swap(this->m_current_index, other.m_current_index); - std::swap(this->mp_output_data, other.mp_output_data); + std::swap(this->m_output_data, other.m_output_data); } //! test for equality diff --git a/Device/Detector/IDetector.cpp b/Device/Detector/IDetector.cpp index f2d242eca202c07833b0cd8a7cd62157195f8a73..793a0b8e78711442a821508cbf4358d8e2b8b747 100644 --- a/Device/Detector/IDetector.cpp +++ b/Device/Detector/IDetector.cpp @@ -28,8 +28,8 @@ IDetector::IDetector(const IDetector& other) : ICloneable(), INode(), m_axes(other.m_axes), m_detection_properties(other.m_detection_properties) { - if (other.mP_detector_resolution) - setDetectorResolution(*other.mP_detector_resolution); + if (other.m_detector_resolution) + setDetectorResolution(*other.m_detector_resolution); setName(other.getName()); registerChild(&m_detection_properties); } @@ -103,8 +103,8 @@ void IDetector::setAnalyzerProperties(const kvector_t direction, double efficien void IDetector::setDetectorResolution(const IDetectorResolution& p_detector_resolution) { - mP_detector_resolution.reset(p_detector_resolution.clone()); - registerChild(mP_detector_resolution.get()); + m_detector_resolution.reset(p_detector_resolution.clone()); + registerChild(m_detector_resolution.get()); } // TODO: pass dimension-independent argument to this function @@ -119,8 +119,8 @@ void IDetector::applyDetectorResolution(OutputData<double>* p_intensity_map) con if (!p_intensity_map) throw std::runtime_error("IDetector::applyDetectorResolution() -> " "Error! Null pointer to intensity map"); - if (mP_detector_resolution) { - mP_detector_resolution->applyDetectorResolution(p_intensity_map); + if (m_detector_resolution) { + m_detector_resolution->applyDetectorResolution(p_intensity_map); if (detectorMask() && detectorMask()->hasMasks()) { // sets amplitude in masked areas to zero std::unique_ptr<OutputData<double>> buff(new OutputData<double>()); @@ -136,12 +136,12 @@ void IDetector::applyDetectorResolution(OutputData<double>* p_intensity_map) con void IDetector::removeDetectorResolution() { - mP_detector_resolution.reset(); + m_detector_resolution.reset(); } const IDetectorResolution* IDetector::detectorResolution() const { - return mP_detector_resolution.get(); + return m_detector_resolution.get(); } OutputData<double>* @@ -153,7 +153,7 @@ IDetector::createDetectorIntensity(const std::vector<SimulationElement>& element "can't create detector map."); setDataToDetectorMap(*detectorMap, elements); - if (mP_detector_resolution) + if (m_detector_resolution) applyDetectorResolution(detectorMap.get()); return detectorMap.release(); @@ -195,7 +195,7 @@ size_t IDetector::numberOfSimulationElements() const std::vector<const INode*> IDetector::getChildren() const { - return std::vector<const INode*>() << &m_detection_properties << mP_detector_resolution; + return std::vector<const INode*>() << &m_detection_properties << m_detector_resolution; } void IDetector::iterate(std::function<void(IDetector::const_iterator)> func, bool visit_masks) const diff --git a/Device/Detector/IDetector.h b/Device/Detector/IDetector.h index 7cd3447f0ccf2f61ac50548c0304bddf73fb8afe..57e3788cd52ddf3d777f70394a0d29df2792d52d 100644 --- a/Device/Detector/IDetector.h +++ b/Device/Detector/IDetector.h @@ -125,7 +125,7 @@ private: CloneableVector<IAxis> m_axes; DetectionProperties m_detection_properties; - std::unique_ptr<IDetectorResolution> mP_detector_resolution; + std::unique_ptr<IDetectorResolution> m_detector_resolution; }; #endif // BORNAGAIN_CORE_DETECTOR_IDETECTOR_H diff --git a/Device/Detector/RectangularPixel.cpp b/Device/Detector/RectangularPixel.cpp index 3f6045b088a22a8a3cdbdbea5e09617ac6388de3..cc45df963a02611bdb7595a66b2b7271f64167c1 100644 --- a/Device/Detector/RectangularPixel.cpp +++ b/Device/Detector/RectangularPixel.cpp @@ -14,16 +14,13 @@ #include "Device/Detector/RectangularPixel.h" #include "Base/Const/MathConstants.h" -#include "Base/Const/Units.h" -#include "Base/Pixel/SimulationElement.h" -#include "Device/Beam/Beam.h" -#include "Device/Detector/RegionOfInterest.h" -#include "Device/Resolution/IDetectorResolution.h" -RectangularPixel::RectangularPixel(kvector_t corner_pos, kvector_t width, kvector_t height) - : m_corner_pos(std::move(corner_pos)), m_width(std::move(width)), m_height(std::move(height)) +RectangularPixel::RectangularPixel(const kvector_t& corner_pos, const kvector_t& width, + const kvector_t& height) + : m_corner_pos(std::move(corner_pos)), m_width(std::move(width)), m_height(std::move(height)), + m_normal(width.cross(height)) { - m_normal = m_width.cross(m_height); + // TODO URGENT: why allow solid angle <=0 ?? auto solid_angle_value = calculateSolidAngle(); m_solid_angle = solid_angle_value <= 0.0 ? 1.0 : solid_angle_value; } diff --git a/Device/Detector/RectangularPixel.h b/Device/Detector/RectangularPixel.h index a7b55bb9030988ddc0bbdb80a98ef261f14573cc..6fc1b938a056c1dee185ec43d0ecad2de00f8ef9 100644 --- a/Device/Detector/RectangularPixel.h +++ b/Device/Detector/RectangularPixel.h @@ -22,7 +22,7 @@ class RectangularPixel : public IPixel { public: - RectangularPixel(kvector_t corner_pos, kvector_t width, kvector_t height); + RectangularPixel(const kvector_t& corner_pos, const kvector_t& width, const kvector_t& height); RectangularPixel* clone() const override; RectangularPixel* createZeroSizePixel(double x, double y) const override; @@ -34,11 +34,12 @@ public: private: kvector_t normalizeLength(const kvector_t direction, double length) const; double calculateSolidAngle() const; - kvector_t m_corner_pos; - kvector_t m_width; - kvector_t m_height; - double m_solid_angle; - kvector_t m_normal; + + const kvector_t m_corner_pos; + const kvector_t m_width; + const kvector_t m_height; + const kvector_t m_normal; + mutable double m_solid_angle; }; #endif // BORNAGAIN_CORE_DETECTOR_RECTANGULARPIXEL_H diff --git a/Device/Detector/SimpleUnitConverters.cpp b/Device/Detector/SimpleUnitConverters.cpp index b7b814b49e269ff31683f1eefac91f86c4d0bbbc..ec848eacb0b72a4bbf832eea6e8835265af946fc 100644 --- a/Device/Detector/SimpleUnitConverters.cpp +++ b/Device/Detector/SimpleUnitConverters.cpp @@ -206,7 +206,7 @@ RectangularConverter::RectangularConverter(const RectangularDetector& detector, + std::to_string(static_cast<int>(detector.dimension()))); addDetectorAxis(detector, 0); addDetectorAxis(detector, 1); - mP_detector_pixel.reset(detector.regionOfInterestPixel()); + m_detector_pixel.reset(detector.regionOfInterestPixel()); } RectangularConverter::~RectangularConverter() = default; @@ -230,7 +230,7 @@ Axes::Units RectangularConverter::defaultUnits() const } RectangularConverter::RectangularConverter(const RectangularConverter& other) - : UnitConverterSimple(other), mP_detector_pixel(other.mP_detector_pixel->clone()) + : UnitConverterSimple(other), m_detector_pixel(other.m_detector_pixel->clone()) { } @@ -239,9 +239,9 @@ double RectangularConverter::calculateValue(size_t i_axis, Axes::Units units_typ { if (units_type == Axes::Units::MM) return value; - const auto k00 = mP_detector_pixel->getPosition(0.0, 0.0); - const auto k01 = mP_detector_pixel->getPosition(0.0, 1.0); - const auto k10 = mP_detector_pixel->getPosition(1.0, 0.0); + const auto k00 = m_detector_pixel->getPosition(0.0, 0.0); + const auto k01 = m_detector_pixel->getPosition(0.0, 1.0); + const auto k10 = m_detector_pixel->getPosition(1.0, 0.0); const auto& max_pos = i_axis == 0 ? k10 : k01; // position of max along given axis const double shift = value - m_axis_data_table[i_axis].min; const auto k_f = normalizeToWavelength(k00 + shift * (max_pos - k00).unit()); diff --git a/Device/Detector/SimpleUnitConverters.h b/Device/Detector/SimpleUnitConverters.h index 20da35499c515cbfd1ca7378e1248044583974e4..fa2f1ac32475569f2b6f21c38f8b9daa7f3a180e 100644 --- a/Device/Detector/SimpleUnitConverters.h +++ b/Device/Detector/SimpleUnitConverters.h @@ -116,7 +116,7 @@ private: std::vector<std::map<Axes::Units, std::string>> createNameMaps() const final; kvector_t normalizeToWavelength(kvector_t vector) const; double axisAngle(size_t i_axis, kvector_t k_f) const; - std::unique_ptr<RectangularPixel> mP_detector_pixel; + std::unique_ptr<RectangularPixel> m_detector_pixel; }; //! IUnitConverter class that handles the unit translations for off-specular simulations diff --git a/Device/Detector/SphericalPixel.h b/Device/Detector/SphericalPixel.h index 8120a92756a28115fe3c7d1eaea25093684ef0a3..27a2b859c3556b70e1800425b9dc3d8ea7948458 100644 --- a/Device/Detector/SphericalPixel.h +++ b/Device/Detector/SphericalPixel.h @@ -33,9 +33,11 @@ public: double getSolidAngle() const override; private: - double m_alpha, m_phi; - double m_dalpha, m_dphi; - double m_solid_angle; + const double m_alpha; + const double m_phi; + const double m_dalpha; + const double m_dphi; + mutable double m_solid_angle; }; #endif // BORNAGAIN_CORE_DETECTOR_SPHERICALPIXEL_H diff --git a/Device/Histo/SimulationResult.cpp b/Device/Histo/SimulationResult.cpp index 852af611f367e3690753c0e1b535b62d674c0014..6fab60ed2a726085f2132d3243bea1780ddf5a38 100644 --- a/Device/Histo/SimulationResult.cpp +++ b/Device/Histo/SimulationResult.cpp @@ -17,54 +17,54 @@ SimulationResult::SimulationResult(const OutputData<double>& data, const IUnitConverter& unit_converter) - : mP_data(data.clone()), mP_unit_converter(unit_converter.clone()) + : m_data(data.clone()), m_unit_converter(unit_converter.clone()) { checkDimensions(); } SimulationResult::SimulationResult(const SimulationResult& other) { - if (!other.mP_data || !other.mP_unit_converter) + if (!other.m_data || !other.m_unit_converter) throw std::runtime_error("Error in SimulationResult(const SimulationResult& other): " "not initialized"); - mP_data.reset(other.mP_data->clone()); - mP_unit_converter.reset(other.mP_unit_converter->clone()); + m_data.reset(other.m_data->clone()); + m_unit_converter.reset(other.m_unit_converter->clone()); } SimulationResult::SimulationResult(SimulationResult&& other) - : mP_data(std::move(other.mP_data)), mP_unit_converter(std::move(other.mP_unit_converter)) + : m_data(std::move(other.m_data)), m_unit_converter(std::move(other.m_unit_converter)) { } SimulationResult& SimulationResult::operator=(const SimulationResult& other) { - if (!other.mP_data || !other.mP_unit_converter) + if (!other.m_data || !other.m_unit_converter) throw std::runtime_error("Error in SimulationResult(const SimulationResult& other): " "not initialized"); - mP_data.reset(other.mP_data->clone()); - mP_unit_converter.reset(other.mP_unit_converter->clone()); + m_data.reset(other.m_data->clone()); + m_unit_converter.reset(other.m_unit_converter->clone()); return *this; } SimulationResult& SimulationResult::operator=(SimulationResult&& other) { - mP_data.reset(other.mP_data.release()); - mP_unit_converter.reset(other.mP_unit_converter.release()); + m_data.reset(other.m_data.release()); + m_unit_converter.reset(other.m_unit_converter.release()); return *this; } std::unique_ptr<OutputData<double>> SimulationResult::data(Axes::Units units) const { - if (!mP_data) + if (!m_data) throw std::runtime_error( "Error in SimulationResult::data:Attempt to access non-initialized data"); - return mP_unit_converter->createConvertedData(*mP_data, units); + return m_unit_converter->createConvertedData(*m_data, units); } Histogram2D* SimulationResult::histogram2d(Axes::Units units) const { - if (mP_data->getRank() != 2 || mP_unit_converter->dimension() != 2) + if (m_data->getRank() != 2 || m_unit_converter->dimension() != 2) throw std::runtime_error("Error in SimulationResult::histogram2d: " "dimension of data is not 2. Please use axis(), array() and " "data() functions for 1D data."); @@ -74,14 +74,14 @@ Histogram2D* SimulationResult::histogram2d(Axes::Units units) const std::vector<AxisInfo> SimulationResult::axisInfo(Axes::Units units) const { - if (!mP_unit_converter) + if (!m_unit_converter) return {}; std::vector<AxisInfo> result; - auto dim = mP_unit_converter->dimension(); + auto dim = m_unit_converter->dimension(); for (size_t i = 0; i < dim; ++i) { - AxisInfo info = {mP_unit_converter->axisName(i, units), - mP_unit_converter->calculateMin(i, units), - mP_unit_converter->calculateMax(i, units)}; + AxisInfo info = {m_unit_converter->axisName(i, units), + m_unit_converter->calculateMin(i, units), + m_unit_converter->calculateMax(i, units)}; result.push_back(info); } return result; @@ -89,40 +89,40 @@ std::vector<AxisInfo> SimulationResult::axisInfo(Axes::Units units) const const IUnitConverter& SimulationResult::converter() const { - if (!mP_unit_converter) + if (!m_unit_converter) throw std::runtime_error( "Error in SimulationResult::converter: unit converter was not initialized"); - return *mP_unit_converter; + return *m_unit_converter; } double& SimulationResult::operator[](size_t i) { - if (mP_data) - return (*mP_data)[i]; + if (m_data) + return (*m_data)[i]; throw std::runtime_error("Error in SimulationResult::operator[]: " "no data initialized"); } const double& SimulationResult::operator[](size_t i) const { - if (mP_data) - return (*mP_data)[i]; + if (m_data) + return (*m_data)[i]; throw std::runtime_error("Error in SimulationResult::operator[]: " "no data initialized"); } size_t SimulationResult::size() const { - return mP_data ? mP_data->getAllocatedSize() : 0; + return m_data ? m_data->getAllocatedSize() : 0; } #ifdef BORNAGAIN_PYTHON PyObject* SimulationResult::array(Axes::Units units) const { - if (!mP_data || !mP_unit_converter) + if (!m_data || !m_unit_converter) throw std::runtime_error( "Error in SimulationResult::array: attempt to access non-initialized data"); - return mP_unit_converter->createConvertedData(*mP_data, units)->getArray(); + return m_unit_converter->createConvertedData(*m_data, units)->getArray(); } #endif @@ -133,16 +133,16 @@ std::vector<double> SimulationResult::axis(Axes::Units units) const std::vector<double> SimulationResult::axis(size_t i_axis, Axes::Units units) const { - if (i_axis >= mP_unit_converter->dimension()) + if (i_axis >= m_unit_converter->dimension()) throw std::runtime_error( "Error in SimulationResult::axis: no axis corresponds to passed index."); - auto axis = mP_unit_converter->createConvertedAxis(i_axis, units); + auto axis = m_unit_converter->createConvertedAxis(i_axis, units); return axis->getBinCenters(); } void SimulationResult::checkDimensions() const { - if (mP_data->getRank() != mP_unit_converter->dimension()) + if (m_data->getRank() != m_unit_converter->dimension()) throw std::runtime_error("Error in SimulationResults::checkDimensions(): " "dimensions of data and unit converter don't match"); } diff --git a/Device/Histo/SimulationResult.h b/Device/Histo/SimulationResult.h index 3342bf34d05615b50e78160b7f21213b2c415688..97d009ebd3ae3b9096325696c33cf573f4d473b0 100644 --- a/Device/Histo/SimulationResult.h +++ b/Device/Histo/SimulationResult.h @@ -84,8 +84,8 @@ public: private: void checkDimensions() const; - std::unique_ptr<OutputData<double>> mP_data; - std::unique_ptr<IUnitConverter> mP_unit_converter; + std::unique_ptr<OutputData<double>> m_data; + std::unique_ptr<IUnitConverter> m_unit_converter; }; #endif // BORNAGAIN_CORE_INSTRUMENT_SIMULATIONRESULT_H diff --git a/Device/Instrument/ChiSquaredModule.cpp b/Device/Instrument/ChiSquaredModule.cpp index 43e043556008380dfb0033a24f1dab9e7957c1f1..906d4e74267aae13303d7c6b3907337d7eb317fd 100644 --- a/Device/Instrument/ChiSquaredModule.cpp +++ b/Device/Instrument/ChiSquaredModule.cpp @@ -24,9 +24,9 @@ double ChiSquaredModule::residual(double a, double b, double weight) double value_simu = a; double value_real = b; - if (mp_intensity_function) { - value_simu = mp_intensity_function->evaluate(value_simu); - value_real = mp_intensity_function->evaluate(value_real); + if (m_intensity_function) { + value_simu = m_intensity_function->evaluate(value_simu); + value_real = m_intensity_function->evaluate(value_real); } double variance = m_variance_function->variance(value_real, value_simu); diff --git a/Device/Instrument/IChiSquaredModule.cpp b/Device/Instrument/IChiSquaredModule.cpp index 9bc7854d7b41ca290ce1e1a68ef39ba9cf5229c9..591e4d4458958c5e1495dbc2dd28e1ec0ff425ba 100644 --- a/Device/Instrument/IChiSquaredModule.cpp +++ b/Device/Instrument/IChiSquaredModule.cpp @@ -28,8 +28,8 @@ IChiSquaredModule::IChiSquaredModule(const IChiSquaredModule& other) : ICloneabl if (other.m_variance_function) m_variance_function.reset(other.m_variance_function->clone()); - if (other.mp_intensity_function) - mp_intensity_function.reset(other.mp_intensity_function->clone()); + if (other.m_intensity_function) + m_intensity_function.reset(other.m_intensity_function->clone()); } IChiSquaredModule::~IChiSquaredModule() = default; @@ -41,10 +41,10 @@ void IChiSquaredModule::setVarianceFunction(const IVarianceFunction& variance_fu const IIntensityFunction* IChiSquaredModule::getIntensityFunction() const { - return mp_intensity_function.get(); + return m_intensity_function.get(); } void IChiSquaredModule::setIntensityFunction(const IIntensityFunction& intensity_function) { - mp_intensity_function.reset(intensity_function.clone()); + m_intensity_function.reset(intensity_function.clone()); } diff --git a/Device/Instrument/IChiSquaredModule.h b/Device/Instrument/IChiSquaredModule.h index a9122940922f2d77a90ecdd32f4273726eff1ec2..0dd95cc0777fa50d2f57ae85ea6a6cc2bf3f5fe9 100644 --- a/Device/Instrument/IChiSquaredModule.h +++ b/Device/Instrument/IChiSquaredModule.h @@ -51,7 +51,7 @@ protected: IChiSquaredModule(const IChiSquaredModule& other); std::unique_ptr<IVarianceFunction> m_variance_function; - std::unique_ptr<IIntensityFunction> mp_intensity_function; + std::unique_ptr<IIntensityFunction> m_intensity_function; }; #endif // BORNAGAIN_CORE_INSTRUMENT_ICHISQUAREDMODULE_H diff --git a/Device/Instrument/IntensityDataFunctions.cpp b/Device/Instrument/IntensityDataFunctions.cpp index 34773771178ffaf7b3cc15a054f6b657cb16eb9c..76737ae26b883632a79d8a73e1094a051631e991 100644 --- a/Device/Instrument/IntensityDataFunctions.cpp +++ b/Device/Instrument/IntensityDataFunctions.cpp @@ -128,9 +128,9 @@ IntensityDataFunctions::createRearrangedDataSet(const OutputData<double>& data, const size_t rev_axis_i = n % 3; const size_t end_bin = data.getAxis(rev_axis_i).size() - 1; index_mapping = [rev_axis_i, end_bin](std::vector<int>& inds) { - const int tmp_index = inds[rev_axis_i]; + const int tm_index = inds[rev_axis_i]; inds[rev_axis_i] = inds[rev_axis_i ^ 1]; - inds[rev_axis_i ^ 1] = static_cast<int>(end_bin) - tmp_index; + inds[rev_axis_i ^ 1] = static_cast<int>(end_bin) - tm_index; }; } diff --git a/Device/Resolution/ConvolutionDetectorResolution.cpp b/Device/Resolution/ConvolutionDetectorResolution.cpp index a7a8c8fe8be37377e1cc33e5f7603fa0b874ae1e..38a5a1cc200a5115ed6f72bf39684142eb36e6bb 100644 --- a/Device/Resolution/ConvolutionDetectorResolution.cpp +++ b/Device/Resolution/ConvolutionDetectorResolution.cpp @@ -36,8 +36,8 @@ ConvolutionDetectorResolution::ConvolutionDetectorResolution( { m_dimension = other.m_dimension; m_res_function_1d = other.m_res_function_1d; - if (other.mp_res_function_2d) - setResolutionFunction(*other.mp_res_function_2d); + if (other.m_res_function_2d) + setResolutionFunction(*other.m_res_function_2d); setName(other.getName()); } @@ -48,7 +48,7 @@ ConvolutionDetectorResolution* ConvolutionDetectorResolution::clone() const std::vector<const INode*> ConvolutionDetectorResolution::getChildren() const { - return std::vector<const INode*>() << mp_res_function_2d; + return std::vector<const INode*>() << m_res_function_2d; } void ConvolutionDetectorResolution::applyDetectorResolution( @@ -75,8 +75,8 @@ void ConvolutionDetectorResolution::applyDetectorResolution( void ConvolutionDetectorResolution::setResolutionFunction(const IResolutionFunction2D& resFunc) { - mp_res_function_2d.reset(resFunc.clone()); - registerChild(mp_res_function_2d.get()); + m_res_function_2d.reset(resFunc.clone()); + registerChild(m_res_function_2d.get()); } void ConvolutionDetectorResolution::apply1dConvolution(OutputData<double>* p_intensity_map) const @@ -117,7 +117,7 @@ void ConvolutionDetectorResolution::apply1dConvolution(OutputData<double>* p_int void ConvolutionDetectorResolution::apply2dConvolution(OutputData<double>* p_intensity_map) const { - if (mp_res_function_2d == 0) + if (m_res_function_2d == 0) throw Exceptions::LogicErrorException( "ConvolutionDetectorResolution::apply2dConvolution() -> Error! " "No 2d resolution function present for convolution of 2d data."); @@ -198,7 +198,7 @@ double ConvolutionDetectorResolution::getIntegratedPDF2d(double x, double step_x double ymin = y - halfstepy; double ymax = y + halfstepy; double result = - mp_res_function_2d->evaluateCDF(xmax, ymax) - mp_res_function_2d->evaluateCDF(xmax, ymin) - - mp_res_function_2d->evaluateCDF(xmin, ymax) + mp_res_function_2d->evaluateCDF(xmin, ymin); + m_res_function_2d->evaluateCDF(xmax, ymax) - m_res_function_2d->evaluateCDF(xmax, ymin) + - m_res_function_2d->evaluateCDF(xmin, ymax) + m_res_function_2d->evaluateCDF(xmin, ymin); return result; } diff --git a/Device/Resolution/ConvolutionDetectorResolution.h b/Device/Resolution/ConvolutionDetectorResolution.h index 2261154bcdc2a48a7847fe6be02d92be9485e14e..9fce46e2e514821b4658491b1a98e5b0abe09b95 100644 --- a/Device/Resolution/ConvolutionDetectorResolution.h +++ b/Device/Resolution/ConvolutionDetectorResolution.h @@ -59,12 +59,12 @@ private: size_t m_dimension; cumulative_DF_1d m_res_function_1d; - std::unique_ptr<IResolutionFunction2D> mp_res_function_2d; + std::unique_ptr<IResolutionFunction2D> m_res_function_2d; }; inline const IResolutionFunction2D* ConvolutionDetectorResolution::getResolutionFunction2D() const { - return mp_res_function_2d.get(); + return m_res_function_2d.get(); } #endif // BORNAGAIN_CORE_DETECTOR_CONVOLUTIONDETECTORRESOLUTION_H diff --git a/Fit/RootAdapter/ObjectiveFunctionAdapter.cpp b/Fit/RootAdapter/ObjectiveFunctionAdapter.cpp index de6f8f5859eece30310edf1dc0f80be3e15a07c5..3087814d2a96a2082fb6a0668d3cccb7f8ae18bf 100644 --- a/Fit/RootAdapter/ObjectiveFunctionAdapter.cpp +++ b/Fit/RootAdapter/ObjectiveFunctionAdapter.cpp @@ -27,19 +27,19 @@ ObjectiveFunctionAdapter::~ObjectiveFunctionAdapter() = default; const RootScalarFunction* ObjectiveFunctionAdapter::rootObjectiveFunction(fcn_scalar_t fcn, const Parameters& parameters) { - std::unique_ptr<ScalarFunctionAdapter> temp_adapter(new ScalarFunctionAdapter(fcn, parameters)); - auto result = temp_adapter->rootObjectiveFunction(); - m_adapter.reset(temp_adapter.release()); + std::unique_ptr<ScalarFunctionAdapter> tem_adapter(new ScalarFunctionAdapter(fcn, parameters)); + auto result = tem_adapter->rootObjectiveFunction(); + m_adapter.reset(tem_adapter.release()); return result; } const RootResidualFunction* ObjectiveFunctionAdapter::rootResidualFunction(fcn_residual_t fcn, const Parameters& parameters) { - std::unique_ptr<ResidualFunctionAdapter> temp_adapter( + std::unique_ptr<ResidualFunctionAdapter> tem_adapter( new ResidualFunctionAdapter(fcn, parameters)); - auto result = temp_adapter->rootResidualFunction(); - m_adapter.reset(temp_adapter.release()); + auto result = tem_adapter->rootResidualFunction(); + m_adapter.reset(tem_adapter.release()); return result; } diff --git a/GUI/coregui/Models/DomainObjectBuilder.cpp b/GUI/coregui/Models/DomainObjectBuilder.cpp index 92fce9acba8d896cadd7f0223eec24bff451ec4e..f543ba42e1330bbf0d874f06cd63eb0f49b9c481 100644 --- a/GUI/coregui/Models/DomainObjectBuilder.cpp +++ b/GUI/coregui/Models/DomainObjectBuilder.cpp @@ -14,10 +14,10 @@ #include "GUI/coregui/Models/DomainObjectBuilder.h" #include "Base/Const/Units.h" +#include "Core/Scan/UnitConverter1D.h" #include "Core/Simulation/UnitConverterUtils.h" #include "Device/Detector/IDetector2D.h" #include "Device/Detector/SimpleUnitConverters.h" -#include "Core/Scan/UnitConverter1D.h" #include "GUI/coregui/Models/AxesItems.h" #include "GUI/coregui/Models/ComboProperty.h" #include "GUI/coregui/Models/DepthProbeInstrumentItem.h" diff --git a/GUI/coregui/Models/DomainSimulationBuilder.cpp b/GUI/coregui/Models/DomainSimulationBuilder.cpp index 01aab0c0e6e9c12535dea13fdf46b885b4590af2..70ed511bc45f4020dc871f5a2dff2af239b759fc 100644 --- a/GUI/coregui/Models/DomainSimulationBuilder.cpp +++ b/GUI/coregui/Models/DomainSimulationBuilder.cpp @@ -15,12 +15,12 @@ #include "GUI/coregui/Models/DomainSimulationBuilder.h" #include "Base/Const/Units.h" #include "Core/Computation/IBackground.h" +#include "Core/Scan/AngularSpecScan.h" #include "Core/Simulation/DepthProbeSimulation.h" #include "Core/Simulation/GISASSimulation.h" #include "Core/Simulation/OffSpecSimulation.h" #include "Core/Simulation/SpecularSimulation.h" #include "Device/Beam/IFootprintFactor.h" -#include "Core/Scan/AngularSpecScan.h" #include "GUI/coregui/Models/AxesItems.h" #include "GUI/coregui/Models/BackgroundItems.h" #include "GUI/coregui/Models/DepthProbeInstrumentItem.h" diff --git a/GUI/coregui/Models/InstrumentItems.cpp b/GUI/coregui/Models/InstrumentItems.cpp index 70e7cb54de5b262d6d804243683c16c6921a36e6..7977a6b39c426d825f07c10d2603a188f8f06ebc 100644 --- a/GUI/coregui/Models/InstrumentItems.cpp +++ b/GUI/coregui/Models/InstrumentItems.cpp @@ -13,9 +13,9 @@ // ************************************************************************** // #include "GUI/coregui/Models/InstrumentItems.h" +#include "Core/Scan/UnitConverter1D.h" #include "Device/Detector/IDetector2D.h" #include "Device/Instrument/Instrument.h" -#include "Core/Scan/UnitConverter1D.h" #include "GUI/coregui/Models/BackgroundItems.h" #include "GUI/coregui/Models/DataItem.h" #include "GUI/coregui/Models/DetectorItems.h" diff --git a/GUI/coregui/Models/ParameterTranslators.cpp b/GUI/coregui/Models/ParameterTranslators.cpp index 3588f1354b4aa057aecc51c5cda9665329c85587..c453660a7aac3c6b18c67af86398f8c0ea832679 100644 --- a/GUI/coregui/Models/ParameterTranslators.cpp +++ b/GUI/coregui/Models/ParameterTranslators.cpp @@ -90,11 +90,11 @@ QStringList DistributionNoneTranslator::translate(const QStringList& list) const //! Converts "/Layer1/LayerBasicRoughness/Sigma" into "/LayerInterface0/LayerBasicRoughness/Sigma" -RoughnessTranslator::RoughnessTranslator(const SessionItem* p_parent) : mp_parent(p_parent) {} +RoughnessTranslator::RoughnessTranslator(const SessionItem* p_parent) : m_parent(p_parent) {} RoughnessTranslator* RoughnessTranslator::clone() const { - return new RoughnessTranslator(mp_parent); + return new RoughnessTranslator(m_parent); } QStringList RoughnessTranslator::translate(const QStringList& list) const @@ -129,7 +129,7 @@ int RoughnessTranslator::getLayerIndex(QString layerName) const int RoughnessTranslator::numberOfLayers() const { - QVector<SessionItem*> list = mp_parent->getChildrenOfType("Layer"); + QVector<SessionItem*> list = m_parent->getChildrenOfType("Layer"); return list.size(); } diff --git a/GUI/coregui/Models/ParameterTranslators.h b/GUI/coregui/Models/ParameterTranslators.h index 52cfbc305dd14455f956f68620a08065dc33f5cf..19c52e877b5ef001168da496e663d16ec6904994 100644 --- a/GUI/coregui/Models/ParameterTranslators.h +++ b/GUI/coregui/Models/ParameterTranslators.h @@ -92,7 +92,7 @@ public: private: int getLayerIndex(QString layerName) const; int numberOfLayers() const; - const SessionItem* mp_parent; + const SessionItem* m_parent; }; class VectorParameterTranslator : public IPathTranslator diff --git a/GUI/coregui/Models/TransformFromDomain.cpp b/GUI/coregui/Models/TransformFromDomain.cpp index 9f6786ef4de055eb1d36ff23c20ddf2fe231407d..4040bcacf50fb40248d42c16391f86e8f6d6c875 100644 --- a/GUI/coregui/Models/TransformFromDomain.cpp +++ b/GUI/coregui/Models/TransformFromDomain.cpp @@ -17,6 +17,7 @@ #include "Core/Computation/ConstantBackground.h" #include "Core/Computation/PoissonNoiseBackground.h" #include "Core/Export/INodeUtils.h" +#include "Core/Scan/AngularSpecScan.h" #include "Core/Simulation/GISASSimulation.h" #include "Core/Simulation/OffSpecSimulation.h" #include "Core/Simulation/SpecularSimulation.h" @@ -33,7 +34,6 @@ #include "Device/Resolution/ConvolutionDetectorResolution.h" #include "Device/Resolution/ResolutionFunction2DGaussian.h" #include "Device/Resolution/ScanResolution.h" -#include "Core/Scan/AngularSpecScan.h" #include "GUI/coregui/Models/AxesItems.h" #include "GUI/coregui/Models/BackgroundItems.h" #include "GUI/coregui/Models/BeamAngleItems.h" diff --git a/GUI/coregui/Models/TransformToDomain.cpp b/GUI/coregui/Models/TransformToDomain.cpp index 24a33362df9090e771576776f7c72bea65e4f839..187d7724ceb5c1dae6ebf9d519a19c87d049b532 100644 --- a/GUI/coregui/Models/TransformToDomain.cpp +++ b/GUI/coregui/Models/TransformToDomain.cpp @@ -14,9 +14,9 @@ #include "GUI/coregui/Models/TransformToDomain.h" #include "Base/Const/Units.h" +#include "Core/Scan/AngularSpecScan.h" #include "Core/Simulation/GISASSimulation.h" #include "Device/Resolution/ScanResolution.h" -#include "Core/Scan/AngularSpecScan.h" #include "GUI/coregui/Models/BeamAngleItems.h" #include "GUI/coregui/Models/BeamItems.h" #include "GUI/coregui/Models/BeamWavelengthItem.h" diff --git a/GUI/coregui/Views/MaskWidgets/MaskUnitsConverter.cpp b/GUI/coregui/Views/MaskWidgets/MaskUnitsConverter.cpp index 7e33bf91d57406f4fe8710644aa7ef17e2bcf485..a575f12b5bfbd8433d4750e65764db6655af4623 100644 --- a/GUI/coregui/Views/MaskWidgets/MaskUnitsConverter.cpp +++ b/GUI/coregui/Views/MaskWidgets/MaskUnitsConverter.cpp @@ -19,7 +19,7 @@ #include "GUI/coregui/Models/ProjectionItems.h" #include "GUI/coregui/utils/GUIHelpers.h" -MaskUnitsConverter::MaskUnitsConverter() : mp_data(nullptr), m_direction(UNDEFINED) {} +MaskUnitsConverter::MaskUnitsConverter() : m_data(nullptr), m_direction(UNDEFINED) {} //! Converts all masks on board of IntensityDataItem into bin-fraction coordinates. @@ -45,7 +45,7 @@ void MaskUnitsConverter::convertIntensityDataItem(IntensityDataItem* intensityDa if (!intensityData || !intensityData->getOutputData()) return; - mp_data = intensityData->getOutputData(); + m_data = intensityData->getOutputData(); if (intensityData->maskContainerItem()) for (SessionItem* maskItem : intensityData->maskContainerItem()->getItems()) @@ -80,11 +80,11 @@ void MaskUnitsConverter::convertMask(SessionItem* maskItem) double y2 = yc + yR; if (m_direction == TO_NBINS) { - IntensityDataFunctions::coordinateToBinf(xc, yc, *mp_data); - IntensityDataFunctions::coordinateToBinf(x2, y2, *mp_data); + IntensityDataFunctions::coordinateToBinf(xc, yc, *m_data); + IntensityDataFunctions::coordinateToBinf(x2, y2, *m_data); } else { - IntensityDataFunctions::coordinateFromBinf(xc, yc, *mp_data); - IntensityDataFunctions::coordinateFromBinf(x2, y2, *mp_data); + IntensityDataFunctions::coordinateFromBinf(xc, yc, *m_data); + IntensityDataFunctions::coordinateFromBinf(x2, y2, *m_data); } maskItem->setItemValue(EllipseItem::P_XCENTER, xc); maskItem->setItemValue(EllipseItem::P_YCENTER, yc); @@ -113,13 +113,13 @@ void MaskUnitsConverter::convertCoordinate(SessionItem* maskItem, const QString& double MaskUnitsConverter::convert(double value, int axis_index) { - ASSERT(mp_data); + ASSERT(m_data); ASSERT(axis_index == 0 || axis_index == 1); if (m_direction == TO_NBINS) { - return IntensityDataFunctions::coordinateToBinf(value, mp_data->getAxis(axis_index)); + return IntensityDataFunctions::coordinateToBinf(value, m_data->getAxis(axis_index)); } else if (m_direction == FROM_NBINS) { - return IntensityDataFunctions::coordinateFromBinf(value, mp_data->getAxis(axis_index)); + return IntensityDataFunctions::coordinateFromBinf(value, m_data->getAxis(axis_index)); } throw GUIHelpers::Error("MaskUnitsConverter::convertX() -> Error. Unknown conversion"); } diff --git a/GUI/coregui/Views/MaskWidgets/MaskUnitsConverter.h b/GUI/coregui/Views/MaskWidgets/MaskUnitsConverter.h index f516dcdb2c08356c462a099566778cec54b6042a..1e2c56c3eac5994e92d465ec3683f196b3128ab2 100644 --- a/GUI/coregui/Views/MaskWidgets/MaskUnitsConverter.h +++ b/GUI/coregui/Views/MaskWidgets/MaskUnitsConverter.h @@ -46,7 +46,7 @@ private: double convert(double value, int axis_index); - const OutputData<double>* mp_data; + const OutputData<double>* m_data; EConvertionDirection m_direction; }; diff --git a/GUI/coregui/Views/RealSpaceWidgets/IPositionBuilder.cpp b/GUI/coregui/Views/RealSpaceWidgets/IPositionBuilder.cpp index 7904242c7c2344acdb50c7790cd2d30a245947a4..49b23a4e46da3b0c96c96858dae4fef5961cc936 100644 --- a/GUI/coregui/Views/RealSpaceWidgets/IPositionBuilder.cpp +++ b/GUI/coregui/Views/RealSpaceWidgets/IPositionBuilder.cpp @@ -95,7 +95,7 @@ double RandomPositionBuilder::positionVariance() const } Lattice1DPositionBuilder::Lattice1DPositionBuilder(const InterferenceFunction1DLattice* p_iff) - : mP_iff(p_iff->clone()) + : m_iff(p_iff->clone()) { } @@ -104,8 +104,8 @@ Lattice1DPositionBuilder::~Lattice1DPositionBuilder() = default; std::vector<std::vector<double>> Lattice1DPositionBuilder::generatePositionsImpl(double layer_size, double) const { - const double length = mP_iff->getLength(); - const double xi = mP_iff->getXi(); + const double length = m_iff->getLength(); + const double xi = m_iff->getXi(); // Take the maximum possible integer multiple of the lattice vector required // for populating particles correctly within the 3D model's boundaries @@ -117,11 +117,11 @@ std::vector<std::vector<double>> Lattice1DPositionBuilder::generatePositionsImpl double Lattice1DPositionBuilder::positionVariance() const { - return mP_iff->positionVariance(); + return m_iff->positionVariance(); } Lattice2DPositionBuilder::Lattice2DPositionBuilder(const InterferenceFunction2DLattice* p_iff) - : mP_iff(p_iff->clone()) + : m_iff(p_iff->clone()) { } @@ -130,7 +130,7 @@ Lattice2DPositionBuilder::~Lattice2DPositionBuilder() = default; std::vector<std::vector<double>> Lattice2DPositionBuilder::generatePositionsImpl(double layer_size, double) const { - auto& lattice = mP_iff->lattice(); + auto& lattice = m_iff->lattice(); double l1 = lattice.length1(); double l2 = lattice.length2(); double alpha = lattice.latticeAngle(); @@ -152,12 +152,12 @@ std::vector<std::vector<double>> Lattice2DPositionBuilder::generatePositionsImpl double Lattice2DPositionBuilder::positionVariance() const { - return mP_iff->positionVariance(); + return m_iff->positionVariance(); } ParaCrystal2DPositionBuilder::ParaCrystal2DPositionBuilder( const InterferenceFunction2DParaCrystal* p_iff) - : mP_iff(p_iff->clone()) + : m_iff(p_iff->clone()) { } @@ -166,18 +166,18 @@ ParaCrystal2DPositionBuilder::~ParaCrystal2DPositionBuilder() = default; std::vector<std::vector<double>> ParaCrystal2DPositionBuilder::generatePositionsImpl(double layer_size, double) const { - return RealSpace2DParacrystalUtils::Compute2DParacrystalLatticePositions(mP_iff.get(), + return RealSpace2DParacrystalUtils::Compute2DParacrystalLatticePositions(m_iff.get(), layer_size); } double ParaCrystal2DPositionBuilder::positionVariance() const { - return mP_iff->positionVariance(); + return m_iff->positionVariance(); } Finite2DLatticePositionBuilder::Finite2DLatticePositionBuilder( const InterferenceFunctionFinite2DLattice* p_iff) - : mP_iff(p_iff->clone()) + : m_iff(p_iff->clone()) { } @@ -186,7 +186,7 @@ Finite2DLatticePositionBuilder::~Finite2DLatticePositionBuilder() = default; std::vector<std::vector<double>> Finite2DLatticePositionBuilder::generatePositionsImpl(double layer_size, double) const { - auto& lattice = mP_iff->lattice(); + auto& lattice = m_iff->lattice(); double l1 = lattice.length1(); double l2 = lattice.length2(); double alpha = lattice.latticeAngle(); @@ -201,20 +201,20 @@ Finite2DLatticePositionBuilder::generatePositionsImpl(double layer_size, double) n1 = l1 == 0.0 ? 2 : static_cast<unsigned>(2.0 * layer_size * std::sqrt(2.0) / l1 / sina); n2 = l2 == 0.0 ? 2 : static_cast<unsigned>(2.0 * layer_size * std::sqrt(2.0) / l2 / sina); } - n1 = std::min(n1, mP_iff->numberUnitCells1()); - n2 = std::min(n2, mP_iff->numberUnitCells2()); + n1 = std::min(n1, m_iff->numberUnitCells1()); + n2 = std::min(n2, m_iff->numberUnitCells2()); return Generate2DLatticePoints(l1, l2, alpha, xi, n1, n2); } double Finite2DLatticePositionBuilder::positionVariance() const { - return mP_iff->positionVariance(); + return m_iff->positionVariance(); } RadialParacrystalPositionBuilder::RadialParacrystalPositionBuilder( const InterferenceFunctionRadialParaCrystal* p_iff) - : mP_iff(p_iff->clone()) + : m_iff(p_iff->clone()) { } @@ -225,7 +225,7 @@ RadialParacrystalPositionBuilder::generatePositionsImpl(double layer_size, doubl { std::vector<std::vector<double>> lattice_positions; - double distance = mP_iff->peakDistance(); + double distance = m_iff->peakDistance(); // Estimate the limit n of the integer multiple i of the peakDistance required // for populating particles correctly within the 3D model's boundaries @@ -243,7 +243,7 @@ RadialParacrystalPositionBuilder::generatePositionsImpl(double layer_size, doubl // positions of particles located along +x (store at odd index) unsigned i_left = static_cast<unsigned>(std::max(0, 2 * i - 3)); - double offset = mP_iff->randomSample(); + double offset = m_iff->randomSample(); lattice_positions[static_cast<size_t>(2 * i - 1)][0] = lattice_positions[i_left][0] + distance + offset; lattice_positions[static_cast<size_t>(2 * i - 1)][1] = 0.0; @@ -251,7 +251,7 @@ RadialParacrystalPositionBuilder::generatePositionsImpl(double layer_size, doubl // positions of particles located along -x (store at even index) unsigned i_right = static_cast<unsigned>(2 * (i - 1)); - offset = mP_iff->randomSample(); + offset = m_iff->randomSample(); lattice_positions[static_cast<size_t>(2 * i)][0] = lattice_positions[i_right][0] - distance + offset; lattice_positions[static_cast<size_t>(2 * i)][1] = 0.0; @@ -261,7 +261,7 @@ RadialParacrystalPositionBuilder::generatePositionsImpl(double layer_size, doubl double RadialParacrystalPositionBuilder::positionVariance() const { - return mP_iff->positionVariance(); + return m_iff->positionVariance(); } namespace diff --git a/GUI/coregui/Views/RealSpaceWidgets/IPositionBuilder.h b/GUI/coregui/Views/RealSpaceWidgets/IPositionBuilder.h index ea9ae1acae1c6371d3871e0d51f4920b51df7f70..b20ab0e6f99d33fae8efbff6331f4764a9bb8eaf 100644 --- a/GUI/coregui/Views/RealSpaceWidgets/IPositionBuilder.h +++ b/GUI/coregui/Views/RealSpaceWidgets/IPositionBuilder.h @@ -76,7 +76,7 @@ private: std::vector<std::vector<double>> generatePositionsImpl(double layer_size, double density = 0.0) const override; double positionVariance() const override; - std::unique_ptr<InterferenceFunction1DLattice> mP_iff; + std::unique_ptr<InterferenceFunction1DLattice> m_iff; }; class Lattice2DPositionBuilder : public IPositionBuilder @@ -89,7 +89,7 @@ private: std::vector<std::vector<double>> generatePositionsImpl(double layer_size, double density = 0.0) const override; double positionVariance() const override; - std::unique_ptr<InterferenceFunction2DLattice> mP_iff; + std::unique_ptr<InterferenceFunction2DLattice> m_iff; }; class ParaCrystal2DPositionBuilder : public IPositionBuilder @@ -102,7 +102,7 @@ private: std::vector<std::vector<double>> generatePositionsImpl(double layer_size, double density = 0.0) const override; double positionVariance() const override; - std::unique_ptr<InterferenceFunction2DParaCrystal> mP_iff; + std::unique_ptr<InterferenceFunction2DParaCrystal> m_iff; }; class Finite2DLatticePositionBuilder : public IPositionBuilder @@ -115,7 +115,7 @@ private: std::vector<std::vector<double>> generatePositionsImpl(double layer_size, double density = 0.0) const override; double positionVariance() const override; - std::unique_ptr<InterferenceFunctionFinite2DLattice> mP_iff; + std::unique_ptr<InterferenceFunctionFinite2DLattice> m_iff; }; class RadialParacrystalPositionBuilder : public IPositionBuilder @@ -128,7 +128,7 @@ private: std::vector<std::vector<double>> generatePositionsImpl(double layer_size, double density = 0.0) const override; double positionVariance() const override; - std::unique_ptr<InterferenceFunctionRadialParaCrystal> mP_iff; + std::unique_ptr<InterferenceFunctionRadialParaCrystal> m_iff; }; #endif // BORNAGAIN_GUI_COREGUI_VIEWS_REALSPACEWIDGETS_IPOSITIONBUILDER_H diff --git a/GUI/coregui/Views/RealSpaceWidgets/RealSpacePositionBuilder.cpp b/GUI/coregui/Views/RealSpaceWidgets/RealSpacePositionBuilder.cpp index d650ccc1c57c13477f08f92b5e4de2a76c502a6b..03ad246dc52284f2d7e90b639a5156b90c8410c3 100644 --- a/GUI/coregui/Views/RealSpaceWidgets/RealSpacePositionBuilder.cpp +++ b/GUI/coregui/Views/RealSpaceWidgets/RealSpacePositionBuilder.cpp @@ -15,7 +15,7 @@ #include "GUI/coregui/Views/RealSpaceWidgets/RealSpacePositionBuilder.h" #include "GUI/coregui/Views/RealSpaceWidgets/IPositionBuilder.h" -RealSpacePositionBuilder::RealSpacePositionBuilder() : mP_pos_builder{new DefaultPositionBuilder()} +RealSpacePositionBuilder::RealSpacePositionBuilder() : m_pos_builder{new DefaultPositionBuilder()} { } @@ -23,36 +23,36 @@ RealSpacePositionBuilder::~RealSpacePositionBuilder() = default; void RealSpacePositionBuilder::visit(const InterferenceFunction1DLattice* p_iff) { - mP_pos_builder = std::make_unique<Lattice1DPositionBuilder>(p_iff); + m_pos_builder = std::make_unique<Lattice1DPositionBuilder>(p_iff); } void RealSpacePositionBuilder::visit(const InterferenceFunction2DLattice* p_iff) { - mP_pos_builder = std::make_unique<Lattice2DPositionBuilder>(p_iff); + m_pos_builder = std::make_unique<Lattice2DPositionBuilder>(p_iff); } void RealSpacePositionBuilder::visit(const InterferenceFunction2DParaCrystal* p_iff) { - mP_pos_builder = std::make_unique<ParaCrystal2DPositionBuilder>(p_iff); + m_pos_builder = std::make_unique<ParaCrystal2DPositionBuilder>(p_iff); } void RealSpacePositionBuilder::visit(const InterferenceFunctionFinite2DLattice* p_iff) { - mP_pos_builder = std::make_unique<Finite2DLatticePositionBuilder>(p_iff); + m_pos_builder = std::make_unique<Finite2DLatticePositionBuilder>(p_iff); } void RealSpacePositionBuilder::visit(const InterferenceFunctionRadialParaCrystal* p_iff) { - mP_pos_builder = std::make_unique<RadialParacrystalPositionBuilder>(p_iff); + m_pos_builder = std::make_unique<RadialParacrystalPositionBuilder>(p_iff); } void RealSpacePositionBuilder::visit(const InterferenceFunctionNone*) { - mP_pos_builder.reset(new RandomPositionBuilder()); + m_pos_builder.reset(new RandomPositionBuilder()); } std::vector<std::vector<double>> RealSpacePositionBuilder::generatePositions(double layer_size, double density) const { - return mP_pos_builder->generatePositions(layer_size, density); + return m_pos_builder->generatePositions(layer_size, density); } diff --git a/GUI/coregui/Views/RealSpaceWidgets/RealSpacePositionBuilder.h b/GUI/coregui/Views/RealSpaceWidgets/RealSpacePositionBuilder.h index e792185bb4087a8932b4cd0489db9c01ae48f2f8..580255634a49da2e03877ce3562616a8a06ee3f3 100644 --- a/GUI/coregui/Views/RealSpaceWidgets/RealSpacePositionBuilder.h +++ b/GUI/coregui/Views/RealSpaceWidgets/RealSpacePositionBuilder.h @@ -39,7 +39,7 @@ public: double density = 0.0) const; private: - std::unique_ptr<IPositionBuilder> mP_pos_builder; + std::unique_ptr<IPositionBuilder> m_pos_builder; }; #endif // BORNAGAIN_GUI_COREGUI_VIEWS_REALSPACEWIDGETS_REALSPACEPOSITIONBUILDER_H diff --git a/Param/Distrib/ParameterDistribution.cpp b/Param/Distrib/ParameterDistribution.cpp index 7e77a5b1864db28748dc0ae9cce6ba8a819b3d79..c2582b4a142aaf226edcaf5c6a802f462653c6c3 100644 --- a/Param/Distrib/ParameterDistribution.cpp +++ b/Param/Distrib/ParameterDistribution.cpp @@ -23,7 +23,7 @@ ParameterDistribution::ParameterDistribution(const std::string& par_name, : IParameterized("ParameterDistribution"), m_name(par_name), m_nbr_samples(nbr_samples), m_sigma_factor(sigma_factor), m_limits(limits), m_xmin(1.0), m_xmax(-1.0) { - mP_distribution.reset(distribution.clone()); + m_distribution.reset(distribution.clone()); if (m_sigma_factor < 0.0) throw Exceptions::RuntimeErrorException( "ParameterDistribution::ParameterDistribution() -> Error." @@ -40,7 +40,7 @@ ParameterDistribution::ParameterDistribution(const std::string& par_name, : IParameterized("ParameterDistribution"), m_name(par_name), m_nbr_samples(nbr_samples), m_sigma_factor(0.0), m_xmin(xmin), m_xmax(xmax) { - mP_distribution.reset(distribution.clone()); + m_distribution.reset(distribution.clone()); if (m_sigma_factor < 0.0) { throw Exceptions::RuntimeErrorException( "ParameterDistribution::ParameterDistribution() -> Error." @@ -64,7 +64,7 @@ ParameterDistribution::ParameterDistribution(const ParameterDistribution& other) m_linked_par_names(other.m_linked_par_names), m_limits(other.m_limits), m_xmin(other.m_xmin), m_xmax(other.m_xmax) { - mP_distribution.reset(other.mP_distribution->clone()); + m_distribution.reset(other.m_distribution->clone()); } ParameterDistribution::~ParameterDistribution() = default; @@ -75,7 +75,7 @@ ParameterDistribution& ParameterDistribution::operator=(const ParameterDistribut this->m_name = other.m_name; m_nbr_samples = other.m_nbr_samples; m_sigma_factor = other.m_sigma_factor; - mP_distribution.reset(other.mP_distribution->clone()); + m_distribution.reset(other.m_distribution->clone()); m_linked_par_names = other.m_linked_par_names; m_limits = other.m_limits; m_xmin = other.m_xmin; @@ -92,7 +92,7 @@ ParameterDistribution& ParameterDistribution::linkParameter(std::string par_name size_t ParameterDistribution::getNbrSamples() const { - if (mP_distribution && mP_distribution->isDelta()) + if (m_distribution && m_distribution->isDelta()) return 1; return m_nbr_samples; } @@ -100,17 +100,17 @@ size_t ParameterDistribution::getNbrSamples() const std::vector<ParameterSample> ParameterDistribution::generateSamples() const { if (m_xmin < m_xmax) - return mP_distribution->equidistantSamplesInRange(m_nbr_samples, m_xmin, m_xmax); + return m_distribution->equidistantSamplesInRange(m_nbr_samples, m_xmin, m_xmax); else - return mP_distribution->equidistantSamples(m_nbr_samples, m_sigma_factor, m_limits); + return m_distribution->equidistantSamples(m_nbr_samples, m_sigma_factor, m_limits); } const IDistribution1D* ParameterDistribution::getDistribution() const { - return mP_distribution.get(); + return m_distribution.get(); } IDistribution1D* ParameterDistribution::getDistribution() { - return mP_distribution.get(); + return m_distribution.get(); } diff --git a/Param/Distrib/ParameterDistribution.h b/Param/Distrib/ParameterDistribution.h index 67a1b0f016a6c89957ff40d80e465c2a3fcdcb6a..92004eba3a8daf0eaa4f9576d1ed3d565d8e2c69 100644 --- a/Param/Distrib/ParameterDistribution.h +++ b/Param/Distrib/ParameterDistribution.h @@ -68,7 +68,7 @@ public: private: std::string m_name; - std::unique_ptr<IDistribution1D> mP_distribution; + std::unique_ptr<IDistribution1D> m_distribution; size_t m_nbr_samples; double m_sigma_factor; std::vector<std::string> m_linked_par_names; diff --git a/Param/Node/NodeIterator.h b/Param/Node/NodeIterator.h index 9c2d032723af0bf6753cc3168a7ef4d477c04e74..ceebe1fc52047e7098e0b7dd4b13e4cbd74a64cf 100644 --- a/Param/Node/NodeIterator.h +++ b/Param/Node/NodeIterator.h @@ -101,17 +101,17 @@ public: protected: Strategy m_strategy; IteratorMemento m_memento_itor; - const INode* mp_root; + const INode* m_root; }; template <class Strategy> -inline NodeIterator<Strategy>::NodeIterator(const INode* root) : mp_root(root) +inline NodeIterator<Strategy>::NodeIterator(const INode* root) : m_root(root) { } template <class Strategy> inline void NodeIterator<Strategy>::first() { - m_memento_itor = m_strategy.first(mp_root); + m_memento_itor = m_strategy.first(m_root); } template <class Strategy> inline void NodeIterator<Strategy>::next() diff --git a/Sample/Aggregate/InterferenceFunction1DLattice.cpp b/Sample/Aggregate/InterferenceFunction1DLattice.cpp index a0f11673048daa44fe735bea435057a1271ae8e3..46c8e5926b695d51311b3c6a80a716f5c7803f4b 100644 --- a/Sample/Aggregate/InterferenceFunction1DLattice.cpp +++ b/Sample/Aggregate/InterferenceFunction1DLattice.cpp @@ -46,8 +46,8 @@ InterferenceFunction1DLattice* InterferenceFunction1DLattice::clone() const auto* ret = new InterferenceFunction1DLattice(m_length, m_xi); ret->setPositionVariance(m_position_var); ret->m_na = m_na; - if (mP_decay) - ret->setDecayFunction(*mP_decay); + if (m_decay) + ret->setDecayFunction(*m_decay); return ret; } @@ -55,9 +55,9 @@ InterferenceFunction1DLattice* InterferenceFunction1DLattice::clone() const //! @param decay: one-dimensional decay function in reciprocal space void InterferenceFunction1DLattice::setDecayFunction(const IFTDecayFunction1D& decay) { - mP_decay.reset(decay.clone()); - registerChild(mP_decay.get()); - double decay_length = mP_decay->decayLength(); + m_decay.reset(decay.clone()); + registerChild(m_decay.get()); + double decay_length = m_decay->decayLength(); double qa_max = m_length * nmax / decay_length / M_TWOPI; m_na = static_cast<int>(std::lround(std::abs(qa_max) + 0.5)); m_na = std::max(m_na, min_points); @@ -65,12 +65,12 @@ void InterferenceFunction1DLattice::setDecayFunction(const IFTDecayFunction1D& d std::vector<const INode*> InterferenceFunction1DLattice::getChildren() const { - return std::vector<const INode*>() << mP_decay; + return std::vector<const INode*>() << m_decay; } double InterferenceFunction1DLattice::iff_without_dw(const kvector_t q) const { - ASSERT(mP_decay); + ASSERT(m_decay); double result = 0.0; double qxr = q.x(); double qyr = q.y(); @@ -89,7 +89,7 @@ double InterferenceFunction1DLattice::iff_without_dw(const kvector_t q) const for (int i = -m_na; i < m_na + 1; ++i) { double qx = qx_frac + i * a_rec; - result += mP_decay->evaluate(qx); + result += m_decay->evaluate(qx); } return result / a; } diff --git a/Sample/Aggregate/InterferenceFunction1DLattice.h b/Sample/Aggregate/InterferenceFunction1DLattice.h index ed4899f9e69bed4f015ac635af51eeed5f700c3c..fdb4d43966e52f3d69358de7ab084c80aea4c502 100644 --- a/Sample/Aggregate/InterferenceFunction1DLattice.h +++ b/Sample/Aggregate/InterferenceFunction1DLattice.h @@ -44,7 +44,7 @@ private: double m_length; double m_xi; - std::unique_ptr<IFTDecayFunction1D> mP_decay; + std::unique_ptr<IFTDecayFunction1D> m_decay; int m_na; //!< determines the number of reciprocal lattice points to use }; diff --git a/Sample/Aggregate/InterferenceFunction2DSuperLattice.cpp b/Sample/Aggregate/InterferenceFunction2DSuperLattice.cpp index ffdc17a37c1f804995c80db16c752bbac328bcce..37851e1ad1a64ec9dce407926ad6b330af7156f0 100644 --- a/Sample/Aggregate/InterferenceFunction2DSuperLattice.cpp +++ b/Sample/Aggregate/InterferenceFunction2DSuperLattice.cpp @@ -25,7 +25,7 @@ InterferenceFunction2DSuperLattice::InterferenceFunction2DSuperLattice(const Lattice2D& lattice, unsigned size_1, unsigned size_2) - : IInterferenceFunction(0), m_integrate_xi(false), mP_substructure(nullptr), m_size_1(size_1), + : IInterferenceFunction(0), m_integrate_xi(false), m_substructure(nullptr), m_size_1(size_1), m_size_2(size_2) { setName("Interference2DSuperLattice"); @@ -51,22 +51,22 @@ InterferenceFunction2DSuperLattice::~InterferenceFunction2DSuperLattice() = defa InterferenceFunction2DSuperLattice* InterferenceFunction2DSuperLattice::clone() const { - auto* ret = new InterferenceFunction2DSuperLattice(*mP_lattice, m_size_1, m_size_2); + auto* ret = new InterferenceFunction2DSuperLattice(*m_lattice, m_size_1, m_size_2); ret->setPositionVariance(m_position_var); - ret->setSubstructureIFF(*mP_substructure); + ret->setSubstructureIFF(*m_substructure); ret->setIntegrationOverXi(integrationOverXi()); return ret; } void InterferenceFunction2DSuperLattice::setSubstructureIFF(const IInterferenceFunction& sub_iff) { - mP_substructure.reset(sub_iff.clone()); - registerChild(mP_substructure.get()); + m_substructure.reset(sub_iff.clone()); + registerChild(m_substructure.get()); } const IInterferenceFunction& InterferenceFunction2DSuperLattice::substructureIFF() const { - return *mP_substructure; + return *m_substructure; } //! Creates square lattice. @@ -97,7 +97,7 @@ double InterferenceFunction2DSuperLattice::evaluate(const kvector_t q, double ou m_qx = q.x(); m_qy = q.y(); if (!m_integrate_xi) - return interferenceForXi(mP_lattice->rotationAngle()); + return interferenceForXi(m_lattice->rotationAngle()); return RealIntegrator().integrate([&](double xi) -> double { return interferenceForXi(xi); }, 0.0, M_TWOPI) / M_TWOPI; @@ -106,29 +106,29 @@ double InterferenceFunction2DSuperLattice::evaluate(const kvector_t q, double ou void InterferenceFunction2DSuperLattice::setIntegrationOverXi(bool integrate_xi) { m_integrate_xi = integrate_xi; - mP_lattice->setRotationEnabled(!m_integrate_xi); // deregister Xi in the case of integration + m_lattice->setRotationEnabled(!m_integrate_xi); // deregister Xi in the case of integration } const Lattice2D& InterferenceFunction2DSuperLattice::lattice() const { - if (!mP_lattice) + if (!m_lattice) throw std::runtime_error("InterferenceFunctionFinite2DLattice::lattice() -> Error. " "No lattice defined."); - return *mP_lattice; + return *m_lattice; } std::vector<const INode*> InterferenceFunction2DSuperLattice::getChildren() const { - return std::vector<const INode*>() << mP_lattice << mP_substructure; + return std::vector<const INode*>() << m_lattice << m_substructure; } double InterferenceFunction2DSuperLattice::iff_without_dw(const kvector_t q) const { using MathFunctions::Laue; - const double a = mP_lattice->length1(); - const double b = mP_lattice->length2(); - const double xialpha = m_xi + mP_lattice->latticeAngle(); + const double a = m_lattice->length1(); + const double b = m_lattice->length2(); + const double xialpha = m_xi + m_lattice->latticeAngle(); const double qadiv2 = (q.x() * a * std::cos(m_xi) + q.y() * a * std::sin(m_xi)) / 2.0; const double qbdiv2 = (q.x() * b * std::cos(xialpha) + q.y() * b * std::sin(xialpha)) / 2.0; @@ -138,8 +138,8 @@ double InterferenceFunction2DSuperLattice::iff_without_dw(const kvector_t q) con void InterferenceFunction2DSuperLattice::setLattice(const Lattice2D& lattice) { - mP_lattice.reset(lattice.clone()); - registerChild(mP_lattice.get()); + m_lattice.reset(lattice.clone()); + registerChild(m_lattice.get()); } double InterferenceFunction2DSuperLattice::interferenceForXi(double xi) const @@ -147,6 +147,6 @@ double InterferenceFunction2DSuperLattice::interferenceForXi(double xi) const m_xi = xi; // TODO ASAP don't set as collateratel effect; rm mutable const kvector_t q = kvector_t(m_qx, m_qy, 0.0); const double outer_iff = iff_no_inner(q, m_outer_iff); - const double delta_xi = xi - mP_lattice->rotationAngle(); - return mP_substructure->evaluate(q.rotatedZ(-delta_xi), outer_iff); + const double delta_xi = xi - m_lattice->rotationAngle(); + return m_substructure->evaluate(q.rotatedZ(-delta_xi), outer_iff); } diff --git a/Sample/Aggregate/InterferenceFunction2DSuperLattice.h b/Sample/Aggregate/InterferenceFunction2DSuperLattice.h index 74eac80657df2acd7154c85814f276aeae6e6638..ae2f84c704fbe0834278aa0c73969370c66a4e6e 100644 --- a/Sample/Aggregate/InterferenceFunction2DSuperLattice.h +++ b/Sample/Aggregate/InterferenceFunction2DSuperLattice.h @@ -60,8 +60,8 @@ private: double interferenceForXi(double xi) const; bool m_integrate_xi; //!< Integrate over the orientation xi - std::unique_ptr<Lattice2D> mP_lattice; - std::unique_ptr<IInterferenceFunction> mP_substructure; //!< IFF of substructure + std::unique_ptr<Lattice2D> m_lattice; + std::unique_ptr<IInterferenceFunction> m_substructure; //!< IFF of substructure unsigned m_size_1, m_size_2; //!< Size of the finite lattice in lattice units mutable double m_outer_iff; mutable double m_qx; diff --git a/Sample/Aggregate/InterferenceFunction3DLattice.cpp b/Sample/Aggregate/InterferenceFunction3DLattice.cpp index 98fe8bd3edb0f0123522509240bfb9c3f02476ae..80a1e165a50f8e872d3997db694bb2083aada1d7 100644 --- a/Sample/Aggregate/InterferenceFunction3DLattice.cpp +++ b/Sample/Aggregate/InterferenceFunction3DLattice.cpp @@ -18,7 +18,7 @@ #include <algorithm> InterferenceFunction3DLattice::InterferenceFunction3DLattice(const Lattice& lattice) - : IInterferenceFunction(0), m_lattice(lattice), mP_peak_shape(nullptr), m_rec_radius(0.0) + : IInterferenceFunction(0), m_lattice(lattice), m_peak_shape(nullptr), m_rec_radius(0.0) { setName("Interference3DLattice"); initRecRadius(); @@ -30,14 +30,14 @@ InterferenceFunction3DLattice* InterferenceFunction3DLattice::clone() const { auto* ret = new InterferenceFunction3DLattice(m_lattice); ret->setPositionVariance(m_position_var); - if (mP_peak_shape) - ret->setPeakShape(*mP_peak_shape); + if (m_peak_shape) + ret->setPeakShape(*m_peak_shape); return ret; } void InterferenceFunction3DLattice::setPeakShape(const IPeakShape& peak_shape) { - mP_peak_shape.reset(peak_shape.clone()); + m_peak_shape.reset(peak_shape.clone()); } const Lattice& InterferenceFunction3DLattice::lattice() const @@ -57,13 +57,13 @@ void InterferenceFunction3DLattice::onChange() double InterferenceFunction3DLattice::iff_without_dw(const kvector_t q) const { - if (!mP_peak_shape) + if (!m_peak_shape) throw std::runtime_error("InterferenceFunction3DLattice::evaluate: " "no peak shape defined"); kvector_t center = q; double radius = 2.1 * m_rec_radius; double inner_radius = 0.0; - if (mP_peak_shape->angularDisorder()) { + if (m_peak_shape->angularDisorder()) { center = kvector_t(0.0, 0.0, 0.0); inner_radius = std::max(0.0, q.mag() - radius); radius += q.mag(); @@ -72,7 +72,7 @@ double InterferenceFunction3DLattice::iff_without_dw(const kvector_t q) const double result = 0.0; for (const auto& q_rec : rec_vectors) { if (!(q_rec.mag() < inner_radius)) { - result += mP_peak_shape->evaluate(q, q_rec); + result += m_peak_shape->evaluate(q, q_rec); } } return result; diff --git a/Sample/Aggregate/InterferenceFunction3DLattice.h b/Sample/Aggregate/InterferenceFunction3DLattice.h index a28cfc619125d3986abb2290546c50b3a8b228c3..2ae4e7b8843def904a8ca632e939f238caea61b8 100644 --- a/Sample/Aggregate/InterferenceFunction3DLattice.h +++ b/Sample/Aggregate/InterferenceFunction3DLattice.h @@ -48,7 +48,7 @@ private: void initRecRadius(); Lattice m_lattice; // TODO ASAP unique_ptr as in otehr InterferenceFunction%s - std::unique_ptr<IPeakShape> mP_peak_shape; + std::unique_ptr<IPeakShape> m_peak_shape; double m_rec_radius; //!< radius in reciprocal space defining the nearest q vectors to use }; diff --git a/Sample/Aggregate/InterferenceFunctionFinite2DLattice.cpp b/Sample/Aggregate/InterferenceFunctionFinite2DLattice.cpp index 2fe668a66a49afce5d2114aebbe3e83a854d0f22..3e63690f75b9f62615496bc152d5f8f348a6fa34 100644 --- a/Sample/Aggregate/InterferenceFunctionFinite2DLattice.cpp +++ b/Sample/Aggregate/InterferenceFunctionFinite2DLattice.cpp @@ -54,7 +54,7 @@ InterferenceFunctionFinite2DLattice::~InterferenceFunctionFinite2DLattice() = de InterferenceFunctionFinite2DLattice* InterferenceFunctionFinite2DLattice::clone() const { - auto* ret = new InterferenceFunctionFinite2DLattice(*mP_lattice, m_N_1, m_N_2); + auto* ret = new InterferenceFunctionFinite2DLattice(*m_lattice, m_N_1, m_N_2); ret->setPositionVariance(m_position_var); ret->setIntegrationOverXi(integrationOverXi()); return ret; @@ -87,26 +87,26 @@ InterferenceFunctionFinite2DLattice::createHexagonal(double lattice_length, doub void InterferenceFunctionFinite2DLattice::setIntegrationOverXi(bool integrate_xi) { m_integrate_xi = integrate_xi; - mP_lattice->setRotationEnabled(!m_integrate_xi); // deregister Xi in the case of integration + m_lattice->setRotationEnabled(!m_integrate_xi); // deregister Xi in the case of integration } const Lattice2D& InterferenceFunctionFinite2DLattice::lattice() const { - if (!mP_lattice) + if (!m_lattice) throw std::runtime_error("InterferenceFunctionFinite2DLattice::lattice() -> Error. " "No lattice defined."); - return *mP_lattice; + return *m_lattice; } double InterferenceFunctionFinite2DLattice::getParticleDensity() const { - double area = mP_lattice->unitCellArea(); + double area = m_lattice->unitCellArea(); return area == 0.0 ? 0.0 : 1.0 / area; } std::vector<const INode*> InterferenceFunctionFinite2DLattice::getChildren() const { - return std::vector<const INode*>() << mP_lattice; + return std::vector<const INode*>() << m_lattice; } double InterferenceFunctionFinite2DLattice::iff_without_dw(const kvector_t q) const @@ -114,7 +114,7 @@ double InterferenceFunctionFinite2DLattice::iff_without_dw(const kvector_t q) co m_qx = q.x(); m_qy = q.y(); if (!m_integrate_xi) - return interferenceForXi(mP_lattice->rotationAngle()); + return interferenceForXi(m_lattice->rotationAngle()); return RealIntegrator().integrate([&](double xi) -> double { return interferenceForXi(xi); }, 0.0, M_TWOPI) / M_TWOPI; @@ -122,15 +122,15 @@ double InterferenceFunctionFinite2DLattice::iff_without_dw(const kvector_t q) co void InterferenceFunctionFinite2DLattice::setLattice(const Lattice2D& lattice) { - mP_lattice.reset(lattice.clone()); - registerChild(mP_lattice.get()); + m_lattice.reset(lattice.clone()); + registerChild(m_lattice.get()); } double InterferenceFunctionFinite2DLattice::interferenceForXi(double xi) const { - double a = mP_lattice->length1(); - double b = mP_lattice->length2(); - double xialpha = xi + mP_lattice->latticeAngle(); + double a = m_lattice->length1(); + double b = m_lattice->length2(); + double xialpha = xi + m_lattice->latticeAngle(); double qadiv2 = (m_qx * a * std::cos(xi) + m_qy * a * std::sin(xi)) / 2.0; double qbdiv2 = (m_qx * b * std::cos(xialpha) + m_qy * b * std::sin(xialpha)) / 2.0; diff --git a/Sample/Aggregate/InterferenceFunctionFinite2DLattice.h b/Sample/Aggregate/InterferenceFunctionFinite2DLattice.h index 9f1a6b5fe3a31b5df9bcdedab3bdd07d8a619d8d..01c31243d5db52cf925a1fc1dcc5f9dc18c8dbf7 100644 --- a/Sample/Aggregate/InterferenceFunctionFinite2DLattice.h +++ b/Sample/Aggregate/InterferenceFunctionFinite2DLattice.h @@ -58,7 +58,7 @@ private: double interferenceForXi(double xi) const; bool m_integrate_xi; //!< Integrate over the orientation xi - std::unique_ptr<Lattice2D> mP_lattice; + std::unique_ptr<Lattice2D> m_lattice; unsigned m_N_1, m_N_2; //!< Size of the finite lattice in lattice units mutable double m_qx; mutable double m_qy; diff --git a/Sample/Aggregate/InterferenceFunctionFinite3DLattice.cpp b/Sample/Aggregate/InterferenceFunctionFinite3DLattice.cpp index 8f333565e3d6d43c5348ddc10ee4b8f005fe8489..b6021ac32cdae6e784bf05c4a04d2adb4e49b0df 100644 --- a/Sample/Aggregate/InterferenceFunctionFinite3DLattice.cpp +++ b/Sample/Aggregate/InterferenceFunctionFinite3DLattice.cpp @@ -33,36 +33,36 @@ InterferenceFunctionFinite3DLattice::~InterferenceFunctionFinite3DLattice() = de InterferenceFunctionFinite3DLattice* InterferenceFunctionFinite3DLattice::clone() const { - auto* ret = new InterferenceFunctionFinite3DLattice(*mP_lattice, m_N_1, m_N_2, m_N_3); + auto* ret = new InterferenceFunctionFinite3DLattice(*m_lattice, m_N_1, m_N_2, m_N_3); ret->setPositionVariance(m_position_var); return ret; } const Lattice& InterferenceFunctionFinite3DLattice::lattice() const { - if (!mP_lattice) + if (!m_lattice) throw std::runtime_error("InterferenceFunctionFinite3DLattice::lattice() -> Error. " "No lattice defined."); - return *mP_lattice; + return *m_lattice; } std::vector<const INode*> InterferenceFunctionFinite3DLattice::getChildren() const { - return std::vector<const INode*>() << mP_lattice; + return std::vector<const INode*>() << m_lattice; } double InterferenceFunctionFinite3DLattice::iff_without_dw(const kvector_t q) const { using MathFunctions::Laue; - const double qadiv2 = q.dot(mP_lattice->getBasisVectorA()) / 2.0; - const double qbdiv2 = q.dot(mP_lattice->getBasisVectorB()) / 2.0; - const double qcdiv2 = q.dot(mP_lattice->getBasisVectorC()) / 2.0; + const double qadiv2 = q.dot(m_lattice->getBasisVectorA()) / 2.0; + const double qbdiv2 = q.dot(m_lattice->getBasisVectorB()) / 2.0; + const double qcdiv2 = q.dot(m_lattice->getBasisVectorC()) / 2.0; const double ampl = Laue(qadiv2, m_N_1) * Laue(qbdiv2, m_N_2) * Laue(qcdiv2, m_N_3); return ampl * ampl / (m_N_1 * m_N_2 * m_N_3); } void InterferenceFunctionFinite3DLattice::setLattice(const Lattice& lattice) { - mP_lattice = std::make_unique<Lattice>(lattice); - registerChild(mP_lattice.get()); + m_lattice = std::make_unique<Lattice>(lattice); + registerChild(m_lattice.get()); } diff --git a/Sample/Aggregate/InterferenceFunctionFinite3DLattice.h b/Sample/Aggregate/InterferenceFunctionFinite3DLattice.h index a94e8179e8fd5d9e4a987776539ae9759f332920..65e7809f2cec86028d0c93d19c0982f2bccf897a 100644 --- a/Sample/Aggregate/InterferenceFunctionFinite3DLattice.h +++ b/Sample/Aggregate/InterferenceFunctionFinite3DLattice.h @@ -46,7 +46,7 @@ private: double iff_without_dw(const kvector_t q) const override final; void setLattice(const Lattice& lattice); - std::unique_ptr<Lattice> mP_lattice; + std::unique_ptr<Lattice> m_lattice; unsigned m_N_1, m_N_2, m_N_3; //!< Size of the finite lattice in lattice units }; diff --git a/Sample/Aggregate/InterferenceFunctionRadialParaCrystal.cpp b/Sample/Aggregate/InterferenceFunctionRadialParaCrystal.cpp index 4661b1287ad043ab0b98ac81e08dff5f6e25cac0..1917cb2fa8fb609b9dffe34e1add930f6d08b79d 100644 --- a/Sample/Aggregate/InterferenceFunctionRadialParaCrystal.cpp +++ b/Sample/Aggregate/InterferenceFunctionRadialParaCrystal.cpp @@ -39,8 +39,8 @@ InterferenceFunctionRadialParaCrystal* InterferenceFunctionRadialParaCrystal::cl { auto* ret = new InterferenceFunctionRadialParaCrystal(m_peak_distance, m_damping_length); ret->setPositionVariance(m_position_var); - if (mP_pdf) - ret->setProbabilityDistribution(*mP_pdf); + if (m_pdf) + ret->setProbabilityDistribution(*m_pdf); ret->setKappa(m_kappa); ret->setDomainSize(m_domain_size); return ret; @@ -68,7 +68,7 @@ void InterferenceFunctionRadialParaCrystal::setDomainSize(double size) complex_t InterferenceFunctionRadialParaCrystal::FTPDF(double qpar) const { complex_t phase = exp_I(qpar * m_peak_distance); - double amplitude = mP_pdf->evaluate(qpar); + double amplitude = m_pdf->evaluate(qpar); complex_t result = phase * amplitude; if (m_use_damping_length) result *= std::exp(-m_peak_distance / m_damping_length); @@ -80,18 +80,18 @@ complex_t InterferenceFunctionRadialParaCrystal::FTPDF(double qpar) const void InterferenceFunctionRadialParaCrystal::setProbabilityDistribution(const IFTDistribution1D& pdf) { - mP_pdf.reset(pdf.clone()); - registerChild(mP_pdf.get()); + m_pdf.reset(pdf.clone()); + registerChild(m_pdf.get()); } std::vector<const INode*> InterferenceFunctionRadialParaCrystal::getChildren() const { - return std::vector<const INode*>() << mP_pdf; + return std::vector<const INode*>() << m_pdf; } double InterferenceFunctionRadialParaCrystal::iff_without_dw(const kvector_t q) const { - if (!mP_pdf) + if (!m_pdf) throw Exceptions::NullPointerException("InterferenceFunctionRadialParaCrystal::" "evaluate() -> Error! Probability distribution for " "interference function not properly initialized"); @@ -104,7 +104,7 @@ double InterferenceFunctionRadialParaCrystal::iff_without_dw(const kvector_t q) complex_t fp = FTPDF(qpar); if (n < 1) { if (std::abs(1.0 - fp) < 10. * std::numeric_limits<double>::epsilon()) { - result = mP_pdf->qSecondDerivative() / m_peak_distance / m_peak_distance; + result = m_pdf->qSecondDerivative() / m_peak_distance / m_peak_distance; } else { result = ((1.0 + fp) / (1.0 - fp)).real(); } diff --git a/Sample/Aggregate/InterferenceFunctionRadialParaCrystal.h b/Sample/Aggregate/InterferenceFunctionRadialParaCrystal.h index 54639466aa6f369a395f363607bcbb00a846e8df..7b22ebda42b2c8b8aa8956255c3424242ec5f865 100644 --- a/Sample/Aggregate/InterferenceFunctionRadialParaCrystal.h +++ b/Sample/Aggregate/InterferenceFunctionRadialParaCrystal.h @@ -47,7 +47,7 @@ public: std::vector<const INode*> getChildren() const override final; - double randomSample() const { return mP_pdf->createSampler()->randomSample(); } + double randomSample() const { return m_pdf->createSampler()->randomSample(); } private: double iff_without_dw(const kvector_t q) const override final; @@ -56,7 +56,7 @@ private: double m_peak_distance; //!< the distance to the first neighbor peak double m_damping_length; //!< damping length of paracrystal //! Fourier transformed probability distribution of the nearest particle - std::unique_ptr<IFTDistribution1D> mP_pdf; + std::unique_ptr<IFTDistribution1D> m_pdf; bool m_use_damping_length; double m_kappa; //!< Size-spacing coupling parameter double m_domain_size; //!< Size of coherence domain diff --git a/Sample/Aggregate/ParticleLayout.cpp b/Sample/Aggregate/ParticleLayout.cpp index 223042dd7aeea0552c8d586a9fda7c1dce7f17fa..1ff12ba89a6473dc33f89844d46965d6bc083dc8 100644 --- a/Sample/Aggregate/ParticleLayout.cpp +++ b/Sample/Aggregate/ParticleLayout.cpp @@ -34,7 +34,7 @@ bool particleDensityIsProvidedByInterference(const IInterferenceFunction& iff) } } // namespace -ParticleLayout::ParticleLayout() : mP_interference_function{nullptr}, m_total_particle_density{0.01} +ParticleLayout::ParticleLayout() : m_interference_function{nullptr}, m_total_particle_density{0.01} { setName("ParticleLayout"); registerParticleDensity(); @@ -42,7 +42,7 @@ ParticleLayout::ParticleLayout() : mP_interference_function{nullptr}, m_total_pa } ParticleLayout::ParticleLayout(const IAbstractParticle& particle, double abundance) - : mP_interference_function{nullptr}, m_total_particle_density{0.01} + : m_interference_function{nullptr}, m_total_particle_density{0.01} { setName("ParticleLayout"); addParticle(particle, abundance); @@ -59,8 +59,8 @@ ParticleLayout* ParticleLayout::clone() const for (auto p_particle : m_particles) p_result->addAndRegisterAbstractParticle(p_particle->clone()); - if (mP_interference_function) - p_result->setAndRegisterInterferenceFunction(mP_interference_function->clone()); + if (m_interference_function) + p_result->setAndRegisterInterferenceFunction(m_interference_function->clone()); p_result->setTotalParticleSurfaceDensity(totalParticleSurfaceDensity()); p_result->setWeight(weight()); @@ -105,7 +105,7 @@ SafePointerVector<IParticle> ParticleLayout::particles() const const IInterferenceFunction* ParticleLayout::interferenceFunction() const { - return mP_interference_function.get(); + return m_interference_function.get(); } double ParticleLayout::getTotalAbundance() const @@ -126,7 +126,7 @@ void ParticleLayout::setInterferenceFunction(const IInterferenceFunction& interf double ParticleLayout::totalParticleSurfaceDensity() const { double iff_density = - mP_interference_function ? mP_interference_function->getParticleDensity() : 0.0; + m_interference_function ? m_interference_function->getParticleDensity() : 0.0; return iff_density > 0.0 ? iff_density : m_total_particle_density; } @@ -142,7 +142,7 @@ std::vector<const INode*> ParticleLayout::getChildren() const std::vector<const INode*> result; for (auto particle : m_particles) result.push_back(particle); - result << mP_interference_function; + result << m_interference_function; return result; } @@ -156,10 +156,10 @@ void ParticleLayout::addAndRegisterAbstractParticle(IAbstractParticle* child) //! Sets interference function with simultaneous registration in parent class void ParticleLayout::setAndRegisterInterferenceFunction(IInterferenceFunction* child) { - mP_interference_function.reset(child); + m_interference_function.reset(child); registerChild(child); - if (particleDensityIsProvidedByInterference(*mP_interference_function)) + if (particleDensityIsProvidedByInterference(*m_interference_function)) registerParticleDensity(false); else registerParticleDensity(true); diff --git a/Sample/Aggregate/ParticleLayout.h b/Sample/Aggregate/ParticleLayout.h index 07642d559061a51fe387ec88d0c0adc36c4d5902..e72043f293994ffa4d8587d2bd9fb81cc0097db9 100644 --- a/Sample/Aggregate/ParticleLayout.h +++ b/Sample/Aggregate/ParticleLayout.h @@ -61,7 +61,7 @@ private: void registerWeight(); SafePointerVector<IAbstractParticle> m_particles; //!< Vector of particle types - std::unique_ptr<IInterferenceFunction> mP_interference_function; + std::unique_ptr<IInterferenceFunction> m_interference_function; double m_total_particle_density; }; diff --git a/Sample/Fresnel/FormFactorCoherentPart.cpp b/Sample/Fresnel/FormFactorCoherentPart.cpp index 7e68766613528fc95b7583ba9873b071021a0e21..b8534b200a4861ccf770a350a5c037381d6fc246 100644 --- a/Sample/Fresnel/FormFactorCoherentPart.cpp +++ b/Sample/Fresnel/FormFactorCoherentPart.cpp @@ -19,18 +19,18 @@ #include "Sample/RT/ILayerRTCoefficients.h" #include "Sample/Scattering/IFormFactor.h" -FormFactorCoherentPart::FormFactorCoherentPart(IFormFactor* p_ff) : mP_ff(p_ff) {} +FormFactorCoherentPart::FormFactorCoherentPart(IFormFactor* p_ff) : m_ff(p_ff) {} FormFactorCoherentPart::FormFactorCoherentPart(const FormFactorCoherentPart& other) - : mP_ff(other.mP_ff->clone()), mp_fresnel_map(other.mp_fresnel_map), + : m_ff(other.m_ff->clone()), m_fresnel_map(other.m_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_ff.reset(other.m_ff->clone()); + m_fresnel_map = other.m_fresnel_map; m_layer_index = other.m_layer_index; return *this; } @@ -46,10 +46,10 @@ complex_t FormFactorCoherentPart::evaluate(const SimulationElement& sim_element) WavevectorInfo wavevectors(sim_element.getKi(), sim_element.getMeanKf(), sim_element.getWavelength()); - auto P_in_coeffs = mp_fresnel_map->getInCoefficients(sim_element, m_layer_index); - auto P_out_coeffs = mp_fresnel_map->getOutCoefficients(sim_element, m_layer_index); - mP_ff->setSpecularInfo(std::move(P_in_coeffs), std::move(P_out_coeffs)); - return mP_ff->evaluate(wavevectors); + auto P_in_coeffs = m_fresnel_map->getInCoefficients(sim_element, m_layer_index); + auto P_out_coeffs = m_fresnel_map->getOutCoefficients(sim_element, m_layer_index); + m_ff->setSpecularInfo(std::move(P_in_coeffs), std::move(P_out_coeffs)); + return m_ff->evaluate(wavevectors); } Eigen::Matrix2cd FormFactorCoherentPart::evaluatePol(const SimulationElement& sim_element) const @@ -57,19 +57,19 @@ Eigen::Matrix2cd FormFactorCoherentPart::evaluatePol(const SimulationElement& si WavevectorInfo wavevectors(sim_element.getKi(), sim_element.getMeanKf(), sim_element.getWavelength()); - auto P_in_coeffs = mp_fresnel_map->getInCoefficients(sim_element, m_layer_index); - auto P_out_coeffs = mp_fresnel_map->getOutCoefficients(sim_element, m_layer_index); - mP_ff->setSpecularInfo(std::move(P_in_coeffs), std::move(P_out_coeffs)); - return mP_ff->evaluatePol(wavevectors); + auto P_in_coeffs = m_fresnel_map->getInCoefficients(sim_element, m_layer_index); + auto P_out_coeffs = m_fresnel_map->getOutCoefficients(sim_element, m_layer_index); + m_ff->setSpecularInfo(std::move(P_in_coeffs), std::move(P_out_coeffs)); + return m_ff->evaluatePol(wavevectors); } void FormFactorCoherentPart::setSpecularInfo(const IFresnelMap* p_fresnel_map, size_t layer_index) { - mp_fresnel_map = p_fresnel_map; + m_fresnel_map = p_fresnel_map; m_layer_index = layer_index; } double FormFactorCoherentPart::radialExtension() const { - return mP_ff->radialExtension(); + return m_ff->radialExtension(); } diff --git a/Sample/Fresnel/FormFactorCoherentPart.h b/Sample/Fresnel/FormFactorCoherentPart.h index 10b51b7ef35eaeac3124d721adb370ca3b484ba1..4efc9c8b1728f9f0c267bfaae190b6737ae29c2f 100644 --- a/Sample/Fresnel/FormFactorCoherentPart.h +++ b/Sample/Fresnel/FormFactorCoherentPart.h @@ -45,8 +45,8 @@ public: double radialExtension() const; private: - std::unique_ptr<IFormFactor> mP_ff; - const IFresnelMap* mp_fresnel_map; + std::unique_ptr<IFormFactor> m_ff; + const IFresnelMap* m_fresnel_map; size_t m_layer_index; }; diff --git a/Sample/HardParticle/FormFactorCone.cpp b/Sample/HardParticle/FormFactorCone.cpp index bcae5fd1c28243c656d5739fe58cc2898fed35bb..a938ad329f20de42ca64f6de1c3fab1045cd0a03 100644 --- a/Sample/HardParticle/FormFactorCone.cpp +++ b/Sample/HardParticle/FormFactorCone.cpp @@ -89,5 +89,5 @@ void FormFactorCone::onChange() { m_cot_alpha = MathFunctions::cot(m_alpha); double radius2 = m_radius - m_height * m_cot_alpha; - mP_shape = std::make_unique<DoubleEllipse>(m_radius, m_radius, m_height, radius2, radius2); + m_shape = std::make_unique<DoubleEllipse>(m_radius, m_radius, m_height, radius2, radius2); } diff --git a/Sample/HardParticle/FormFactorCylinder.cpp b/Sample/HardParticle/FormFactorCylinder.cpp index d5c1ec6a99f15094609448d8b2844396298eb9d3..68acfd06720f1c8022f13c85bda1767cccd20349 100644 --- a/Sample/HardParticle/FormFactorCylinder.cpp +++ b/Sample/HardParticle/FormFactorCylinder.cpp @@ -57,5 +57,5 @@ IFormFactor* FormFactorCylinder::sliceFormFactor(ZLimits limits, const IRotation void FormFactorCylinder::onChange() { - mP_shape = std::make_unique<DoubleEllipse>(m_radius, m_radius, m_height, m_radius, m_radius); + m_shape = std::make_unique<DoubleEllipse>(m_radius, m_radius, m_height, m_radius, m_radius); } diff --git a/Sample/HardParticle/FormFactorEllipsoidalCylinder.cpp b/Sample/HardParticle/FormFactorEllipsoidalCylinder.cpp index 837a66f86f185ef50dda0ca1633de9f3f1bcf651..fbf4e354fdec35b27ea79f359f97a8f78fa2e6ba 100644 --- a/Sample/HardParticle/FormFactorEllipsoidalCylinder.cpp +++ b/Sample/HardParticle/FormFactorEllipsoidalCylinder.cpp @@ -64,6 +64,6 @@ IFormFactor* FormFactorEllipsoidalCylinder::sliceFormFactor(ZLimits limits, cons void FormFactorEllipsoidalCylinder::onChange() { - mP_shape = + m_shape = std::make_unique<DoubleEllipse>(m_radius_x, m_radius_y, m_height, m_radius_x, m_radius_y); } diff --git a/Sample/HardParticle/FormFactorFullSpheroid.cpp b/Sample/HardParticle/FormFactorFullSpheroid.cpp index 8a216ab896d488517861d336abd025f1f1fe6b59..6c03b3e0b8e1819f78f2d1c60cd47a125745a483 100644 --- a/Sample/HardParticle/FormFactorFullSpheroid.cpp +++ b/Sample/HardParticle/FormFactorFullSpheroid.cpp @@ -66,6 +66,6 @@ IFormFactor* FormFactorFullSpheroid::sliceFormFactor(ZLimits limits, const IRota void FormFactorFullSpheroid::onChange() { - mP_shape = + m_shape = std::make_unique<TruncatedEllipsoid>(m_radius, m_radius, m_height / 2.0, m_height, 0.0); } diff --git a/Sample/HardParticle/FormFactorHemiEllipsoid.cpp b/Sample/HardParticle/FormFactorHemiEllipsoid.cpp index f4225f067a812c926f0f410e69723096f676862a..4fc7f6337e1e13940bdf2677903b1385c2822b5c 100644 --- a/Sample/HardParticle/FormFactorHemiEllipsoid.cpp +++ b/Sample/HardParticle/FormFactorHemiEllipsoid.cpp @@ -74,6 +74,5 @@ complex_t FormFactorHemiEllipsoid::evaluate_for_q(cvector_t q) const void FormFactorHemiEllipsoid::onChange() { - mP_shape = - std::make_unique<TruncatedEllipsoid>(m_radius_x, m_radius_x, m_height, m_height, 0.0); + m_shape = std::make_unique<TruncatedEllipsoid>(m_radius_x, m_radius_x, m_height, m_height, 0.0); } diff --git a/Sample/HardParticle/FormFactorHollowSphere.cpp b/Sample/HardParticle/FormFactorHollowSphere.cpp index 449617ae344c59168b52d43f0449580971bb25d3..5aad868063bc152b9e5b926911f1b313bb4bb3e7 100644 --- a/Sample/HardParticle/FormFactorHollowSphere.cpp +++ b/Sample/HardParticle/FormFactorHollowSphere.cpp @@ -57,7 +57,7 @@ complex_t FormFactorHollowSphere::evaluate_for_q(cvector_t q) const void FormFactorHollowSphere::onChange() { - mP_shape = std::make_unique<TruncatedEllipsoid>(m_mean, m_mean, m_mean, 2.0 * m_mean, 0.0); + m_shape = std::make_unique<TruncatedEllipsoid>(m_mean, m_mean, m_mean, 2.0 * m_mean, 0.0); } bool FormFactorHollowSphere::checkParameters() const diff --git a/Sample/HardParticle/FormFactorLongBoxGauss.cpp b/Sample/HardParticle/FormFactorLongBoxGauss.cpp index 4aee997417c6287787a71b444ff0810d080635e9..c0e411680af00e482b14738d15c4905861c34349 100644 --- a/Sample/HardParticle/FormFactorLongBoxGauss.cpp +++ b/Sample/HardParticle/FormFactorLongBoxGauss.cpp @@ -54,5 +54,5 @@ IFormFactor* FormFactorLongBoxGauss::sliceFormFactor(ZLimits limits, const IRota void FormFactorLongBoxGauss::onChange() { - mP_shape = std::make_unique<Box>(m_length, m_width, m_height); + m_shape = std::make_unique<Box>(m_length, m_width, m_height); } diff --git a/Sample/HardParticle/FormFactorLongBoxLorentz.cpp b/Sample/HardParticle/FormFactorLongBoxLorentz.cpp index 3f5c4eb2467ac23e4fe6bb435ec955a80584a9ec..ce8c005d1cc746e042e8c25382403a138b8d52d1 100644 --- a/Sample/HardParticle/FormFactorLongBoxLorentz.cpp +++ b/Sample/HardParticle/FormFactorLongBoxLorentz.cpp @@ -54,5 +54,5 @@ IFormFactor* FormFactorLongBoxLorentz::sliceFormFactor(ZLimits limits, const IRo void FormFactorLongBoxLorentz::onChange() { - mP_shape = std::make_unique<Box>(m_length, m_width, m_height); + m_shape = std::make_unique<Box>(m_length, m_width, m_height); } diff --git a/Sample/HardParticle/FormFactorTruncatedSphere.cpp b/Sample/HardParticle/FormFactorTruncatedSphere.cpp index 077034ce5bf2ad7f98228268db177d4b2d6cbc17..7191783b624c949957cc887787d163a884a0a34e 100644 --- a/Sample/HardParticle/FormFactorTruncatedSphere.cpp +++ b/Sample/HardParticle/FormFactorTruncatedSphere.cpp @@ -90,5 +90,5 @@ IFormFactor* FormFactorTruncatedSphere::sliceFormFactor(ZLimits limits, const IR void FormFactorTruncatedSphere::onChange() { - mP_shape = std::make_unique<TruncatedEllipsoid>(m_radius, m_radius, m_radius, m_height, m_dh); + m_shape = std::make_unique<TruncatedEllipsoid>(m_radius, m_radius, m_radius, m_height, m_dh); } diff --git a/Sample/HardParticle/FormFactorTruncatedSpheroid.cpp b/Sample/HardParticle/FormFactorTruncatedSpheroid.cpp index d757f3bd277b4305c2f3fb1c60493da06e152fde..9e0606ad3c85234a79bf11c3e4085561dbb3a8a1 100644 --- a/Sample/HardParticle/FormFactorTruncatedSpheroid.cpp +++ b/Sample/HardParticle/FormFactorTruncatedSpheroid.cpp @@ -96,6 +96,6 @@ IFormFactor* FormFactorTruncatedSpheroid::sliceFormFactor(ZLimits limits, const void FormFactorTruncatedSpheroid::onChange() { - mP_shape.reset( + m_shape.reset( new TruncatedEllipsoid(m_radius, m_radius, m_height_flattening * m_radius, m_height, m_dh)); } diff --git a/Sample/HardParticle/IProfileRipple.cpp b/Sample/HardParticle/IProfileRipple.cpp index 386b123111a494ac11a264d0a7fd5511c12347d0..5cc12a21ba02fb05be13ac70e5a2eb815bc25d96 100644 --- a/Sample/HardParticle/IProfileRipple.cpp +++ b/Sample/HardParticle/IProfileRipple.cpp @@ -61,7 +61,7 @@ complex_t IProfileRectangularRipple::factor_yz(complex_t qy, complex_t qz) const void IProfileRectangularRipple::onChange() { - mP_shape = std::make_unique<Box>(m_length, m_width, m_height); + m_shape = std::make_unique<Box>(m_length, m_width, m_height); } // ************************************************************************** // @@ -82,7 +82,7 @@ complex_t ICosineRipple::factor_yz(complex_t qy, complex_t qz) const void ICosineRipple::onChange() { - mP_shape = std::make_unique<RippleCosine>(m_length, m_width, m_height); + m_shape = std::make_unique<RippleCosine>(m_length, m_width, m_height); } // ************************************************************************** // @@ -106,5 +106,5 @@ complex_t ISawtoothRipple::factor_yz(complex_t qy, complex_t qz) const void ISawtoothRipple::onChange() { - mP_shape = std::make_unique<RippleSawtooth>(m_length, m_width, m_height, m_asymmetry); + m_shape = std::make_unique<RippleSawtooth>(m_length, m_width, m_height, m_asymmetry); } diff --git a/Sample/Interference/DecouplingApproximationStrategy.cpp b/Sample/Interference/DecouplingApproximationStrategy.cpp index c57430887b6221f651248bcdbde92763ba472d56..8b9b7ea07d6a598de9e866276c528bcdb1f944cf 100644 --- a/Sample/Interference/DecouplingApproximationStrategy.cpp +++ b/Sample/Interference/DecouplingApproximationStrategy.cpp @@ -49,7 +49,7 @@ DecouplingApproximationStrategy::scalarCalculation(const SimulationElement& sim_ intensity += fraction * std::norm(ff); } double amplitude_norm = std::norm(amplitude); - double itf_function = mP_iff->evaluate(sim_element.getMeanQ()); + double itf_function = m_iff->evaluate(sim_element.getMeanQ()); return intensity + amplitude_norm * (itf_function - 1.0); } @@ -78,6 +78,6 @@ DecouplingApproximationStrategy::polarizedCalculation(const SimulationElement& s Eigen::Matrix2cd intensity_matrix = polarization_handler.getAnalyzerOperator() * mean_intensity; double amplitude_trace = std::abs(amplitude_matrix.trace()); double intensity_trace = std::abs(intensity_matrix.trace()); - double itf_function = mP_iff->evaluate(sim_element.getMeanQ()); + double itf_function = m_iff->evaluate(sim_element.getMeanQ()); return intensity_trace + amplitude_trace * (itf_function - 1.0); } diff --git a/Sample/Interference/IInterferenceFunctionStrategy.cpp b/Sample/Interference/IInterferenceFunctionStrategy.cpp index f982fdf91bace51c2533bba5f2fa0a211b19e982..cb4a6a9ddfac766aa7cb221e118873c0e00f9fb9 100644 --- a/Sample/Interference/IInterferenceFunctionStrategy.cpp +++ b/Sample/Interference/IInterferenceFunctionStrategy.cpp @@ -21,8 +21,8 @@ IInterferenceFunctionStrategy::IInterferenceFunctionStrategy(const SimulationOptions& sim_params, bool polarized) - : mP_iff(nullptr), m_options(sim_params), m_polarized(polarized), - mP_integrator( + : m_iff(nullptr), m_options(sim_params), m_polarized(polarized), + m_integrator( make_integrator_miser(this, &IInterferenceFunctionStrategy::evaluate_for_fixed_angles, 2)) { } @@ -38,9 +38,9 @@ void IInterferenceFunctionStrategy::init( "IInterferenceFunctionStrategy::init: strategy gets no form factors."); m_formfactor_wrappers = weighted_formfactors; if (p_iff) - mP_iff.reset(p_iff->clone()); + m_iff.reset(p_iff->clone()); else - mP_iff.reset(new InterferenceFunctionNone()); + m_iff.reset(new InterferenceFunctionNone()); strategy_specific_post_init(); } @@ -67,8 +67,8 @@ IInterferenceFunctionStrategy::MCIntegratedEvaluate(const SimulationElement& sim { double min_array[] = {0.0, 0.0}; double max_array[] = {1.0, 1.0}; - return mP_integrator->integrate(min_array, max_array, (void*)&sim_element, - m_options.getMcPoints()); + return m_integrator->integrate(min_array, max_array, (void*)&sim_element, + m_options.getMcPoints()); } double IInterferenceFunctionStrategy::evaluate_for_fixed_angles(double* fractions, size_t, @@ -79,7 +79,7 @@ double IInterferenceFunctionStrategy::evaluate_for_fixed_angles(double* fraction SimulationElement* pars = static_cast<SimulationElement*>(params); - SimulationElement sim_element(*pars, par0, par1); + SimulationElement sim_element = pars->pointElement(par0, par1); return pars->getIntegrationFactor(par0, par1) * evaluateSinglePoint(sim_element); } diff --git a/Sample/Interference/IInterferenceFunctionStrategy.h b/Sample/Interference/IInterferenceFunctionStrategy.h index ecb80ad35458a983e8c102a39ca64685ef63b04e..ba0a541a81c57adc184bc3ea60ef6193d651a249 100644 --- a/Sample/Interference/IInterferenceFunctionStrategy.h +++ b/Sample/Interference/IInterferenceFunctionStrategy.h @@ -53,7 +53,7 @@ public: protected: std::vector<FormFactorCoherentSum> m_formfactor_wrappers; - std::unique_ptr<IInterferenceFunction> mP_iff; + std::unique_ptr<IInterferenceFunction> m_iff; SimulationOptions m_options; private: @@ -69,7 +69,7 @@ private: bool m_polarized; #ifndef SWIG - std::unique_ptr<IntegratorMCMiser<IInterferenceFunctionStrategy>> mP_integrator; + std::unique_ptr<IntegratorMCMiser<IInterferenceFunctionStrategy>> m_integrator; #endif }; diff --git a/Sample/Interference/SSCApproximationStrategy.cpp b/Sample/Interference/SSCApproximationStrategy.cpp index 5f1eece3c3a08bb5161c37ee5947bde3eb76cb6a..6040bbfff232ecf0e4fb6a9a1d7e56f2c00c2409 100644 --- a/Sample/Interference/SSCApproximationStrategy.cpp +++ b/Sample/Interference/SSCApproximationStrategy.cpp @@ -47,9 +47,9 @@ double SSCApproximationStrategy::scalarCalculation(const SimulationElement& sim_ complex_t mean_ff_norm = m_helper.getMeanFormfactorNorm(qp, precomputed_ff, m_formfactor_wrappers); complex_t p2kappa = m_helper.getCharacteristicSizeCoupling(qp, m_formfactor_wrappers); - complex_t omega = m_helper.getCharacteristicDistribution(qp, mP_iff.get()); + complex_t omega = m_helper.getCharacteristicDistribution(qp, m_iff.get()); double iff = 2.0 * (mean_ff_norm * omega / (1.0 - p2kappa * omega)).real(); - double dw_factor = mP_iff->DWfactor(sim_element.getMeanQ()); + double dw_factor = m_iff->DWfactor(sim_element.getMeanQ()); return diffuse_intensity + dw_factor * iff; } @@ -68,13 +68,13 @@ double SSCApproximationStrategy::polarizedCalculation(const SimulationElement& s Eigen::Matrix2cd mff_orig, mff_conj; // original and conjugated mean formfactor m_helper.getMeanFormfactors(qp, mff_orig, mff_conj, precomputed_ff, m_formfactor_wrappers); complex_t p2kappa = m_helper.getCharacteristicSizeCoupling(qp, m_formfactor_wrappers); - complex_t omega = m_helper.getCharacteristicDistribution(qp, mP_iff.get()); + complex_t omega = m_helper.getCharacteristicDistribution(qp, m_iff.get()); Eigen::Matrix2cd interference_matrix = (2.0 * omega / (1.0 - p2kappa * omega)) * polarization_handler.getAnalyzerOperator() * mff_orig * polarization_handler.getPolarization() * mff_conj; Eigen::Matrix2cd diffuse_matrix2 = polarization_handler.getAnalyzerOperator() * diffuse_matrix; double interference_trace = std::abs(interference_matrix.trace()); double diffuse_trace = std::abs(diffuse_matrix2.trace()); - double dw_factor = mP_iff->DWfactor(sim_element.getMeanQ()); + double dw_factor = m_iff->DWfactor(sim_element.getMeanQ()); return diffuse_trace + dw_factor * interference_trace; } diff --git a/Sample/Lattice/Lattice.cpp b/Sample/Lattice/Lattice.cpp index dda413a56d0484b7b9bc94e218ffbd02ee1320e7..5ecfdf162e8f6ee3c775379a4b4c37ca43f0ad2a 100644 --- a/Sample/Lattice/Lattice.cpp +++ b/Sample/Lattice/Lattice.cpp @@ -20,7 +20,7 @@ #include <gsl/gsl_linalg.h> Lattice::Lattice() - : mp_selection_rule(nullptr), m_a({1.0, 0.0, 0.0}), m_b({0.0, 1.0, 0.0}), m_c({0.0, 0.0, 1.0}), + : m_selection_rule(nullptr), m_a({1.0, 0.0, 0.0}), m_b({0.0, 1.0, 0.0}), m_c({0.0, 0.0, 1.0}), m_cache_ok(false) { setName("Lattice"); @@ -29,7 +29,7 @@ Lattice::Lattice() } Lattice::Lattice(const kvector_t a1, const kvector_t a2, const kvector_t a3) - : mp_selection_rule(nullptr), m_a(a1), m_b(a2), m_c(a3), m_cache_ok(false) + : m_selection_rule(nullptr), m_a(a1), m_b(a2), m_c(a3), m_cache_ok(false) { setName("Lattice"); initialize(); @@ -37,19 +37,19 @@ Lattice::Lattice(const kvector_t a1, const kvector_t a2, const kvector_t a3) } Lattice::Lattice(const Lattice& lattice) - : INode(), mp_selection_rule(nullptr), m_a(lattice.m_a), m_b(lattice.m_b), m_c(lattice.m_c), + : INode(), m_selection_rule(nullptr), m_a(lattice.m_a), m_b(lattice.m_b), m_c(lattice.m_c), m_cache_ok(false) { setName("Lattice"); initialize(); - if (lattice.mp_selection_rule) - setSelectionRule(*lattice.mp_selection_rule); + if (lattice.m_selection_rule) + setSelectionRule(*lattice.m_selection_rule); registerBasisVectors(); } Lattice::~Lattice() { - delete mp_selection_rule; + delete m_selection_rule; } Lattice Lattice::createTransformedLattice(const Transform3D& transform) const @@ -58,8 +58,8 @@ Lattice Lattice::createTransformedLattice(const Transform3D& transform) const kvector_t a2 = transform.transformed(m_b); kvector_t a3 = transform.transformed(m_c); Lattice result = {a1, a2, a3}; - if (mp_selection_rule) - result.setSelectionRule(*mp_selection_rule); + if (m_selection_rule) + result.setSelectionRule(*m_selection_rule); return result; } @@ -223,7 +223,7 @@ std::vector<kvector_t> Lattice::vectorsWithinRadius(const kvector_t input_vector for (int index_Z = -max_Z; index_Z <= max_Z; ++index_Z) { ivector_t coords(index_X + nearest_coords[0], index_Y + nearest_coords[1], index_Z + nearest_coords[2]); - if (mp_selection_rule && !mp_selection_rule->coordinateSelected(coords)) + if (m_selection_rule && !m_selection_rule->coordinateSelected(coords)) continue; kvector_t latticePoint = coords[0] * v1 + coords[1] * v2 + coords[2] * v3; if ((latticePoint - input_vector).mag() <= radius) @@ -276,6 +276,6 @@ void Lattice::computeInverseVectors(const kvector_t v1, const kvector_t v2, cons void Lattice::setSelectionRule(const ISelectionRule& p_selection_rule) { - delete mp_selection_rule; - mp_selection_rule = p_selection_rule.clone(); + delete m_selection_rule; + m_selection_rule = p_selection_rule.clone(); } diff --git a/Sample/Lattice/Lattice.h b/Sample/Lattice/Lattice.h index d5340e46e1d22e394ef454e5aaafbf7789873ff7..9350a4ac4727fd65170a1c7c3adecf473aca19ee 100644 --- a/Sample/Lattice/Lattice.h +++ b/Sample/Lattice/Lattice.h @@ -109,7 +109,7 @@ private: void computeReciprocalVectors() const; static void computeInverseVectors(const kvector_t v1, const kvector_t v2, const kvector_t v3, kvector_t o1, kvector_t o2, kvector_t o3); - ISelectionRule* mp_selection_rule; + ISelectionRule* m_selection_rule; kvector_t m_a, m_b, m_c; //!< Basis vectors in real space mutable kvector_t m_ra, m_rb, m_rc; //!< Cache of basis vectors in reciprocal space //! Boolean indicating if the reciprocal vectors are already initialized in the cache diff --git a/Sample/Particle/Crystal.cpp b/Sample/Particle/Crystal.cpp index f601fd2038e2efaa13dcea07846460abf180ace9..9f539cd1ddda262368cf386840d7a9ea329df6e6 100644 --- a/Sample/Particle/Crystal.cpp +++ b/Sample/Particle/Crystal.cpp @@ -22,9 +22,9 @@ Crystal::Crystal(const IParticle& lattice_basis, const Lattice& lattice) : m_lattice(lattice), m_position_variance(0.0) { setName("Crystal"); - mp_lattice_basis.reset(lattice_basis.clone()); - mp_lattice_basis->registerAbundance(false); - registerChild(mp_lattice_basis.get()); + m_lattice_basis.reset(lattice_basis.clone()); + m_lattice_basis->registerAbundance(false); + registerChild(m_lattice_basis.get()); registerChild(&m_lattice); } @@ -32,7 +32,7 @@ Crystal::~Crystal() = default; Crystal* Crystal::clone() const { - Crystal* p_new = new Crystal(*mp_lattice_basis, m_lattice); + Crystal* p_new = new Crystal(*m_lattice_basis, m_lattice); p_new->setPositionVariance(m_position_variance); return p_new; } @@ -42,7 +42,7 @@ IFormFactor* Crystal::createTotalFormFactor(const IFormFactor& meso_crystal_form const kvector_t& translation) const { Lattice transformed_lattice = transformedLattice(p_rotation); - std::unique_ptr<IParticle> P_basis_clone{mp_lattice_basis->clone()}; + std::unique_ptr<IParticle> P_basis_clone{m_lattice_basis->clone()}; if (p_rotation) P_basis_clone->rotate(*p_rotation); P_basis_clone->translate(translation); @@ -57,7 +57,7 @@ std::vector<HomogeneousRegion> Crystal::homogeneousRegions() const double unit_cell_volume = m_lattice.volume(); if (unit_cell_volume <= 0) return {}; - auto particles = mp_lattice_basis->decompose(); + auto particles = m_lattice_basis->decompose(); ZLimits limits; for (auto p_particle : particles) { auto sliced_particle = p_particle->createSlicedParticle(limits); @@ -79,14 +79,14 @@ Lattice Crystal::transformedLattice(const IRotation* p_rotation) const std::vector<const INode*> Crystal::getChildren() const { - return std::vector<const INode*>() << mp_lattice_basis << &m_lattice; + return std::vector<const INode*>() << m_lattice_basis << &m_lattice; } Crystal::Crystal(IParticle* p_lattice_basis, const Lattice& lattice) : m_lattice(lattice), m_position_variance(0.0) { setName("Crystal"); - mp_lattice_basis.reset(p_lattice_basis); - registerChild(mp_lattice_basis.get()); + m_lattice_basis.reset(p_lattice_basis); + registerChild(m_lattice_basis.get()); registerChild(&m_lattice); } diff --git a/Sample/Particle/Crystal.h b/Sample/Particle/Crystal.h index cd9cb2da36d19cdd2a9212bd607be810f4071549..690840c1c3bce9925891a30a7565aeb5ebb22360 100644 --- a/Sample/Particle/Crystal.h +++ b/Sample/Particle/Crystal.h @@ -48,7 +48,7 @@ private: Crystal(IParticle* p_lattice_basis, const Lattice& lattice); Lattice m_lattice; - std::unique_ptr<IParticle> mp_lattice_basis; + std::unique_ptr<IParticle> m_lattice_basis; double m_position_variance; }; diff --git a/Sample/Particle/FormFactorCoreShell.cpp b/Sample/Particle/FormFactorCoreShell.cpp index 6066d2aad29f728b6ba0495fec62850888911ba5..2fd62e45fbf73457260920bf6cd0fdb02d30db70 100644 --- a/Sample/Particle/FormFactorCoreShell.cpp +++ b/Sample/Particle/FormFactorCoreShell.cpp @@ -15,7 +15,7 @@ #include "Sample/Particle/FormFactorCoreShell.h" FormFactorCoreShell::FormFactorCoreShell(IFormFactor* core, IFormFactor* shell) - : mP_core(core), mP_shell(shell) + : m_core(core), m_shell(shell) { setName("FormFactorCoreShell"); } @@ -24,35 +24,35 @@ FormFactorCoreShell::~FormFactorCoreShell() = default; FormFactorCoreShell* FormFactorCoreShell::clone() const { - return new FormFactorCoreShell(mP_core->clone(), mP_shell->clone()); + return new FormFactorCoreShell(m_core->clone(), m_shell->clone()); } double FormFactorCoreShell::radialExtension() const { - return mP_shell->radialExtension(); + return m_shell->radialExtension(); } double FormFactorCoreShell::bottomZ(const IRotation& rotation) const { - return mP_shell->bottomZ(rotation); + return m_shell->bottomZ(rotation); } double FormFactorCoreShell::topZ(const IRotation& rotation) const { - return mP_shell->topZ(rotation); + return m_shell->topZ(rotation); } void FormFactorCoreShell::setAmbientMaterial(const Material& material) { - mP_shell->setAmbientMaterial(material); + m_shell->setAmbientMaterial(material); } complex_t FormFactorCoreShell::evaluate(const WavevectorInfo& wavevectors) const { - return mP_shell->evaluate(wavevectors) + mP_core->evaluate(wavevectors); + return m_shell->evaluate(wavevectors) + m_core->evaluate(wavevectors); } Eigen::Matrix2cd FormFactorCoreShell::evaluatePol(const WavevectorInfo& wavevectors) const { - return mP_shell->evaluatePol(wavevectors) + mP_core->evaluatePol(wavevectors); + return m_shell->evaluatePol(wavevectors) + m_core->evaluatePol(wavevectors); } diff --git a/Sample/Particle/FormFactorCoreShell.h b/Sample/Particle/FormFactorCoreShell.h index 1c1b8353bb1207626bba70ae2343a611c13ae5c8..539d164da0732671581636596a47a50f36391c44 100644 --- a/Sample/Particle/FormFactorCoreShell.h +++ b/Sample/Particle/FormFactorCoreShell.h @@ -51,8 +51,8 @@ public: #endif protected: - std::unique_ptr<IFormFactor> mP_core; - std::unique_ptr<IFormFactor> mP_shell; + std::unique_ptr<IFormFactor> m_core; + std::unique_ptr<IFormFactor> m_shell; }; #endif // BORNAGAIN_CORE_PARTICLE_FORMFACTORCORESHELL_H diff --git a/Sample/Particle/FormFactorCrystal.cpp b/Sample/Particle/FormFactorCrystal.cpp index c35843aaf26811565882ee73b6c2b0be00b4d207..bc0f68bbfc37110742291b55295bb8cd1227f7de 100644 --- a/Sample/Particle/FormFactorCrystal.cpp +++ b/Sample/Particle/FormFactorCrystal.cpp @@ -19,8 +19,8 @@ FormFactorCrystal::FormFactorCrystal(const Lattice& lattice, const IFormFactor& basis_form_factor, const IFormFactor& meso_form_factor, double position_variance) - : m_lattice(lattice), mp_basis_form_factor(basis_form_factor.clone()), - mp_meso_form_factor(meso_form_factor.clone()), m_position_variance(position_variance) + : m_lattice(lattice), m_basis_form_factor(basis_form_factor.clone()), + m_meso_form_factor(meso_form_factor.clone()), m_position_variance(position_variance) { setName("FormFactorCrystal"); calculateLargestReciprocalDistance(); @@ -28,18 +28,18 @@ FormFactorCrystal::FormFactorCrystal(const Lattice& lattice, const IFormFactor& FormFactorCrystal::~FormFactorCrystal() { - delete mp_basis_form_factor; - delete mp_meso_form_factor; + delete m_basis_form_factor; + delete m_meso_form_factor; } double FormFactorCrystal::bottomZ(const IRotation& rotation) const { - return mp_meso_form_factor->bottomZ(rotation); + return m_meso_form_factor->bottomZ(rotation); } double FormFactorCrystal::topZ(const IRotation& rotation) const { - return mp_meso_form_factor->topZ(rotation); + return m_meso_form_factor->topZ(rotation); } complex_t FormFactorCrystal::evaluate(const WavevectorInfo& wavevectors) const @@ -55,10 +55,10 @@ complex_t FormFactorCrystal::evaluate(const WavevectorInfo& wavevectors) const for (const auto& rec : rec_vectors) { auto dw_factor = debyeWallerFactor(rec); WavevectorInfo basis_wavevectors(kvector_t(), -rec, wavevectors.getWavelength()); - complex_t basis_factor = mp_basis_form_factor->evaluate(basis_wavevectors); + complex_t basis_factor = m_basis_form_factor->evaluate(basis_wavevectors); WavevectorInfo meso_wavevectors(cvector_t(), rec.complex() - q, wavevectors.getWavelength()); - complex_t meso_factor = mp_meso_form_factor->evaluate(meso_wavevectors); + complex_t meso_factor = m_meso_form_factor->evaluate(meso_wavevectors); result += dw_factor * basis_factor * meso_factor; } // the transformed delta train gets a factor of (2pi)^3/V, but the (2pi)^3 @@ -80,10 +80,10 @@ Eigen::Matrix2cd FormFactorCrystal::evaluatePol(const WavevectorInfo& wavevector for (const auto& rec : rec_vectors) { auto dw_factor = debyeWallerFactor(rec); WavevectorInfo basis_wavevectors(kvector_t(), -rec, wavevectors.getWavelength()); - Eigen::Matrix2cd basis_factor = mp_basis_form_factor->evaluatePol(basis_wavevectors); + Eigen::Matrix2cd basis_factor = m_basis_form_factor->evaluatePol(basis_wavevectors); WavevectorInfo meso_wavevectors(cvector_t(), rec.complex() - q, wavevectors.getWavelength()); - complex_t meso_factor = mp_meso_form_factor->evaluate(meso_wavevectors); + complex_t meso_factor = m_meso_form_factor->evaluate(meso_wavevectors); result += dw_factor * basis_factor * meso_factor; } // the transformed delta train gets a factor of (2pi)^3/V, but the (2pi)^3 diff --git a/Sample/Particle/FormFactorCrystal.h b/Sample/Particle/FormFactorCrystal.h index 8f0cf4672dd0debf2f8f049e267f96037fb296a9..9fbe492b2abb2c39c454dc5bd365b82bdb3a52b7 100644 --- a/Sample/Particle/FormFactorCrystal.h +++ b/Sample/Particle/FormFactorCrystal.h @@ -30,7 +30,7 @@ public: FormFactorCrystal* clone() const override final { - return new FormFactorCrystal(m_lattice, *mp_basis_form_factor, *mp_meso_form_factor, + return new FormFactorCrystal(m_lattice, *m_basis_form_factor, *m_meso_form_factor, m_position_variance); } @@ -38,11 +38,11 @@ public: void setAmbientMaterial(const Material& material) override { - mp_basis_form_factor->setAmbientMaterial(material); + m_basis_form_factor->setAmbientMaterial(material); } - double volume() const override final { return mp_meso_form_factor->volume(); } - double radialExtension() const override final { return mp_meso_form_factor->radialExtension(); } + double volume() const override final { return m_meso_form_factor->volume(); } + double radialExtension() const override final { return m_meso_form_factor->radialExtension(); } double bottomZ(const IRotation& rotation) const override; @@ -58,8 +58,8 @@ private: complex_t debyeWallerFactor(const kvector_t& q_i) const; Lattice m_lattice; - IFormFactor* mp_basis_form_factor; - IFormFactor* mp_meso_form_factor; //!< The outer shape of this mesocrystal + IFormFactor* m_basis_form_factor; + IFormFactor* m_meso_form_factor; //!< The outer shape of this mesocrystal double m_position_variance; double m_max_rec_length; }; diff --git a/Sample/Particle/IParticle.cpp b/Sample/Particle/IParticle.cpp index d29a8b4a655a4cac8656aa133ef0962d626e76ec..58bb692971dd59e7c5b1f155effec18b8d221ed6 100644 --- a/Sample/Particle/IParticle.cpp +++ b/Sample/Particle/IParticle.cpp @@ -22,7 +22,7 @@ IParticle::~IParticle() = default; IFormFactor* IParticle::createFormFactor() const { - return createSlicedParticle(ZLimits{}).mP_slicedff.release(); + return createSlicedParticle(ZLimits{}).m_slicedff.release(); } SlicedParticle IParticle::createSlicedParticle(ZLimits) const @@ -38,29 +38,29 @@ void IParticle::translate(kvector_t translation) const IRotation* IParticle::rotation() const { - return mP_rotation.get(); + return m_rotation.get(); } void IParticle::setRotation(const IRotation& rotation) { - mP_rotation.reset(rotation.clone()); - registerChild(mP_rotation.get()); + m_rotation.reset(rotation.clone()); + registerChild(m_rotation.get()); } void IParticle::rotate(const IRotation& rotation) { - if (mP_rotation) { - mP_rotation.reset(createProduct(rotation, *mP_rotation)); + if (m_rotation) { + m_rotation.reset(createProduct(rotation, *m_rotation)); } else { - mP_rotation.reset(rotation.clone()); + m_rotation.reset(rotation.clone()); } m_position = rotation.transformed(m_position); - registerChild(mP_rotation.get()); + registerChild(m_rotation.get()); } std::vector<const INode*> IParticle::getChildren() const { - return std::vector<const INode*>() << mP_rotation; + return std::vector<const INode*>() << m_rotation; } void IParticle::registerAbundance(bool make_registered) @@ -101,13 +101,13 @@ ParticleLimits IParticle::bottomTopZ() const IRotation* IParticle::createComposedRotation(const IRotation* p_rotation) const { if (p_rotation) { - if (mP_rotation) - return createProduct(*p_rotation, *mP_rotation); + if (m_rotation) + return createProduct(*p_rotation, *m_rotation); else return p_rotation->clone(); } else { - if (mP_rotation) - return mP_rotation->clone(); + if (m_rotation) + return m_rotation->clone(); else return nullptr; } diff --git a/Sample/Particle/IParticle.h b/Sample/Particle/IParticle.h index 3d5262af485b1769a4a393a48833b0c98f479901..17d25c9865681c29bee15837f5a666f19c27aa1d 100644 --- a/Sample/Particle/IParticle.h +++ b/Sample/Particle/IParticle.h @@ -92,7 +92,7 @@ protected: void registerParticleProperties(); kvector_t m_position; - std::unique_ptr<IRotation> mP_rotation; + std::unique_ptr<IRotation> m_rotation; }; #endif // BORNAGAIN_CORE_PARTICLE_IPARTICLE_H diff --git a/Sample/Particle/MesoCrystal.cpp b/Sample/Particle/MesoCrystal.cpp index 5b4eb101ef6d57e5e55a59add454798021252d1f..4ddb436ef968f1a87b16e1eb5181f60192eb75e3 100644 --- a/Sample/Particle/MesoCrystal.cpp +++ b/Sample/Particle/MesoCrystal.cpp @@ -20,7 +20,7 @@ MesoCrystal::MesoCrystal(const IClusteredParticles& particle_structure, const IFormFactor& form_factor) - : mp_particle_structure(particle_structure.clone()), mp_meso_form_factor(form_factor.clone()) + : m_particle_structure(particle_structure.clone()), m_meso_form_factor(form_factor.clone()) { initialize(); } @@ -30,10 +30,10 @@ MesoCrystal::~MesoCrystal() = default; MesoCrystal* MesoCrystal::clone() const { MesoCrystal* p_result = - new MesoCrystal(mp_particle_structure->clone(), mp_meso_form_factor->clone()); + new MesoCrystal(m_particle_structure->clone(), m_meso_form_factor->clone()); p_result->setAbundance(m_abundance); - if (mP_rotation) - p_result->setRotation(*mP_rotation); + if (m_rotation) + p_result->setRotation(*m_rotation); p_result->setPosition(m_position); return p_result; } @@ -45,21 +45,21 @@ void MesoCrystal::accept(INodeVisitor* visitor) const SlicedParticle MesoCrystal::createSlicedParticle(ZLimits limits) const { - if (!mp_particle_structure || !mp_meso_form_factor) + if (!m_particle_structure || !m_meso_form_factor) return {}; std::unique_ptr<IRotation> P_rotation(IRotation::createIdentity()); - if (mP_rotation) - P_rotation.reset(mP_rotation->clone()); - std::unique_ptr<IFormFactor> P_temp_ff( - mp_meso_form_factor->createSlicedFormFactor(limits, *P_rotation, m_position)); + if (m_rotation) + P_rotation.reset(m_rotation->clone()); + std::unique_ptr<IFormFactor> P_tem_ff( + m_meso_form_factor->createSlicedFormFactor(limits, *P_rotation, m_position)); std::unique_ptr<IFormFactor> P_total_ff( - mp_particle_structure->createTotalFormFactor(*P_temp_ff, P_rotation.get(), m_position)); - double meso_volume = mp_meso_form_factor->volume(); - auto regions = mp_particle_structure->homogeneousRegions(); + m_particle_structure->createTotalFormFactor(*P_tem_ff, P_rotation.get(), m_position)); + double meso_volume = m_meso_form_factor->volume(); + auto regions = m_particle_structure->homogeneousRegions(); for (auto& region : regions) region.m_volume *= meso_volume; SlicedParticle result; - result.mP_slicedff = std::move(P_total_ff); + result.m_slicedff = std::move(P_total_ff); result.m_regions = regions; return result; } @@ -67,11 +67,11 @@ SlicedParticle MesoCrystal::createSlicedParticle(ZLimits limits) const std::vector<const INode*> MesoCrystal::getChildren() const { return std::vector<const INode*>() - << IParticle::getChildren() << mp_particle_structure << mp_meso_form_factor; + << IParticle::getChildren() << m_particle_structure << m_meso_form_factor; } MesoCrystal::MesoCrystal(IClusteredParticles* p_particle_structure, IFormFactor* p_form_factor) - : mp_particle_structure(p_particle_structure), mp_meso_form_factor(p_form_factor) + : m_particle_structure(p_particle_structure), m_meso_form_factor(p_form_factor) { initialize(); } @@ -80,6 +80,6 @@ void MesoCrystal::initialize() { setName("MesoCrystal"); registerParticleProperties(); - registerChild(mp_particle_structure.get()); - registerChild(mp_meso_form_factor.get()); + registerChild(m_particle_structure.get()); + registerChild(m_meso_form_factor.get()); } diff --git a/Sample/Particle/MesoCrystal.h b/Sample/Particle/MesoCrystal.h index e51f8c6fc41052675de9911876b91bf7b3537ff2..f2312ad67943d263af95ae363d4b630b9ee3fab3 100644 --- a/Sample/Particle/MesoCrystal.h +++ b/Sample/Particle/MesoCrystal.h @@ -40,8 +40,8 @@ private: MesoCrystal(IClusteredParticles* p_particle_structure, IFormFactor* p_form_factor); void initialize(); - std::unique_ptr<IClusteredParticles> mp_particle_structure; //!< Crystal structure - std::unique_ptr<IFormFactor> mp_meso_form_factor; //!< Outer shape of this mesocrystal + std::unique_ptr<IClusteredParticles> m_particle_structure; //!< Crystal structure + std::unique_ptr<IFormFactor> m_meso_form_factor; //!< Outer shape of this mesocrystal }; #endif // BORNAGAIN_CORE_PARTICLE_MESOCRYSTAL_H diff --git a/Sample/Particle/Particle.cpp b/Sample/Particle/Particle.cpp index 8dcd3f5ac8f640343a3fb32655196e3eb00a304c..487299279a713ae447eab64550a8cda0555f43a5 100644 --- a/Sample/Particle/Particle.cpp +++ b/Sample/Particle/Particle.cpp @@ -28,28 +28,28 @@ Particle::Particle(Material material) : m_material(std::move(material)) } Particle::Particle(Material material, const IFormFactor& form_factor) - : m_material(std::move(material)), mP_form_factor(form_factor.clone()) + : m_material(std::move(material)), m_form_factor(form_factor.clone()) { initialize(); - registerChild(mP_form_factor.get()); + registerChild(m_form_factor.get()); } Particle::Particle(Material material, const IFormFactor& form_factor, const IRotation& rotation) - : m_material(std::move(material)), mP_form_factor(form_factor.clone()) + : m_material(std::move(material)), m_form_factor(form_factor.clone()) { initialize(); setRotation(rotation); - registerChild(mP_form_factor.get()); + registerChild(m_form_factor.get()); } Particle* Particle::clone() const { Particle* p_result = new Particle(m_material); p_result->setAbundance(m_abundance); - if (mP_form_factor) - p_result->setFormFactor(*mP_form_factor); - if (mP_rotation) - p_result->setRotation(*mP_rotation); + if (m_form_factor) + p_result->setFormFactor(*m_form_factor); + if (m_rotation) + p_result->setRotation(*m_rotation); p_result->setPosition(m_position); return p_result; @@ -57,22 +57,22 @@ Particle* Particle::clone() const SlicedParticle Particle::createSlicedParticle(ZLimits limits) const { - if (!mP_form_factor) + if (!m_form_factor) return {}; std::unique_ptr<IRotation> P_rotation(IRotation::createIdentity()); - if (mP_rotation) - P_rotation.reset(mP_rotation->clone()); - std::unique_ptr<IFormFactor> P_temp_ff( - mP_form_factor->createSlicedFormFactor(limits, *P_rotation, m_position)); - if (!P_temp_ff) + if (m_rotation) + P_rotation.reset(m_rotation->clone()); + std::unique_ptr<IFormFactor> P_tem_ff( + m_form_factor->createSlicedFormFactor(limits, *P_rotation, m_position)); + if (!P_tem_ff) return {}; - std::unique_ptr<FormFactorDecoratorMaterial> P_ff(new FormFactorDecoratorMaterial(*P_temp_ff)); - double volume = P_temp_ff->volume(); + std::unique_ptr<FormFactorDecoratorMaterial> P_ff(new FormFactorDecoratorMaterial(*P_tem_ff)); + double volume = P_tem_ff->volume(); Material transformed_material(m_material.rotatedMaterial(P_rotation->getTransform3D())); P_ff->setMaterial(transformed_material); SlicedParticle result; result.m_regions.push_back({volume, transformed_material}); - result.mP_slicedff = std::move(P_ff); + result.m_slicedff = std::move(P_ff); return result; } @@ -83,15 +83,15 @@ void Particle::setMaterial(Material material) void Particle::setFormFactor(const IFormFactor& form_factor) { - if (&form_factor != mP_form_factor.get()) { - mP_form_factor.reset(form_factor.clone()); - registerChild(mP_form_factor.get()); + if (&form_factor != m_form_factor.get()) { + m_form_factor.reset(form_factor.clone()); + registerChild(m_form_factor.get()); } } std::vector<const INode*> Particle::getChildren() const { - return std::vector<const INode*>() << IParticle::getChildren() << mP_form_factor; + return std::vector<const INode*>() << IParticle::getChildren() << m_form_factor; } void Particle::initialize() diff --git a/Sample/Particle/Particle.h b/Sample/Particle/Particle.h index 9a22579cbdbe37ef2e1fa66cd42cc377c7034f3b..6e3d88f9b5a35a6dc5c4c7ed69e28b39f6d1093a 100644 --- a/Sample/Particle/Particle.h +++ b/Sample/Particle/Particle.h @@ -45,7 +45,7 @@ public: protected: Material m_material; - std::unique_ptr<IFormFactor> mP_form_factor; + std::unique_ptr<IFormFactor> m_form_factor; private: void initialize(); diff --git a/Sample/Particle/ParticleComposition.cpp b/Sample/Particle/ParticleComposition.cpp index c80291ee3b42f4613eee9192a611354258c2535a..d60182a34c6f251b8889766977e99c00fdd0859f 100644 --- a/Sample/Particle/ParticleComposition.cpp +++ b/Sample/Particle/ParticleComposition.cpp @@ -38,8 +38,8 @@ ParticleComposition* ParticleComposition::clone() const p_result->setAbundance(m_abundance); for (size_t index = 0; index < m_particles.size(); ++index) p_result->addParticle(*m_particles[index]); - if (mP_rotation) - p_result->setRotation(*mP_rotation); + if (m_rotation) + p_result->setRotation(*m_rotation); p_result->setPosition(m_position); return p_result; } diff --git a/Sample/Particle/ParticleCoreShell.cpp b/Sample/Particle/ParticleCoreShell.cpp index 5bebf6431f5b08988b78020da5307ec52ad7e235..051b092d902578c7894ebd8fdac5679a79a33fc5 100644 --- a/Sample/Particle/ParticleCoreShell.cpp +++ b/Sample/Particle/ParticleCoreShell.cpp @@ -30,40 +30,40 @@ ParticleCoreShell::~ParticleCoreShell() = default; ParticleCoreShell* ParticleCoreShell::clone() const { - ParticleCoreShell* p_result = new ParticleCoreShell(*mp_shell, *mp_core); + ParticleCoreShell* p_result = new ParticleCoreShell(*m_shell, *m_core); p_result->setAbundance(m_abundance); - if (mP_rotation) - p_result->setRotation(*mP_rotation); + if (m_rotation) + p_result->setRotation(*m_rotation); p_result->setPosition(m_position); return p_result; } SlicedParticle ParticleCoreShell::createSlicedParticle(ZLimits limits) const { - if (!mp_core || !mp_shell) + if (!m_core || !m_shell) return {}; std::unique_ptr<IRotation> P_rotation(IRotation::createIdentity()); - if (mP_rotation) - P_rotation.reset(mP_rotation->clone()); + if (m_rotation) + P_rotation.reset(m_rotation->clone()); // core - std::unique_ptr<Particle> P_core(mp_core->clone()); + std::unique_ptr<Particle> P_core(m_core->clone()); P_core->rotate(*P_rotation); P_core->translate(m_position); auto sliced_core = P_core->createSlicedParticle(limits); // shell - std::unique_ptr<Particle> P_shell(mp_shell->clone()); + std::unique_ptr<Particle> P_shell(m_shell->clone()); P_shell->rotate(*P_rotation); P_shell->translate(m_position); auto sliced_shell = P_shell->createSlicedParticle(limits); - if (!sliced_shell.mP_slicedff) + if (!sliced_shell.m_slicedff) return {}; SlicedParticle result; // if core out of limits, return sliced shell - if (!sliced_core.mP_slicedff) { - result.mP_slicedff.reset(sliced_shell.mP_slicedff.release()); + if (!sliced_core.m_slicedff) { + result.m_slicedff.reset(sliced_shell.m_slicedff.release()); result.m_regions.push_back(sliced_shell.m_regions.back()); return result; } @@ -72,12 +72,12 @@ SlicedParticle ParticleCoreShell::createSlicedParticle(ZLimits limits) const if (sliced_shell.m_regions.size() != 1) return {}; auto shell_material = sliced_shell.m_regions[0].m_material; - sliced_core.mP_slicedff->setAmbientMaterial(shell_material); + sliced_core.m_slicedff->setAmbientMaterial(shell_material); // construct sliced particle sliced_shell.m_regions.back().m_volume -= sliced_core.m_regions.back().m_volume; - result.mP_slicedff.reset(new FormFactorCoreShell(sliced_core.mP_slicedff.release(), - sliced_shell.mP_slicedff.release())); + result.m_slicedff.reset(new FormFactorCoreShell(sliced_core.m_slicedff.release(), + sliced_shell.m_slicedff.release())); result.m_regions.push_back(sliced_core.m_regions.back()); result.m_regions.push_back(sliced_shell.m_regions.back()); @@ -86,26 +86,26 @@ SlicedParticle ParticleCoreShell::createSlicedParticle(ZLimits limits) const std::vector<const INode*> ParticleCoreShell::getChildren() const { - return std::vector<const INode*>() << IParticle::getChildren() << mp_core << mp_shell; + return std::vector<const INode*>() << IParticle::getChildren() << m_core << m_shell; } void ParticleCoreShell::addAndRegisterCore(const Particle& core, kvector_t relative_core_position) { - mp_core.reset(core.clone()); - mp_core->translate(relative_core_position); - registerChild(mp_core.get()); - mp_core->registerAbundance(false); + m_core.reset(core.clone()); + m_core->translate(relative_core_position); + registerChild(m_core.get()); + m_core->registerAbundance(false); } void ParticleCoreShell::addAndRegisterShell(const Particle& shell) { - mp_shell.reset(shell.clone()); - registerChild(mp_shell.get()); - mp_shell->registerAbundance(false); - mp_shell->registerPosition(false); + m_shell.reset(shell.clone()); + registerChild(m_shell.get()); + m_shell->registerAbundance(false); + m_shell->registerPosition(false); } -ParticleCoreShell::ParticleCoreShell() : mp_shell{nullptr}, mp_core{nullptr} +ParticleCoreShell::ParticleCoreShell() : m_shell{nullptr}, m_core{nullptr} { setName("ParticleCoreShell"); } diff --git a/Sample/Particle/ParticleCoreShell.h b/Sample/Particle/ParticleCoreShell.h index cf499873643ee71275c0a10c8fb0d9d50372b19c..8c38402582b30537853f211b901e2c2dc2ed3e49 100644 --- a/Sample/Particle/ParticleCoreShell.h +++ b/Sample/Particle/ParticleCoreShell.h @@ -46,18 +46,18 @@ protected: void addAndRegisterShell(const Particle& shell); ParticleCoreShell(); - std::unique_ptr<Particle> mp_shell; - std::unique_ptr<Particle> mp_core; + std::unique_ptr<Particle> m_shell; + std::unique_ptr<Particle> m_core; }; inline const Particle* ParticleCoreShell::coreParticle() const { - return mp_core.get(); + return m_core.get(); } inline const Particle* ParticleCoreShell::shellParticle() const { - return mp_shell.get(); + return m_shell.get(); } #endif // BORNAGAIN_CORE_PARTICLE_PARTICLECORESHELL_H diff --git a/Sample/Particle/ParticleDistribution.cpp b/Sample/Particle/ParticleDistribution.cpp index f11fad8ca8957030efd77972635d390b8af49a8c..6b40f7cfb66fb5ab20604c0dbef7d000f5737e4e 100644 --- a/Sample/Particle/ParticleDistribution.cpp +++ b/Sample/Particle/ParticleDistribution.cpp @@ -26,9 +26,9 @@ ParticleDistribution::ParticleDistribution(const IParticle& prototype, : m_par_distribution(par_distr) { setName("ParticleDistribution"); - mP_particle.reset(prototype.clone()); - registerChild(mP_particle.get()); - mP_particle->registerAbundance(false); + m_particle.reset(prototype.clone()); + registerChild(m_particle.get()); + m_particle->registerAbundance(false); if (auto dist = m_par_distribution.getDistribution()) registerChild(dist); registerParameter("Abundance", &m_abundance); @@ -36,26 +36,26 @@ ParticleDistribution::ParticleDistribution(const IParticle& prototype, ParticleDistribution* ParticleDistribution::clone() const { - ParticleDistribution* p_result = new ParticleDistribution(*mP_particle, m_par_distribution); + ParticleDistribution* p_result = new ParticleDistribution(*m_particle, m_par_distribution); p_result->setAbundance(m_abundance); return p_result; } void ParticleDistribution::translate(kvector_t translation) { - mP_particle->translate(translation); + m_particle->translate(translation); } void ParticleDistribution::rotate(const IRotation& rotation) { - mP_particle->rotate(rotation); + m_particle->rotate(rotation); } //! Returns particle clones with parameter values drawn from distribution. SafePointerVector<IParticle> ParticleDistribution::generateParticles() const { - std::unique_ptr<ParameterPool> P_pool{mP_particle->createParameterTree()}; + std::unique_ptr<ParameterPool> P_pool{m_particle->createParameterTree()}; std::string main_par_name = m_par_distribution.getMainParameterName(); double main_par_value = P_pool->getUniqueMatch(main_par_name)->value(); @@ -69,7 +69,7 @@ SafePointerVector<IParticle> ParticleDistribution::generateParticles() const std::vector<ParameterSample> main_par_samples = m_par_distribution.generateSamples(); SafePointerVector<IParticle> result; for (const ParameterSample& main_sample : main_par_samples) { - IParticle* p_particle_clone = mP_particle->clone(); + IParticle* p_particle_clone = m_particle->clone(); std::unique_ptr<ParameterPool> P_new_pool{p_particle_clone->createParameterTree()}; P_new_pool->setUniqueMatchValue(main_par_name, main_sample.value); for (auto it = linked_ratios.begin(); it != linked_ratios.end(); ++it) @@ -82,7 +82,7 @@ SafePointerVector<IParticle> ParticleDistribution::generateParticles() const std::vector<const INode*> ParticleDistribution::getChildren() const { - std::vector<const INode*> result = std::vector<const INode*>() << mP_particle; + std::vector<const INode*> result = std::vector<const INode*>() << m_particle; if (auto dist = m_par_distribution.getDistribution()) result.push_back(dist); return result; diff --git a/Sample/Particle/ParticleDistribution.h b/Sample/Particle/ParticleDistribution.h index e8e147b4974afc659dfd8fff83283cf193a08150..203c2e2d831e9e673336b3a5173ff14a815dbb78 100644 --- a/Sample/Particle/ParticleDistribution.h +++ b/Sample/Particle/ParticleDistribution.h @@ -41,7 +41,7 @@ public: SafePointerVector<IParticle> generateParticles() const; //! Returns the prototype particle, used for generating multiple ones - const IParticle& prototype() const { return *mP_particle.get(); } + const IParticle& prototype() const { return *m_particle.get(); } //! Returns the distributed parameter data ParameterDistribution parameterDistribution() const { return m_par_distribution; } @@ -51,7 +51,7 @@ public: std::string mainUnits() const; private: - std::unique_ptr<IParticle> mP_particle; + std::unique_ptr<IParticle> m_particle; ParameterDistribution m_par_distribution; }; diff --git a/Sample/Particle/SlicedParticle.h b/Sample/Particle/SlicedParticle.h index 31de980086cd477de871c33e700271368276a46d..650d913a510c2b238aebca76b299c559b57ec0a2 100644 --- a/Sample/Particle/SlicedParticle.h +++ b/Sample/Particle/SlicedParticle.h @@ -26,7 +26,7 @@ //! @ingroup intern struct SlicedParticle { - std::unique_ptr<IFormFactor> mP_slicedff; + std::unique_ptr<IFormFactor> m_slicedff; std::vector<HomogeneousRegion> m_regions; }; diff --git a/Sample/Scattering/FormFactorBAPol.cpp b/Sample/Scattering/FormFactorBAPol.cpp index 5086e2faf11a19664ed15d8b94ca939b806c3b4a..b7de22f5640f1252ccac4a949d3defe859047fa1 100644 --- a/Sample/Scattering/FormFactorBAPol.cpp +++ b/Sample/Scattering/FormFactorBAPol.cpp @@ -17,7 +17,7 @@ #include <stdexcept> FormFactorBAPol::FormFactorBAPol(const IFormFactor& form_factor) - : mP_form_factor(form_factor.clone()) + : m_form_factor(form_factor.clone()) { setName("FormFactorBAPol"); } @@ -26,7 +26,7 @@ FormFactorBAPol::~FormFactorBAPol() = default; FormFactorBAPol* FormFactorBAPol::clone() const { - return new FormFactorBAPol(*mP_form_factor); + return new FormFactorBAPol(*m_form_factor); } complex_t FormFactorBAPol::evaluate(const WavevectorInfo&) const @@ -37,7 +37,7 @@ complex_t FormFactorBAPol::evaluate(const WavevectorInfo&) const Eigen::Matrix2cd FormFactorBAPol::evaluatePol(const WavevectorInfo& wavevectors) const { - Eigen::Matrix2cd ff_BA = mP_form_factor->evaluatePol(wavevectors); + Eigen::Matrix2cd ff_BA = m_form_factor->evaluatePol(wavevectors); Eigen::Matrix2cd result; result(0, 0) = -ff_BA(1, 0); result(0, 1) = ff_BA(0, 0); @@ -48,10 +48,10 @@ Eigen::Matrix2cd FormFactorBAPol::evaluatePol(const WavevectorInfo& wavevectors) double FormFactorBAPol::bottomZ(const IRotation& rotation) const { - return mP_form_factor->bottomZ(rotation); + return m_form_factor->bottomZ(rotation); } double FormFactorBAPol::topZ(const IRotation& rotation) const { - return mP_form_factor->topZ(rotation); + return m_form_factor->topZ(rotation); } diff --git a/Sample/Scattering/FormFactorBAPol.h b/Sample/Scattering/FormFactorBAPol.h index f12f96309ce3267b3fe7cf3fcbcd9132f66c2098..08dc5a83f1b4613af21063c94c286d0494b29efe 100644 --- a/Sample/Scattering/FormFactorBAPol.h +++ b/Sample/Scattering/FormFactorBAPol.h @@ -34,7 +34,7 @@ public: void setAmbientMaterial(const Material& material) override { - mP_form_factor->setAmbientMaterial(material); + m_form_factor->setAmbientMaterial(material); } //! Throws not-implemented exception @@ -43,9 +43,9 @@ public: //! Calculates and returns a polarized form factor calculation in BA Eigen::Matrix2cd evaluatePol(const WavevectorInfo& wavevectors) const override; - double volume() const override { return mP_form_factor->volume(); } + double volume() const override { return m_form_factor->volume(); } - double radialExtension() const override { return mP_form_factor->radialExtension(); } + double radialExtension() const override { return m_form_factor->radialExtension(); } double bottomZ(const IRotation& rotation) const override; @@ -53,7 +53,7 @@ public: private: //! The form factor for BA - std::unique_ptr<IFormFactor> mP_form_factor; + std::unique_ptr<IFormFactor> m_form_factor; }; #endif // BORNAGAIN_CORE_MULTILAYER_FORMFACTORBAPOL_H diff --git a/Sample/Scattering/FormFactorDWBA.cpp b/Sample/Scattering/FormFactorDWBA.cpp index 8897beaaabbc83757806fcb02887ef9a35daa528..3f59f952eaf19f7cf17a8e52aebd1b6295cf1ff2 100644 --- a/Sample/Scattering/FormFactorDWBA.cpp +++ b/Sample/Scattering/FormFactorDWBA.cpp @@ -16,7 +16,7 @@ #include "Sample/Material/WavevectorInfo.h" #include "Sample/RT/ILayerRTCoefficients.h" -FormFactorDWBA::FormFactorDWBA(const IFormFactor& form_factor) : mP_form_factor(form_factor.clone()) +FormFactorDWBA::FormFactorDWBA(const IFormFactor& form_factor) : m_form_factor(form_factor.clone()) { setName("FormFactorDWBA"); } @@ -25,12 +25,11 @@ FormFactorDWBA::~FormFactorDWBA() = default; FormFactorDWBA* FormFactorDWBA::clone() const { - FormFactorDWBA* result = new FormFactorDWBA(*mP_form_factor); + FormFactorDWBA* result = new FormFactorDWBA(*m_form_factor); std::unique_ptr<const ILayerRTCoefficients> p_in_coefs = - mp_in_coeffs ? std::unique_ptr<const ILayerRTCoefficients>(mp_in_coeffs->clone()) : nullptr; + m_in_coeffs ? std::unique_ptr<const ILayerRTCoefficients>(m_in_coeffs->clone()) : nullptr; std::unique_ptr<const ILayerRTCoefficients> p_out_coefs = - mp_out_coeffs ? std::unique_ptr<const ILayerRTCoefficients>(mp_out_coeffs->clone()) - : nullptr; + m_out_coeffs ? std::unique_ptr<const ILayerRTCoefficients>(m_out_coeffs->clone()) : nullptr; result->setSpecularInfo(std::move(p_in_coefs), std::move(p_out_coefs)); return result; } @@ -39,13 +38,13 @@ complex_t FormFactorDWBA::evaluate(const WavevectorInfo& wavevectors) const { // Retrieve the two different incoming wavevectors in the layer cvector_t k_i_T = wavevectors.getKi(); - k_i_T.setZ(-mp_in_coeffs->getScalarKz()); + k_i_T.setZ(-m_in_coeffs->getScalarKz()); cvector_t k_i_R = k_i_T; k_i_R.setZ(-k_i_T.z()); // Retrieve the two different outgoing wavevector bins in the layer cvector_t k_f_T = wavevectors.getKf(); - k_f_T.setZ(mp_out_coeffs->getScalarKz()); + k_f_T.setZ(m_out_coeffs->getScalarKz()); cvector_t k_f_R = k_f_T; k_f_R.setZ(-k_f_T.z()); @@ -57,34 +56,34 @@ complex_t FormFactorDWBA::evaluate(const WavevectorInfo& wavevectors) const WavevectorInfo k_RR(k_i_R, k_f_R, wavelength); // Get the four R,T coefficients - complex_t T_in = mp_in_coeffs->getScalarT(); - complex_t R_in = mp_in_coeffs->getScalarR(); - complex_t T_out = mp_out_coeffs->getScalarT(); - complex_t R_out = mp_out_coeffs->getScalarR(); + complex_t T_in = m_in_coeffs->getScalarT(); + complex_t R_in = m_in_coeffs->getScalarR(); + complex_t T_out = m_out_coeffs->getScalarT(); + complex_t R_out = m_out_coeffs->getScalarR(); // The four different scattering contributions; S stands for scattering // off the particle, R for reflection off the layer interface - complex_t term_S = T_in * mP_form_factor->evaluate(k_TT) * T_out; - complex_t term_RS = R_in * mP_form_factor->evaluate(k_RT) * T_out; - complex_t term_SR = T_in * mP_form_factor->evaluate(k_TR) * R_out; - complex_t term_RSR = R_in * mP_form_factor->evaluate(k_RR) * R_out; + complex_t term_S = T_in * m_form_factor->evaluate(k_TT) * T_out; + complex_t term_RS = R_in * m_form_factor->evaluate(k_RT) * T_out; + complex_t term_SR = T_in * m_form_factor->evaluate(k_TR) * R_out; + complex_t term_RSR = R_in * m_form_factor->evaluate(k_RR) * R_out; return term_S + term_RS + term_SR + term_RSR; } double FormFactorDWBA::bottomZ(const IRotation& rotation) const { - return mP_form_factor->bottomZ(rotation); + return m_form_factor->bottomZ(rotation); } double FormFactorDWBA::topZ(const IRotation& rotation) const { - return mP_form_factor->topZ(rotation); + return m_form_factor->topZ(rotation); } void FormFactorDWBA::setSpecularInfo(std::unique_ptr<const ILayerRTCoefficients> p_in_coeffs, std::unique_ptr<const ILayerRTCoefficients> p_out_coeffs) { - mp_in_coeffs = std::move(p_in_coeffs); - mp_out_coeffs = std::move(p_out_coeffs); + m_in_coeffs = std::move(p_in_coeffs); + m_out_coeffs = std::move(p_out_coeffs); } diff --git a/Sample/Scattering/FormFactorDWBA.h b/Sample/Scattering/FormFactorDWBA.h index fadeddfe15556c77cae099a2caeac0ff7cf62855..6586bb0ab27bb05824532a0b08efc79be5c70494 100644 --- a/Sample/Scattering/FormFactorDWBA.h +++ b/Sample/Scattering/FormFactorDWBA.h @@ -35,15 +35,15 @@ public: void setAmbientMaterial(const Material& material) override { - mP_form_factor->setAmbientMaterial(material); + m_form_factor->setAmbientMaterial(material); } //! Calculates and returns a form factor calculation in DWBA complex_t evaluate(const WavevectorInfo& wavevectors) const override; - double volume() const override { return mP_form_factor->volume(); } + double volume() const override { return m_form_factor->volume(); } - double radialExtension() const override { return mP_form_factor->radialExtension(); } + double radialExtension() const override { return m_form_factor->radialExtension(); } double bottomZ(const IRotation& rotation) const override; @@ -56,10 +56,10 @@ public: private: //! The form factor for BA - std::unique_ptr<IFormFactor> mP_form_factor; + std::unique_ptr<IFormFactor> m_form_factor; - std::unique_ptr<const ILayerRTCoefficients> mp_in_coeffs; - std::unique_ptr<const ILayerRTCoefficients> mp_out_coeffs; + std::unique_ptr<const ILayerRTCoefficients> m_in_coeffs; + std::unique_ptr<const ILayerRTCoefficients> m_out_coeffs; }; #endif // BORNAGAIN_CORE_MULTILAYER_FORMFACTORDWBA_H diff --git a/Sample/Scattering/FormFactorDWBAPol.cpp b/Sample/Scattering/FormFactorDWBAPol.cpp index 39a1b9cae0195c814b13a83d16186971221e9fce..f4d2cdf0a1c70c7efbe6096c0de30839f4483716 100644 --- a/Sample/Scattering/FormFactorDWBAPol.cpp +++ b/Sample/Scattering/FormFactorDWBAPol.cpp @@ -26,7 +26,7 @@ std::complex<double> VecMatVecProduct(const Eigen::Vector2cd& vec1, const Eigen: } // namespace FormFactorDWBAPol::FormFactorDWBAPol(const IFormFactor& form_factor) - : mP_form_factor(form_factor.clone()) + : m_form_factor(form_factor.clone()) { setName("FormFactorDWBAPol"); } @@ -35,12 +35,11 @@ FormFactorDWBAPol::~FormFactorDWBAPol() = default; FormFactorDWBAPol* FormFactorDWBAPol::clone() const { - FormFactorDWBAPol* p_result = new FormFactorDWBAPol(*mP_form_factor); + FormFactorDWBAPol* p_result = new FormFactorDWBAPol(*m_form_factor); std::unique_ptr<const ILayerRTCoefficients> p_in_coefs = - mp_in_coeffs ? std::unique_ptr<const ILayerRTCoefficients>(mp_in_coeffs->clone()) : nullptr; + m_in_coeffs ? std::unique_ptr<const ILayerRTCoefficients>(m_in_coeffs->clone()) : nullptr; std::unique_ptr<const ILayerRTCoefficients> p_out_coefs = - mp_out_coeffs ? std::unique_ptr<const ILayerRTCoefficients>(mp_out_coeffs->clone()) - : nullptr; + m_out_coeffs ? std::unique_ptr<const ILayerRTCoefficients>(m_out_coeffs->clone()) : nullptr; p_result->setSpecularInfo(std::move(p_in_coefs), std::move(p_out_coefs)); return p_result; } @@ -57,19 +56,19 @@ Eigen::Matrix2cd FormFactorDWBAPol::evaluatePol(const WavevectorInfo& wavevector // different eigenmodes and in- and outgoing wavevector; complex_t kix = wavevectors.getKi().x(); complex_t kiy = wavevectors.getKi().y(); - cvector_t ki_1R(kix, kiy, mp_in_coeffs->getKz()(0)); - cvector_t ki_1T(kix, kiy, -mp_in_coeffs->getKz()(0)); - cvector_t ki_2R(kix, kiy, mp_in_coeffs->getKz()(1)); - cvector_t ki_2T(kix, kiy, -mp_in_coeffs->getKz()(1)); + cvector_t ki_1R(kix, kiy, m_in_coeffs->getKz()(0)); + cvector_t ki_1T(kix, kiy, -m_in_coeffs->getKz()(0)); + cvector_t ki_2R(kix, kiy, m_in_coeffs->getKz()(1)); + cvector_t ki_2T(kix, kiy, -m_in_coeffs->getKz()(1)); cvector_t kf_1R = wavevectors.getKf(); - kf_1R.setZ(-(complex_t)mp_out_coeffs->getKz()(0)); + kf_1R.setZ(-(complex_t)m_out_coeffs->getKz()(0)); cvector_t kf_1T = kf_1R; - kf_1T.setZ((complex_t)mp_out_coeffs->getKz()(0)); + kf_1T.setZ((complex_t)m_out_coeffs->getKz()(0)); cvector_t kf_2R = kf_1R; - kf_2R.setZ(-(complex_t)mp_out_coeffs->getKz()(1)); + kf_2R.setZ(-(complex_t)m_out_coeffs->getKz()(1)); cvector_t kf_2T = kf_1R; - kf_2T.setZ((complex_t)mp_out_coeffs->getKz()(1)); + kf_2T.setZ((complex_t)m_out_coeffs->getKz()(1)); // now each of the 16 matrix terms of the polarized DWBA is calculated: // NOTE: when the underlying reflection/transmission coefficients are // scalar, the eigenmodes have identical eigenvalues and spin polarization @@ -93,104 +92,104 @@ Eigen::Matrix2cd FormFactorDWBAPol::evaluatePol(const WavevectorInfo& wavevector M21_SR, M21_RSR, M22_S, M22_RS, M22_SR, M22_RSR; // eigenmode 1 -> eigenmode 1: direct scattering - ff_BA = mP_form_factor->evaluatePol(WavevectorInfo(ki_1T, kf_1T, wavelength)); - M11_S(0, 0) = -VecMatVecProduct(mp_out_coeffs->T1min(), ff_BA, mp_in_coeffs->T1plus()); - M11_S(0, 1) = VecMatVecProduct(mp_out_coeffs->T1plus(), ff_BA, mp_in_coeffs->T1plus()); - M11_S(1, 0) = -VecMatVecProduct(mp_out_coeffs->T1min(), ff_BA, mp_in_coeffs->T1min()); - M11_S(1, 1) = VecMatVecProduct(mp_out_coeffs->T1plus(), ff_BA, mp_in_coeffs->T1min()); + ff_BA = m_form_factor->evaluatePol(WavevectorInfo(ki_1T, kf_1T, wavelength)); + M11_S(0, 0) = -VecMatVecProduct(m_out_coeffs->T1min(), ff_BA, m_in_coeffs->T1plus()); + M11_S(0, 1) = VecMatVecProduct(m_out_coeffs->T1plus(), ff_BA, m_in_coeffs->T1plus()); + M11_S(1, 0) = -VecMatVecProduct(m_out_coeffs->T1min(), ff_BA, m_in_coeffs->T1min()); + M11_S(1, 1) = VecMatVecProduct(m_out_coeffs->T1plus(), ff_BA, m_in_coeffs->T1min()); // eigenmode 1 -> eigenmode 1: reflection and then scattering - ff_BA = mP_form_factor->evaluatePol(WavevectorInfo(ki_1R, kf_1T, wavelength)); - M11_RS(0, 0) = -VecMatVecProduct(mp_out_coeffs->T1min(), ff_BA, mp_in_coeffs->R1plus()); - M11_RS(0, 1) = VecMatVecProduct(mp_out_coeffs->T1plus(), ff_BA, mp_in_coeffs->R1plus()); - M11_RS(1, 0) = -VecMatVecProduct(mp_out_coeffs->T1min(), ff_BA, mp_in_coeffs->R1min()); - M11_RS(1, 1) = VecMatVecProduct(mp_out_coeffs->T1plus(), ff_BA, mp_in_coeffs->R1min()); + ff_BA = m_form_factor->evaluatePol(WavevectorInfo(ki_1R, kf_1T, wavelength)); + M11_RS(0, 0) = -VecMatVecProduct(m_out_coeffs->T1min(), ff_BA, m_in_coeffs->R1plus()); + M11_RS(0, 1) = VecMatVecProduct(m_out_coeffs->T1plus(), ff_BA, m_in_coeffs->R1plus()); + M11_RS(1, 0) = -VecMatVecProduct(m_out_coeffs->T1min(), ff_BA, m_in_coeffs->R1min()); + M11_RS(1, 1) = VecMatVecProduct(m_out_coeffs->T1plus(), ff_BA, m_in_coeffs->R1min()); // eigenmode 1 -> eigenmode 1: scattering and then reflection - ff_BA = mP_form_factor->evaluatePol(WavevectorInfo(ki_1T, kf_1R, wavelength)); - M11_SR(0, 0) = -VecMatVecProduct(mp_out_coeffs->R1min(), ff_BA, mp_in_coeffs->T1plus()); - M11_SR(0, 1) = VecMatVecProduct(mp_out_coeffs->R1plus(), ff_BA, mp_in_coeffs->T1plus()); - M11_SR(1, 0) = -VecMatVecProduct(mp_out_coeffs->R1min(), ff_BA, mp_in_coeffs->T1min()); - M11_SR(1, 1) = VecMatVecProduct(mp_out_coeffs->R1plus(), ff_BA, mp_in_coeffs->T1min()); + ff_BA = m_form_factor->evaluatePol(WavevectorInfo(ki_1T, kf_1R, wavelength)); + M11_SR(0, 0) = -VecMatVecProduct(m_out_coeffs->R1min(), ff_BA, m_in_coeffs->T1plus()); + M11_SR(0, 1) = VecMatVecProduct(m_out_coeffs->R1plus(), ff_BA, m_in_coeffs->T1plus()); + M11_SR(1, 0) = -VecMatVecProduct(m_out_coeffs->R1min(), ff_BA, m_in_coeffs->T1min()); + M11_SR(1, 1) = VecMatVecProduct(m_out_coeffs->R1plus(), ff_BA, m_in_coeffs->T1min()); // eigenmode 1 -> eigenmode 1: reflection, scattering and again reflection - ff_BA = mP_form_factor->evaluatePol(WavevectorInfo(ki_1R, kf_1R, wavelength)); - M11_RSR(0, 0) = -VecMatVecProduct(mp_out_coeffs->R1min(), ff_BA, mp_in_coeffs->R1plus()); - M11_RSR(0, 1) = VecMatVecProduct(mp_out_coeffs->R1plus(), ff_BA, mp_in_coeffs->R1plus()); - M11_RSR(1, 0) = -VecMatVecProduct(mp_out_coeffs->R1min(), ff_BA, mp_in_coeffs->R1min()); - M11_RSR(1, 1) = VecMatVecProduct(mp_out_coeffs->R1plus(), ff_BA, mp_in_coeffs->R1min()); + ff_BA = m_form_factor->evaluatePol(WavevectorInfo(ki_1R, kf_1R, wavelength)); + M11_RSR(0, 0) = -VecMatVecProduct(m_out_coeffs->R1min(), ff_BA, m_in_coeffs->R1plus()); + M11_RSR(0, 1) = VecMatVecProduct(m_out_coeffs->R1plus(), ff_BA, m_in_coeffs->R1plus()); + M11_RSR(1, 0) = -VecMatVecProduct(m_out_coeffs->R1min(), ff_BA, m_in_coeffs->R1min()); + M11_RSR(1, 1) = VecMatVecProduct(m_out_coeffs->R1plus(), ff_BA, m_in_coeffs->R1min()); // eigenmode 1 -> eigenmode 2: direct scattering - ff_BA = mP_form_factor->evaluatePol(WavevectorInfo(ki_1T, kf_2T, wavelength)); - M12_S(0, 0) = -VecMatVecProduct(mp_out_coeffs->T2min(), ff_BA, mp_in_coeffs->T1plus()); - M12_S(0, 1) = VecMatVecProduct(mp_out_coeffs->T2plus(), ff_BA, mp_in_coeffs->T1plus()); - M12_S(1, 0) = -VecMatVecProduct(mp_out_coeffs->T2min(), ff_BA, mp_in_coeffs->T1min()); - M12_S(1, 1) = VecMatVecProduct(mp_out_coeffs->T2plus(), ff_BA, mp_in_coeffs->T1min()); + ff_BA = m_form_factor->evaluatePol(WavevectorInfo(ki_1T, kf_2T, wavelength)); + M12_S(0, 0) = -VecMatVecProduct(m_out_coeffs->T2min(), ff_BA, m_in_coeffs->T1plus()); + M12_S(0, 1) = VecMatVecProduct(m_out_coeffs->T2plus(), ff_BA, m_in_coeffs->T1plus()); + M12_S(1, 0) = -VecMatVecProduct(m_out_coeffs->T2min(), ff_BA, m_in_coeffs->T1min()); + M12_S(1, 1) = VecMatVecProduct(m_out_coeffs->T2plus(), ff_BA, m_in_coeffs->T1min()); // eigenmode 1 -> eigenmode 2: reflection and then scattering - ff_BA = mP_form_factor->evaluatePol(WavevectorInfo(ki_1R, kf_2T, wavelength)); - M12_RS(0, 0) = -VecMatVecProduct(mp_out_coeffs->T2min(), ff_BA, mp_in_coeffs->R1plus()); - M12_RS(0, 1) = VecMatVecProduct(mp_out_coeffs->T2plus(), ff_BA, mp_in_coeffs->R1plus()); - M12_RS(1, 0) = -VecMatVecProduct(mp_out_coeffs->T2min(), ff_BA, mp_in_coeffs->R1min()); - M12_RS(1, 1) = VecMatVecProduct(mp_out_coeffs->T2plus(), ff_BA, mp_in_coeffs->R1min()); + ff_BA = m_form_factor->evaluatePol(WavevectorInfo(ki_1R, kf_2T, wavelength)); + M12_RS(0, 0) = -VecMatVecProduct(m_out_coeffs->T2min(), ff_BA, m_in_coeffs->R1plus()); + M12_RS(0, 1) = VecMatVecProduct(m_out_coeffs->T2plus(), ff_BA, m_in_coeffs->R1plus()); + M12_RS(1, 0) = -VecMatVecProduct(m_out_coeffs->T2min(), ff_BA, m_in_coeffs->R1min()); + M12_RS(1, 1) = VecMatVecProduct(m_out_coeffs->T2plus(), ff_BA, m_in_coeffs->R1min()); // eigenmode 1 -> eigenmode 2: scattering and then reflection - ff_BA = mP_form_factor->evaluatePol(WavevectorInfo(ki_1T, kf_2R, wavelength)); - M12_SR(0, 0) = -VecMatVecProduct(mp_out_coeffs->R2min(), ff_BA, mp_in_coeffs->T1plus()); - M12_SR(0, 1) = VecMatVecProduct(mp_out_coeffs->R2plus(), ff_BA, mp_in_coeffs->T1plus()); - M12_SR(1, 0) = -VecMatVecProduct(mp_out_coeffs->R2min(), ff_BA, mp_in_coeffs->T1min()); - M12_SR(1, 1) = VecMatVecProduct(mp_out_coeffs->R2plus(), ff_BA, mp_in_coeffs->T1min()); + ff_BA = m_form_factor->evaluatePol(WavevectorInfo(ki_1T, kf_2R, wavelength)); + M12_SR(0, 0) = -VecMatVecProduct(m_out_coeffs->R2min(), ff_BA, m_in_coeffs->T1plus()); + M12_SR(0, 1) = VecMatVecProduct(m_out_coeffs->R2plus(), ff_BA, m_in_coeffs->T1plus()); + M12_SR(1, 0) = -VecMatVecProduct(m_out_coeffs->R2min(), ff_BA, m_in_coeffs->T1min()); + M12_SR(1, 1) = VecMatVecProduct(m_out_coeffs->R2plus(), ff_BA, m_in_coeffs->T1min()); // eigenmode 1 -> eigenmode 2: reflection, scattering and again reflection - ff_BA = mP_form_factor->evaluatePol(WavevectorInfo(ki_1R, kf_2R, wavelength)); - M12_RSR(0, 0) = -VecMatVecProduct(mp_out_coeffs->R2min(), ff_BA, mp_in_coeffs->R1plus()); - M12_RSR(0, 1) = VecMatVecProduct(mp_out_coeffs->R2plus(), ff_BA, mp_in_coeffs->R1plus()); - M12_RSR(1, 0) = -VecMatVecProduct(mp_out_coeffs->R2min(), ff_BA, mp_in_coeffs->R1min()); - M12_RSR(1, 1) = VecMatVecProduct(mp_out_coeffs->R2plus(), ff_BA, mp_in_coeffs->R1min()); + ff_BA = m_form_factor->evaluatePol(WavevectorInfo(ki_1R, kf_2R, wavelength)); + M12_RSR(0, 0) = -VecMatVecProduct(m_out_coeffs->R2min(), ff_BA, m_in_coeffs->R1plus()); + M12_RSR(0, 1) = VecMatVecProduct(m_out_coeffs->R2plus(), ff_BA, m_in_coeffs->R1plus()); + M12_RSR(1, 0) = -VecMatVecProduct(m_out_coeffs->R2min(), ff_BA, m_in_coeffs->R1min()); + M12_RSR(1, 1) = VecMatVecProduct(m_out_coeffs->R2plus(), ff_BA, m_in_coeffs->R1min()); // eigenmode 2 -> eigenmode 1: direct scattering - ff_BA = mP_form_factor->evaluatePol(WavevectorInfo(ki_2T, kf_1T, wavelength)); - M21_S(0, 0) = -VecMatVecProduct(mp_out_coeffs->T1min(), ff_BA, mp_in_coeffs->T2plus()); - M21_S(0, 1) = VecMatVecProduct(mp_out_coeffs->T1plus(), ff_BA, mp_in_coeffs->T2plus()); - M21_S(1, 0) = -VecMatVecProduct(mp_out_coeffs->T1min(), ff_BA, mp_in_coeffs->T2min()); - M21_S(1, 1) = VecMatVecProduct(mp_out_coeffs->T1plus(), ff_BA, mp_in_coeffs->T2min()); + ff_BA = m_form_factor->evaluatePol(WavevectorInfo(ki_2T, kf_1T, wavelength)); + M21_S(0, 0) = -VecMatVecProduct(m_out_coeffs->T1min(), ff_BA, m_in_coeffs->T2plus()); + M21_S(0, 1) = VecMatVecProduct(m_out_coeffs->T1plus(), ff_BA, m_in_coeffs->T2plus()); + M21_S(1, 0) = -VecMatVecProduct(m_out_coeffs->T1min(), ff_BA, m_in_coeffs->T2min()); + M21_S(1, 1) = VecMatVecProduct(m_out_coeffs->T1plus(), ff_BA, m_in_coeffs->T2min()); // eigenmode 2 -> eigenmode 1: reflection and then scattering - ff_BA = mP_form_factor->evaluatePol(WavevectorInfo(ki_2R, kf_1T, wavelength)); - M21_RS(0, 0) = -VecMatVecProduct(mp_out_coeffs->T1min(), ff_BA, mp_in_coeffs->R2plus()); - M21_RS(0, 1) = VecMatVecProduct(mp_out_coeffs->T1plus(), ff_BA, mp_in_coeffs->R2plus()); - M21_RS(1, 0) = -VecMatVecProduct(mp_out_coeffs->T1min(), ff_BA, mp_in_coeffs->R2min()); - M21_RS(1, 1) = VecMatVecProduct(mp_out_coeffs->T1plus(), ff_BA, mp_in_coeffs->R2min()); + ff_BA = m_form_factor->evaluatePol(WavevectorInfo(ki_2R, kf_1T, wavelength)); + M21_RS(0, 0) = -VecMatVecProduct(m_out_coeffs->T1min(), ff_BA, m_in_coeffs->R2plus()); + M21_RS(0, 1) = VecMatVecProduct(m_out_coeffs->T1plus(), ff_BA, m_in_coeffs->R2plus()); + M21_RS(1, 0) = -VecMatVecProduct(m_out_coeffs->T1min(), ff_BA, m_in_coeffs->R2min()); + M21_RS(1, 1) = VecMatVecProduct(m_out_coeffs->T1plus(), ff_BA, m_in_coeffs->R2min()); // eigenmode 2 -> eigenmode 1: scattering and then reflection - ff_BA = mP_form_factor->evaluatePol(WavevectorInfo(ki_2T, kf_1R, wavelength)); - M21_SR(0, 0) = -VecMatVecProduct(mp_out_coeffs->R1min(), ff_BA, mp_in_coeffs->T2plus()); - M21_SR(0, 1) = VecMatVecProduct(mp_out_coeffs->R1plus(), ff_BA, mp_in_coeffs->T2plus()); - M21_SR(1, 0) = -VecMatVecProduct(mp_out_coeffs->R1min(), ff_BA, mp_in_coeffs->T2min()); - M21_SR(1, 1) = VecMatVecProduct(mp_out_coeffs->R1plus(), ff_BA, mp_in_coeffs->T2min()); + ff_BA = m_form_factor->evaluatePol(WavevectorInfo(ki_2T, kf_1R, wavelength)); + M21_SR(0, 0) = -VecMatVecProduct(m_out_coeffs->R1min(), ff_BA, m_in_coeffs->T2plus()); + M21_SR(0, 1) = VecMatVecProduct(m_out_coeffs->R1plus(), ff_BA, m_in_coeffs->T2plus()); + M21_SR(1, 0) = -VecMatVecProduct(m_out_coeffs->R1min(), ff_BA, m_in_coeffs->T2min()); + M21_SR(1, 1) = VecMatVecProduct(m_out_coeffs->R1plus(), ff_BA, m_in_coeffs->T2min()); // eigenmode 2 -> eigenmode 1: reflection, scattering and again reflection - ff_BA = mP_form_factor->evaluatePol(WavevectorInfo(ki_2R, kf_1R, wavelength)); - M21_RSR(0, 0) = -VecMatVecProduct(mp_out_coeffs->R1min(), ff_BA, mp_in_coeffs->R2plus()); - M21_RSR(0, 1) = VecMatVecProduct(mp_out_coeffs->R1plus(), ff_BA, mp_in_coeffs->R2plus()); - M21_RSR(1, 0) = -VecMatVecProduct(mp_out_coeffs->R1min(), ff_BA, mp_in_coeffs->R2min()); - M21_RSR(1, 1) = VecMatVecProduct(mp_out_coeffs->R1plus(), ff_BA, mp_in_coeffs->R2min()); + ff_BA = m_form_factor->evaluatePol(WavevectorInfo(ki_2R, kf_1R, wavelength)); + M21_RSR(0, 0) = -VecMatVecProduct(m_out_coeffs->R1min(), ff_BA, m_in_coeffs->R2plus()); + M21_RSR(0, 1) = VecMatVecProduct(m_out_coeffs->R1plus(), ff_BA, m_in_coeffs->R2plus()); + M21_RSR(1, 0) = -VecMatVecProduct(m_out_coeffs->R1min(), ff_BA, m_in_coeffs->R2min()); + M21_RSR(1, 1) = VecMatVecProduct(m_out_coeffs->R1plus(), ff_BA, m_in_coeffs->R2min()); // eigenmode 2 -> eigenmode 2: direct scattering - ff_BA = mP_form_factor->evaluatePol(WavevectorInfo(ki_2T, kf_2T, wavelength)); - M22_S(0, 0) = -VecMatVecProduct(mp_out_coeffs->T2min(), ff_BA, mp_in_coeffs->T2plus()); - M22_S(0, 1) = VecMatVecProduct(mp_out_coeffs->T2plus(), ff_BA, mp_in_coeffs->T2plus()); - M22_S(1, 0) = -VecMatVecProduct(mp_out_coeffs->T2min(), ff_BA, mp_in_coeffs->T2min()); - M22_S(1, 1) = VecMatVecProduct(mp_out_coeffs->T2plus(), ff_BA, mp_in_coeffs->T2min()); + ff_BA = m_form_factor->evaluatePol(WavevectorInfo(ki_2T, kf_2T, wavelength)); + M22_S(0, 0) = -VecMatVecProduct(m_out_coeffs->T2min(), ff_BA, m_in_coeffs->T2plus()); + M22_S(0, 1) = VecMatVecProduct(m_out_coeffs->T2plus(), ff_BA, m_in_coeffs->T2plus()); + M22_S(1, 0) = -VecMatVecProduct(m_out_coeffs->T2min(), ff_BA, m_in_coeffs->T2min()); + M22_S(1, 1) = VecMatVecProduct(m_out_coeffs->T2plus(), ff_BA, m_in_coeffs->T2min()); // eigenmode 2 -> eigenmode 2: reflection and then scattering - ff_BA = mP_form_factor->evaluatePol(WavevectorInfo(ki_2R, kf_2T, wavelength)); - M22_RS(0, 0) = -VecMatVecProduct(mp_out_coeffs->T2min(), ff_BA, mp_in_coeffs->R2plus()); - M22_RS(0, 1) = VecMatVecProduct(mp_out_coeffs->T2plus(), ff_BA, mp_in_coeffs->R2plus()); - M22_RS(1, 0) = -VecMatVecProduct(mp_out_coeffs->T2min(), ff_BA, mp_in_coeffs->R2min()); - M22_RS(1, 1) = VecMatVecProduct(mp_out_coeffs->T2plus(), ff_BA, mp_in_coeffs->R2min()); + ff_BA = m_form_factor->evaluatePol(WavevectorInfo(ki_2R, kf_2T, wavelength)); + M22_RS(0, 0) = -VecMatVecProduct(m_out_coeffs->T2min(), ff_BA, m_in_coeffs->R2plus()); + M22_RS(0, 1) = VecMatVecProduct(m_out_coeffs->T2plus(), ff_BA, m_in_coeffs->R2plus()); + M22_RS(1, 0) = -VecMatVecProduct(m_out_coeffs->T2min(), ff_BA, m_in_coeffs->R2min()); + M22_RS(1, 1) = VecMatVecProduct(m_out_coeffs->T2plus(), ff_BA, m_in_coeffs->R2min()); // eigenmode 2 -> eigenmode 2: scattering and then reflection - ff_BA = mP_form_factor->evaluatePol(WavevectorInfo(ki_2T, kf_2R, wavelength)); - M22_SR(0, 0) = -VecMatVecProduct(mp_out_coeffs->R2min(), ff_BA, mp_in_coeffs->T2plus()); - M22_SR(0, 1) = VecMatVecProduct(mp_out_coeffs->R2plus(), ff_BA, mp_in_coeffs->T2plus()); - M22_SR(1, 0) = -VecMatVecProduct(mp_out_coeffs->R2min(), ff_BA, mp_in_coeffs->T2min()); - M22_SR(1, 1) = VecMatVecProduct(mp_out_coeffs->R2plus(), ff_BA, mp_in_coeffs->T2min()); + ff_BA = m_form_factor->evaluatePol(WavevectorInfo(ki_2T, kf_2R, wavelength)); + M22_SR(0, 0) = -VecMatVecProduct(m_out_coeffs->R2min(), ff_BA, m_in_coeffs->T2plus()); + M22_SR(0, 1) = VecMatVecProduct(m_out_coeffs->R2plus(), ff_BA, m_in_coeffs->T2plus()); + M22_SR(1, 0) = -VecMatVecProduct(m_out_coeffs->R2min(), ff_BA, m_in_coeffs->T2min()); + M22_SR(1, 1) = VecMatVecProduct(m_out_coeffs->R2plus(), ff_BA, m_in_coeffs->T2min()); // eigenmode 2 -> eigenmode 2: reflection, scattering and again reflection - ff_BA = mP_form_factor->evaluatePol(WavevectorInfo(ki_2R, kf_2R, wavelength)); - M22_RSR(0, 0) = -VecMatVecProduct(mp_out_coeffs->R2min(), ff_BA, mp_in_coeffs->R2plus()); - M22_RSR(0, 1) = VecMatVecProduct(mp_out_coeffs->R2plus(), ff_BA, mp_in_coeffs->R2plus()); - M22_RSR(1, 0) = -VecMatVecProduct(mp_out_coeffs->R2min(), ff_BA, mp_in_coeffs->R2min()); - M22_RSR(1, 1) = VecMatVecProduct(mp_out_coeffs->R2plus(), ff_BA, mp_in_coeffs->R2min()); + ff_BA = m_form_factor->evaluatePol(WavevectorInfo(ki_2R, kf_2R, wavelength)); + M22_RSR(0, 0) = -VecMatVecProduct(m_out_coeffs->R2min(), ff_BA, m_in_coeffs->R2plus()); + M22_RSR(0, 1) = VecMatVecProduct(m_out_coeffs->R2plus(), ff_BA, m_in_coeffs->R2plus()); + M22_RSR(1, 0) = -VecMatVecProduct(m_out_coeffs->R2min(), ff_BA, m_in_coeffs->R2min()); + M22_RSR(1, 1) = VecMatVecProduct(m_out_coeffs->R2plus(), ff_BA, m_in_coeffs->R2min()); return M11_S + M11_RS + M11_SR + M11_RSR + M12_S + M12_RS + M12_SR + M12_RSR + M21_S + M21_RS + M21_SR + M21_RSR + M22_S + M22_RS + M22_SR + M22_RSR; @@ -198,17 +197,17 @@ Eigen::Matrix2cd FormFactorDWBAPol::evaluatePol(const WavevectorInfo& wavevector double FormFactorDWBAPol::bottomZ(const IRotation& rotation) const { - return mP_form_factor->bottomZ(rotation); + return m_form_factor->bottomZ(rotation); } double FormFactorDWBAPol::topZ(const IRotation& rotation) const { - return mP_form_factor->topZ(rotation); + return m_form_factor->topZ(rotation); } void FormFactorDWBAPol::setSpecularInfo(std::unique_ptr<const ILayerRTCoefficients> p_in_coeffs, std::unique_ptr<const ILayerRTCoefficients> p_out_coeffs) { - mp_in_coeffs = std::move(p_in_coeffs); - mp_out_coeffs = std::move(p_out_coeffs); + m_in_coeffs = std::move(p_in_coeffs); + m_out_coeffs = std::move(p_out_coeffs); } diff --git a/Sample/Scattering/FormFactorDWBAPol.h b/Sample/Scattering/FormFactorDWBAPol.h index 5433bbc642287d8cf68bdded0c480efcf6235dfb..04a15dbcb418d94b5cf00e8529c30404986dc0a7 100644 --- a/Sample/Scattering/FormFactorDWBAPol.h +++ b/Sample/Scattering/FormFactorDWBAPol.h @@ -36,7 +36,7 @@ public: void setAmbientMaterial(const Material& material) override { - mP_form_factor->setAmbientMaterial(material); + m_form_factor->setAmbientMaterial(material); } //! Throws not-implemented exception @@ -45,9 +45,9 @@ public: //! Calculates and returns a polarized form factor calculation in DWBA Eigen::Matrix2cd evaluatePol(const WavevectorInfo& wavevectors) const override; - double volume() const override { return mP_form_factor->volume(); } + double volume() const override { return m_form_factor->volume(); } - double radialExtension() const override { return mP_form_factor->radialExtension(); } + double radialExtension() const override { return m_form_factor->radialExtension(); } double bottomZ(const IRotation& rotation) const override; @@ -60,10 +60,10 @@ public: private: //! The form factor for BA - std::unique_ptr<IFormFactor> mP_form_factor; + std::unique_ptr<IFormFactor> m_form_factor; - std::unique_ptr<const ILayerRTCoefficients> mp_in_coeffs; - std::unique_ptr<const ILayerRTCoefficients> mp_out_coeffs; + std::unique_ptr<const ILayerRTCoefficients> m_in_coeffs; + std::unique_ptr<const ILayerRTCoefficients> m_out_coeffs; }; #endif // BORNAGAIN_CORE_MULTILAYER_FORMFACTORDWBAPOL_H diff --git a/Sample/Scattering/FormFactorDecoratorMaterial.cpp b/Sample/Scattering/FormFactorDecoratorMaterial.cpp index 626fc18eed8aa878276af77e5fe7131f7d43e24f..8fa15f13966b013f57a587d76b4711e6808165e1 100644 --- a/Sample/Scattering/FormFactorDecoratorMaterial.cpp +++ b/Sample/Scattering/FormFactorDecoratorMaterial.cpp @@ -28,7 +28,7 @@ FormFactorDecoratorMaterial::~FormFactorDecoratorMaterial() = default; FormFactorDecoratorMaterial* FormFactorDecoratorMaterial::clone() const { - auto* result = new FormFactorDecoratorMaterial(*mp_form_factor); + auto* result = new FormFactorDecoratorMaterial(*m_form_factor); result->setMaterial(m_material); result->setAmbientMaterial(m_ambient_material); return result; @@ -46,7 +46,7 @@ void FormFactorDecoratorMaterial::setAmbientMaterial(const Material& material) complex_t FormFactorDecoratorMaterial::evaluate(const WavevectorInfo& wavevectors) const { - return getRefractiveIndexFactor(wavevectors) * mp_form_factor->evaluate(wavevectors); + return getRefractiveIndexFactor(wavevectors) * m_form_factor->evaluate(wavevectors); } Eigen::Matrix2cd FormFactorDecoratorMaterial::evaluatePol(const WavevectorInfo& wavevectors) const @@ -60,7 +60,7 @@ Eigen::Matrix2cd FormFactorDecoratorMaterial::evaluatePol(const WavevectorInfo& Eigen::Matrix2cd V_eff = time_reverse_conj * (m_material.polarizedSubtrSLD(wavevectors) - m_ambient_material.polarizedSubtrSLD(wavevectors)); - return mp_form_factor->evaluate(wavevectors) * V_eff; + return m_form_factor->evaluate(wavevectors) * V_eff; } complex_t diff --git a/Sample/Scattering/FormFactorDecoratorPositionFactor.cpp b/Sample/Scattering/FormFactorDecoratorPositionFactor.cpp index e0dc311b4f6d40ab60de0233c515ba35cf99fc61..79c8942f7343c145e249e328321c237d5464d3b4 100644 --- a/Sample/Scattering/FormFactorDecoratorPositionFactor.cpp +++ b/Sample/Scattering/FormFactorDecoratorPositionFactor.cpp @@ -26,24 +26,24 @@ FormFactorDecoratorPositionFactor::FormFactorDecoratorPositionFactor(const IForm double FormFactorDecoratorPositionFactor::bottomZ(const IRotation& rotation) const { kvector_t rotated_translation = rotation.transformed(m_position); - return mp_form_factor->bottomZ(rotation) + rotated_translation.z(); + return m_form_factor->bottomZ(rotation) + rotated_translation.z(); } double FormFactorDecoratorPositionFactor::topZ(const IRotation& rotation) const { kvector_t rotated_translation = rotation.transformed(m_position); - return mp_form_factor->topZ(rotation) + rotated_translation.z(); + return m_form_factor->topZ(rotation) + rotated_translation.z(); } complex_t FormFactorDecoratorPositionFactor::evaluate(const WavevectorInfo& wavevectors) const { - return getPositionFactor(wavevectors) * mp_form_factor->evaluate(wavevectors); + return getPositionFactor(wavevectors) * m_form_factor->evaluate(wavevectors); } Eigen::Matrix2cd FormFactorDecoratorPositionFactor::evaluatePol(const WavevectorInfo& wavevectors) const { - return getPositionFactor(wavevectors) * mp_form_factor->evaluatePol(wavevectors); + return getPositionFactor(wavevectors) * m_form_factor->evaluatePol(wavevectors); } complex_t diff --git a/Sample/Scattering/FormFactorDecoratorPositionFactor.h b/Sample/Scattering/FormFactorDecoratorPositionFactor.h index 9872ee143ebae713b6294d7f549088384a9301b8..d3d36c61b98b487f3c525a75c3c063664287896f 100644 --- a/Sample/Scattering/FormFactorDecoratorPositionFactor.h +++ b/Sample/Scattering/FormFactorDecoratorPositionFactor.h @@ -27,7 +27,7 @@ public: FormFactorDecoratorPositionFactor* clone() const override final { - return new FormFactorDecoratorPositionFactor(*mp_form_factor, m_position); + return new FormFactorDecoratorPositionFactor(*m_form_factor, m_position); } void accept(INodeVisitor* visitor) const override final { visitor->visit(this); } diff --git a/Sample/Scattering/FormFactorDecoratorRotation.cpp b/Sample/Scattering/FormFactorDecoratorRotation.cpp index 0b1ea7a34c4500a4483164a5c97d919adcc47d92..1ce60b7eaf147f247effc967be3fd4572f468f53 100644 --- a/Sample/Scattering/FormFactorDecoratorRotation.cpp +++ b/Sample/Scattering/FormFactorDecoratorRotation.cpp @@ -26,31 +26,31 @@ FormFactorDecoratorRotation::FormFactorDecoratorRotation(const IFormFactor& form FormFactorDecoratorRotation* FormFactorDecoratorRotation::clone() const { - return new FormFactorDecoratorRotation(*mp_form_factor, m_transform); + return new FormFactorDecoratorRotation(*m_form_factor, m_transform); } double FormFactorDecoratorRotation::bottomZ(const IRotation& rotation) const { Transform3D transform = rotation.getTransform3D(); std::unique_ptr<IRotation> P_total_rotation(IRotation::createRotation(transform * m_transform)); - return mp_form_factor->bottomZ(*P_total_rotation); + return m_form_factor->bottomZ(*P_total_rotation); } double FormFactorDecoratorRotation::topZ(const IRotation& rotation) const { Transform3D transform = rotation.getTransform3D(); std::unique_ptr<IRotation> P_total_rotation(IRotation::createRotation(transform * m_transform)); - return mp_form_factor->topZ(*P_total_rotation); + return m_form_factor->topZ(*P_total_rotation); } complex_t FormFactorDecoratorRotation::evaluate(const WavevectorInfo& wavevectors) const { - return mp_form_factor->evaluate(wavevectors.transformed(m_transform.getInverse())); + return m_form_factor->evaluate(wavevectors.transformed(m_transform.getInverse())); } Eigen::Matrix2cd FormFactorDecoratorRotation::evaluatePol(const WavevectorInfo& wavevectors) const { - return mp_form_factor->evaluatePol(wavevectors.transformed(m_transform.getInverse())); + return m_form_factor->evaluatePol(wavevectors.transformed(m_transform.getInverse())); } FormFactorDecoratorRotation::FormFactorDecoratorRotation(const IFormFactor& form_factor, diff --git a/Sample/Scattering/IFormFactorBorn.cpp b/Sample/Scattering/IFormFactorBorn.cpp index dfa90c4600e5d2fd8cddc24a6e35d82bc16f76cb..b3d7ceaee05ac8fb4371f6e7f8de171459c61dfa 100644 --- a/Sample/Scattering/IFormFactorBorn.cpp +++ b/Sample/Scattering/IFormFactorBorn.cpp @@ -40,16 +40,16 @@ Eigen::Matrix2cd IFormFactorBorn::evaluatePol(const WavevectorInfo& wavevectors) double IFormFactorBorn::bottomZ(const IRotation& rotation) const { - if (!mP_shape) + if (!m_shape) return 0; - return BottomZ(mP_shape->vertices(), rotation); + return BottomZ(m_shape->vertices(), rotation); } double IFormFactorBorn::topZ(const IRotation& rotation) const { - if (!mP_shape) + if (!m_shape) return 0; - return TopZ(mP_shape->vertices(), rotation); + return TopZ(m_shape->vertices(), rotation); } bool IFormFactorBorn::canSliceAnalytically(const IRotation& rot) const diff --git a/Sample/Scattering/IFormFactorBorn.h b/Sample/Scattering/IFormFactorBorn.h index a873ed4bdf2a9cdf498b56a1300b560479a2452a..30f87b3a5874db31f94f246f8f7698c31e3fba97 100644 --- a/Sample/Scattering/IFormFactorBorn.h +++ b/Sample/Scattering/IFormFactorBorn.h @@ -65,7 +65,7 @@ protected: //! IShape object, used to retrieve vertices (which may be approximate in the case //! of round shapes). For soft particles, this will be a hard mean shape. - std::unique_ptr<IShape> mP_shape; + std::unique_ptr<IShape> m_shape; //! Helper method for slicing SlicingEffects computeSlicingEffects(ZLimits limits, const kvector_t& position, diff --git a/Sample/Scattering/IFormFactorDecorator.h b/Sample/Scattering/IFormFactorDecorator.h index 9b0100b8e7e3a37184206cd37adf98a3b03f9ad7..e2ad8fc48aa01fa310d680c3224ef8ba59fc1f2b 100644 --- a/Sample/Scattering/IFormFactorDecorator.h +++ b/Sample/Scattering/IFormFactorDecorator.h @@ -28,30 +28,30 @@ class IFormFactorDecorator : public IFormFactor { public: - IFormFactorDecorator(const IFormFactor& form_factor) : mp_form_factor(form_factor.clone()) {} - ~IFormFactorDecorator() override { delete mp_form_factor; } + IFormFactorDecorator(const IFormFactor& form_factor) : m_form_factor(form_factor.clone()) {} + ~IFormFactorDecorator() override { delete m_form_factor; } IFormFactorDecorator* clone() const override = 0; void setAmbientMaterial(const Material& material) override { - mp_form_factor->setAmbientMaterial(material); + m_form_factor->setAmbientMaterial(material); } - double volume() const override { return mp_form_factor->volume(); } + double volume() const override { return m_form_factor->volume(); } - double radialExtension() const override { return mp_form_factor->radialExtension(); } + double radialExtension() const override { return m_form_factor->radialExtension(); } double bottomZ(const IRotation& rotation) const override { - return mp_form_factor->bottomZ(rotation); + return m_form_factor->bottomZ(rotation); } - double topZ(const IRotation& rotation) const override { return mp_form_factor->topZ(rotation); } + double topZ(const IRotation& rotation) const override { return m_form_factor->topZ(rotation); } - const IFormFactor* getFormFactor() const { return mp_form_factor; } + const IFormFactor* getFormFactor() const { return m_form_factor; } protected: - IFormFactor* mp_form_factor; + IFormFactor* m_form_factor; }; #endif // BORNAGAIN_CORE_SCATTERING_IFORMFACTORDECORATOR_H diff --git a/Sample/Slice/Slice.cpp b/Sample/Slice/Slice.cpp index a3e4c47a04de9383fe3d2a05452f6e15679b04f6..942d7a864282ff7384e78f01bb33c6bfc5f847df 100644 --- a/Sample/Slice/Slice.cpp +++ b/Sample/Slice/Slice.cpp @@ -17,28 +17,28 @@ #include "Sample/Slice/LayerRoughness.h" Slice::Slice(double thickness, const Material& material) - : m_thickness{thickness}, m_material{material}, m_B_field{}, mP_top_roughness{nullptr} + : m_thickness{thickness}, m_material{material}, m_B_field{}, m_top_roughness{nullptr} { } Slice::Slice(double thickness, const Material& material, const LayerRoughness& top_roughness) - : m_thickness{thickness}, m_material{material}, m_B_field{}, mP_top_roughness{ + : m_thickness{thickness}, m_material{material}, m_B_field{}, m_top_roughness{ top_roughness.clone()} { } Slice::Slice(const Slice& other) : m_thickness{other.m_thickness}, m_material{other.m_material}, m_B_field{other.m_B_field}, - mP_top_roughness{} + m_top_roughness{} { - if (other.mP_top_roughness) { - mP_top_roughness.reset(other.mP_top_roughness->clone()); + if (other.m_top_roughness) { + m_top_roughness.reset(other.m_top_roughness->clone()); } } Slice::Slice(Slice&& other) : m_thickness{other.m_thickness}, m_material{std::move(other.m_material)}, - m_B_field{other.m_B_field}, mP_top_roughness{std::move(other.mP_top_roughness)} + m_B_field{other.m_B_field}, m_top_roughness{std::move(other.m_top_roughness)} { } @@ -47,8 +47,8 @@ Slice& Slice::operator=(const Slice& other) m_thickness = other.m_thickness; m_material = other.m_material; m_B_field = other.m_B_field; - if (other.mP_top_roughness) { - mP_top_roughness.reset(other.mP_top_roughness->clone()); + if (other.m_top_roughness) { + m_top_roughness.reset(other.m_top_roughness->clone()); } return *this; } @@ -72,7 +72,7 @@ double Slice::thickness() const const LayerRoughness* Slice::topRoughness() const { - return mP_top_roughness.get(); + return m_top_roughness.get(); } complex_t Slice::scalarReducedPotential(kvector_t k, double n_ref) const diff --git a/Sample/Slice/Slice.h b/Sample/Slice/Slice.h index 1e159998f70652bdab8147c64ecddbf1e87508da..c09a8c6013e59bef022bdeb76c388dcdbd205356 100644 --- a/Sample/Slice/Slice.h +++ b/Sample/Slice/Slice.h @@ -61,7 +61,7 @@ private: double m_thickness; Material m_material; kvector_t m_B_field; //!< cached value of magnetic induction - std::unique_ptr<LayerRoughness> mP_top_roughness; + std::unique_ptr<LayerRoughness> m_top_roughness; }; #endif // BORNAGAIN_CORE_MULTILAYER_SLICE_H diff --git a/Sample/Slice/SlicedFormFactorList.cpp b/Sample/Slice/SlicedFormFactorList.cpp index 01bdee4ada38b09025df0d3c9c6aadaa2070b561..5d39e84c9f246998eb0218c7651f8bb1ff075a7f 100644 --- a/Sample/Slice/SlicedFormFactorList.cpp +++ b/Sample/Slice/SlicedFormFactorList.cpp @@ -54,7 +54,7 @@ void SlicedFormFactorList::addParticle(IParticle& particle, const std::vector<Sl // if particle is contained in this layer, set limits to infinite: ZLimits limits = single_layer ? ZLimits() : SlicesZLimits(slices, i); auto sliced_particle = particle.createSlicedParticle(limits); - m_ff_list.emplace_back(std::move(sliced_particle.mP_slicedff), i); + m_ff_list.emplace_back(std::move(sliced_particle.m_slicedff), i); double thickness = slices[i].thickness(); if (thickness > 0.0) ScaleRegions(sliced_particle.m_regions, 1 / thickness); diff --git a/Sample/SoftParticle/FormFactorSphereGaussianRadius.cpp b/Sample/SoftParticle/FormFactorSphereGaussianRadius.cpp index 42b94fb3b45ccd5df78a6436861bf8c611860d99..129107bc07e96750dd0a7f824f4132248cd35b09 100644 --- a/Sample/SoftParticle/FormFactorSphereGaussianRadius.cpp +++ b/Sample/SoftParticle/FormFactorSphereGaussianRadius.cpp @@ -44,7 +44,7 @@ complex_t FormFactorSphereGaussianRadius::evaluate_for_q(cvector_t q) const void FormFactorSphereGaussianRadius::onChange() { - mP_shape = std::make_unique<TruncatedEllipsoid>(m_mean, m_mean, m_mean, 2.0 * m_mean, 0.0); + m_shape = std::make_unique<TruncatedEllipsoid>(m_mean, m_mean, m_mean, 2.0 * m_mean, 0.0); } double FormFactorSphereGaussianRadius::calculateMeanR3() const diff --git a/Sample/SoftParticle/FormFactorSphereLogNormalRadius.cpp b/Sample/SoftParticle/FormFactorSphereLogNormalRadius.cpp index 55b0490935876ac5ca452b0b7c780ce9584e07ca..7205f9a93a31465b0fedeb4813560d585ecc0fd9 100644 --- a/Sample/SoftParticle/FormFactorSphereLogNormalRadius.cpp +++ b/Sample/SoftParticle/FormFactorSphereLogNormalRadius.cpp @@ -60,5 +60,5 @@ complex_t FormFactorSphereLogNormalRadius::evaluate_for_q(cvector_t q) const void FormFactorSphereLogNormalRadius::onChange() { - mP_shape = std::make_unique<TruncatedEllipsoid>(m_mean, m_mean, m_mean, 2.0 * m_mean, 0.0); + m_shape = std::make_unique<TruncatedEllipsoid>(m_mean, m_mean, m_mean, 2.0 * m_mean, 0.0); } diff --git a/Tests/Functional/Python/PyCore/transform_BoxComposition.py b/Tests/Functional/Python/PyCore/transform_BoxComposition.py index 9c6310d3629ac6014b3d7b27c113fde57b20934e..bc2f1c7e65e9b664812a42d6da331d99954c8230 100644 --- a/Tests/Functional/Python/PyCore/transform_BoxComposition.py +++ b/Tests/Functional/Python/PyCore/transform_BoxComposition.py @@ -14,9 +14,9 @@ import utils from bornagain import * layer_thickness = 100.0 -comp_length = 50.0 -comp_width = 20.0 -comp_height = 10.0 +com_length = 50.0 +com_width = 20.0 +com_height = 10.0 particle_material = HomogeneousMaterial("Ag", 1.245e-5, 5.419e-7) class TransformBoxCompositionTest(unittest.TestCase): @@ -62,12 +62,12 @@ class TransformBoxCompositionTest(unittest.TestCase): #IntensityDataIOFactory.writeIntensityData(reference_data, "ref_BoxComposition.int") # composition - box = Particle(particle_material, FormFactorBox(comp_length/2.0, comp_width, comp_height)) + box = Particle(particle_material, FormFactorBox(com_length/2.0, com_width, com_height)) composition = ParticleComposition() # composition = ParticleComposition(box, positions) composition.addParticle(box, kvector_t(0.0, 0.0, 0.0)) - composition.addParticle(box, kvector_t(comp_length/2.0, 0.0, 0.0)) - composition.setPosition(kvector_t(0.0, 0.0, -layer_thickness/2.0 - comp_height/2.0)) + composition.addParticle(box, kvector_t(com_length/2.0, 0.0, 0.0)) + composition.setPosition(kvector_t(0.0, 0.0, -layer_thickness/2.0 - com_height/2.0)) data = self.get_result(composition) @@ -91,10 +91,10 @@ class TransformBoxCompositionTest(unittest.TestCase): #IntensityDataIOFactory.writeIntensityData(reference_data, "ref_BoxCompositionRotateX.int") # composition - box = Particle(particle_material, FormFactorBox(comp_length/2.0, comp_width, comp_height)) + box = Particle(particle_material, FormFactorBox(com_length/2.0, com_width, com_height)) composition = ParticleComposition() composition.addParticle(box, kvector_t(0.0, 0.0, 0.0)) - composition.addParticle(box, kvector_t(comp_length/2.0, 0.0, 0.0)) + composition.addParticle(box, kvector_t(com_length/2.0, 0.0, 0.0)) composition.setRotation(RotationX(90*deg)) composition.setPosition(kvector_t(0.0, 0.0, -layer_thickness/2.)) @@ -120,12 +120,12 @@ class TransformBoxCompositionTest(unittest.TestCase): #IntensityDataIOFactory.writeIntensityData(reference_data, "ref_BoxCompositionRotateY.int") # composition - box = Particle(particle_material, FormFactorBox(comp_length/2.0, comp_width, comp_height)) + box = Particle(particle_material, FormFactorBox(com_length/2.0, com_width, com_height)) composition = ParticleComposition() composition.addParticle(box, kvector_t(0.0, 0.0, 0.0)) - composition.addParticle(box, kvector_t(comp_length/2.0, 0.0, 0.0)) + composition.addParticle(box, kvector_t(com_length/2.0, 0.0, 0.0)) composition.setRotation(RotationY(90*deg)) - composition.setPosition(kvector_t(0.0, 0.0, -layer_thickness/2. + comp_length/4.)) + composition.setPosition(kvector_t(0.0, 0.0, -layer_thickness/2. + com_length/4.)) data = self.get_result(composition) @@ -149,12 +149,12 @@ class TransformBoxCompositionTest(unittest.TestCase): #IntensityDataIOFactory.writeIntensityData(reference_data, "ref_BoxCompositionRotateZ.int") # composition - box = Particle(particle_material, FormFactorBox(comp_length/2.0, comp_width, comp_height)) + box = Particle(particle_material, FormFactorBox(com_length/2.0, com_width, com_height)) composition = ParticleComposition() composition.addParticle(box, kvector_t(0.0, 0.0, 0.0)) - composition.addParticle(box, kvector_t(comp_length/2.0, 0.0, 0.0)) + composition.addParticle(box, kvector_t(com_length/2.0, 0.0, 0.0)) composition.setRotation(RotationZ(90*deg)) - composition.setPosition(kvector_t(0.0, 0.0, -layer_thickness/2.0 - comp_height/2.0)) + composition.setPosition(kvector_t(0.0, 0.0, -layer_thickness/2.0 - com_height/2.0)) data = self.get_result(composition) @@ -178,10 +178,10 @@ class TransformBoxCompositionTest(unittest.TestCase): #IntensityDataIOFactory.writeIntensityData(reference_data, "ref_BoxCompositionRotateZandY.int") # composition - box = Particle(particle_material, FormFactorBox(comp_length/2.0, comp_width, comp_height)) + box = Particle(particle_material, FormFactorBox(com_length/2.0, com_width, com_height)) composition = ParticleComposition() composition.addParticle(box, kvector_t(0.0, 0.0, 0.0)) - composition.addParticle(box, kvector_t(comp_length/2.0, 0.0, 0.0)) + composition.addParticle(box, kvector_t(com_length/2.0, 0.0, 0.0)) composition.setRotation(RotationZ(90*deg)) composition.rotate(RotationY(90*deg)) composition.setPosition(kvector_t(0.0, 0.0, -layer_thickness/2.)) diff --git a/Tests/Performance/GUI/CsvImportAssistantPerformanceTest.h b/Tests/Performance/GUI/CsvImportAssistantPerformanceTest.h index e32a706521e806c0101a47857927ee816859010f..8967bec7aad0421bd5e69ea12a94a5a6566e3841 100644 --- a/Tests/Performance/GUI/CsvImportAssistantPerformanceTest.h +++ b/Tests/Performance/GUI/CsvImportAssistantPerformanceTest.h @@ -31,7 +31,7 @@ protected: void writeTestFile(size_t nRows, size_t nCols); OutputData<double>* readTestFile(); - const std::string m_testFilename = "tmp_TestCsvImportAssistant.txt"; + const std::string m_testFilename = "tm_TestCsvImportAssistant.txt"; const std::vector<std::vector<double>> m_testVector = { {0.0, 1.0, 2.0, 3.0}, {4.0, 5.0, 6.0, 7.0}, {8.0, 9.0, 10.0, 11.0}, {12.0, 13.0, 14.0, 15.0}, {16.0, 17.0, 18.0, 19.0}, {20.0, 21.0, 22.0, 23.0}}; diff --git a/Tests/UnitTests/Core/Axes/UnitConverter1DTest.cpp b/Tests/UnitTests/Core/Axes/UnitConverter1DTest.cpp index ca4b1ea7e6189a284cd2c0b9fbb6fd49322a84ff..db0291f8dd15ccf3b8174a15b971615fe9babc5b 100644 --- a/Tests/UnitTests/Core/Axes/UnitConverter1DTest.cpp +++ b/Tests/UnitTests/Core/Axes/UnitConverter1DTest.cpp @@ -3,9 +3,9 @@ #include "Base/Axis/VariableBinAxis.h" #include "Base/Const/MathConstants.h" #include "Base/Const/Units.h" +#include "Core/Scan/QSpecScan.h" #include "Device/Beam/Beam.h" #include "Device/Data/OutputData.h" -#include "Core/Scan/QSpecScan.h" #include "Tests/GTestWrapper/google_test.h" class UnitConverter1DTest : public ::testing::Test diff --git a/Tests/UnitTests/Core/Fresnel/SpecularScanTest.cpp b/Tests/UnitTests/Core/Fresnel/SpecularScanTest.cpp index c2ef4232d890c29c147134804b2fa67551cd720b..3202c2ddfbd90fb5e966b24da263905e4104c388 100644 --- a/Tests/UnitTests/Core/Fresnel/SpecularScanTest.cpp +++ b/Tests/UnitTests/Core/Fresnel/SpecularScanTest.cpp @@ -1,11 +1,12 @@ #include "Base/Axis/FixedBinAxis.h" #include "Base/Axis/PointwiseAxis.h" -#include "Device/Beam/FootprintGauss.h" -#include "Device/Resolution/ScanResolution.h" #include "Core/Scan/AngularSpecScan.h" #include "Core/Scan/QSpecScan.h" +#include "Device/Beam/FootprintGauss.h" +#include "Device/Instrument/Instrument.h" +#include "Device/Resolution/ScanResolution.h" #include "Param/Distrib/RangedDistributions.h" -#include "Sample/Slice/SpecularSimulationElement.h" +#include "Core/Scan/SpecularSimulationElement.h" #include "Tests/GTestWrapper/google_test.h" class SpecularScanTest : public ::testing::Test @@ -184,14 +185,17 @@ TEST_F(SpecularScanTest, QScanClone) TEST_F(SpecularScanTest, GenerateSimElements) { AngularSpecScan scan(0.1, std::vector<double>{0.0, 0.2, 0.3}); - std::vector<SpecularSimulationElement> sim_elements = scan.generateSimulationElements(); + const Instrument instrument; + std::vector<SpecularSimulationElement> sim_elements = + scan.generateSimulationElements(instrument); EXPECT_EQ(sim_elements.size(), scan.numberOfSimulationElements()); EXPECT_EQ(scan.numberOfSimulationElements(), 3u); for (size_t i = 0; i < sim_elements.size(); ++i) EXPECT_TRUE(sim_elements[i].isCalculated()); QSpecScan scan2(std::vector<double>{0.0, 0.2, 0.3}); - std::vector<SpecularSimulationElement> sim_elements2 = scan.generateSimulationElements(); + std::vector<SpecularSimulationElement> sim_elements2 = + scan.generateSimulationElements(instrument); EXPECT_EQ(sim_elements2.size(), scan2.numberOfSimulationElements()); EXPECT_EQ(scan2.numberOfSimulationElements(), 3u); for (size_t i = 0; i < sim_elements2.size(); ++i) diff --git a/Tests/UnitTests/Core/Fresnel/SpecularSimulationTest.cpp b/Tests/UnitTests/Core/Fresnel/SpecularSimulationTest.cpp index 58557b7ce84ee71b3a633b4d373e792f87c5bdfb..8683b9cfd138315b8f48cd7f213f32b146678f12 100644 --- a/Tests/UnitTests/Core/Fresnel/SpecularSimulationTest.cpp +++ b/Tests/UnitTests/Core/Fresnel/SpecularSimulationTest.cpp @@ -2,9 +2,9 @@ #include "Base/Axis/VariableBinAxis.h" #include "Base/Const/MathConstants.h" #include "Base/Const/Units.h" -#include "Device/Histo/Histogram1D.h" #include "Core/Scan/AngularSpecScan.h" #include "Core/Scan/QSpecScan.h" +#include "Device/Histo/Histogram1D.h" #include "Param/Base/RealParameter.h" #include "Param/Distrib/Distributions.h" #include "Param/Varia/ParameterPattern.h" diff --git a/Tests/UnitTests/Core/Sample/ParticleCoreShellTest.cpp b/Tests/UnitTests/Core/Sample/ParticleCoreShellTest.cpp index f1b0e34f6610910ab90401e8aeaed7b380d0c87c..e58d4be7aeaf26de7d63d90b49e23c8d32a34908 100644 --- a/Tests/UnitTests/Core/Sample/ParticleCoreShellTest.cpp +++ b/Tests/UnitTests/Core/Sample/ParticleCoreShellTest.cpp @@ -12,31 +12,31 @@ protected: ParticleCoreShellTest(); virtual ~ParticleCoreShellTest(); - ParticleCoreShell* mp_coreshell; + ParticleCoreShell* m_coreshell; }; -ParticleCoreShellTest::ParticleCoreShellTest() : mp_coreshell(nullptr) +ParticleCoreShellTest::ParticleCoreShellTest() : m_coreshell(nullptr) { Particle core; Particle shell; kvector_t position; - mp_coreshell = new ParticleCoreShell(shell, core, position); + m_coreshell = new ParticleCoreShell(shell, core, position); } ParticleCoreShellTest::~ParticleCoreShellTest() { - delete mp_coreshell; + delete m_coreshell; } TEST_F(ParticleCoreShellTest, InitialState) { - EXPECT_EQ(nullptr, mp_coreshell->createFormFactor()); - EXPECT_EQ(nullptr, mp_coreshell->rotation()); + EXPECT_EQ(nullptr, m_coreshell->createFormFactor()); + EXPECT_EQ(nullptr, m_coreshell->rotation()); } TEST_F(ParticleCoreShellTest, Clone) { - ParticleCoreShell* p_clone = mp_coreshell->clone(); + ParticleCoreShell* p_clone = m_coreshell->clone(); EXPECT_EQ(nullptr, p_clone->createFormFactor()); EXPECT_EQ(nullptr, p_clone->rotation()); delete p_clone; diff --git a/Tests/UnitTests/Core/SimulationElement/SimulationElementTest.cpp b/Tests/UnitTests/Core/SimulationElement/SimulationElementTest.cpp index d6d6702f49dd59717a62665eb1d7ac19ba0e913a..19e7f5082a3d740f8f63fef5f165507670593e15 100644 --- a/Tests/UnitTests/Core/SimulationElement/SimulationElementTest.cpp +++ b/Tests/UnitTests/Core/SimulationElement/SimulationElementTest.cpp @@ -24,13 +24,14 @@ public: std::unique_ptr<SimulationElement> createElement() const { - return std::make_unique<SimulationElement>(wavelength, alpha_i, phi_i, createPixel()); + return std::make_unique<SimulationElement>(wavelength, alpha_i, phi_i, createPixel(), + Eigen::Matrix2cd{}, Eigen::Matrix2cd{}, false); } }; TEST_F(SimulationElementTest, basicConstructor) { - SimulationElement element(wavelength, alpha_i, phi_i, createPixel()); + SimulationElement element(wavelength, alpha_i, phi_i, createPixel(), {}, {}, false); EXPECT_EQ(element.getWavelength(), wavelength); EXPECT_EQ(element.getAlphaI(), alpha_i); EXPECT_EQ(element.getPhiI(), phi_i); @@ -72,54 +73,10 @@ TEST_F(SimulationElementTest, copyConstructor) EXPECT_EQ(orig->isSpecular(), element.isSpecular()); } -TEST_F(SimulationElementTest, assignmentOperator) -{ - auto orig = createElement(); - SimulationElement element(1.0, 1.0, 1.0, createPixel()); - element = *orig; - - EXPECT_EQ(orig->getWavelength(), element.getWavelength()); - EXPECT_EQ(orig->getAlphaI(), element.getAlphaI()); - EXPECT_EQ(orig->getPhiI(), element.getPhiI()); - EXPECT_EQ(orig->getAlphaMean(), element.getAlphaMean()); - EXPECT_EQ(orig->getPhiMean(), element.getPhiMean()); - EXPECT_EQ(orig->getIntensity(), element.getIntensity()); - EXPECT_EQ(orig->getKi(), element.getKi()); - EXPECT_EQ(orig->getMeanKf(), element.getMeanKf()); - EXPECT_EQ(orig->getQ(0.5, 0.5), element.getQ(0.5, 0.5)); - EXPECT_EQ(orig->getIntegrationFactor(0.5, 0.5), element.getIntegrationFactor(0.5, 0.5)); - EXPECT_EQ(orig->getSolidAngle(), element.getSolidAngle()); - EXPECT_EQ(orig->getAlpha(0.5, 0.5), element.getAlpha(0.5, 0.5)); - EXPECT_EQ(orig->getPhi(0.5, 0.5), element.getPhi(0.5, 0.5)); - EXPECT_EQ(orig->isSpecular(), element.isSpecular()); -} - -TEST_F(SimulationElementTest, moveAssignment) -{ - SimulationElement for_move(1.0, 2.0, 3.0, createPixel()); - SimulationElement orig(1.0, 2.0, 3.0, createPixel()); - SimulationElement element = std::move(for_move); - - EXPECT_EQ(orig.getWavelength(), element.getWavelength()); - EXPECT_EQ(orig.getAlphaI(), element.getAlphaI()); - EXPECT_EQ(orig.getPhiI(), element.getPhiI()); - EXPECT_EQ(orig.getAlphaMean(), element.getAlphaMean()); - EXPECT_EQ(orig.getPhiMean(), element.getPhiMean()); - EXPECT_EQ(orig.getIntensity(), element.getIntensity()); - EXPECT_EQ(orig.getKi(), element.getKi()); - EXPECT_EQ(orig.getMeanKf(), element.getMeanKf()); - EXPECT_EQ(orig.getQ(0.5, 0.5), element.getQ(0.5, 0.5)); - EXPECT_EQ(orig.getIntegrationFactor(0.5, 0.5), element.getIntegrationFactor(0.5, 0.5)); - EXPECT_EQ(orig.getSolidAngle(), element.getSolidAngle()); - EXPECT_EQ(orig.getAlpha(0.5, 0.5), element.getAlpha(0.5, 0.5)); - EXPECT_EQ(orig.getPhi(0.5, 0.5), element.getPhi(0.5, 0.5)); - EXPECT_EQ(orig.isSpecular(), element.isSpecular()); -} - TEST_F(SimulationElementTest, moveConstruction) { - SimulationElement for_move(1.0, 2.0, 3.0, createPixel()); - SimulationElement orig(1.0, 2.0, 3.0, createPixel()); + SimulationElement for_move(1.0, 2.0, 3.0, createPixel(), {}, {}, false); + SimulationElement orig(1.0, 2.0, 3.0, createPixel(), {}, {}, false); SimulationElement element(std::move(for_move)); EXPECT_EQ(orig.getWavelength(), element.getWavelength()); diff --git a/Tests/UnitTests/GUI/TestCsvImportAssistant.cpp b/Tests/UnitTests/GUI/TestCsvImportAssistant.cpp index d81a5ce644750997bde3912ff68cb94fbebde020..0799e7c9d3c858f5820f3ad64f6c2f9c28547f2a 100644 --- a/Tests/UnitTests/GUI/TestCsvImportAssistant.cpp +++ b/Tests/UnitTests/GUI/TestCsvImportAssistant.cpp @@ -11,7 +11,7 @@ class TestCsvImportAssistant : public ::testing::Test { protected: - const std::string m_testFilename = "tmp_TestCsvImportAssistant.txt"; + const std::string m_testFilename = "tm_TestCsvImportAssistant.txt"; const std::vector<std::vector<double>> m_testVector = { {0.0, 1.0, 2.0, 3.0}, {4.0, 5.0, 6.0, 7.0}, {8.0, 9.0, 10.0, 11.0}, {12.0, 13.0, 14.0, 15.0}, {16.0, 17.0, 18.0, 19.0}, {20.0, 21.0, 22.0, 23.0}}; diff --git a/Wrap/python/bornagain_python_install.py b/Wrap/python/bornagain_python_install.py index 38c961dc16bbaf759eb5fbc29b46ca747c483de2..ed50aea5d77b09684fdb3f4fc76a77b8264eb6b1 100644 --- a/Wrap/python/bornagain_python_install.py +++ b/Wrap/python/bornagain_python_install.py @@ -117,7 +117,7 @@ def get_application_dir(): return app_dir -def create_bundle_temp_dir(): +def create_bundle_tem_dir(): """ Creates temporary directory for BornAgain package bundle """ @@ -244,7 +244,7 @@ def create_bundle(app_dir): """ Creates ready to install BornAgain Python bundle package """ - bundle_dir = create_bundle_temp_dir() + bundle_dir = create_bundle_tem_dir() print('-'*80) print("Generating Python bundle in temporary '{0}'".format(bundle_dir)) print('-'*80) diff --git a/Wrap/swig/numpy.i b/Wrap/swig/numpy.i index 36bb55c98cff1e306fe7e0e6efd6077fa24cc46d..3095efbe32a4bf310c397b287dbe637c5551342b 100644 --- a/Wrap/swig/numpy.i +++ b/Wrap/swig/numpy.i @@ -1028,7 +1028,7 @@ (DATA_TYPE** array=NULL, PyArrayObject** object_array=NULL, int* is_new_object_array=NULL) { npy_intp size[2] = { -1, -1 }; - PyArrayObject* temp_array; + PyArrayObject* tem_array; Py_ssize_t i; int is_new_object; @@ -1047,24 +1047,24 @@ for (i=0; i<$2; i++) { - temp_array = obj_to_array_contiguous_allow_conversion(PySequence_GetItem($input,i), DATA_TYPECODE, &is_new_object); + tem_array = obj_to_array_contiguous_allow_conversion(PySequence_GetItem($input,i), DATA_TYPECODE, &is_new_object); /* the new array must be stored so that it can be destroyed in freearg */ - object_array[i] = temp_array; + object_array[i] = tem_array; is_new_object_array[i] = is_new_object; - if (!temp_array || !require_dimensions(temp_array, 2)) SWIG_fail; + if (!tem_array || !require_dimensions(tem_array, 2)) SWIG_fail; /* store the size of the first array in the list, then use that for comparison. */ if (i == 0) { - size[0] = array_size(temp_array,0); - size[1] = array_size(temp_array,1); + size[0] = array_size(tem_array,0); + size[1] = array_size(tem_array,1); } - if (!require_size(temp_array, size, 2)) SWIG_fail; + if (!require_size(tem_array, size, 2)) SWIG_fail; - array[i] = (DATA_TYPE*) array_data(temp_array); + array[i] = (DATA_TYPE*) array_data(tem_array); } $1 = (DATA_TYPE**) array; @@ -1263,7 +1263,7 @@ (DATA_TYPE** array=NULL, PyArrayObject** object_array=NULL, int* is_new_object_array=NULL) { npy_intp size[3] = { -1, -1, -1 }; - PyArrayObject* temp_array; + PyArrayObject* tem_array; Py_ssize_t i; int is_new_object; @@ -1282,25 +1282,25 @@ for (i=0; i<$2; i++) { - temp_array = obj_to_array_contiguous_allow_conversion(PySequence_GetItem($input,i), DATA_TYPECODE, &is_new_object); + tem_array = obj_to_array_contiguous_allow_conversion(PySequence_GetItem($input,i), DATA_TYPECODE, &is_new_object); /* the new array must be stored so that it can be destroyed in freearg */ - object_array[i] = temp_array; + object_array[i] = tem_array; is_new_object_array[i] = is_new_object; - if (!temp_array || !require_dimensions(temp_array, 3)) SWIG_fail; + if (!tem_array || !require_dimensions(tem_array, 3)) SWIG_fail; /* store the size of the first array in the list, then use that for comparison. */ if (i == 0) { - size[0] = array_size(temp_array,0); - size[1] = array_size(temp_array,1); - size[2] = array_size(temp_array,2); + size[0] = array_size(tem_array,0); + size[1] = array_size(tem_array,1); + size[2] = array_size(tem_array,2); } - if (!require_size(temp_array, size, 3)) SWIG_fail; + if (!require_size(tem_array, size, 3)) SWIG_fail; - array[i] = (DATA_TYPE*) array_data(temp_array); + array[i] = (DATA_TYPE*) array_data(tem_array); } $1 = (DATA_TYPE**) array; @@ -1665,7 +1665,7 @@ (DATA_TYPE** array=NULL, PyArrayObject** object_array=NULL) { npy_intp size[2] = { -1, -1 }; - PyArrayObject* temp_array; + PyArrayObject* tem_array; Py_ssize_t i; /* length of the list */ @@ -1682,27 +1682,27 @@ for (i=0; i<$2; i++) { - temp_array = obj_to_array_no_conversion(PySequence_GetItem($input,i), DATA_TYPECODE); + tem_array = obj_to_array_no_conversion(PySequence_GetItem($input,i), DATA_TYPECODE); /* the new array must be stored so that it can be destroyed in freearg */ - object_array[i] = temp_array; + object_array[i] = tem_array; - if ( !temp_array || !require_dimensions(temp_array, 2) || - !require_contiguous(temp_array) || - !require_native(temp_array) || - !PyArray_EquivTypenums(array_type(temp_array), DATA_TYPECODE) + if ( !tem_array || !require_dimensions(tem_array, 2) || + !require_contiguous(tem_array) || + !require_native(tem_array) || + !PyArray_EquivTypenums(array_type(tem_array), DATA_TYPECODE) ) SWIG_fail; /* store the size of the first array in the list, then use that for comparison. */ if (i == 0) { - size[0] = array_size(temp_array,0); - size[1] = array_size(temp_array,1); + size[0] = array_size(tem_array,0); + size[1] = array_size(tem_array,1); } - if (!require_size(temp_array, size, 2)) SWIG_fail; + if (!require_size(tem_array, size, 2)) SWIG_fail; - array[i] = (DATA_TYPE*) array_data(temp_array); + array[i] = (DATA_TYPE*) array_data(tem_array); } $1 = (DATA_TYPE**) array; @@ -1849,7 +1849,7 @@ (DATA_TYPE** array=NULL, PyArrayObject** object_array=NULL) { npy_intp size[3] = { -1, -1, -1 }; - PyArrayObject* temp_array; + PyArrayObject* tem_array; Py_ssize_t i; /* length of the list */ @@ -1866,28 +1866,28 @@ for (i=0; i<$2; i++) { - temp_array = obj_to_array_no_conversion(PySequence_GetItem($input,i), DATA_TYPECODE); + tem_array = obj_to_array_no_conversion(PySequence_GetItem($input,i), DATA_TYPECODE); /* the new array must be stored so that it can be destroyed in freearg */ - object_array[i] = temp_array; + object_array[i] = tem_array; - if ( !temp_array || !require_dimensions(temp_array, 3) || - !require_contiguous(temp_array) || - !require_native(temp_array) || - !PyArray_EquivTypenums(array_type(temp_array), DATA_TYPECODE) + if ( !tem_array || !require_dimensions(tem_array, 3) || + !require_contiguous(tem_array) || + !require_native(tem_array) || + !PyArray_EquivTypenums(array_type(tem_array), DATA_TYPECODE) ) SWIG_fail; /* store the size of the first array in the list, then use that for comparison. */ if (i == 0) { - size[0] = array_size(temp_array,0); - size[1] = array_size(temp_array,1); - size[2] = array_size(temp_array,2); + size[0] = array_size(tem_array,0); + size[1] = array_size(tem_array,1); + size[2] = array_size(tem_array,2); } - if (!require_size(temp_array, size, 3)) SWIG_fail; + if (!require_size(tem_array, size, 3)) SWIG_fail; - array[i] = (DATA_TYPE*) array_data(temp_array); + array[i] = (DATA_TYPE*) array_data(tem_array); } $1 = (DATA_TYPE**) array; diff --git a/auto/Wrap/doxygenBase.i b/auto/Wrap/doxygenBase.i index 91ea6cd97355f23e7886beeeb6d87d551793dab6..04d4c0a481982acf192f85d509d43f123b5dc7a1 100644 --- a/auto/Wrap/doxygenBase.i +++ b/auto/Wrap/doxygenBase.i @@ -639,7 +639,7 @@ perform the actual integration over the ranges [min_array, max_array] // File: classIPixel.xml %feature("docstring") IPixel " -Interface for a function that maps [0,1]x[0,1] to the kvectors in a pixel. +Interface for a function that maps [0,1]x[0,1] to the kvectors in a pixel. Pure virtual base class for SphericalPixel and RectangularPixel. C++ includes: IPixel.h "; @@ -891,31 +891,24 @@ Data stucture containing both input and output of a single detector cell. C++ includes: SimulationElement.h "; -%feature("docstring") SimulationElement::SimulationElement "SimulationElement::SimulationElement(double wavelength, double alpha_i, double phi_i, std::unique_ptr< IPixel > pixel) +%feature("docstring") SimulationElement::SimulationElement "SimulationElement::SimulationElement()=delete "; -%feature("docstring") SimulationElement::SimulationElement "SimulationElement::SimulationElement(const SimulationElement &other) +%feature("docstring") SimulationElement::SimulationElement "SimulationElement::SimulationElement(double wavelength, double alpha_i, double phi_i, std::unique_ptr< IPixel > pixel, const Eigen::Matrix2cd &beam_polarization, const Eigen::Matrix2cd &analyzer, bool isSpecular_) "; -%feature("docstring") SimulationElement::SimulationElement "SimulationElement::SimulationElement(const SimulationElement &other, double x, double y) - -Construct SimulationElement from other element and restrict k_f to specific value in the original detector pixel +%feature("docstring") SimulationElement::SimulationElement "SimulationElement::SimulationElement(const SimulationElement &other) "; -%feature("docstring") SimulationElement::SimulationElement "SimulationElement::SimulationElement(SimulationElement &&other) noexcept +%feature("docstring") SimulationElement::SimulationElement "SimulationElement::SimulationElement(SimulationElement &&other) "; %feature("docstring") SimulationElement::~SimulationElement "SimulationElement::~SimulationElement() "; -%feature("docstring") SimulationElement::setPolarization "void SimulationElement::setPolarization(const Eigen::Matrix2cd &polarization) +%feature("docstring") SimulationElement::pointElement "SimulationElement SimulationElement::pointElement(double x, double y) const -Sets the polarization density matrix (in spin basis along z-axis) -"; - -%feature("docstring") SimulationElement::setAnalyzerOperator "void SimulationElement::setAnalyzerOperator(const Eigen::Matrix2cd &polarization_operator) - -Sets the polarization analyzer operator (in spin basis along z-axis) +Returns copy of this SimulationElement with k_f given by in-pixel coordinate x,y. "; %feature("docstring") SimulationElement::polarizationHandler "const PolarizationHandler& SimulationElement::polarizationHandler() const @@ -973,11 +966,6 @@ Returns scattering vector Q, with Kf determined from in-pixel coordinates x,y. I %feature("docstring") SimulationElement::getPhi "double SimulationElement::getPhi(double x, double y) const "; -%feature("docstring") SimulationElement::setSpecular "void SimulationElement::setSpecular(bool is_specular) - -Set specularity indication on/off. -"; - %feature("docstring") SimulationElement::isSpecular "bool SimulationElement::isSpecular() const Tells if simulation element corresponds to a specular peak. diff --git a/auto/Wrap/doxygenCore.i b/auto/Wrap/doxygenCore.i index bfa00895e7a5fe63854c63ea53e2ebbfab75018f..45fe2b67a10ddc37dd93b9a303bb4c7aaf972aec 100644 --- a/auto/Wrap/doxygenCore.i +++ b/auto/Wrap/doxygenCore.i @@ -26,7 +26,7 @@ Sets angle-defined specular scan. The first parameter is always a wavelength in %feature("docstring") AngularSpecScan::clone "AngularSpecScan * AngularSpecScan::clone() const override "; -%feature("docstring") AngularSpecScan::generateSimulationElements "std::vector< SpecularSimulationElement > AngularSpecScan::generateSimulationElements() const override +%feature("docstring") AngularSpecScan::generateSimulationElements "std::vector< SpecularSimulationElement > AngularSpecScan::generateSimulationElements(const Instrument &instrument) const override Generates simulation elements for specular simulations. "; @@ -915,7 +915,7 @@ C++ includes: ISpecularScan.h %feature("docstring") ISpecularScan::clone "ISpecularScan* ISpecularScan::clone() const override=0 "; -%feature("docstring") ISpecularScan::generateSimulationElements "virtual std::vector<SpecularSimulationElement> ISpecularScan::generateSimulationElements() const =0 +%feature("docstring") ISpecularScan::generateSimulationElements "virtual std::vector<SpecularSimulationElement> ISpecularScan::generateSimulationElements(const Instrument &instrument) const =0 Generates simulation elements for specular simulations. "; @@ -1578,7 +1578,7 @@ Sets q-defined specular scan. Accepts either numpy array of q-values sorted in a %feature("docstring") QSpecScan::clone "QSpecScan * QSpecScan::clone() const override "; -%feature("docstring") QSpecScan::generateSimulationElements "std::vector< SpecularSimulationElement > QSpecScan::generateSimulationElements() const override +%feature("docstring") QSpecScan::generateSimulationElements "std::vector< SpecularSimulationElement > QSpecScan::generateSimulationElements(const Instrument &instrument) const override Generates simulation elements for specular simulations. "; @@ -2344,6 +2344,51 @@ Returns internal data handler. "; +// File: classSpecularSimulationElement.xml +%feature("docstring") SpecularSimulationElement " + +Data stucture containing both input and output of a single image pixel for specular simulation. + +C++ includes: SpecularSimulationElement.h +"; + +%feature("docstring") SpecularSimulationElement::SpecularSimulationElement "SpecularSimulationElement::SpecularSimulationElement(double kz, const Instrument &instrument, bool computable) +"; + +%feature("docstring") SpecularSimulationElement::SpecularSimulationElement "SpecularSimulationElement::SpecularSimulationElement(double wavelength, double alpha, const Instrument &instrument, bool computable) +"; + +%feature("docstring") SpecularSimulationElement::SpecularSimulationElement "SpecularSimulationElement::SpecularSimulationElement(const SpecularSimulationElement &other) +"; + +%feature("docstring") SpecularSimulationElement::SpecularSimulationElement "SpecularSimulationElement::SpecularSimulationElement(SpecularSimulationElement &&other) noexcept +"; + +%feature("docstring") SpecularSimulationElement::~SpecularSimulationElement "SpecularSimulationElement::~SpecularSimulationElement() +"; + +%feature("docstring") SpecularSimulationElement::polarizationHandler "const PolarizationHandler& SpecularSimulationElement::polarizationHandler() const + +Returns assigned PolarizationHandler. +"; + +%feature("docstring") SpecularSimulationElement::getIntensity "double SpecularSimulationElement::getIntensity() const +"; + +%feature("docstring") SpecularSimulationElement::setIntensity "void SpecularSimulationElement::setIntensity(double intensity) +"; + +%feature("docstring") SpecularSimulationElement::isCalculated "bool SpecularSimulationElement::isCalculated() const + +Returns calculation flag (if it's false, zero intensity is assigned to the element) +"; + +%feature("docstring") SpecularSimulationElement::produceKz "std::vector< complex_t > SpecularSimulationElement::produceKz(const std::vector< Slice > &slices) + +Returns kz values for Abeles computation of reflection/transition coefficients. +"; + + // File: classSpecularStrategyBuilder.xml %feature("docstring") SpecularStrategyBuilder ""; @@ -2459,6 +2504,9 @@ Returns default units to convert to. "; +// File: namespace_0d100.xml + + // File: namespace_0d29.xml @@ -2495,16 +2543,13 @@ Returns default units to convert to. // File: namespace_0d75.xml -// File: namespace_0d80.xml - - // File: namespace_0d82.xml -// File: namespace_0d90.xml +// File: namespace_0d84.xml -// File: namespace_0d96.xml +// File: namespace_0d92.xml // File: namespace_0d98.xml @@ -3048,6 +3093,12 @@ Generate z values (equidistant) for use in MaterialProfile. // File: QSpecScan_8h.xml +// File: SpecularSimulationElement_8cpp.xml + + +// File: SpecularSimulationElement_8h.xml + + // File: UnitConverter1D_8cpp.xml diff --git a/auto/Wrap/doxygenDevice.i b/auto/Wrap/doxygenDevice.i index ffe98c08e805af5d921920328121cf9eaa388d63..a5bdaf8d91d8103424946a7530a74b51cb9d97c8 100644 --- a/auto/Wrap/doxygenDevice.i +++ b/auto/Wrap/doxygenDevice.i @@ -2619,7 +2619,7 @@ A pixel in a RectangularDetector. C++ includes: RectangularPixel.h "; -%feature("docstring") RectangularPixel::RectangularPixel "RectangularPixel::RectangularPixel(kvector_t corner_pos, kvector_t width, kvector_t height) +%feature("docstring") RectangularPixel::RectangularPixel "RectangularPixel::RectangularPixel(const kvector_t &corner_pos, const kvector_t &width, const kvector_t &height) "; %feature("docstring") RectangularPixel::clone "RectangularPixel * RectangularPixel::clone() const override diff --git a/auto/Wrap/doxygenSample.i b/auto/Wrap/doxygenSample.i index 3318ee252af6df42e029123cf50e4233ca3671be..68d8e4891a8c70a869516dd4923aac2ba6774e5d 100644 --- a/auto/Wrap/doxygenSample.i +++ b/auto/Wrap/doxygenSample.i @@ -7489,10 +7489,10 @@ Data stucture containing both input and output of a single image pixel for specu C++ includes: SpecularSimulationElement.h "; -%feature("docstring") SpecularSimulationElement::SpecularSimulationElement "SpecularSimulationElement::SpecularSimulationElement(double kz, bool computable) +%feature("docstring") SpecularSimulationElement::SpecularSimulationElement "SpecularSimulationElement::SpecularSimulationElement(double kz, bool computable, const Instrument &instrument) "; -%feature("docstring") SpecularSimulationElement::SpecularSimulationElement "SpecularSimulationElement::SpecularSimulationElement(double wavelength, double alpha, bool computable) +%feature("docstring") SpecularSimulationElement::SpecularSimulationElement "SpecularSimulationElement::SpecularSimulationElement(double wavelength, double alpha, bool computable, const Instrument &instrument) "; %feature("docstring") SpecularSimulationElement::SpecularSimulationElement "SpecularSimulationElement::SpecularSimulationElement(const SpecularSimulationElement &other) diff --git a/auto/Wrap/libBornAgainBase.py b/auto/Wrap/libBornAgainBase.py index ffc84d1344d27ab710214bb6c5b40f0eb9a7f76f..c56b4dfa91bb2dd6d74547cdb1a04cb0856d83de 100644 --- a/auto/Wrap/libBornAgainBase.py +++ b/auto/Wrap/libBornAgainBase.py @@ -2747,7 +2747,7 @@ class IPixel(object): r""" - Interface for a function that maps [0,1]x[0,1] to the kvectors in a pixel. + Interface for a function that maps [0,1]x[0,1] to the kvectors in a pixel. Pure virtual base class for SphericalPixel and RectangularPixel. C++ includes: IPixel.h