21 const double prefactor = std::sqrt(2.0 /
M_PI);
23 double TransitionTanh(
double x)
25 return (1.0 - std::tanh(prefactor * x)) / 2.0;
28 double Transition(
double x,
double sigma)
31 return x < 0.0 ? 1.0 : 0.0;
32 return TransitionTanh(x / sigma);
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) {
53 const complex_t sld_diff =
55 for (
size_t j = 0; j < z_values.size(); ++j) {
56 const double arg = (z_values[j] - slice.
zTop());
58 const double t = Transition(arg, roughness ? roughness->
sigma() : 0);
59 result[j] += sld_diff * t;
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;
75 topRoughness && topRoughness->
sigma() > 0 ? 5.0 * topRoughness->
sigma() : default_margin;
76 double bottom_margin = bottomRoughness && bottomRoughness->
sigma() > 0
77 ? 5.0 * bottomRoughness->
sigma()
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};
Defines class LayerRoughness.
Defines class ProfileHelper.
Defines class SliceStack.
A roughness of interface between two layers.
double sigma() const
Returns rms of roughness.
complex_t materialData() const
Returns delta + i beta.
std::pair< double, double > defaultLimits() const
std::vector< complex_t > calculateProfile(const std::vector< double > &z_values) const
const SliceStack & m_stack
ProfileHelper(const SliceStack &stack)
Data structure containing the data of a single slice, for calculating the Fresnel coefficients.
const Material & material() const
const LayerRoughness * topRoughness() const