BornAgain  1.18.0
Simulate and fit neutron and x-ray scattering at grazing incidence
Material Class Reference
Collaboration diagram for Material:

Public Member Functions

 Material (std::unique_ptr< BaseMaterialImpl > material_impl)
 
 Material (const Material &material)
 
 Material (Material &&material)=default
 
Materialoperator= (const Material &other)
 
Materialoperator= (Material &&other)=default
 
Material inverted () const
 
complex_t refractiveIndex (double wavelength) const
 
complex_t refractiveIndex2 (double wavelength) const
 
bool isScalarMaterial () const
 
bool isMagneticMaterial () const
 
std::string getName () const
 
MATERIAL_TYPES typeID () const
 
kvector_t magnetization () const
 
complex_t materialData () const
 
bool isEmpty () const
 
bool isDefaultMaterial () const
 
complex_t scalarSubtrSLD (const WavevectorInfo &wavevectors) const
 
Eigen::Matrix2cd polarizedSubtrSLD (const WavevectorInfo &wavevectors) const
 
Material rotatedMaterial (const Transform3D &transform) const
 

Private Attributes

std::unique_ptr< BaseMaterialImplm_material_impl
 

Friends

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

Detailed Description

A wrapper for underlying material implementation.

Definition at line 28 of file Material.h.

Constructor & Destructor Documentation

◆ Material() [1/3]

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

Creates material with particular material implementation.

Definition at line 21 of file Material.cpp.

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

Referenced by inverted().

◆ Material() [2/3]

Material::Material ( const Material material)

Definition at line 26 of file Material.cpp.

27 {
28  if (material.isEmpty())
30  "Material: Error! Attempt to initialize material with nullptr.");
31  m_material_impl.reset(material.m_material_impl->clone());
32 }
bool isEmpty() const
Returns true if material underlying data is nullptr.
Definition: Material.h:77

References isEmpty(), and m_material_impl.

Here is the call graph for this function:

◆ Material() [3/3]

Material::Material ( Material &&  material)
default

Member Function Documentation

◆ operator=() [1/2]

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

Definition at line 34 of file Material.cpp.

35 {
36  if (other.isEmpty())
38  "Material: Error! Attempt to assign nullptr to material.");
39  m_material_impl.reset(other.m_material_impl->clone());
40  return *this;
41 }

References isEmpty(), and m_material_impl.

Here is the call graph for this function:

◆ operator=() [2/2]

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

◆ inverted()

Material Material::inverted ( ) const

Constructs a material with inverted magnetization.

Definition at line 43 of file Material.cpp.

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

References m_material_impl, and Material().

Here is the call graph for this function:

◆ refractiveIndex()

complex_t Material::refractiveIndex ( double  wavelength) const

Returns refractive index.

Definition at line 49 of file Material.cpp.

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

References m_material_impl, and anonymous_namespace{SlicedCylindersBuilder.cpp}::wavelength().

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

Here is the call graph for this function:

◆ refractiveIndex2()

complex_t Material::refractiveIndex2 ( double  wavelength) const

Returns squared refractive index.

Definition at line 54 of file Material.cpp.

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

References m_material_impl, and anonymous_namespace{SlicedCylindersBuilder.cpp}::wavelength().

Here is the call graph for this function:

◆ 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 59 of file Material.cpp.

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

References m_material_impl.

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

◆ isMagneticMaterial()

bool Material::isMagneticMaterial ( ) const

Definition at line 64 of file Material.cpp.

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

References m_material_impl.

◆ getName()

std::string Material::getName ( ) const

Returns the name of material.

Definition at line 69 of file Material.cpp.

70 {
71  return m_material_impl->getName();
72 }

References m_material_impl.

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

◆ typeID()

MATERIAL_TYPES Material::typeID ( ) const

Returns the type of underlying material implementation.

Definition at line 74 of file Material.cpp.

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

References m_material_impl.

Referenced by SampleToPython::defineMaterials(), anonymous_namespace{KzComputation.cpp}::normalizedSLD(), and operator==().

◆ magnetization()

kvector_t Material::magnetization ( ) const

Get the magnetization (in A/m)

Definition at line 79 of file Material.cpp.

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

References m_material_impl.

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

◆ materialData()

complex_t Material::materialData ( ) const

Returns underlying material data.

The units of returned values are the same as the ones passed to material factory functions

Definition at line 84 of file Material.cpp.

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

References m_material_impl.

Referenced by createAveragedMaterial(), SampleToPython::defineMaterials(), isDefaultMaterial(), anonymous_namespace{KzComputation.cpp}::normalizedSLD(), and operator==().

◆ isEmpty()

bool Material::isEmpty ( ) const
inline

Returns true if material underlying data is nullptr.

Definition at line 77 of file Material.h.

77 { return !m_material_impl; }

References m_material_impl.

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

◆ isDefaultMaterial()

bool Material::isDefaultMaterial ( ) const

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

Definition at line 89 of file Material.cpp.

90 {
91  return materialData() == complex_t() && isScalarMaterial();
92 }
std::complex< double > complex_t
Definition: Complex.h:20
bool isScalarMaterial() const
Indicates whether the interaction with the material is scalar.
Definition: Material.cpp:59
complex_t materialData() const
Returns underlying material data.
Definition: Material.cpp:84

References isScalarMaterial(), and materialData().

Here is the call graph for this function:

◆ 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 94 of file Material.cpp.

95 {
96  return m_material_impl->scalarSubtrSLD(wavevectors);
97 }

References m_material_impl.

Referenced by FormFactorDecoratorMaterial::getRefractiveIndexFactor().

◆ polarizedSubtrSLD()

Eigen::Matrix2cd Material::polarizedSubtrSLD ( const WavevectorInfo wavevectors) const

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

Definition at line 99 of file Material.cpp.

100 {
101  return m_material_impl->polarizedSubtrSLD(wavevectors);
102 }

References m_material_impl.

Referenced by FormFactorDecoratorMaterial::evaluatePol().

◆ rotatedMaterial()

Material Material::rotatedMaterial ( const Transform3D transform) const

Definition at line 104 of file Material.cpp.

105 {
106  std::unique_ptr<BaseMaterialImpl> material_impl(m_material_impl->rotatedMaterial(transform));
107  return Material(std::move(material_impl));
108 }

Referenced by Particle::createSlicedParticle().

Friends And Related Function Documentation

◆ operator<<

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

Definition at line 110 of file Material.cpp.

111 {
112  m.m_material_impl->print(ostr);
113  return ostr;
114 }

Member Data Documentation

◆ m_material_impl


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