BornAgain  1.18.0
Simulate and fit neutron and x-ray scattering at grazing incidence
SpecularSimulationElement.cpp
Go to the documentation of this file.
1 // ************************************************************************** //
2 //
3 // BornAgain: simulate and fit scattering at grazing incidence
4 //
5 //! @file Sample/Slice/SpecularSimulationElement.cpp
6 //! @brief Implements the class SpecularSimulationElement.
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 
17 
19  : m_intensity(0.0), m_computable(computable),
20  m_kz_computation([kz](const std::vector<Slice>& slices) {
21  return KzComputation::computeKzFromSLDs(slices, kz);
22  })
23 {
24 }
25 
27  bool computable)
28  : m_intensity(0.0), m_computable(computable),
29  m_kz_computation(
30  [k = vecOfLambdaAlphaPhi(wavelength, alpha, 0.0)](const std::vector<Slice>& slices) {
32  })
33 {
34 }
35 
37  : m_polarization(other.m_polarization), m_intensity(other.m_intensity),
38  m_computable(other.m_computable), m_kz_computation(other.m_kz_computation)
39 {
40 }
41 
43  : m_polarization(std::move(other.m_polarization)), m_intensity(other.m_intensity),
44  m_computable(other.m_computable), m_kz_computation(std::move(other.m_kz_computation))
45 {
46 }
47 
49 
52 {
53  if (this != &other) {
54  SpecularSimulationElement tmp(other);
55  tmp.swapContent(*this);
56  }
57  return *this;
58 }
59 
61 {
62  m_polarization = handler;
63 }
64 
65 std::vector<complex_t> SpecularSimulationElement::produceKz(const std::vector<Slice>& slices)
66 {
67  return m_kz_computation(slices);
68 }
69 
71 {
75 }
BasicVector3D< double > vecOfLambdaAlphaPhi(double _lambda, double _alpha, double _phi)
Creates a vector<double> as a wavevector with given wavelength and angles.
Declares functions in namespace KzComputation.
void swap(OutputDataIterator< TValue, TContainer > &left, OutputDataIterator< TValue, TContainer > &right)
make Swappable
Declares the class SpecularSimulationElement.
Convenience class for handling polarization density matrix and polarization analyzer operator.
void swapContent(PolarizationHandler &other)
Data structure containing the data of a single slice, for calculating the Fresnel coefficients.
Definition: Slice.h:28
Data stucture containing both input and output of a single image pixel for specular simulation.
std::vector< complex_t > produceKz(const std::vector< Slice > &slices)
Returns kz values for Abeles computation of reflection/transition coefficients.
SpecularSimulationElement(double kz, bool computable)
SpecularSimulationElement & operator=(const SpecularSimulationElement &other)
void setPolarizationHandler(const PolarizationHandler &handler)
Assigns PolarizationHandler.
void swapContent(SpecularSimulationElement &other)
std::function< std::vector< complex_t >const std::vector< Slice > &)> m_kz_computation
double m_intensity
simulated intensity for detector cell
std::vector< complex_t > computeKzFromRefIndices(const std::vector< Slice > &slices, kvector_t k)
std::vector< complex_t > computeKzFromSLDs(const std::vector< Slice > &slices, double kz)