From 166a89fc14cd778c050bd39db7821a196c6b6f33 Mon Sep 17 00:00:00 2001 From: Walter Van Herck <w.van.herck@fz-juelich.de> Date: Fri, 3 Feb 2017 18:23:55 +0100 Subject: [PATCH] Remove typedef of MultiLayerCoeff_t, since it's just a vector --- Core/Multilayer/DWBADiffuseReflection.h | 4 +-- Core/Multilayer/MatrixFresnelMap.cpp | 4 +-- Core/Multilayer/SpecularMagnetic.cpp | 8 ++--- Core/Multilayer/SpecularMagnetic.h | 17 +++++------ Core/Multilayer/SpecularMatrix.cpp | 15 +++++----- Core/Multilayer/SpecularMatrix.h | 7 ++--- Core/Simulation/SpecularSimulation.cpp | 2 +- .../Core/Fresnel/SpecularMagneticTest.h | 6 ++-- .../Core/Fresnel/SpecularMatrixTest.h | 2 +- auto/Wrap/doxygen_core.i | 30 ++++++++++++++----- 10 files changed, 53 insertions(+), 42 deletions(-) diff --git a/Core/Multilayer/DWBADiffuseReflection.h b/Core/Multilayer/DWBADiffuseReflection.h index 5b3e872449e..e4ca5180cf4 100644 --- a/Core/Multilayer/DWBADiffuseReflection.h +++ b/Core/Multilayer/DWBADiffuseReflection.h @@ -49,8 +49,8 @@ private: complex_t get_sum4terms(size_t ilayer); const MultiLayer* m_sample; - SpecularMatrix::MultiLayerCoeff_t m_fcoeff_i; - SpecularMatrix::MultiLayerCoeff_t m_fcoeff_f; + std::vector<ScalarRTCoefficients> m_fcoeff_i; + std::vector<ScalarRTCoefficients> m_fcoeff_f; double m_diffuse_autocorr; double m_diffuse_crosscorr; diff --git a/Core/Multilayer/MatrixFresnelMap.cpp b/Core/Multilayer/MatrixFresnelMap.cpp index 848f9130515..2b30c4716f3 100644 --- a/Core/Multilayer/MatrixFresnelMap.cpp +++ b/Core/Multilayer/MatrixFresnelMap.cpp @@ -29,7 +29,7 @@ MatrixFresnelMap::MatrixFresnelMap(const MultiLayer* p_multilayer, const ILayerRTCoefficients* MatrixFresnelMap::getOutCoefficients( const SimulationElement& sim_element, size_t layer_index) const { - SpecularMagnetic::MultiLayerCoeff_t coeffs; + std::vector<MatrixRTCoefficients> coeffs; SpecularMagnetic::execute(*mp_inverted_multilayer, -sim_element.getMeanKf(), coeffs); return new MatrixRTCoefficients(coeffs[layer_index]); } @@ -37,7 +37,7 @@ const ILayerRTCoefficients* MatrixFresnelMap::getOutCoefficients( const ILayerRTCoefficients* MatrixFresnelMap::getInCoefficients( const SimulationElement& sim_element, size_t layer_index) const { - SpecularMagnetic::MultiLayerCoeff_t coeffs; + std::vector<MatrixRTCoefficients> coeffs; SpecularMagnetic::execute(*mp_multilayer, sim_element.getKi(), coeffs); return new MatrixRTCoefficients(coeffs[layer_index]); } diff --git a/Core/Multilayer/SpecularMagnetic.cpp b/Core/Multilayer/SpecularMagnetic.cpp index 362f09a9fd5..e22a527af42 100644 --- a/Core/Multilayer/SpecularMagnetic.cpp +++ b/Core/Multilayer/SpecularMagnetic.cpp @@ -26,7 +26,7 @@ namespace { } void SpecularMagnetic::execute( - const MultiLayer& sample, const kvector_t k, MultiLayerCoeff_t& coeff) + const MultiLayer& sample, const kvector_t k, std::vector<MatrixRTCoefficients>& coeff) { coeff.clear(); coeff.resize(sample.getNumberOfLayers()); @@ -37,7 +37,7 @@ void SpecularMagnetic::execute( } void SpecularMagnetic::calculateEigenvalues( - const MultiLayer& sample, const kvector_t k, MultiLayerCoeff_t& coeff) + const MultiLayer& sample, const kvector_t k, std::vector<MatrixRTCoefficients>& coeff) { double mag_k = k.mag(); double sign_kz = k.z() > 0.0 ? -1.0 : 1.0; @@ -64,7 +64,7 @@ void SpecularMagnetic::calculateEigenvalues( // todo: avoid overflows (see SpecularMatrix.cpp) void SpecularMagnetic::calculateTransferAndBoundary( - const MultiLayer& sample, const kvector_t k, MultiLayerCoeff_t& coeff) + const MultiLayer& sample, const kvector_t k, std::vector<MatrixRTCoefficients>& coeff) { (void)k; size_t N = coeff.size(); @@ -127,7 +127,7 @@ void SpecularMagnetic::calculateTransferAndBoundary( } } -void SpecularMagnetic::setForNoTransmission(MultiLayerCoeff_t& coeff) +void SpecularMagnetic::setForNoTransmission(std::vector<MatrixRTCoefficients>& coeff) { size_t N = coeff.size(); for (size_t i=0; i<N; ++i) { diff --git a/Core/Multilayer/SpecularMagnetic.h b/Core/Multilayer/SpecularMagnetic.h index 87bea205fc4..84986df1a4c 100644 --- a/Core/Multilayer/SpecularMagnetic.h +++ b/Core/Multilayer/SpecularMagnetic.h @@ -27,20 +27,17 @@ class BA_CORE_API_ SpecularMagnetic { public: - //! Layer coefficients describing refraction and reflection/transmission. - typedef std::vector<MatrixRTCoefficients> MultiLayerCoeff_t; - //! Computes refraction angle reflection/transmission coefficients //! for given multilayer and wavevector k - static void execute( - const class MultiLayer& sample, const kvector_t k, MultiLayerCoeff_t& coeff); + static void execute(const class MultiLayer& sample, const kvector_t k, + std::vector<MatrixRTCoefficients>& coeff); private: - static void calculateEigenvalues( - const class MultiLayer& sample, const kvector_t k, MultiLayerCoeff_t& coeff); - static void calculateTransferAndBoundary( - const MultiLayer& sample, const kvector_t k, MultiLayerCoeff_t& coeff); - static void setForNoTransmission(MultiLayerCoeff_t& coeff); + static void calculateEigenvalues(const class MultiLayer& sample, const kvector_t k, + std::vector<MatrixRTCoefficients>& coeff); + static void calculateTransferAndBoundary(const MultiLayer& sample, const kvector_t k, + std::vector<MatrixRTCoefficients>& coeff); + static void setForNoTransmission(std::vector<MatrixRTCoefficients>& coeff); static complex_t getImExponential(complex_t exponent); }; diff --git a/Core/Multilayer/SpecularMatrix.cpp b/Core/Multilayer/SpecularMatrix.cpp index fcc33dfc212..9a0aa43bf7e 100644 --- a/Core/Multilayer/SpecularMatrix.cpp +++ b/Core/Multilayer/SpecularMatrix.cpp @@ -27,12 +27,12 @@ namespace { const complex_t imag_unit = complex_t(0.0, 1.0); } -void setZeroBelow(SpecularMatrix::MultiLayerCoeff_t& coeff, size_t current_layer); +void setZeroBelow(std::vector<ScalarRTCoefficients>& coeff, size_t current_layer); bool calculateUpFromLayer( - SpecularMatrix::MultiLayerCoeff_t& coeff, const MultiLayer& sample, + std::vector<ScalarRTCoefficients>& coeff, const MultiLayer& sample, const double kmag, size_t layer_index); size_t bisectRTcomputation( - SpecularMatrix::MultiLayerCoeff_t& coeff, const MultiLayer& sample, + std::vector<ScalarRTCoefficients>& coeff, const MultiLayer& sample, const double kmag, const size_t lgood, const size_t lbad, const size_t l); //! Computes refraction angles and transmission/reflection coefficients @@ -40,7 +40,8 @@ size_t bisectRTcomputation( //! Roughness is modelled by tanh profile [see e.g. Phys. Rev. B, vol. 47 (8), p. 4385 (1993)]. //! k : length: wavenumber in vacuum, direction: defined in layer 0. -void SpecularMatrix::execute(const MultiLayer& sample, const kvector_t k, MultiLayerCoeff_t& coeff) +void SpecularMatrix::execute(const MultiLayer& sample, const kvector_t k, + std::vector<ScalarRTCoefficients>& coeff) { size_t N = sample.getNumberOfLayers(); assert(N>0); @@ -102,7 +103,7 @@ void SpecularMatrix::execute(const MultiLayer& sample, const kvector_t k, MultiL //! Sets coeff to zero for all layers below current_layer. -void setZeroBelow(SpecularMatrix::MultiLayerCoeff_t& coeff, size_t current_layer) +void setZeroBelow(std::vector<ScalarRTCoefficients>& coeff, size_t current_layer) { size_t N = coeff.size(); for (size_t i=current_layer+1; i<N; ++i) { @@ -113,7 +114,7 @@ void setZeroBelow(SpecularMatrix::MultiLayerCoeff_t& coeff, size_t current_layer //! Computes RT coefficients coeff, starting from layer number layer_index. //! Returns true if no overflow happens. -bool calculateUpFromLayer(SpecularMatrix::MultiLayerCoeff_t& coeff, const MultiLayer& sample, +bool calculateUpFromLayer(std::vector<ScalarRTCoefficients>& coeff, const MultiLayer& sample, const double kmag, size_t layer_index) { coeff[layer_index+1].t_r(0) = 1.0; @@ -154,7 +155,7 @@ bool calculateUpFromLayer(SpecularMatrix::MultiLayerCoeff_t& coeff, const MultiL //! Computes coeff, and returns largest possible start layer index. size_t bisectRTcomputation( - SpecularMatrix::MultiLayerCoeff_t& coeff, const MultiLayer& sample, + std::vector<ScalarRTCoefficients>& coeff, const MultiLayer& sample, const double kmag, const size_t lgood, const size_t lbad, const size_t l) { if (calculateUpFromLayer(coeff, sample, kmag, l)) { diff --git a/Core/Multilayer/SpecularMatrix.h b/Core/Multilayer/SpecularMatrix.h index 75ae0ade4b0..edb4a3dab71 100644 --- a/Core/Multilayer/SpecularMatrix.h +++ b/Core/Multilayer/SpecularMatrix.h @@ -27,13 +27,10 @@ class BA_CORE_API_ SpecularMatrix { public: - //! Layer coefficients describing refraction and transmission/reflection. - typedef std::vector<ScalarRTCoefficients> MultiLayerCoeff_t; - //! Computes refraction angles and transmission/reflection coefficients //! for given coherent wave propagation in a multilayer. - static void execute( - const class MultiLayer& sample, const kvector_t k, MultiLayerCoeff_t& coeff); + static void execute(const class MultiLayer& sample, const kvector_t k, + std::vector<ScalarRTCoefficients>& coeff); }; #endif // SPECULARMATRIX_H diff --git a/Core/Simulation/SpecularSimulation.cpp b/Core/Simulation/SpecularSimulation.cpp index a9312fd3e97..5d1d43e4f5a 100644 --- a/Core/Simulation/SpecularSimulation.cpp +++ b/Core/Simulation/SpecularSimulation.cpp @@ -213,7 +213,7 @@ void SpecularSimulation::collectRTCoefficientsScalar(const MultiLayer *multilaye double alpha_i = m_data.getAxisValue(it.getIndex(), 0); kvector_t kvec = vecOfLambdaAlphaPhi(m_lambda, -alpha_i, 0.0); - SpecularMatrix::MultiLayerCoeff_t coeffs; + std::vector<ScalarRTCoefficients> coeffs; SpecularMatrix::execute(*multilayer, kvec, coeffs); MultiLayerRTCoefficients_t ml_coeffs; diff --git a/Tests/UnitTests/Core/Fresnel/SpecularMagneticTest.h b/Tests/UnitTests/Core/Fresnel/SpecularMagneticTest.h index 7063a99d593..ea10dfa222c 100644 --- a/Tests/UnitTests/Core/Fresnel/SpecularMagneticTest.h +++ b/Tests/UnitTests/Core/Fresnel/SpecularMagneticTest.h @@ -16,7 +16,7 @@ TEST_F(SpecularMagneticTest, initial) { MultiLayer mLayer; kvector_t v; - SpecularMagnetic::MultiLayerCoeff_t coeff; + std::vector<MatrixRTCoefficients> coeff; // @Error: Throws exception (Layer index is out of bounds) //matrix.execute(mLayer, v, coeff); @@ -45,14 +45,14 @@ TEST_F(SpecularMagneticTest, zerofield) Layer substr_layer_scalar(substr_material_scalar); multi_layer_scalar.addLayer(air_layer); multi_layer_scalar.addLayer(substr_layer_scalar); - SpecularMatrix::MultiLayerCoeff_t coeffs_scalar; + std::vector<ScalarRTCoefficients> coeffs_scalar; MultiLayer multi_layer_zerofield; HomogeneousMagneticMaterial substr_material_zerofield("Substrate", 7e-6, 2e-8, substr_field); Layer substr_layer_zerofield(substr_material_zerofield); multi_layer_zerofield.addLayer(air_layer); multi_layer_zerofield.addLayer(substr_layer_zerofield); - SpecularMagnetic::MultiLayerCoeff_t coeffs_zerofield; + std::vector<MatrixRTCoefficients> coeffs_zerofield; // k1 SpecularMatrix::execute(multi_layer_scalar, k1, coeffs_scalar); diff --git a/Tests/UnitTests/Core/Fresnel/SpecularMatrixTest.h b/Tests/UnitTests/Core/Fresnel/SpecularMatrixTest.h index b5ea32dfafd..c382c1fc3bd 100644 --- a/Tests/UnitTests/Core/Fresnel/SpecularMatrixTest.h +++ b/Tests/UnitTests/Core/Fresnel/SpecularMatrixTest.h @@ -14,7 +14,7 @@ TEST_F(SpecularMatrixTest, initial) { MultiLayer mLayer; kvector_t v; - SpecularMatrix::MultiLayerCoeff_t coeff; + std::vector<ScalarRTCoefficients> coeff; // @Error: Throws exception (Layer index is out of bounds) //matrix.execute(mLayer, v, coeff); diff --git a/auto/Wrap/doxygen_core.i b/auto/Wrap/doxygen_core.i index e728bd58ce3..09b9cbda7cd 100644 --- a/auto/Wrap/doxygen_core.i +++ b/auto/Wrap/doxygen_core.i @@ -5077,6 +5077,16 @@ Resets region of interest making whole detector plane available for the simulati "; +// File: classHashKVector.xml +%feature("docstring") HashKVector ""; + +%feature("docstring") HashKVector::HashKVector "HashKVector::HashKVector() +"; + +%feature("docstring") HashKVector::~HashKVector "HashKVector::~HashKVector() +"; + + // File: classHexagonalLattice.xml %feature("docstring") HexagonalLattice ""; @@ -13179,16 +13189,16 @@ C++ includes: WavevectorInfo.h // File: namespace_0D280.xml -// File: namespace_0D306.xml +// File: namespace_0D308.xml -// File: namespace_0D308.xml +// File: namespace_0D310.xml -// File: namespace_0D321.xml +// File: namespace_0D323.xml -// File: namespace_0D434.xml +// File: namespace_0D436.xml // File: namespace_0D60.xml @@ -14602,6 +14612,12 @@ make Swappable // File: FormFactorDWBAPol_8h.xml +// File: HashKVector_8cpp.xml + + +// File: HashKVector_8h.xml + + // File: IFresnelMap_8cpp.xml @@ -14681,17 +14697,17 @@ make Swappable // File: SpecularMatrix_8cpp.xml -%feature("docstring") setZeroBelow "void setZeroBelow(SpecularMatrix::MultiLayerCoeff_t &coeff, size_t current_layer) +%feature("docstring") setZeroBelow "void setZeroBelow(std::vector< ScalarRTCoefficients > &coeff, size_t current_layer) Sets coeff to zero for all layers below current_layer. "; -%feature("docstring") calculateUpFromLayer "bool calculateUpFromLayer(SpecularMatrix::MultiLayerCoeff_t &coeff, const MultiLayer &sample, const double kmag, size_t layer_index) +%feature("docstring") calculateUpFromLayer "bool calculateUpFromLayer(std::vector< ScalarRTCoefficients > &coeff, const MultiLayer &sample, const double kmag, size_t layer_index) Computes RT coefficients coeff, starting from layer number layer_index. Returns true if no overflow happens. "; -%feature("docstring") bisectRTcomputation "size_t bisectRTcomputation(SpecularMatrix::MultiLayerCoeff_t &coeff, const MultiLayer &sample, const double kmag, const size_t lgood, const size_t lbad, const size_t l) +%feature("docstring") bisectRTcomputation "size_t bisectRTcomputation(std::vector< ScalarRTCoefficients > &coeff, const MultiLayer &sample, const double kmag, const size_t lgood, const size_t lbad, const size_t l) Recursive bisection to determine the number of the deepest layer where RT computation can be started without running into overflow. Computes coeff, and returns largest possible start layer index. "; -- GitLab