BornAgain  1.19.79
Open-source research software to simulate and fit neutron and x-ray reflectometry and grazing-incidence small-angle scattering
SpecularElement.h
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file Resample/Element/SpecularElement.h
6 //! @brief Declares 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 
15 #ifdef SWIG
16 #error no need to expose this header to Swig
17 #endif
18 
19 #ifndef USER_API
20 #ifndef BORNAGAIN_RESAMPLE_ELEMENT_SPECULARELEMENT_H
21 #define BORNAGAIN_RESAMPLE_ELEMENT_SPECULARELEMENT_H
22 
23 #include "Base/Element/IElement.h"
24 #include <functional>
25 #include <heinz/Complex.h>
26 #include <heinz/Vectors3D.h>
27 #include <memory>
28 #include <vector>
29 
30 class SliceStack;
31 
32 //! Data stucture containing both input and output of a single image pixel for specular simulation.
33 //! @ingroup simulation
34 
35 class SpecularElement : public IElement {
36 public:
37  static SpecularElement FromQzScan(double kz, const PolMatrices& polMatrices, bool computable);
38  static SpecularElement FromAlphaScan(double wavelength, double alpha,
39  const PolMatrices& polMatrices, bool computable);
40 
41  SpecularElement(const SpecularElement& other) = delete;
43 
45 
46  double intensity() const { return m_intensity; }
48 
49  //! Returns calculation flag (if it's false, zero intensity is assigned to the element)
50  bool isCalculated() const { return m_computable; }
51 
52  //! Returns kz values for Abeles computation of reflection/transition coefficients
53  std::vector<complex_t> produceKz(const SliceStack& slices);
54 
55 private:
56  SpecularElement(bool computable, const PolMatrices& polMatrices,
57  std::function<std::vector<complex_t>(const SliceStack&)> kz_comp);
58 
59  double m_intensity; //!< simulated intensity for detector cell
60  const bool m_computable;
61  const std::function<std::vector<complex_t>(const SliceStack&)> m_kz_computation;
62 };
63 
64 #endif // BORNAGAIN_RESAMPLE_ELEMENT_SPECULARELEMENT_H
65 #endif // USER_API
Defines class DiffuseElement.
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.
double m_intensity
simulated intensity for detector cell
bool isCalculated() const
Returns calculation flag (if it's false, zero intensity is assigned to the element)
void setIntensity(double intensity)
std::vector< complex_t > produceKz(const SliceStack &slices)
Returns kz values for Abeles computation of reflection/transition coefficients.
const bool m_computable
SpecularElement(const SpecularElement &other)=delete
const std::function< std::vector< complex_t >const SliceStack &)> m_kz_computation
SpecularElement(SpecularElement &&other)
double intensity() const
static SpecularElement FromAlphaScan(double wavelength, double alpha, const PolMatrices &polMatrices, bool computable)
static SpecularElement FromQzScan(double kz, const PolMatrices &polMatrices, bool computable)