BornAgain  1.18.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 scattering at grazing incidence
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 #ifndef BORNAGAIN_CORE_MATERIAL_BASEMATERIALIMPL_H
16 #define BORNAGAIN_CORE_MATERIAL_BASEMATERIALIMPL_H
17 
18 #include "Base/Types/Complex.h"
19 #include "Base/Vector/EigenCore.h"
20 #include "Base/Vector/Vectors3D.h"
21 
22 class Transform3D;
23 class WavevectorInfo;
24 
26 
27 //! Interface for material implementation classes.
28 //! Inherited by MagneticMaterialImpl, which has further children.
29 //! @ingroup materials
30 
32 {
33 public:
34  //! Constructs basic material with name
35  BaseMaterialImpl(const std::string& name) : m_name(name) {}
36 
37  virtual ~BaseMaterialImpl() = default;
38 
39  //! Returns pointer to a copy of material
40  virtual BaseMaterialImpl* clone() const = 0;
41 
42  //! Constructs a material with inverted magnetization
43  virtual BaseMaterialImpl* inverted() const = 0;
44 
45  //! Returns refractive index.
46  virtual complex_t refractiveIndex(double wavelength) const = 0;
47 
48  //! Returns squared refractive index.
49  virtual complex_t refractiveIndex2(double wavelength) const = 0;
50 
51  //! Indicates whether the interaction with the material is scalar.
52  //! This means that different polarization states will be diffracted equally
53  virtual bool isScalarMaterial() const = 0;
54 
55  virtual bool isMagneticMaterial() const = 0;
56 
57  //! Returns the magnetization (in A/m)
58  virtual kvector_t magnetization() const = 0;
59 
60  //! Returns underlying material data
61  virtual complex_t materialData() const = 0;
62 
63  //! Returns type of material implementation
64  virtual MATERIAL_TYPES typeID() const = 0;
65 
66  //! Returns (\f$ \pi/\lambda^2 \f$ - sld), sld being the scattering length density
67  virtual complex_t scalarSubtrSLD(const WavevectorInfo& wavevectors) const = 0;
68 
69  //! Returns (\f$ \pi/\lambda^2 \f$ - sld) matrix with magnetization corrections
70  virtual Eigen::Matrix2cd polarizedSubtrSLD(const WavevectorInfo& wavevectors) const = 0;
71 
72  virtual BaseMaterialImpl* rotatedMaterial(const Transform3D& transform) const = 0;
73 
74  //! Prints object data
75  virtual void print(std::ostream& ostr) const = 0;
76 
77  //! Returns name of the material
78  const std::string& getName() const { return m_name; }
79 
80 private:
81  const std::string m_name;
82 };
83 
84 #endif // BORNAGAIN_CORE_MATERIAL_BASEMATERIALIMPL_H
MATERIAL_TYPES
Defines complex_t, and a few elementary functions.
std::complex< double > complex_t
Definition: Complex.h:20
Include to deal with Eigen alignment centrally.
Defines basic vectors in R^3 and 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:28
Holds all wavevector information relevant for calculating form factors.