BornAgain  1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
IFormFactorDecorator.h
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file Sample/Scattering/IFormFactorDecorator.h
6 //! @brief Defines and implements interface class IFormFactorDecorator.
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 USER_API
16 #ifndef BORNAGAIN_SAMPLE_SCATTERING_IFORMFACTORDECORATOR_H
17 #define BORNAGAIN_SAMPLE_SCATTERING_IFORMFACTORDECORATOR_H
18 
20 
21 //! Encapsulates another formfactor and adds extra functionality
22 //! (a scalar factor, a position-dependent phase factor, ...).
23 //!
24 //! This class is designed according to the Decorator Pattern.
25 //! It inherits from IFormFactor _and_ has a member of type IFormFactor*.
26 //!
27 //! @ingroup formfactors_internal
28 
30 public:
32  ~IFormFactorDecorator() override { delete m_ff; }
33  IFormFactorDecorator* clone() const override = 0;
34 
35  void setAmbientMaterial(const Material& material) override
36  {
38  }
39 
40  double volume() const override { return m_ff->volume(); }
41 
42  double radialExtension() const override { return m_ff->radialExtension(); }
43 
44  double bottomZ(const IRotation& rotation) const override { return m_ff->bottomZ(rotation); }
45 
46  double topZ(const IRotation& rotation) const override { return m_ff->topZ(rotation); }
47 
48  const IFormFactor* getFormFactor() const { return m_ff; }
49 
50 protected:
52 };
53 
54 #endif // BORNAGAIN_SAMPLE_SCATTERING_IFORMFACTORDECORATOR_H
55 #endif // USER_API
Defines and implements interface IFormFactor.
Encapsulates another formfactor and adds extra functionality (a scalar factor, a position-dependent p...
double bottomZ(const IRotation &rotation) const override
Returns the z-coordinate of the lowest point in this shape after a given rotation.
double radialExtension() const override
Returns the (approximate in some cases) radial size of the particle of this form factor's shape.
double volume() const override
Returns the total volume of the particle of this form factor's shape.
IFormFactorDecorator * clone() const override=0
Returns a clone of this ISampleNode object.
IFormFactorDecorator(const IFormFactor &ff)
void setAmbientMaterial(const Material &material) override
Passes the material in which this particle is embedded.
double topZ(const IRotation &rotation) const override
Returns the z-coordinate of the lowest point in this shape after a given rotation.
const IFormFactor * getFormFactor() const
Abstract base class for all form factors.
Definition: IFormFactor.h:36
virtual double radialExtension() const =0
Returns the (approximate in some cases) radial size of the particle of this form factor's shape.
virtual double topZ(const IRotation &rotation) const =0
Returns the z-coordinate of the lowest point in this shape after a given rotation.
virtual double bottomZ(const IRotation &rotation) const =0
Returns the z-coordinate of the lowest point in this shape after a given rotation.
virtual void setAmbientMaterial(const Material &)=0
Passes the material in which this particle is embedded.
virtual double volume() const
Returns the total volume of the particle of this form factor's shape.
Definition: IFormFactor.cpp:78
Abstract base class for rotations.
Definition: Rotations.h:28
virtual const Material * material() const
Returns nullptr, unless overwritten to return a specific material.
Definition: ISampleNode.h:37
A wrapper for underlying material implementation.
Definition: Material.h:29