BornAgain  1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
MultiLayerUtils Namespace Reference

Functions

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

Function Documentation

◆ ContainsCompatibleMaterials()

bool MultiLayerUtils::ContainsCompatibleMaterials ( const MultiLayer multilayer)

Returns true if the multilayer 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:26
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::prepareSimulation().

Here is the call graph for this function:

◆ hasRoughness()

bool MultiLayerUtils::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)->getRoughness())
46  return true;
47  return false;
48 }
const LayerRoughness * getRoughness() 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:50

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

Here is the call graph for this function:

◆ IndexOfLayer()

size_t MultiLayerUtils::IndexOfLayer ( const MultiLayer multilayer,
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 < multilayer.numberOfLayers(); ++i)
31  if (p_layer == multilayer.layer(i))
32  return i;
33  throw std::out_of_range("MultiLayerUtils::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().

Referenced by GUIDomainSampleVisitor::visit().

Here is the call graph for this function:

◆ LayerTopRoughness()

const LayerRoughness * MultiLayerUtils::LayerTopRoughness ( const MultiLayer multilayer,
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 multilayer.layerInterface(i - 1)->getRoughness();
26 }

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

Referenced by ProcessedSample::initSlices().

Here is the call graph for this function: