BornAgain  1.19.79
Open-source research software to simulate and fit neutron and x-ray reflectometry and grazing-incidence small-angle scattering
SpecularElement.cpp
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file Resample/Element/SpecularElement.cpp
6 //! @brief Implements the class SpecularElement.
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 
16 #include "Base/Vector/Direction.h"
18 
20  bool computable)
21 {
22  return SpecularElement(computable, polMatrices, [kz](const SliceStack& slices) {
23  return Compute::Kz::computeKzFromSLDs(slices, kz);
24  });
25 }
26 
27 SpecularElement SpecularElement::FromAlphaScan(double wavelength, double alpha,
28  const PolMatrices& polMatrices, bool computable)
29 {
30  return SpecularElement(
31  computable, polMatrices,
32  [k = vecOfLambdaAlphaPhi(wavelength, alpha, 0.0)](const SliceStack& slices) {
33  return Compute::Kz::computeKzFromRefIndices(slices, k);
34  });
35 }
36 
37 SpecularElement::SpecularElement(bool computable, const PolMatrices& polMatrices,
38  std::function<std::vector<complex_t>(const SliceStack&)> kz_comp)
39  : IElement(polMatrices)
40  , m_intensity(0.0)
41  , m_computable(computable)
42  , m_kz_computation(kz_comp)
43 {
44 }
45 
47 
49 
50 std::vector<complex_t> SpecularElement::produceKz(const SliceStack& slices)
51 {
52  return m_kz_computation(slices);
53 }
R3 vecOfLambdaAlphaPhi(double _lambda, double _alpha, double _phi)
Definition: Direction.cpp:19
Defines class Direction.
Declares functions in namespace ComputateKz.
Declares the class SpecularElement.
const PolMatrices & polMatrices() const
Returns polarizer and analyzer matrices.
Definition: IElement.h:37
Convenience class for handling polarization density matrix and polarization analyzer operator.
Definition: PolMatrices.h:29
A stack of Slices.
Definition: SliceStack.h:38
Data stucture containing both input and output of a single image pixel for specular simulation.
std::vector< complex_t > produceKz(const SliceStack &slices)
Returns kz values for Abeles computation of reflection/transition coefficients.
SpecularElement(const SpecularElement &other)=delete
const std::function< std::vector< complex_t >const SliceStack &)> m_kz_computation
static SpecularElement FromAlphaScan(double wavelength, double alpha, const PolMatrices &polMatrices, bool computable)
static SpecularElement FromQzScan(double kz, const PolMatrices &polMatrices, bool computable)
std::vector< complex_t > computeKzFromSLDs(const SliceStack &slices, double kz)
Computes kz values from kz of the incoming beam known at a distant point in vacuum....
std::vector< complex_t > computeKzFromRefIndices(const SliceStack &slices, R3 k)
Computes kz values from k-vector of the incoming beam known at a distant point in vacuum....