BornAgain  1.19.79
Open-source research software to simulate and fit neutron and x-ray reflectometry and grazing-incidence small-angle scattering
SampleUtils::Multilayer Namespace Reference

Description

Helper functions for class MultiLayer.

Functions

bool ContainsCompatibleMaterials (const MultiLayer &sample)
 Returns true if the sample contains non-default materials of one type only. More...
 
bool hasRoughness (const MultiLayer &sample)
 
size_t IndexOfLayer (const MultiLayer &sample, const Layer *p_layer)
 Returns the index of the given layer. More...
 
const LayerRoughnessLayerTopRoughness (const MultiLayer &sample, size_t i)
 Returns top roughness of layer. More...
 

Function Documentation

◆ ContainsCompatibleMaterials()

bool SampleUtils::Multilayer::ContainsCompatibleMaterials ( const MultiLayer sample)

Returns true if the sample contains non-default materials of one type only.

Definition at line 36 of file MultilayerUtils.cpp.

37 {
40 }
std::vector< const Material * > containedMaterials() const
Returns set of unique materials contained in this ISampleNode.
Definition: ISampleNode.cpp:25
MATERIAL_TYPES checkMaterialTypes(const std::vector< const Material * > &materials)
Checks if all non-default materials in materials are of the same type and returns this type....

References MaterialUtils::checkMaterialTypes(), ISampleNode::containedMaterials(), and InvalidMaterialType.

Referenced by ISimulation::simulate().

Here is the call graph for this function:

◆ hasRoughness()

bool SampleUtils::Multilayer::hasRoughness ( const MultiLayer sample)

Definition at line 42 of file MultilayerUtils.cpp.

43 {
44  for (size_t i = 0; i < sample.numberOfLayers() - 1; i++)
45  if (sample.layerInterface(i)->roughness())
46  return true;
47  return false;
48 }
const LayerRoughness * roughness() const
Returns roughness of the interface.
const LayerInterface * layerInterface(size_t i_interface) const
Returns interface with given index.
Definition: MultiLayer.cpp:96
size_t numberOfLayers() const
Definition: MultiLayer.h:51

References MultiLayer::layerInterface(), MultiLayer::numberOfLayers(), and LayerInterface::roughness().

Here is the call graph for this function:

◆ IndexOfLayer()

size_t SampleUtils::Multilayer::IndexOfLayer ( const MultiLayer sample,
const Layer p_layer 
)

Returns the index of the given layer.

Definition at line 28 of file MultilayerUtils.cpp.

29 {
30  for (size_t i = 0; i < sample.numberOfLayers(); ++i)
31  if (p_layer == sample.layer(i))
32  return i;
33  throw std::out_of_range("SampleUtils::Multilayer::IndexOfLayer: layer not found");
34 }
const Layer * layer(size_t i_layer) const
Returns layer with given index.
Definition: MultiLayer.cpp:91

References MultiLayer::layer(), and MultiLayer::numberOfLayers().

Here is the call graph for this function:

◆ LayerTopRoughness()

const LayerRoughness * SampleUtils::Multilayer::LayerTopRoughness ( const MultiLayer sample,
size_t  i 
)

Returns top roughness of layer.

Definition at line 21 of file MultilayerUtils.cpp.

22 {
23  if (i == 0)
24  return nullptr;
25  return sample.layerInterface(i - 1)->roughness();
26 }

References MultiLayer::layerInterface(), and LayerInterface::roughness().

Here is the call graph for this function: