BornAgain  1.19.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 reflection and scattering
4 //
5 //! @file Core/Term/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 #ifdef SWIG
16 #error no need to expose this header to Swig
17 #endif
18 
19 #ifndef USER_API
20 #ifndef BORNAGAIN_CORE_TERM_SPECULARCOMPUTATIONTERM_H
21 #define BORNAGAIN_CORE_TERM_SPECULARCOMPUTATIONTERM_H
22 
24 #include <memory>
25 #include <vector>
26 
29 class ProgressHandler;
31 class Slice;
32 
33 //! Computes the specular scattering.
34 //! Used by SpecularComputation.
35 //!
36 //! Abstract base class of SpecularScalarTerm, SpecularMatrixTerm
37 //!
38 //! @ingroup algorithms_internal
39 
41 public:
42  SpecularComputationTerm(std::unique_ptr<ISpecularStrategy> strategy);
44 
47 
48  void setProgressHandler(ProgressHandler* p_progress);
49  void computeIntensity(SpecularSimulationElement& elem, const std::vector<Slice>& slices) const;
50 
51 protected:
52  virtual void eval(SpecularSimulationElement& elem, const std::vector<Slice>& slices) const = 0;
53 
54  std::unique_ptr<ISpecularStrategy> m_Strategy;
55 
56 private:
57  std::unique_ptr<DelayedProgressCounter> m_progress_counter;
58 };
59 
60 //! Computes the specular scattering for a scalar sample
61 //! Used by SpecularComputation.
62 //! @ingroup algorithms_internal
63 
65 public:
66  SpecularScalarTerm(std::unique_ptr<ISpecularStrategy> strategy);
67 
68 private:
69  ~SpecularScalarTerm() override;
70 
71  void eval(SpecularSimulationElement& elem, const std::vector<Slice>& slices) const override;
72 };
73 
74 //! Computes the specular scattering for a magnetic sample
75 //! Used by SpecularComputation.
76 //! @ingroup algorithms_internal
77 
79 public:
80  SpecularMatrixTerm(std::unique_ptr<ISpecularStrategy> strategy);
81 
82 private:
83  ~SpecularMatrixTerm() override;
84 
85  void eval(SpecularSimulationElement& elem, const std::vector<Slice>& slices) const override;
86 };
87 
88 #endif // BORNAGAIN_CORE_TERM_SPECULARCOMPUTATIONTERM_H
89 #endif // USER_API
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:32
Computes the specular scattering.
std::unique_ptr< ISpecularStrategy > m_Strategy
std::unique_ptr< DelayedProgressCounter > m_progress_counter
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
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.