BornAgain  1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
FormFactorPrism3.cpp
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file Sample/HardParticle/FormFactorPrism3.cpp
6 //! @brief Implements class FormFactorPrism3.
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 
16 #include <iostream>
17 
18 FormFactorPrism3::FormFactorPrism3(const std::vector<double> P)
19  : IFormFactorPrism({"Prism3",
20  "prism with regular trigonal base",
21  {{"BaseEdge", "nm", "edge length of trigonal base", 0, +INF, 0},
22  {"Height", "nm", "height", 0, +INF, 0}}},
23  P)
24  , m_base_edge(m_P[0])
25  , m_height(m_P[1])
26 {
27  onChange();
28 }
29 
30 FormFactorPrism3::FormFactorPrism3(double base_edge, double height)
31  : FormFactorPrism3(std::vector<double>{base_edge, height})
32 {
33 }
34 
36  kvector_t translation) const
37 {
38  auto effects = computeSlicingEffects(limits, translation, m_height);
39  FormFactorPrism3 slicedff(m_base_edge, m_height - effects.dz_bottom - effects.dz_top);
40  return createTransformedFormFactor(slicedff, rot, effects.position);
41 }
42 
44 {
45  double a = m_base_edge;
46  double as = a / 2;
47  double ac = a / sqrt(3) / 2;
48  double ah = a / sqrt(3);
49  std::vector<kvector_t> V{{-ac, as, 0.}, {-ac, -as, 0.}, {ah, 0., 0.}};
50  setPrism(false, V);
51 }
Defines class FormFactorPrism3.
const double INF
Definition: INode.h:25
A prism based on an equilateral triangle.
IFormFactor * sliceFormFactor(ZLimits limits, const IRotation &rot, kvector_t translation) const final
Actually slices the form factor or throws an exception.
FormFactorPrism3(const std::vector< double > P)
const double & m_height
double height() const final
void onChange() final
Action to be taken in inherited class when a parameter has changed.
const double & m_base_edge
static SlicingEffects computeSlicingEffects(ZLimits limits, const kvector_t &position, double height)
Helper method for slicing.
Definition: IBornFF.cpp:66
A prism with a polygonal base, for form factor computation.
void setPrism(bool symmetry_Ci, const std::vector< kvector_t > &vertices)
Abstract base class for all form factors.
Definition: IFormFactor.h:36
static IFormFactor * createTransformedFormFactor(const IFormFactor &formfactor, const IRotation &rot, kvector_t translation)
Definition: IFormFactor.cpp:99
Abstract base class for rotations.
Definition: Rotations.h:28
Class that contains upper and lower limits of the z-coordinate for the slicing of form factors.
Definition: ZLimits.h:45
Definition: filesystem.h:81