BornAgain  1.19.79
Open-source research software to simulate and fit neutron and x-ray reflectometry and grazing-incidence small-angle scattering
IInterparticleStrategy.h
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file Resample/Interparticle/IInterparticleStrategy.h
6 //! @brief Defines interface IInterparticleStrategy.
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_RESAMPLE_INTERPARTICLE_IINTERPARTICLESTRATEGY_H
21 #define BORNAGAIN_RESAMPLE_INTERPARTICLE_IINTERPARTICLESTRATEGY_H
22 
24 #include <heinz/Complex.h>
25 #include <memory>
26 #include <vector>
27 
28 template <class T>
29 class IntegratorMCMiser;
30 class CoherentFFSum;
31 class IInterference;
32 class DiffuseElement;
33 
34 //! Abstract base class of DecouplingApproximationStrategy, SSCAStrategy.
35 //! Provides function 'evaluate' that computes the total scattering intensity
36 //! from a decorated layer.
37 //!
38 //! Instantiation of child classes takes place in LayoutStrategyBuilder::createStrategy,
39 //! which is called from ParticleLayoutContribution::eval.
40 
42 public:
44  const std::vector<std::unique_ptr<const CoherentFFSum>>& weighted_formfactors,
45  const SimulationOptions& sim_params, bool polarized);
47 
48  //! Calculates the intensity for scalar particles/interactions
49  double evaluate(const DiffuseElement& ele) const;
50 
51 protected:
52  const std::vector<std::unique_ptr<const CoherentFFSum>>& m_weighted_formfactors;
54 
55 private:
56  double evaluateSinglePoint(const DiffuseElement& ele) const;
57  double MCIntegratedEvaluate(const DiffuseElement& ele) const;
58  double evaluate_for_fixed_angles(const double* fractions, size_t dim, const void* params) const;
59  //! Evaluates the intensity in the scalar case
60  virtual double scalarCalculation(const DiffuseElement& ele) const = 0;
61  //! Evaluates the intensity in the polarized case
62  virtual double polarizedCalculation(const DiffuseElement& ele) const = 0;
63 
64  const bool m_polarized;
65 
66  const std::unique_ptr<IntegratorMCMiser<IInterparticleStrategy>> m_integrator;
67 };
68 
69 #endif // BORNAGAIN_RESAMPLE_INTERPARTICLE_IINTERPARTICLESTRATEGY_H
70 #endif // USER_API
Defines class SimulationOptions.
Information about particle form factor and abundance.
Definition: CoherentFFSum.h:33
Data stucture containing both input and output of a single detector cell.
Abstract base class of interference functions.
Definition: IInterference.h:24
Abstract base class of DecouplingApproximationStrategy, SSCAStrategy. Provides function 'evaluate' th...
virtual double scalarCalculation(const DiffuseElement &ele) const =0
Evaluates the intensity in the scalar case.
const std::unique_ptr< IntegratorMCMiser< IInterparticleStrategy > > m_integrator
double evaluate_for_fixed_angles(const double *fractions, size_t dim, const void *params) const
double evaluate(const DiffuseElement &ele) const
Calculates the intensity for scalar particles/interactions.
virtual ~IInterparticleStrategy()
double evaluateSinglePoint(const DiffuseElement &ele) const
double MCIntegratedEvaluate(const DiffuseElement &ele) const
Performs a Monte Carlo integration over the bin for the evaluation of the intensity.
const std::vector< std::unique_ptr< const CoherentFFSum > > & m_weighted_formfactors
IInterparticleStrategy(const std::vector< std::unique_ptr< const CoherentFFSum >> &weighted_formfactors, const SimulationOptions &sim_params, bool polarized)
const SimulationOptions m_options
virtual double polarizedCalculation(const DiffuseElement &ele) const =0
Evaluates the intensity in the polarized case.
Template class to use Monte Carlo MISER integration of class member functions.
Collect the different options for simulation.SimulationOptions.