BornAgain  1.19.79
Open-source research software to simulate and fit neutron and x-ray reflectometry and grazing-incidence small-angle scattering
Material Class Reference

Description

A wrapper for underlying material implementation.

Definition at line 35 of file Material.h.

Collaboration diagram for Material:
[legend]

Public Member Functions

 Material (const Material &material)
 
 Material (Material &&material)=default
 
 Material (std::unique_ptr< BaseMaterialImpl > &&material_impl)
 Creates material with particular material implementation. More...
 
Material inverted () const
 Constructs a material with inverted magnetization. More...
 
bool isDefaultMaterial () const
 Returns true if material has refractive index of (1.0, 0.0) and zero magnetization. More...
 
bool isEmpty () const
 Returns true if material underlying data is nullptr. More...
 
bool isMagneticMaterial () const
 
bool isScalarMaterial () const
 Indicates whether the interaction with the material is scalar. This means that different polarization states will be diffracted equally. More...
 
R3 magnetization () const
 Get the magnetization (in A/m) More...
 
complex_t materialData () const
 Returns delta + i beta. More...
 
std::string materialName () const
 Returns the name of material. More...
 
Materialoperator= (const Material &other)
 
Materialoperator= (Material &&other)=default
 
SpinMatrix polarizedSubtrSLD (const WavevectorInfo &wavevectors) const
 Returns ( $ \pi/\lambda^2 $ - sld) matrix with magnetization corrections. More...
 
complex_t refractiveIndex (double wavelength) const
 Returns refractive index. More...
 
complex_t refractiveIndex2 (double wavelength) const
 Returns squared refractive index. More...
 
Material rotatedMaterial (const RotMatrix &transform) const
 
complex_t scalarSubtrSLD (const WavevectorInfo &wavevectors) const
 Returns ( $ \pi/\lambda^2 $ - sld), sld (in $nm^{-2}$) being the scattering length density. More...
 
MATERIAL_TYPES typeID () const
 Returns the type of underlying material implementation. More...
 

Private Attributes

std::unique_ptr< BaseMaterialImplm_material_impl
 

Friends

std::ostream & operator<< (std::ostream &ostr, const Material &mat)
 

Constructor & Destructor Documentation

◆ Material() [1/3]

Material::Material ( std::unique_ptr< BaseMaterialImpl > &&  material_impl)

Creates material with particular material implementation.

Definition at line 22 of file Material.cpp.

23  : m_material_impl(std::move(material_impl))
24 {
25 }
std::unique_ptr< BaseMaterialImpl > m_material_impl
Definition: Material.h:100

Referenced by inverted().

◆ Material() [2/3]

Material::Material ( const Material material)

Definition at line 27 of file Material.cpp.

28 {
29  ASSERT(!material.isEmpty());
30  m_material_impl.reset(material.m_material_impl->clone());
31 }
#define ASSERT(condition)
Definition: Assert.h:45
bool isEmpty() const
Returns true if material underlying data is nullptr.
Definition: Material.cpp:93

References ASSERT, isEmpty(), and m_material_impl.

Here is the call graph for this function:

◆ Material() [3/3]

Material::Material ( Material &&  material)
default

Member Function Documentation

◆ inverted()

Material Material::inverted ( ) const

Constructs a material with inverted magnetization.

Definition at line 42 of file Material.cpp.

43 {
44  std::unique_ptr<BaseMaterialImpl> material_impl(m_material_impl->inverted());
45  return Material(std::move(material_impl));
46 }
Material(std::unique_ptr< BaseMaterialImpl > &&material_impl)
Creates material with particular material implementation.
Definition: Material.cpp:22

References Material(), and m_material_impl.

Here is the call graph for this function:

◆ isDefaultMaterial()

bool Material::isDefaultMaterial ( ) const

Returns true if material has refractive index of (1.0, 0.0) and zero magnetization.

Definition at line 88 of file Material.cpp.

89 {
90  return materialData() == complex_t() && isScalarMaterial();
91 }
bool isScalarMaterial() const
Indicates whether the interaction with the material is scalar. This means that different polarization...
Definition: Material.cpp:58
complex_t materialData() const
Returns delta + i beta.
Definition: Material.cpp:83

References isScalarMaterial(), and materialData().

Here is the call graph for this function:

◆ isEmpty()

bool Material::isEmpty ( ) const

Returns true if material underlying data is nullptr.

Definition at line 93 of file Material.cpp.

94 {
95  return !m_material_impl;
96 }

References m_material_impl.

Referenced by Material(), and operator=().

◆ isMagneticMaterial()

bool Material::isMagneticMaterial ( ) const

