BornAgain  1.18.0
Simulate and fit neutron and x-ray scattering at grazing incidence
SpecularComputationTerm.h
Go to the documentation of this file.
1 // ************************************************************************** //
2 //
3 // BornAgain: simulate and fit scattering at grazing incidence
4 //
5 //! @file Core/Computation/SpecularComputationTerm.h
6 //! @brief Defines classes SpecularComputationTerm, SpecularScalarTerm, SpecularMatrixTerm
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_COMPUTATION_SPECULARCOMPUTATIONTERM_H
16 #define BORNAGAIN_CORE_COMPUTATION_SPECULARCOMPUTATIONTERM_H
17 
19 #include <memory>
20 #include <vector>
21 
24 class ProgressHandler;
26 class Slice;
27 
28 //! Computes the specular scattering.
29 //! Used by SpecularComputation.
30 //!
31 //! Pure virtual base class of SpecularScalarTerm, SpecularMatrixTerm
32 //!
33 //! @ingroup algorithms_internal
34 
36 {
37 public:
38  SpecularComputationTerm(std::unique_ptr<ISpecularStrategy> strategy);
40 
43 
44  void setProgressHandler(ProgressHandler* p_progress);
45  void computeIntensity(SpecularSimulationElement& elem, const std::vector<Slice>& slices) const;
46 
47 protected:
48  virtual void eval(SpecularSimulationElement& elem, const std::vector<Slice>& slices) const = 0;
49 
50  std::unique_ptr<ISpecularStrategy> m_Strategy;
51 
52 private:
53  std::unique_ptr<DelayedProgressCounter> mP_progress_counter;
54 };
55 
56 //! Computes the specular scattering for a scalar sample
57 //! Used by SpecularComputation.
58 //! @ingroup algorithms_internal
59 
61 {
62 public:
63  SpecularScalarTerm(std::unique_ptr<ISpecularStrategy> strategy);
64 
65 private:
66  ~SpecularScalarTerm() override;
67 
68  void eval(SpecularSimulationElement& elem, const std::vector<Slice>& slices) const override;
69 };
70 
71 //! Computes the specular scattering for a magnetic sample
72 //! Used by SpecularComputation.
73 //! @ingroup algorithms_internal
74 
76 {
77 public:
78  SpecularMatrixTerm(std::unique_ptr<ISpecularStrategy> strategy);
79 
80 private:
81  ~SpecularMatrixTerm() override;
82 
83  void eval(SpecularSimulationElement& elem, const std::vector<Slice>& slices) const override;
84 };
85 
86 #endif // BORNAGAIN_CORE_COMPUTATION_SPECULARCOMPUTATIONTERM_H
Defines and implements class ISpecularStrategy.
Counter for reporting progress (with delay interval) in a threaded computation.
Specular reflection and transmission coefficients in a layer in case of magnetic interactions between...
Maintains information about progress of a computation.
Data structure containing the data of a single slice, for calculating the Fresnel coefficients.
Definition: Slice.h:28
Computes the specular scattering.
std::unique_ptr< ISpecularStrategy > m_Strategy
virtual void eval(SpecularSimulationElement &elem, const std::vector< Slice > &slices) const =0
void setProgressHandler(ProgressHandler *p_progress)
virtual ~SpecularComputationTerm()
void computeIntensity(SpecularSimulationElement &elem, const std::vector< Slice > &slices) const
SpecularComputationTerm(const SpecularComputationTerm &other)=delete
SpecularComputationTerm(std::unique_ptr< ISpecularStrategy > strategy)
SpecularComputationTerm & operator=(const SpecularComputationTerm &other)=delete
std::unique_ptr< DelayedProgressCounter > mP_progress_counter
Computes the specular scattering for a magnetic sample Used by SpecularComputation.
void eval(SpecularSimulationElement &elem, const std::vector< Slice > &slices) const override
~SpecularMatrixTerm() override
SpecularMatrixTerm(std::unique_ptr< ISpecularStrategy > strategy)
Computes the specular scattering for a scalar sample Used by SpecularComputation.
SpecularScalarTerm(std::unique_ptr< ISpecularStrategy > strategy)
void eval(SpecularSimulationElement &elem, const std::vector< Slice > &slices) const override
~SpecularScalarTerm() override
Data stucture containing both input and output of a single image pixel for specular simulation.