BornAgain  1.18.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 scattering at grazing incidence
4 //
5 //! @file Sample/Fresnel/IFresnelMap.h
6 //! @brief Defines class 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 #ifndef BORNAGAIN_CORE_MULTILAYER_IFRESNELMAP_H
16 #define BORNAGAIN_CORE_MULTILAYER_IFRESNELMAP_H
17 
19 #include <memory>
20 #include <vector>
21 
22 class SimulationElement;
23 
24 //! Holds the necessary information to calculate the radiation wavefunction in every layer
25 //! for different incoming (outgoing) angles of the beam in the top layer
26 //! (these amplitudes correspond to the specular part of the wavefunction).
27 //! @ingroup algorithms_internal
28 
30 {
31 public:
32  IFresnelMap(std::unique_ptr<ISpecularStrategy> strategy);
33  virtual ~IFresnelMap();
34 
35  //! Retrieves the amplitude coefficients for a (time-reversed) outgoing wavevector.
36  virtual std::unique_ptr<const ILayerRTCoefficients>
37  getOutCoefficients(const SimulationElement& sim_element, size_t layer_index) const = 0;
38 
39  //! Retrieves the amplitude coefficients for an incoming wavevector.
40  template <typename T>
41  std::unique_ptr<const ILayerRTCoefficients> getInCoefficients(const T& sim_element,
42  size_t layer_index) const
43  {
44  return getCoefficients(sim_element.getKi(), layer_index);
45  }
46 
47  virtual void setSlices(const std::vector<Slice>& slices);
48  const std::vector<Slice>& slices() const;
49 
50  //! Disables caching of previously computed Fresnel coefficients
51  void disableCaching();
52 
53 protected:
54  virtual std::unique_ptr<const ILayerRTCoefficients>
55  getCoefficients(const kvector_t& kvec, size_t layer_index) const = 0;
56 
57  std::vector<Slice> m_slices;
59 
60  std::unique_ptr<ISpecularStrategy> m_Strategy;
61 };
62 
63 #endif // BORNAGAIN_CORE_MULTILAYER_IFRESNELMAP_H
Defines and implements class ISpecularStrategy.
Holds the necessary information to calculate the radiation wavefunction in every layer for different ...
Definition: IFresnelMap.h:30
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:57
virtual void setSlices(const std::vector< Slice > &slices)
Definition: IFresnelMap.cpp:23
std::unique_ptr< ISpecularStrategy > m_Strategy
Definition: IFresnelMap.h:60
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
const std::vector< Slice > & slices() const
Definition: IFresnelMap.cpp:28
bool m_use_cache
Definition: IFresnelMap.h:58
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.