BornAgain  1.19.79
Open-source research software to simulate and fit neutron and x-ray reflectometry and grazing-incidence small-angle scattering
IFormFactorPrism.cpp
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file Sample/HardParticle/IFormFactorPrism.cpp
6 //! @brief Implements interface IFormFactorPrism.
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 <ff/Prism.h>
18 
19 IFormFactorPrism::IFormFactorPrism(const std::vector<double>& PValues)
20  : IFormFactor(PValues)
21 {
22 }
23 
25 
26 void IFormFactorPrism::setPrism(bool symmetry_Ci, const std::vector<R3>& vertices)
27 {
28  pimpl = std::make_unique<ff::Prism>(symmetry_Ci, height(), vertices);
29 
30  m_vertices.clear();
31  for (const R3& vertex : vertices) {
32  m_vertices.push_back(vertex);
33  m_vertices.push_back(vertex + R3{0, 0, height()});
34  }
35 }
36 
37 double IFormFactorPrism::bottomZ(const IRotation* rotation) const
38 {
39  return PolyhedralUtil::BottomZ(m_vertices, rotation);
40 }
41 
42 double IFormFactorPrism::topZ(const IRotation* rotation) const
43 {
44  return PolyhedralUtil::TopZ(m_vertices, rotation);
45 }
46 
47 //! Returns the volume of this prism.
49 {
50  return height() * pimpl->area();
51 }
52 
54 {
55  return std::sqrt(pimpl->area());
56 }
57 
58 //! Returns the form factor F(q) of this polyhedron, respecting the offset height/2.
59 
61 {
62  return exp_I(height() / 2 * q.z()) * pimpl->formfactor(q);
63 }
Defines interface IFormFactorPrism.
Defines interface IDecoratableBorn.
complex_t formfactor_at_bottom(C3 q) const override
Returns the form factor F(q) of this polyhedron, respecting the offset height/2.
double bottomZ(const IRotation *rotation) const override
double radialExtension() const override
Returns the (approximate in some cases) radial size of the particle of this form factor's shape....
IFormFactorPrism(const std::vector< double > &PValues)
virtual double height() const =0
double volume() const override
Returns the volume of this prism.
std::unique_ptr< ff::Prism > pimpl
void setPrism(bool symmetry_Ci, const std::vector< R3 > &vertices)
double topZ(const IRotation *rotation) const override
std::vector< R3 > m_vertices
~IFormFactorPrism() override
Abstract base class for Born form factors.
Definition: IFormFactor.h:36
Abstract base class for rotations.
Definition: Rotations.h:29
double BottomZ(const std::vector< R3 > &vertices, const IRotation *rotation)
Calculates the z-coordinate of the lowest vertex after rotation.
double TopZ(const std::vector< R3 > &vertices, const IRotation *rotation)
Calculates the z-coordinate of the highest vertex after rotation.