diff --git a/Sample/Interference/DecouplingApproximationStrategy.cpp b/Sample/Interference/DecouplingApproximationStrategy.cpp index d13e5c9060996149d8134f10c3af2b0c3f4e1ee1..7b6f493ad14590276e0c9ecb6ea708db0a7f0e56 100644 --- a/Sample/Interference/DecouplingApproximationStrategy.cpp +++ b/Sample/Interference/DecouplingApproximationStrategy.cpp @@ -19,10 +19,7 @@ #include "Param/Base/RealParameter.h" #include "Sample/Aggregate/IInterferenceFunction.h" #include "Sample/Fresnel/FormFactorCoherentSum.h" -#include "Sample/Interference/InterferenceFunctionUtils.h" - -using InterferenceFunctionUtils::PrecomputePolarizedFormFactors; -using InterferenceFunctionUtils::PrecomputeScalarFormFactors; +#include "Sample/Interference/FormFactorPrecompute.h" DecouplingApproximationStrategy::DecouplingApproximationStrategy( const std::vector<FormFactorCoherentSum>& weighted_formfactors, @@ -39,7 +36,7 @@ DecouplingApproximationStrategy::scalarCalculation(const SimulationElement& sim_ { double intensity = 0.0; complex_t amplitude = complex_t(0.0, 0.0); - auto precomputed_ff = PrecomputeScalarFormFactors(sim_element, m_formfactor_wrappers); + auto precomputed_ff = FormFactorPrecompute::scalar(sim_element, m_formfactor_wrappers); for (size_t i = 0; i < m_formfactor_wrappers.size(); ++i) { complex_t ff = precomputed_ff[i]; if (std::isnan(ff.real())) @@ -61,7 +58,7 @@ DecouplingApproximationStrategy::polarizedCalculation(const SimulationElement& s Eigen::Matrix2cd mean_intensity = Eigen::Matrix2cd::Zero(); Eigen::Matrix2cd mean_amplitude = Eigen::Matrix2cd::Zero(); - auto precomputed_ff = PrecomputePolarizedFormFactors(sim_element, m_formfactor_wrappers); + auto precomputed_ff = FormFactorPrecompute::polarized(sim_element, m_formfactor_wrappers); const auto& polarization_handler = sim_element.polarizationHandler(); for (size_t i = 0; i < m_formfactor_wrappers.size(); ++i) { Eigen::Matrix2cd ff = precomputed_ff[i]; diff --git a/Sample/Interference/InterferenceFunctionUtils.cpp b/Sample/Interference/FormFactorPrecompute.cpp similarity index 73% rename from Sample/Interference/InterferenceFunctionUtils.cpp rename to Sample/Interference/FormFactorPrecompute.cpp index 4982beb3258c0699e135df0f002b181baf7dab04..90e6149b6d96e22192c58b7a0269a952f7610327 100644 --- a/Sample/Interference/InterferenceFunctionUtils.cpp +++ b/Sample/Interference/FormFactorPrecompute.cpp @@ -2,7 +2,7 @@ // // BornAgain: simulate and fit scattering at grazing incidence // -//! @file Sample/Interference/InterferenceFunctionUtils.cpp +//! @file Sample/Interference/FormFactorPrecompute.cpp //! @brief Implements helper functions for InterferenceFunctions and Strategies. //! //! @homepage http://www.bornagainproject.org @@ -12,13 +12,11 @@ // // ************************************************************************** // -#include "Sample/Interference/InterferenceFunctionUtils.h" +#include "Sample/Interference/FormFactorPrecompute.h" #include "Sample/Fresnel/FormFactorCoherentSum.h" -namespace InterferenceFunctionUtils -{ std::vector<complex_t> -PrecomputeScalarFormFactors(const SimulationElement& sim_element, +FormFactorPrecompute::scalar(const SimulationElement& sim_element, const std::vector<FormFactorCoherentSum>& ff_wrappers) { std::vector<complex_t> result; @@ -28,14 +26,13 @@ PrecomputeScalarFormFactors(const SimulationElement& sim_element, return result; } -matrixFFVector_t -PrecomputePolarizedFormFactors(const SimulationElement& sim_element, +FormFactorPrecompute::matrixFFVector_t +FormFactorPrecompute::polarized(const SimulationElement& sim_element, const std::vector<FormFactorCoherentSum>& ff_wrappers) { - matrixFFVector_t result; + FormFactorPrecompute::matrixFFVector_t result; for (auto& ffw : ff_wrappers) { result.push_back(ffw.evaluatePol(sim_element)); } return result; } -} // namespace InterferenceFunctionUtils diff --git a/Sample/Interference/InterferenceFunctionUtils.h b/Sample/Interference/FormFactorPrecompute.h similarity index 81% rename from Sample/Interference/InterferenceFunctionUtils.h rename to Sample/Interference/FormFactorPrecompute.h index f45b666bf22d7ec9731688e97d7fcdc8b632a96f..a4330109c60f3f153bc471446efa7ee9d34e0916 100644 --- a/Sample/Interference/InterferenceFunctionUtils.h +++ b/Sample/Interference/FormFactorPrecompute.h @@ -2,7 +2,7 @@ // // BornAgain: simulate and fit scattering at grazing incidence // -//! @file Sample/Interference/InterferenceFunctionUtils.h +//! @file Sample/Interference/FormFactorPrecompute.h //! @brief Defines helper functions for InterferenceFunctions and Strategies. //! //! @homepage http://www.bornagainproject.org @@ -22,17 +22,17 @@ class FormFactorCoherentSum; class SimulationElement; -namespace InterferenceFunctionUtils +namespace FormFactorPrecompute { using matrixFFVector_t = std::vector<Eigen::Matrix2cd, Eigen::aligned_allocator<Eigen::Matrix2cd>>; std::vector<complex_t> -PrecomputeScalarFormFactors(const SimulationElement& sim_element, +scalar(const SimulationElement& sim_element, const std::vector<FormFactorCoherentSum>& ff_wrappers); matrixFFVector_t -PrecomputePolarizedFormFactors(const SimulationElement& sim_element, +polarized(const SimulationElement& sim_element, const std::vector<FormFactorCoherentSum>& ff_wrappers); -} // namespace InterferenceFunctionUtils +} // namespace FormFactorPrecompute #endif // BORNAGAIN_CORE_MULTILAYER_INTERFERENCEFUNCTIONUTILS_H diff --git a/Sample/Interference/SSCAHelper.cpp b/Sample/Interference/SSCAHelper.cpp index c9bd8dee49b60b901b552418e3ae160b1069f8e3..f26921e9ee9a2f9fe1ad56c2dab511476dd7bc52 100644 --- a/Sample/Interference/SSCAHelper.cpp +++ b/Sample/Interference/SSCAHelper.cpp @@ -70,7 +70,7 @@ SSCAHelper::getMeanFormfactorNorm(double qp, const std::vector<complex_t>& preco void SSCAHelper::getMeanFormfactors( double qp, Eigen::Matrix2cd& ff_orig, Eigen::Matrix2cd& ff_conj, - const InterferenceFunctionUtils::matrixFFVector_t& precomputed_ff, + const FormFactorPrecompute::matrixFFVector_t& precomputed_ff, const std::vector<FormFactorCoherentSum>& ff_wrappers) const { ff_orig = Eigen::Matrix2cd::Zero(); diff --git a/Sample/Interference/SSCAHelper.h b/Sample/Interference/SSCAHelper.h index f96782a162b11b25421b3189cd6272df32b15400..f5eade1c668ace91c114c8ade77d114dc782f0b1 100644 --- a/Sample/Interference/SSCAHelper.h +++ b/Sample/Interference/SSCAHelper.h @@ -16,7 +16,7 @@ #define BORNAGAIN_CORE_MULTILAYER_SSCAHELPER_H #include "Sample/Interference/IInterferenceFunctionStrategy.h" -#include "Sample/Interference/InterferenceFunctionUtils.h" +#include "Sample/Interference/FormFactorPrecompute.h" #include <Eigen/StdVector> class FormFactorCoherentSum; @@ -41,7 +41,7 @@ public: complex_t getMeanFormfactorNorm(double qp, const std::vector<complex_t>& precomputed_ff, const std::vector<FormFactorCoherentSum>& ff_wrappers) const; void getMeanFormfactors(double qp, Eigen::Matrix2cd& ff_orig, Eigen::Matrix2cd& ff_conj, - const InterferenceFunctionUtils::matrixFFVector_t& precomputed_ff, + const FormFactorPrecompute::matrixFFVector_t& precomputed_ff, const std::vector<FormFactorCoherentSum>& ff_wrappers) const; private: diff --git a/Sample/Interference/SSCApproximationStrategy.cpp b/Sample/Interference/SSCApproximationStrategy.cpp index c30565cf5b7eceb1ce619900cabc4ad1408c4d24..05ea5486b1fd398a5964939c1b28ea85c37ef138 100644 --- a/Sample/Interference/SSCApproximationStrategy.cpp +++ b/Sample/Interference/SSCApproximationStrategy.cpp @@ -17,9 +17,6 @@ #include "Sample/Aggregate/IInterferenceFunction.h" #include "Sample/Fresnel/FormFactorCoherentSum.h" -using InterferenceFunctionUtils::PrecomputePolarizedFormFactors; -using InterferenceFunctionUtils::PrecomputeScalarFormFactors; - SSCApproximationStrategy::SSCApproximationStrategy( const std::vector<FormFactorCoherentSum>& weighted_formfactors, const IInterferenceFunction* p_iff, SimulationOptions sim_params, bool polarized, double kappa) @@ -36,7 +33,7 @@ double SSCApproximationStrategy::scalarCalculation(const SimulationElement& sim_ { double qp = sim_element.getMeanQ().magxy(); double diffuse_intensity = 0.0; - auto precomputed_ff = PrecomputeScalarFormFactors(sim_element, m_formfactor_wrappers); + auto precomputed_ff = FormFactorPrecompute::scalar(sim_element, m_formfactor_wrappers); for (size_t i = 0; i < m_formfactor_wrappers.size(); ++i) { complex_t ff = precomputed_ff[i]; double fraction = m_formfactor_wrappers[i].relativeAbundance(); @@ -56,7 +53,7 @@ double SSCApproximationStrategy::polarizedCalculation(const SimulationElement& s { double qp = sim_element.getMeanQ().magxy(); Eigen::Matrix2cd diffuse_matrix = Eigen::Matrix2cd::Zero(); - auto precomputed_ff = PrecomputePolarizedFormFactors(sim_element, m_formfactor_wrappers); + auto precomputed_ff = FormFactorPrecompute::polarized(sim_element, m_formfactor_wrappers); const auto& polarization_handler = sim_element.polarizationHandler(); for (size_t i = 0; i < m_formfactor_wrappers.size(); ++i) { Eigen::Matrix2cd ff = precomputed_ff[i]; diff --git a/auto/Wrap/doxygenSample.i b/auto/Wrap/doxygenSample.i index d05ebb308f186c2833b1074229853893e5b9cad3..98375f0ae83d34b758304770864618c94a1b1ba8 100644 --- a/auto/Wrap/doxygenSample.i +++ b/auto/Wrap/doxygenSample.i @@ -7557,7 +7557,7 @@ C++ includes: SSCAHelper.h %feature("docstring") SSCAHelper::getMeanFormfactorNorm "complex_t SSCAHelper::getMeanFormfactorNorm(double qp, const std::vector< complex_t > &precomputed_ff, const std::vector< FormFactorCoherentSum > &ff_wrappers) const "; -%feature("docstring") SSCAHelper::getMeanFormfactors "void SSCAHelper::getMeanFormfactors(double qp, Eigen::Matrix2cd &ff_orig, Eigen::Matrix2cd &ff_conj, const InterferenceFunctionUtils::matrixFFVector_t &precomputed_ff, const std::vector< FormFactorCoherentSum > &ff_wrappers) const +%feature("docstring") SSCAHelper::getMeanFormfactors "void SSCAHelper::getMeanFormfactors(double qp, Eigen::Matrix2cd &ff_orig, Eigen::Matrix2cd &ff_conj, const FormFactorPrecompute::matrixFFVector_t &precomputed_ff, const std::vector< FormFactorCoherentSum > &ff_wrappers) const "; @@ -7869,11 +7869,11 @@ C++ includes: ZLimits.h // File: namespace_0d41.xml -// File: namespaceInterferenceFunctionUtils.xml -%feature("docstring") InterferenceFunctionUtils::PrecomputeScalarFormFactors "std::vector< complex_t > InterferenceFunctionUtils::PrecomputeScalarFormFactors(const SimulationElement &sim_element, const std::vector< FormFactorCoherentSum > &ff_wrappers) +// File: namespaceFormFactorPrecompute.xml +%feature("docstring") FormFactorPrecompute::scalar "std::vector< complex_t > FormFactorPrecompute::scalar(const SimulationElement &sim_element, const std::vector< FormFactorCoherentSum > &ff_wrappers) "; -%feature("docstring") InterferenceFunctionUtils::PrecomputePolarizedFormFactors "matrixFFVector_t InterferenceFunctionUtils::PrecomputePolarizedFormFactors(const SimulationElement &sim_element, const std::vector< FormFactorCoherentSum > &ff_wrappers) +%feature("docstring") FormFactorPrecompute::polarized "FormFactorPrecompute::matrixFFVector_t FormFactorPrecompute::polarized(const SimulationElement &sim_element, const std::vector< FormFactorCoherentSum > &ff_wrappers) "; @@ -8405,16 +8405,16 @@ Used by the hard sphere and by several soft sphere classes. // File: DecouplingApproximationStrategy_8h.xml -// File: IInterferenceFunctionStrategy_8cpp.xml +// File: FormFactorPrecompute_8cpp.xml -// File: IInterferenceFunctionStrategy_8h.xml +// File: FormFactorPrecompute_8h.xml -// File: InterferenceFunctionUtils_8cpp.xml +// File: IInterferenceFunctionStrategy_8cpp.xml -// File: InterferenceFunctionUtils_8h.xml +// File: IInterferenceFunctionStrategy_8h.xml // File: SSCAHelper_8cpp.xml