BornAgain  1.18.0
Simulate and fit neutron and x-ray scattering at grazing incidence
IFormFactorPolyhedron.cpp
Go to the documentation of this file.
1 // ************************************************************************** //
2 //
3 // BornAgain: simulate and fit scattering at grazing incidence
4 //
5 //! @file Sample/HardParticle/IFormFactorPolyhedron.cpp
6 //! @brief Implements class IFormFactorPolyhedron.
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 //! The mathematics implemented here is described in full detail in a paper
16 //! by Joachim Wuttke, entitled
17 //! "Form factor (Fourier shape transform) of polygon and polyhedron."
18 
21 
22 #ifdef POLYHEDRAL_DIAGNOSTIC // TODO restore
23 void IFormFactorPolyhedron::setLimits(double _q, int _n)
24 {
25  q_limit_series = _q;
26  n_limit_series = _n;
27 }
28 #endif
29 
31  const std::vector<double>& PValues)
32  : IFormFactorBorn(meta, PValues)
33 {
34 }
35 
37 
38 //! Called by child classes to set faces and other internal variables.
39 
40 void IFormFactorPolyhedron::setPolyhedron(const PolyhedralTopology& topology, double z_bottom,
41  const std::vector<kvector_t>& vertices)
42 {
43  pimpl = std::make_unique<Polyhedron>(topology, z_bottom, vertices);
44 }
45 
46 double IFormFactorPolyhedron::bottomZ(const IRotation& rotation) const
47 {
48  return BottomZ(pimpl->vertices(), rotation);
49 }
50 
51 double IFormFactorPolyhedron::topZ(const IRotation& rotation) const
52 {
53  return TopZ(pimpl->vertices(), rotation);
54 }
55 
57 {
58  return pimpl->evaluate_for_q(q);
59 }
60 
62 {
63  return pimpl->evaluate_centered(q);
64 }
65 
67 {
68  return pimpl->volume();
69 }
71 {
72  return pimpl->radius();
73 }
74 
75 //! Assertions for Platonic solid.
76 
78 {
79  pimpl->assert_platonic();
80 }
std::complex< double > complex_t
Definition: Complex.h:20
Defines class IFormFactorPolyhedron.
Defines class Polyhedron.
Pure virtual base class for Born form factors.
static double TopZ(const std::vector< kvector_t > &vertices, const IRotation &rotation)
Calculates the z-coordinate of the highest vertex after rotation.
static double BottomZ(const std::vector< kvector_t > &vertices, const IRotation &rotation)
Calculates the z-coordinate of the lowest vertex after rotation.
void assert_platonic() const
Assertions for Platonic solid.
double volume() const override final
Returns the total volume of the particle of this form factor's shape.
void setPolyhedron(const PolyhedralTopology &topology, double z_bottom, const std::vector< kvector_t > &vertices)
Called by child classes to set faces and other internal variables.
IFormFactorPolyhedron()=delete
complex_t evaluate_centered(cvector_t q) const
double bottomZ(const IRotation &rotation) const override final
Returns the z-coordinate of the lowest point in this shape after a given rotation.
complex_t evaluate_for_q(cvector_t q) const override final
Returns scattering amplitude for complex scattering wavevector q=k_i-k_f.
double radialExtension() const override final
Returns the (approximate in some cases) radial size of the particle of this form factor's shape.
double topZ(const IRotation &rotation) const override final
Returns the z-coordinate of the lowest point in this shape after a given rotation.
std::unique_ptr< Polyhedron > pimpl
Pure virtual interface for rotations.
Definition: Rotations.h:27
For internal use in IFormFactorPolyhedron.
Metadata of one model node.
Definition: INode.h:37