BornAgain  1.19.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 reflection and scattering
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 
18 #include <memory>
19 
21  const IRotation& rotation)
23 {
24  setName("FormFactorDecoratorRotation");
25  m_transform = rotation.getTransform3D();
26 }
27 
29 {
31 }
32 
33 double FormFactorDecoratorRotation::bottomZ(const IRotation& rotation) const
34 {
35  Transform3D transform = rotation.getTransform3D();
36  std::unique_ptr<IRotation> total_rotation(IRotation::createRotation(transform * m_transform));
37  return m_ff->bottomZ(*total_rotation);
38 }
39 
40 double FormFactorDecoratorRotation::topZ(const IRotation& rotation) const
41 {
42  Transform3D transform = rotation.getTransform3D();
43  std::unique_ptr<IRotation> total_rotation(IRotation::createRotation(transform * m_transform));
44  return m_ff->topZ(*total_rotation);
45 }
46 
48 {
49  return m_ff->evaluate(wavevectors.transformed(m_transform.getInverse()));
50 }
51 
52 Eigen::Matrix2cd FormFactorDecoratorRotation::evaluatePol(const WavevectorInfo& wavevectors) const
53 {
54  return m_ff->evaluatePol(wavevectors.transformed(m_transform.getInverse()));
55 }
56 
58  const Transform3D& transform)
59  : IFormFactorDecorator(ff), m_transform(transform)
60 {
61  setName("FormFactorDecoratorRotation");
62 }
std::complex< double > complex_t
Definition: Complex.h:20
Defines class FormFactorDecoratorRotation.
Defines IRotation classes.
Defines WavevectorInfo.
Equips a form factor with a rotation.
complex_t evaluate(const WavevectorInfo &wavevectors) const final
Returns scattering amplitude for complex wavevectors ki, kf.
double topZ(const IRotation &rotation) const final
Returns the z-coordinate of the lowest point in this shape after a given rotation.
FormFactorDecoratorRotation(const IFormFactor &ff, const IRotation &rotation)
Constructor, setting form factor and rotation.
FormFactorDecoratorRotation * clone() const final
Returns a clone of this ISampleNode object.
Eigen::Matrix2cd evaluatePol(const WavevectorInfo &wavevectors) const final
Returns scattering amplitude for matrix interactions.
double bottomZ(const IRotation &rotation) const final
Returns the z-coordinate of the lowest point in this shape after a given rotation.
Encapsulates another formfactor and adds extra functionality (a scalar factor, a position-dependent p...
Abstract base class for all form factors.
Definition: IFormFactor.h:36
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:72
void setName(const std::string &name)
Abstract base class for rotations.
Definition: Rotations.h:28
virtual Transform3D getTransform3D() const =0
Returns transformation.
static IRotation * createRotation(const Transform3D &transform)
Definition: Rotations.cpp:28
Vector transformations in three dimensions.
Definition: Transform3D.h:26
Transform3D getInverse() const
Returns the inverse transformation.
Holds all wavevector information relevant for calculating form factors.
WavevectorInfo transformed(const Transform3D &transform) const