BornAgain  1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
BaseMaterialImpl.h
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file Sample/Material/BaseMaterialImpl.h
6 //! @brief Defines basic material implementation interface.
7 //!
8 //! @homepage http://www.bornagainproject.org
9 //! @license GNU General Public License v3 or higher (see COPYING)
10 //! @copyright Forschungszentrum Jülich GmbH 2018
11 //! @authors Scientific Computing Group at MLZ (see CITATION, AUTHORS)
12 //
13 // ************************************************************************************************
14 
15 #ifdef SWIG
16 #error no need to expose this header to Swig
17 #endif
18 
19 #ifndef USER_API
20 #ifndef BORNAGAIN_SAMPLE_MATERIAL_BASEMATERIALIMPL_H
21 #define BORNAGAIN_SAMPLE_MATERIAL_BASEMATERIALIMPL_H
22 
23 #include "Base/Vector/EigenCore.h"
24 #include "Base/Vector/Vectors3D.h"
25 
26 class Transform3D;
27 class WavevectorInfo;
28 
30 
31 //! Interface for material implementation classes.
32 //! Inherited by MagneticMaterialImpl, which has further children.
33 //! @ingroup materials
34 
36 public:
37  //! Constructs basic material with name
38  BaseMaterialImpl(const std::string& name) : m_name(name) {}
39 
40  virtual ~BaseMaterialImpl() = default;
41 
42  //! Returns pointer to a copy of material
43  virtual BaseMaterialImpl* clone() const = 0;
44 
45  //! Constructs a material with inverted magnetization
46  virtual BaseMaterialImpl* inverted() const = 0;
47 
48  //! Returns refractive index.
49  virtual complex_t refractiveIndex(double wavelength) const = 0;
50 
51  //! Returns squared refractive index.
52  virtual complex_t refractiveIndex2(double wavelength) const = 0;
53 
54  //! Indicates whether the interaction with the material is scalar.
55  //! This means that different polarization states will be diffracted equally
56  virtual bool isScalarMaterial() const = 0;
57 
58  virtual bool isMagneticMaterial() const = 0;
59 
60  //! Returns the magnetization (in A/m)
61  virtual kvector_t magnetization() const = 0;
62 
63  //! Returns underlying material data
64  virtual complex_t materialData() const = 0;
65 
66  //! Returns type of material implementation
67  virtual MATERIAL_TYPES typeID() const = 0;
68 
69  //! Returns (\f$ \pi/\lambda^2 \f$ - sld), sld being the scattering length density
70  virtual complex_t scalarSubtrSLD(const WavevectorInfo& wavevectors) const = 0;
71 
72  //! Returns (\f$ \pi/\lambda^2 \f$ - sld) matrix with magnetization corrections
73  virtual Eigen::Matrix2cd polarizedSubtrSLD(const WavevectorInfo& wavevectors) const = 0;
74 
75  virtual BaseMaterialImpl* rotatedMaterial(const Transform3D& transform) const = 0;
76 
77  //! Prints object data
78  virtual void print(std::ostream& ostr) const = 0;
79 
80  //! Returns name of the material
81  const std::string& getName() const { return m_name; }
82 
83 private:
84  const std::string m_name;
85 };
86 
87 #endif // BORNAGAIN_SAMPLE_MATERIAL_BASEMATERIALIMPL_H
88 #endif // USER_API
MATERIAL_TYPES
std::complex< double > complex_t
Definition: Complex.h:20
Include to deal with Eigen alignment centrally.
Defines basic vectors in Z^3, R^3, C^3.
Interface for material implementation classes.
BaseMaterialImpl(const std::string &name)
Constructs basic material with name.
virtual complex_t refractiveIndex(double wavelength) const =0
Returns refractive index.
const std::string & getName() const
Returns name of the material.
virtual complex_t materialData() const =0
Returns underlying material data.
virtual BaseMaterialImpl * clone() const =0
Returns pointer to a copy of material.
virtual kvector_t magnetization() const =0
Returns the magnetization (in A/m)
virtual BaseMaterialImpl * inverted() const =0
Constructs a material with inverted magnetization.
const std::string m_name
virtual bool isScalarMaterial() const =0
Indicates whether the interaction with the material is scalar.
virtual complex_t scalarSubtrSLD(const WavevectorInfo &wavevectors) const =0
Returns ( - sld), sld being the scattering length density.
virtual complex_t refractiveIndex2(double wavelength) const =0
Returns squared refractive index.
virtual bool isMagneticMaterial() const =0
virtual MATERIAL_TYPES typeID() const =0
Returns type of material implementation.
virtual BaseMaterialImpl * rotatedMaterial(const Transform3D &transform) const =0
virtual Eigen::Matrix2cd polarizedSubtrSLD(const WavevectorInfo &wavevectors) const =0
Returns ( - sld) matrix with magnetization corrections.
virtual ~BaseMaterialImpl()=default
virtual void print(std::ostream &ostr) const =0
Prints object data.
Vector transformations in three dimensions.
Definition: Transform3D.h:26
Holds all wavevector information relevant for calculating form factors.
QString const & name(EShape k)
Definition: particles.cpp:21