BornAgain  1.18.0
Simulate and fit neutron and x-ray scattering at grazing incidence
anonymous_namespace{KzComputation.cpp} Namespace Reference

Functions

complex_t normalizedSLD (const Material &material)
 
complex_t checkForUnderflow (complex_t val)
 

Function Documentation

◆ normalizedSLD()

complex_t anonymous_namespace{KzComputation.cpp}::normalizedSLD ( const Material material)

Definition at line 21 of file KzComputation.cpp.

22 {
23  if (material.typeID() != MATERIAL_TYPES::MaterialBySLD)
24  throw std::runtime_error("Error in normalizedSLD: passed material has wrong type");
25 
26  complex_t sld = std::conj(material.materialData()) / (Units::angstrom * Units::angstrom);
27  sld *= 4.0 * M_PI;
28  return sld;
29 }
std::complex< double > complex_t
Definition: Complex.h:20
#define M_PI
Definition: MathConstants.h:39
MATERIAL_TYPES typeID() const
Returns the type of underlying material implementation.
Definition: Material.cpp:74
complex_t materialData() const
Returns underlying material data.
Definition: Material.cpp:84
static constexpr double angstrom
Definition: Units.h:25

References Units::angstrom, M_PI, MaterialBySLD, Material::materialData(), and Material::typeID().

Referenced by KzComputation::computeKzFromSLDs().

Here is the call graph for this function:

◆ checkForUnderflow()

complex_t anonymous_namespace{KzComputation.cpp}::checkForUnderflow ( complex_t  val)

Definition at line 31 of file KzComputation.cpp.

32 {
33  return std::norm(val) < 1e-80 ? complex_t(0.0, 1e-40) : val;
34 }

Referenced by KzComputation::computeKzFromRefIndices(), KzComputation::computeKzFromSLDs(), and KzComputation::computeReducedKz().