20 const double prefactor = std::sqrt(2.0 /
M_PI);
21 double Transition(
double x,
double sigma);
22 double TransitionTanh(
double x);
27 auto N = sample.size();
34 for (
size_t i = 0; i < N; ++i) {
36 bottom_z -= sample[i].thickness();
40 if (
auto roughness = sample[i + 1].topRoughness())
41 sigma = roughness->getSigma();
51 std::vector<complex_t>
54 complex_t top_value = m_materialdata.size() ? m_materialdata[0] : 0.0;
55 std::vector<complex_t> result(z_values.size(), top_value);
56 for (
size_t i = 0; i < m_zlimits.size(); ++i) {
57 auto sld_diff = m_materialdata[i + 1] - m_materialdata[i];
58 for (
size_t j = 0; j < z_values.size(); ++j) {
59 auto arg = (z_values[j] - m_zlimits[i]);
60 auto t = Transition(arg, m_sigmas[i]);
61 result[j] += sld_diff * t;
69 if (m_zlimits.size() < 1)
71 double interface_span = m_zlimits.front() - m_zlimits.back();
72 double default_margin = interface_span > 0.0 ? interface_span / 20.0 : 10.0;
73 double top_margin = m_sigmas.front() > 0.0 ? 5.0 * m_sigmas.front() : default_margin;
74 double bottom_margin = m_sigmas.back() > 0.0 ? 5.0 * m_sigmas.back() : default_margin;
75 double z_min = m_zlimits.back() - bottom_margin;
76 double z_max = m_zlimits.front() + top_margin;
77 return {z_min, z_max};
83 double Transition(
double x,
double sigma)
86 return x < 0.0 ? 1.0 : 0.0;
87 return TransitionTanh(x / sigma);
89 double TransitionTanh(
double x)
91 return (1.0 - std::tanh(prefactor * x)) / 2.0;
Defines class LayerRoughness.
std::vector< double > m_sigmas
ProfileHelper(const std::vector< Slice > &sample)
std::pair< double, double > defaultLimits() const
std::vector< complex_t > calculateProfile(const std::vector< double > &z_values) const
std::vector< double > m_zlimits
std::vector< complex_t > m_materialdata
std::complex< double > complex_t