BornAgain  1.18.0
Simulate and fit neutron and x-ray scattering at grazing incidence
FormFactorDecoratorRotation.cpp
Go to the documentation of this file.
1 // ************************************************************************** //
2 //
3 // BornAgain: simulate and fit scattering at grazing incidence
4 //
5 //! @file Sample/Scattering/FormFactorDecoratorRotation.cpp
6 //! @brief Implements class FormFactorDecoratorRotation
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 
17 #include <memory>
18 
20  const IRotation& rotation)
21  : IFormFactorDecorator(form_factor)
22 {
23  setName("FormFactorDecoratorRotation");
24  m_transform = rotation.getTransform3D();
25 }
26 
28 {
29  return new FormFactorDecoratorRotation(*mp_form_factor, m_transform);
30 }
31 
32 double FormFactorDecoratorRotation::bottomZ(const IRotation& rotation) const
33 {
34  Transform3D transform = rotation.getTransform3D();
35  std::unique_ptr<IRotation> P_total_rotation(IRotation::createRotation(transform * m_transform));
36  return mp_form_factor->bottomZ(*P_total_rotation);
37 }
38 
39 double FormFactorDecoratorRotation::topZ(const IRotation& rotation) const
40 {
41  Transform3D transform = rotation.getTransform3D();
42  std::unique_ptr<IRotation> P_total_rotation(IRotation::createRotation(transform * m_transform));
43  return mp_form_factor->topZ(*P_total_rotation);
44 }
45 
46 complex_t FormFactorDecoratorRotation::evaluate(const WavevectorInfo& wavevectors) const
47 {
48  return mp_form_factor->evaluate(wavevectors.transformed(m_transform.getInverse()));
49 }
50 
51 Eigen::Matrix2cd FormFactorDecoratorRotation::evaluatePol(const WavevectorInfo& wavevectors) const
52 {
53  return mp_form_factor->evaluatePol(wavevectors.transformed(m_transform.getInverse()));
54 }
55 
57  const Transform3D& transform)
58  : IFormFactorDecorator(form_factor), m_transform(transform)
59 {
60  setName("FormFactorDecoratorRotation");
61 }
Defines class FormFactorDecoratorRotation.
Defines WavevectorInfo.
Equips a form factor with a rotation.
complex_t evaluate(const WavevectorInfo &wavevectors) const override final
Returns scattering amplitude for complex wavevectors ki, kf.
double topZ(const IRotation &rotation) const override final
Returns the z-coordinate of the lowest point in this shape after a given rotation.
FormFactorDecoratorRotation * clone() const override final
Returns a clone of this ISample object.
double bottomZ(const IRotation &rotation) const override final
Returns the z-coordinate of the lowest point in this shape after a given rotation.
Eigen::Matrix2cd evaluatePol(const WavevectorInfo &wavevectors) const override final
Returns scattering amplitude for matrix interactions.
FormFactorDecoratorRotation(const IFormFactor &form_factor, const IRotation &rotation)
Constructor, setting form factor and rotation.
Encapsulates another formfactor and adds extra functionality (a scalar factor, a position-dependent p...
Pure virtual base class for all form factors.
Definition: IFormFactor.h:40
virtual complex_t evaluate(const WavevectorInfo &wavevectors) const =0
Returns scattering amplitude for complex wavevectors ki, kf.
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 Eigen::Matrix2cd evaluatePol(const WavevectorInfo &wavevectors) const
Returns scattering amplitude for matrix interactions.
Definition: IFormFactor.cpp:49
Pure virtual interface for rotations.
Definition: Rotations.h:27
virtual Transform3D getTransform3D() const =0
Returns transformation.
Vector transformations in three dimensions.
Definition: Transform3D.h:28
Transform3D getInverse() const
Returns the inverse transformation.
Holds all wavevector information relevant for calculating form factors.