BornAgain  1.18.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 scattering at grazing incidence
4 //
5 //! @file Sample/Scattering/IFormFactorDecorator.h
6 //! @brief Defines and implements pure virtual 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 BORNAGAIN_CORE_SCATTERING_IFORMFACTORDECORATOR_H
16 #define BORNAGAIN_CORE_SCATTERING_IFORMFACTORDECORATOR_H
17 
19 
20 //! Encapsulates another formfactor and adds extra functionality
21 //! (a scalar factor, a position-dependent phase factor, ...).
22 //!
23 //! This class is designed according to the Decorator Pattern.
24 //! It inherits from IFormFactor _and_ has a member of type IFormFactor*.
25 //!
26 //! @ingroup formfactors_internal
27 
29 {
30 public:
31  IFormFactorDecorator(const IFormFactor& form_factor) : mp_form_factor(form_factor.clone()) {}
32  ~IFormFactorDecorator() override { delete mp_form_factor; }
33  IFormFactorDecorator* clone() const override = 0;
34 
35  void setAmbientMaterial(const Material& material) override
36  {
38  }
39 
40  double volume() const override { return mp_form_factor->volume(); }
41 
42  double radialExtension() const override { return mp_form_factor->radialExtension(); }
43 
44  double bottomZ(const IRotation& rotation) const override
45  {
46  return mp_form_factor->bottomZ(rotation);
47  }
48 
49  double topZ(const IRotation& rotation) const override { return mp_form_factor->topZ(rotation); }
50 
51  const IFormFactor* getFormFactor() const { return mp_form_factor; }
52 
53 protected:
55 };
56 
57 #endif // BORNAGAIN_CORE_SCATTERING_IFORMFACTORDECORATOR_H
Defines and implements pure virtual 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(const IFormFactor &form_factor)
IFormFactorDecorator * clone() const override=0
Returns a clone of this ISample object.
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
Pure virtual base class for all form factors.
Definition: IFormFactor.h:40
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:56
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