BornAgain  1.19.79
Open-source research software to simulate and fit neutron and x-ray reflectometry and grazing-incidence small-angle scattering
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 <heinz/Complex.h>
24 #include <heinz/Vectors3D.h>
25 
26 class RotMatrix;
27 class SpinMatrix;
28 class WavevectorInfo;
29 
31 
32 //! Interface for material implementation classes.
33 //! Inherited by MagneticMaterialImpl, which has further children.
34 //! @ingroup materials
35 
37 public:
38  //! Constructs basic material with name
39  BaseMaterialImpl(const std::string& name)
40  : m_name(name)
41  {
42  }
43 
44  virtual ~BaseMaterialImpl() = default;
45 
46  //! Returns pointer to a copy of material
47  virtual BaseMaterialImpl* clone() const = 0;
48 
49  //! Constructs a material with inverted magnetization
50  virtual BaseMaterialImpl* inverted() const = 0;
51 
52  //! Returns refractive index.
53  virtual complex_t refractiveIndex(double wavelength) const = 0;
54 
55  //! Returns squared refractive index.
56  virtual complex_t refractiveIndex2(double wavelength) const = 0;
57 
58  //! Indicates whether the interaction with the material is scalar.
59  //! This means that different polarization states will be diffracted equally
60  virtual bool isScalarMaterial() const = 0;
61 
62  virtual bool isMagneticMaterial() const = 0;
63 
64  //! Returns the magnetization (in A/m)
65  virtual R3 magnetization() const = 0;
66 
67  //! Returns underlying material data
68  virtual complex_t materialData() const = 0;
69 
70  //! Returns type of material implementation
71  virtual MATERIAL_TYPES typeID() const = 0;
72 
73  //! Returns (\f$ \pi/\lambda^2 \f$ - sld), sld being the scattering length density
74  virtual complex_t scalarSubtrSLD(double lambda0) const = 0;
75 
76  //! Returns (\f$ \pi/\lambda^2 \f$ - sld) matrix with magnetization corrections
77  virtual SpinMatrix polarizedSubtrSLD(const WavevectorInfo& wavevectors) const = 0;
78 
79  virtual BaseMaterialImpl* rotatedMaterial(const RotMatrix& transform) const = 0;
80 
81  //! Prints object data
82  virtual std::string print() const = 0;
83 
84  //! Returns name of the material
85  const std::string& matName() const { return m_name; }
86 
87 private:
88  const std::string m_name;
89 };
90 
91 #endif // BORNAGAIN_SAMPLE_MATERIAL_BASEMATERIALIMPL_H
92 #endif // USER_API
MATERIAL_TYPES
Interface for material implementation classes. Inherited by MagneticMaterialImpl, which has further c...
BaseMaterialImpl(const std::string &name)
Constructs basic material with name.
const std::string & matName() const
Returns name of the material.
virtual R3 magnetization() const =0
Returns the magnetization (in A/m)
virtual complex_t refractiveIndex(double wavelength) const =0
Returns refractive index.
virtual complex_t materialData() const =0
Returns underlying material data.
virtual BaseMaterialImpl * clone() const =0
Returns pointer to a copy of material.
virtual BaseMaterialImpl * inverted() const =0
Constructs a material with inverted magnetization.
virtual BaseMaterialImpl * rotatedMaterial(const RotMatrix &transform) const =0
const std::string m_name
virtual bool isScalarMaterial() const =0
Indicates whether the interaction with the material is scalar. This means that different polarization...
virtual complex_t scalarSubtrSLD(double lambda0) const =0
Returns ( - sld), sld being the scattering length density.
virtual complex_t refractiveIndex2(double wavelength) const =0
Returns squared refractive index.
virtual std::string print() const =0
Prints object data.
virtual bool isMagneticMaterial() const =0
virtual SpinMatrix polarizedSubtrSLD(const WavevectorInfo &wavevectors) const =0
Returns ( - sld) matrix with magnetization corrections.
virtual MATERIAL_TYPES typeID() const =0
Returns type of material implementation.
virtual ~BaseMaterialImpl()=default
Rotation matrix in three dimensions. Represents group SO(3). Internal parameterization based on quate...
Definition: RotMatrix.h:25
Holds all wavevector information relevant for calculating form factors.