BornAgain  1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
IFresnelMap.h
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file Sample/Fresnel/IFresnelMap.h
6 //! @brief Defines interface IFresnelMap.
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_SAMPLE_FRESNEL_IFRESNELMAP_H
21 #define BORNAGAIN_SAMPLE_FRESNEL_IFRESNELMAP_H
22 
24 #include <memory>
25 #include <vector>
26 
27 class SimulationElement;
28 
29 //! Holds the necessary information to calculate the radiation wavefunction in every layer
30 //! for different incoming (outgoing) angles of the beam in the top layer
31 //! (these amplitudes correspond to the specular part of the wavefunction).
32 //! @ingroup algorithms_internal
33 
34 class IFresnelMap {
35 public:
36  IFresnelMap(std::unique_ptr<ISpecularStrategy> strategy);
37  virtual ~IFresnelMap();
38 
39  //! Retrieves the amplitude coefficients for a (time-reversed) outgoing wavevector.
40  virtual std::unique_ptr<const ILayerRTCoefficients>
41  getOutCoefficients(const SimulationElement& sim_element, size_t layer_index) const = 0;
42 
43  //! Retrieves the amplitude coefficients for an incoming wavevector.
44  template <typename T>
45  std::unique_ptr<const ILayerRTCoefficients> getInCoefficients(const T& sim_element,
46  size_t layer_index) const
47  {
48  return getCoefficients(sim_element.getKi(), layer_index);
49  }
50 
51  virtual void setSlices(const std::vector<Slice>& slices);
52  const std::vector<Slice>& slices() const;
53 
54  //! Disables caching of previously computed Fresnel coefficients
55  void disableCaching();
56 
57 protected:
58  virtual std::unique_ptr<const ILayerRTCoefficients>
59  getCoefficients(const kvector_t& kvec, size_t layer_index) const = 0;
60 
61  std::vector<Slice> m_slices;
63 
64  std::unique_ptr<ISpecularStrategy> m_Strategy;
65 };
66 
67 #endif // BORNAGAIN_SAMPLE_FRESNEL_IFRESNELMAP_H
68 #endif // USER_API
Defines and implements class ISpecularStrategy.
Holds the necessary information to calculate the radiation wavefunction in every layer for different ...
Definition: IFresnelMap.h:34
void disableCaching()
Disables caching of previously computed Fresnel coefficients.
Definition: IFresnelMap.cpp:35
IFresnelMap(std::unique_ptr< ISpecularStrategy > strategy)
Definition: IFresnelMap.cpp:18
virtual std::unique_ptr< const ILayerRTCoefficients > getOutCoefficients(const SimulationElement &sim_element, size_t layer_index) const =0
Retrieves the amplitude coefficients for a (time-reversed) outgoing wavevector.
std::vector< Slice > m_slices
Definition: IFresnelMap.h:61
virtual void setSlices(const std::vector< Slice > &slices)
Definition: IFresnelMap.cpp:23
std::unique_ptr< ISpecularStrategy > m_Strategy
Definition: IFresnelMap.h:64
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:45
const std::vector< Slice > & slices() const
Definition: IFresnelMap.cpp:28
bool m_use_cache
Definition: IFresnelMap.h:62
virtual std::unique_ptr< const ILayerRTCoefficients > getCoefficients(const kvector_t &kvec, size_t layer_index) const =0
virtual ~IFresnelMap()
Data stucture containing both input and output of a single detector cell.