BornAgain  1.18.0
Simulate and fit neutron and x-ray scattering at grazing incidence
SpecularScalarTanhStrategy.cpp
Go to the documentation of this file.
1 // ************************************************************************** //
2 //
3 // BornAgain: simulate and fit scattering at grazing incidence
4 //
5 //! @file Sample/Specular/SpecularScalarTanhStrategy.cpp
6 //! @brief Implements class SpecularScalarTanhStrategy.
7 //!
8 //! @homepage http://www.bornagainproject.org
9 //! @license GNU General Public License v3 or higher (see COPYING)
10 //! @copyright Forschungszentrum Jülich GmbH 2018
11 //! @authors Scientific Computing Group at MLZ (see CITATION, AUTHORS)
12 //
13 // ************************************************************************** //
14 
18 #include <Eigen/Dense>
19 
20 namespace
21 {
22 const double pi2_15 = std::pow(M_PI_2, 1.5);
23 }
24 
25 std::pair<complex_t, complex_t>
26 SpecularScalarTanhStrategy::transition(complex_t kzi, complex_t kzi1, double sigma) const
27 {
28  complex_t roughness = 1;
29  if (sigma > 0.0) {
30  const double sigeff = pi2_15 * sigma;
31  roughness =
32  std::sqrt(MathFunctions::tanhc(sigeff * kzi1) / MathFunctions::tanhc(sigeff * kzi));
33  }
34  const complex_t inv_roughness = 1.0 / roughness;
35  const complex_t kz_ratio = kzi1 / kzi * roughness;
36 
37  const complex_t a00 = 0.5 * (inv_roughness + kz_ratio);
38  const complex_t a01 = 0.5 * (inv_roughness - kz_ratio);
39 
40  return {a00, a01};
41 }
Defines M_PI and some more mathematical constants.
Defines namespace MathFunctions.
Defines class SpecularScalarTanhStrategy.
complex_t tanhc(const complex_t z)
Complex tanhc function: .