Definition at line 63 of file Material.cpp.

64 {
65  return m_material_impl->isMagneticMaterial();
66 }

References m_material_impl.

◆ isScalarMaterial()

bool Material::isScalarMaterial ( ) const

Indicates whether the interaction with the material is scalar. This means that different polarization states will be diffracted equally.

Definition at line 58 of file Material.cpp.

59 {
60  return m_material_impl->isScalarMaterial();
61 }

References m_material_impl.

Referenced by SampleToPython::defineMaterials(), and isDefaultMaterial().

◆ magnetization()

R3 Material::magnetization ( ) const

Get the magnetization (in A/m)

Definition at line 78 of file Material.cpp.

79 {
80  return m_material_impl->magnetization();
81 }

References m_material_impl.

Referenced by SampleToPython::defineMaterials(), Slice::initBField(), and operator==().

◆ materialData()

complex_t Material::materialData ( ) const

Returns delta + i beta.

Definition at line 83 of file Material.cpp.

84 {
85  return m_material_impl->materialData();
86 }

References m_material_impl.

Referenced by ProfileHelper::calculateProfile(), SampleToPython::defineMaterials(), isDefaultMaterial(), and operator==().

◆ materialName()

std::string Material::materialName ( ) const

Returns the name of material.

Definition at line 68 of file Material.cpp.

69 {
70  return m_material_impl->matName();
71 }

References m_material_impl.

Referenced by SampleToPython::defineMaterials(), MaterialKeyHandler::insertMaterial(), and operator==().

◆ operator=() [1/2]

Material & Material::operator= ( const Material other)

Definition at line 33 of file Material.cpp.

34 {
35  if (this == &other)
36  return *this;
37  ASSERT(!other.isEmpty());
38  m_material_impl.reset(other.m_material_impl->clone());
39  return *this;
40 }

References ASSERT, isEmpty(), and m_material_impl.

Here is the call graph for this function:

◆ operator=() [2/2]

Material& Material::operator= ( Material &&  other)
default

◆ polarizedSubtrSLD()

SpinMatrix Material::polarizedSubtrSLD ( const WavevectorInfo wavevectors) const

Returns ( $ \pi/\lambda^2 $ - sld) matrix with magnetization corrections.

Definition at line 103 of file Material.cpp.

104 {
105  return m_material_impl->polarizedSubtrSLD(wavevectors);
106 }

References m_material_impl.

◆ refractiveIndex()

complex_t Material::refractiveIndex ( double  wavelength) const

Returns refractive index.

Definition at line 48 of file Material.cpp.

49 {
50  return m_material_impl->refractiveIndex(wavelength);
51 }

References m_material_impl.

Referenced by Slice::polarizedReducedPotential(), and Slice::scalarReducedPotential().

◆ refractiveIndex2()

complex_t Material::refractiveIndex2 ( double  wavelength) const

Returns squared refractive index.

Definition at line 53 of file Material.cpp.

54 {
55  return m_material_impl->refractiveIndex2(wavelength);
56 }

References m_material_impl.

Referenced by RoughMultiLayerContribution::get_refractive_term().

◆ rotatedMaterial()

Material Material::rotatedMaterial ( const RotMatrix transform) const

Definition at line 108 of file Material.cpp.

109 {
110  std::unique_ptr<BaseMaterialImpl> material_impl(m_material_impl->rotatedMaterial(transform));
111  return Material(std::move(material_impl));
112 }

◆ scalarSubtrSLD()

complex_t Material::scalarSubtrSLD ( const WavevectorInfo wavevectors) const

Returns ( $ \pi/\lambda^2 $ - sld), sld (in $nm^{-2}$) being the scattering length density.

Definition at line 98 of file Material.cpp.

99 {
100  return m_material_impl->scalarSubtrSLD(wavevectors.vacuumLambda());
101 }
double vacuumLambda() const

References m_material_impl, and WavevectorInfo::vacuumLambda().

Here is the call graph for this function:

◆ typeID()

MATERIAL_TYPES Material::typeID ( ) const

Returns the type of underlying material implementation.

Definition at line 73 of file Material.cpp.

74 {
75  return m_material_impl->typeID();
76 }

References m_material_impl.

Referenced by SampleToPython::defineMaterials(), and operator==().

Friends And Related Function Documentation

◆ operator<<

std::ostream& operator<< ( std::ostream &  ostr,
const Material mat 
)
friend

Definition at line 114 of file Material.cpp.

115 {
116  ostr << m.m_material_impl->print();
117  return ostr;
118 }

Member Data Documentation

◆ m_material_impl


The documentation for this class was generated from the following files: