BornAgain  1.18.0
Simulate and fit neutron and x-ray scattering at grazing incidence
GISASSpecularComputation.cpp
Go to the documentation of this file.
1 // ************************************************************************** //
2 //
3 // BornAgain: simulate and fit scattering at grazing incidence
4 //
5 //! @file Core/Computation/GISASSpecularComputation.cpp
6 //! @brief Implements class GISASSpecularComputation.
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 
19 
21  : mp_fresnel_map{p_fresnel_map}
22 {
23 }
24 
26 {
27  if (!elem.isSpecular())
28  return;
29  complex_t R = mp_fresnel_map->getInCoefficients(elem, 0)->getScalarR();
30  double sin_alpha_i = std::abs(std::sin(elem.getAlphaI()));
31  if (sin_alpha_i == 0.0)
32  sin_alpha_i = 1.0;
33  const double solid_angle = elem.getSolidAngle();
34  if (solid_angle <= 0.0)
35  return;
36  const double intensity = std::norm(R) * sin_alpha_i / solid_angle;
37  elem.setIntensity(intensity);
38 }
std::complex< double > complex_t
Definition: Complex.h:20
Defines class GISASSpecularComputation.
Defines class IFresnelMap.
Defines and implements class ILayerRTCoefficients.
Defines class SimulationElement.
const IFresnelMap * mp_fresnel_map
void compute(SimulationElement &elem) const
GISASSpecularComputation(const IFresnelMap *p_fresnel_map)
Holds the necessary information to calculate the radiation wavefunction in every layer for different ...
Definition: IFresnelMap.h:30
std::unique_ptr< const ILayerRTCoefficients > getInCoefficients(const T &sim_element, size_t layer_index) const
Retrieves the amplitude coefficients for an incoming wavevector.
Definition: IFresnelMap.h:41
Data stucture containing both input and output of a single detector cell.
double getSolidAngle() const
double getAlphaI() const
void setIntensity(double intensity)
bool isSpecular() const
Tells if simulation element corresponds to a specular peak.