BornAgain  1.18.0
Simulate and fit neutron and x-ray scattering at grazing incidence
FormFactorWeighted.h
Go to the documentation of this file.
1 // ************************************************************************** //
2 //
3 // BornAgain: simulate and fit scattering at grazing incidence
4 //
5 //! @file Sample/Particle/FormFactorWeighted.h
6 //! @brief Defines class FormFactorWeighted.
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_PARTICLE_FORMFACTORWEIGHTED_H
16 #define BORNAGAIN_CORE_PARTICLE_FORMFACTORWEIGHTED_H
17 
19 
20 //! Coherent sum of different scalar IFormFactor's with different weights.
21 //!
22 //! Used by ParticleComposition.
23 //! If same particles are at different positions, then consider
24 //! FormFactorDecoratorMultiPositionFactor (restore from commit 0500a26de76).
25 
26 //! @ingroup formfactors_internal
27 
29 {
30 public:
32  ~FormFactorWeighted() override final;
33 
34  FormFactorWeighted* clone() const override final;
35 
36  void accept(INodeVisitor* visitor) const override final { visitor->visit(this); }
37 
38  double radialExtension() const override final;
39 
40  double bottomZ(const IRotation& rotation) const override final;
41 
42  double topZ(const IRotation& rotation) const override final;
43 
44  void addFormFactor(const IFormFactor& form_factor, double weight = 1.0);
45 
46  void setAmbientMaterial(const Material& material) override final;
47 
48  complex_t evaluate(const WavevectorInfo& wavevectors) const override final;
49 
50 #ifndef SWIG
51  //! Calculates and returns a polarized form factor calculation in DWBA
52  Eigen::Matrix2cd evaluatePol(const WavevectorInfo& wavevectors) const override final;
53 #endif
54 
55 protected:
56  std::vector<IFormFactor*> m_form_factors;
57  std::vector<double> m_weights;
58 };
59 
60 #endif // BORNAGAIN_CORE_PARTICLE_FORMFACTORWEIGHTED_H
std::complex< double > complex_t
Definition: Complex.h:20
Defines and implements pure virtual interface IFormFactor.
Coherent sum of different scalar IFormFactor's with different weights.
void setAmbientMaterial(const Material &material) override final
Passes the material in which this particle is embedded.
double bottomZ(const IRotation &rotation) const override final
Returns the z-coordinate of the lowest point in this shape after a given rotation.
~FormFactorWeighted() override final
void addFormFactor(const IFormFactor &form_factor, double weight=1.0)
Eigen::Matrix2cd evaluatePol(const WavevectorInfo &wavevectors) const override final
Calculates and returns a polarized form factor calculation in DWBA.
double topZ(const IRotation &rotation) const override final
Returns the z-coordinate of the lowest point in this shape after a given rotation.
complex_t evaluate(const WavevectorInfo &wavevectors) const override final
Returns scattering amplitude for complex wavevectors ki, kf.
std::vector< IFormFactor * > m_form_factors
void accept(INodeVisitor *visitor) const override final
Calls the INodeVisitor's visit method.
std::vector< double > m_weights
FormFactorWeighted * clone() const override final
Returns a clone of this ISample object.
double radialExtension() const override final
Returns the (approximate in some cases) radial size of the particle of this form factor's shape.
Pure virtual base class for all form factors.
Definition: IFormFactor.h:40
Visitor interface to visit ISample objects.
Definition: INodeVisitor.h:149
Pure virtual interface for rotations.
Definition: Rotations.h:27
virtual const Material * material() const
Returns nullptr, unless overwritten to return a specific material.
Definition: ISample.h:37
A wrapper for underlying material implementation.
Definition: Material.h:29
Holds all wavevector information relevant for calculating form factors.