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

Description

Object that can generate the material profile of a sample as a function of depth.

The generated profile contains the complex SLD for SLD materials and the parameters delta and beta for refractive index materials

Definition at line 34 of file ProfileHelper.h.

Collaboration diagram for ProfileHelper:
[legend]

Public Member Functions

 ProfileHelper (const SliceStack &stack)
 
 ~ProfileHelper ()=default
 
std::vector< complex_t > calculateProfile (const std::vector< double > &z_values) const
 
std::pair< double, double > defaultLimits () const
 

Private Attributes

const SliceStackm_stack
 

Constructor & Destructor Documentation

◆ ProfileHelper()

ProfileHelper::ProfileHelper ( const SliceStack stack)

Definition at line 38 of file ProfileHelper.cpp.

39  : m_stack(stack)
40 {
41 }
const SliceStack & m_stack
Definition: ProfileHelper.h:43

◆ ~ProfileHelper()

ProfileHelper::~ProfileHelper ( )
default

Member Function Documentation

◆ calculateProfile()

std::vector< complex_t > ProfileHelper::calculateProfile ( const std::vector< double > &  z_values) const

Definition at line 46 of file ProfileHelper.cpp.

47 {
48  const complex_t top_value = !m_stack.empty() ? m_stack.at(0).material().materialData() : 0.0;
49  std::vector<complex_t> result(z_values.size(), top_value);
50  for (size_t i = 1; i < m_stack.size(); ++i) {
51  const Slice& slice = m_stack.at(i);
52  const Slice& sliceAbove = m_stack.at(i - 1);
53  const complex_t sld_diff =
54  slice.material().materialData() - sliceAbove.material().materialData();
55  for (size_t j = 0; j < z_values.size(); ++j) {
56  const double arg = (z_values[j] - slice.zTop());
57  const LayerRoughness* roughness = slice.topRoughness();
58  const double t = Transition(arg, roughness ? roughness->sigma() : 0);
59  result[j] += sld_diff * t;
60  }
61  }
62  return result;
63 }
A roughness of interface between two layers.
double sigma() const
Returns rms of roughness.
complex_t materialData() const
Returns delta + i beta.
Definition: Material.cpp:83
Data structure containing the data of a single slice, for calculating the Fresnel coefficients.
Definition: Slice.h:31
double zTop() const
Definition: Slice.cpp:61
const Material & material() const
Definition: Slice.cpp:51
const LayerRoughness * topRoughness() const
Definition: Slice.cpp:76

References m_stack, Slice::material(), Material::materialData(), LayerRoughness::sigma(), Slice::topRoughness(), and Slice::zTop().

Referenced by swigAPI::materialProfileSLD().

Here is the call graph for this function:

◆ defaultLimits()

std::pair< double, double > ProfileHelper::defaultLimits ( ) const

Definition at line 65 of file ProfileHelper.cpp.

66 {
67  if (m_stack.size() < 2)
68  return {0.0, 0.0};
69  double interface_span = m_stack.front().zBottom() - m_stack.back().zTop();
70  double default_margin = interface_span > 0.0 ? interface_span / 20.0 : 10.0;
71  const LayerRoughness* topRoughness = m_stack.at(1).topRoughness();
72  const LayerRoughness* bottomRoughness = m_stack.back().topRoughness();
73 
74  double top_margin =
75  topRoughness && topRoughness->sigma() > 0 ? 5.0 * topRoughness->sigma() : default_margin;
76  double bottom_margin = bottomRoughness && bottomRoughness->sigma() > 0
77  ? 5.0 * bottomRoughness->sigma()
78  : default_margin;
79  double z_min = m_stack.back().zTop() - bottom_margin;
80  double z_max = m_stack.front().zBottom() + top_margin;
81  return {z_min, z_max};
82 }

References m_stack, and LayerRoughness::sigma().

Referenced by swigAPI::defaultMaterialProfileLimits().

Here is the call graph for this function:

Member Data Documentation

◆ m_stack

const SliceStack& ProfileHelper::m_stack
private

Definition at line 43 of file ProfileHelper.h.

Referenced by calculateProfile(), and defaultLimits().


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