BornAgain  1.18.0
Simulate and fit neutron and x-ray scattering at grazing incidence
ScalarFresnelMap.h
Go to the documentation of this file.
1 // ************************************************************************** //
2 //
3 // BornAgain: simulate and fit scattering at grazing incidence
4 //
5 //! @file Sample/Fresnel/ScalarFresnelMap.h
6 //! @brief Defines class ScalarFresnelMap.
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_SCALARFRESNELMAP_H
16 #define BORNAGAIN_CORE_MULTILAYER_SCALARFRESNELMAP_H
17 
20 #include <cstddef>
21 #include <unordered_map>
22 #include <utility>
23 #include <vector>
24 
26 class SimulationElement;
27 class Slice;
28 
29 //! Implementation of IFresnelMap for scalar valued reflection/transmission coefficients.
30 //! @ingroup algorithms_internal
31 
33 {
34 public:
35  ScalarFresnelMap(std::unique_ptr<ISpecularStrategy> strategy);
37 
38  ScalarFresnelMap(const ScalarFresnelMap& other) = delete;
39  ScalarFresnelMap& operator=(const ScalarFresnelMap& other) = delete;
40 
41  std::unique_ptr<const ILayerRTCoefficients>
42  getOutCoefficients(const SimulationElement& sim_element, size_t layer_index) const override;
43 
44 private:
45  //! Provides a hash function for a pair of doubles.
47  {
48  public:
49  size_t operator()(const std::pair<double, double>& doubles) const noexcept;
50  };
51 
52  std::unique_ptr<const ILayerRTCoefficients> getCoefficients(const kvector_t& kvec,
53  size_t layer_index) const override;
55  mutable std::unordered_map<std::pair<double, double>, ISpecularStrategy::coeffs_t, Hash2Doubles>
57 };
58 
59 #endif // BORNAGAIN_CORE_MULTILAYER_SCALARFRESNELMAP_H
Defines class IFresnelMap.
Defines class ScalarRTCoefficients.
Holds the necessary information to calculate the radiation wavefunction in every layer for different ...
Definition: IFresnelMap.h:30
Interface to access reflection/transmission coefficients.
std::vector< std::unique_ptr< const ILayerRTCoefficients > > coeffs_t
Provides a hash function for a pair of doubles.
Implementation of IFresnelMap for scalar valued reflection/transmission coefficients.
std::unique_ptr< const ILayerRTCoefficients > getOutCoefficients(const SimulationElement &sim_element, size_t layer_index) const override
Retrieves the amplitude coefficients for a (time-reversed) outgoing wavevector.
ScalarFresnelMap(std::unique_ptr< ISpecularStrategy > strategy)
const ISpecularStrategy::coeffs_t & getCoefficientsFromCache(kvector_t kvec) const
std::unique_ptr< const ILayerRTCoefficients > getCoefficients(const kvector_t &kvec, size_t layer_index) const override
~ScalarFresnelMap() final
std::unordered_map< std::pair< double, double >, ISpecularStrategy::coeffs_t, Hash2Doubles > m_cache
Data stucture containing both input and output of a single detector cell.
Data structure containing the data of a single slice, for calculating the Fresnel coefficients.
Definition: Slice.h:28