diff --git a/Core/Core.pro b/Core/Core.pro index e908016f71ca171a824fac8a617f1b084141c688..72428ed0c340af343f6ccb4febb67357848a3323 100644 --- a/Core/Core.pro +++ b/Core/Core.pro @@ -94,6 +94,7 @@ SOURCES += \ FormFactors/src/FormFactorHemiSpheroid.cpp \ FormFactors/src/FormFactorLorentz.cpp \ FormFactors/src/FormFactorParallelepiped.cpp \ + FormFactors/src/FormFactorPol.cpp \ FormFactors/src/FormFactorPrism3.cpp \ FormFactors/src/FormFactorPrism6.cpp \ FormFactors/src/FormFactorPyramid.cpp \ @@ -251,6 +252,7 @@ HEADERS += \ FormFactors/inc/FormFactorHemiSpheroid.h \ FormFactors/inc/FormFactorLorentz.h \ FormFactors/inc/FormFactorParallelepiped.h \ + FormFactors/inc/FormFactorPol.h \ FormFactors/inc/FormFactorPrism3.h \ FormFactors/inc/FormFactorPrism6.h \ FormFactors/inc/FormFactorPyramid.h \ diff --git a/Core/FormFactors/inc/FormFactorDWBAPol.h b/Core/FormFactors/inc/FormFactorDWBAPol.h index 33d98b4724b47ebc2cdab77f6c11366e4f5ac80e..be085b690b3922d3c4631c14e0db8d8e7f7b457f 100644 --- a/Core/FormFactors/inc/FormFactorDWBAPol.h +++ b/Core/FormFactors/inc/FormFactorDWBAPol.h @@ -16,7 +16,7 @@ #ifndef FORMFACTORDWBAPOL_H_ #define FORMFACTORDWBAPOL_H_ -#include "IFormFactorDecorator.h" +#include "FormFactorPol.h" #include "SpecularMagnetic.h" #include "MagneticCoefficientsMap.h" @@ -24,7 +24,7 @@ //! Evaluates a coherent sum of the 16 matrix DWBA terms in a polarized form factor -class FormFactorDWBAPol : public IFormFactorDecorator +class FormFactorDWBAPol : public FormFactorPol { public: FormFactorDWBAPol(IFormFactor *p_formfactor); @@ -32,29 +32,11 @@ public: virtual FormFactorDWBAPol *clone() const; - // Forwards to the evaluate function of the embedded form factor - virtual complex_t evaluate(const cvector_t& k_i, - const Bin1DCVector& k_f_bin, double alpha_i, double alpha_f) const { - return mp_form_factor->evaluate(k_i, k_f_bin, alpha_i, alpha_f); - } - - //! Calculates and returns a polarized form factor in DWBA + //! Calculates and returns a polarized form factor calculation in DWBA virtual Eigen::Matrix2cd evaluatePol(const cvector_t& k_i, const Bin1DCVector& k_f1_bin, const Bin1DCVector& k_f2_bin, double alpha_i, double alpha_f, double phi_f) const; - //! Sets magnetic reflection/transmission info for polarized DWBA - void setRTInfo(const MagneticCoefficientsMap& magnetic_coeff_map); - - //! Sets the material of the scatterer - void setMaterial(const IMaterial *p_material) { - mp_material = p_material; - } - - //! Sets the material of the surrounding structure - virtual void setAmbientMaterial(const IMaterial *p_material) { - mp_ambient_material = p_material; - } protected: const SpecularMagnetic::LayerMatrixCoeff& getOutCoeffs(double alpha_f, double phi_f) const; @@ -62,9 +44,6 @@ protected: const Bin1DCVector& k_f2_bin, double alpha_i, double alpha_f, double phi_f) const; - MagneticCoefficientsMap *mp_magnetic_coeffs; - const IMaterial *mp_material; - const IMaterial *mp_ambient_material; //! The following matrices each contain the four polarization conditions //! (p->p, p->m, m->p, m->m) //! The first two indices indicate a scattering from the 1/2 eigenstate into diff --git a/Core/FormFactors/inc/FormFactorPol.h b/Core/FormFactors/inc/FormFactorPol.h new file mode 100644 index 0000000000000000000000000000000000000000..ee73cc939a9f1677b612339a2c8cea5e89ef83d8 --- /dev/null +++ b/Core/FormFactors/inc/FormFactorPol.h @@ -0,0 +1,60 @@ +// ************************************************************************** // +// +// BornAgain: simulate and fit scattering at grazing incidence +// +//! @file FormFactors/inc/FormFactorPol.h +//! @brief Defines interface FormFactorPol. +//! +//! @homepage http://apps.jcns.fz-juelich.de/BornAgain +//! @license GNU General Public License v3 or higher (see COPYING) +//! @copyright Forschungszentrum Jülich GmbH 2013 +//! @authors Scientific Computing Group at MLZ Garching +//! @authors C. Durniak, G. Pospelov, W. Van Herck, J. Wuttke +// +// ************************************************************************** // + +#ifndef FORMFACTORPOL_H_ +#define FORMFACTORPOL_H_ + +#include "IFormFactorDecorator.h" + +class FormFactorPol : public IFormFactorDecorator +{ +public: + FormFactorPol(IFormFactor *p_formfactor) + : IFormFactorDecorator(p_formfactor) + , mp_magnetic_coeffs(0), mp_material(0), mp_ambient_material(0) {} + virtual ~FormFactorPol() {} + + virtual FormFactorPol *clone() const; + + // Forwards to the evaluate function of the embedded form factor + virtual complex_t evaluate(const cvector_t& k_i, + const Bin1DCVector& k_f_bin, double alpha_i, double alpha_f) const { + return mp_form_factor->evaluate(k_i, k_f_bin, alpha_i, alpha_f); + } + + //! Calculates and returns a polarized form factor calculation in DWBA + virtual Eigen::Matrix2cd evaluatePol(const cvector_t& k_i, + const Bin1DCVector& k_f1_bin, const Bin1DCVector& k_f2_bin, + double alpha_i, double alpha_f, double phi_f) const; + + //! Sets magnetic reflection/transmission info for polarized DWBA + void setRTInfo(const MagneticCoefficientsMap& magnetic_coeff_map); + + //! Sets the material of the scatterer + void setMaterial(const IMaterial *p_material) { + mp_material = p_material; + } + + //! Sets the material of the surrounding structure + virtual void setAmbientMaterial(const IMaterial *p_material) { + mp_ambient_material = p_material; + } +protected: + MagneticCoefficientsMap *mp_magnetic_coeffs; + const IMaterial *mp_material; + const IMaterial *mp_ambient_material; +}; + +#endif /* FORMFACTORPOL_H_ */ diff --git a/Core/FormFactors/src/FormFactorDWBAPol.cpp b/Core/FormFactors/src/FormFactorDWBAPol.cpp index 8e0ca7c37c3584dae34ed60739f0789022c80510..5f2143b96f339b6d0a9361bae0e96c6ee52c84ca 100644 --- a/Core/FormFactors/src/FormFactorDWBAPol.cpp +++ b/Core/FormFactors/src/FormFactorDWBAPol.cpp @@ -18,7 +18,7 @@ #include "Exceptions.h" FormFactorDWBAPol::FormFactorDWBAPol(IFormFactor* p_formfactor) -: IFormFactorDecorator(p_formfactor) +: FormFactorPol(p_formfactor) , mp_magnetic_coeffs(0) , mp_material(0) , mp_ambient_material(0) @@ -39,13 +39,6 @@ FormFactorDWBAPol* FormFactorDWBAPol::clone() const return p_result; } -void FormFactorDWBAPol::setRTInfo( - const MagneticCoefficientsMap& magnetic_coeff_map) -{ - delete mp_magnetic_coeffs; - mp_magnetic_coeffs = magnetic_coeff_map.clone(); -} - Eigen::Matrix2cd FormFactorDWBAPol::evaluatePol(const cvector_t& k_i, const Bin1DCVector& k_f1_bin, const Bin1DCVector& k_f2_bin, double alpha_i, double alpha_f, double phi_f) const diff --git a/Core/FormFactors/src/FormFactorPol.cpp b/Core/FormFactors/src/FormFactorPol.cpp new file mode 100644 index 0000000000000000000000000000000000000000..d4edcabc6bd29a49bb5634d8d07f764ab743a29f --- /dev/null +++ b/Core/FormFactors/src/FormFactorPol.cpp @@ -0,0 +1,36 @@ +// ************************************************************************** // +// +// BornAgain: simulate and fit scattering at grazing incidence +// +//! @file FormFactors/src/FormFactorPol.cpp +//! @brief Implements class FormFactorPol. +//! +//! @homepage http://apps.jcns.fz-juelich.de/BornAgain +//! @license GNU General Public License v3 or higher (see COPYING) +//! @copyright Forschungszentrum Jülich GmbH 2013 +//! @authors Scientific Computing Group at MLZ Garching +//! @authors C. Durniak, G. Pospelov, W. Van Herck, J. Wuttke +// +// ************************************************************************** // + +#include "FormFactorPol.h" + +FormFactorPol* FormFactorPol::clone() const +{ + FormFactorPol *p_result = new FormFactorPol(mp_form_factor->clone()); + p_result->setRTInfo(*mp_magnetic_coeffs); + p_result->setName(getName()); + return p_result; +} + +Eigen::Matrix2cd FormFactorPol::evaluatePol(const cvector_t& k_i, + const Bin1DCVector& k_f1_bin, const Bin1DCVector& k_f2_bin, + double alpha_i, double alpha_f, double phi_f) const +{ +} + +void FormFactorPol::setRTInfo(const MagneticCoefficientsMap& magnetic_coeff_map) +{ + delete mp_magnetic_coeffs; + mp_magnetic_coeffs = magnetic_coeff_map.clone(); +}