BornAgain  1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
FormFactorPrism6.cpp
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file Sample/HardParticle/FormFactorPrism6.cpp
6 //! @brief Implements class FormFactorPrism6.
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 
17 FormFactorPrism6::FormFactorPrism6(const std::vector<double> P)
18  : IFormFactorPrism({"Prism6",
19  "prism with regular hexagonal base",
20  {{"BaseEdge", "nm", "edge length of hexagonal base", 0, +INF, 0},
21  {"Height", "nm", "height", 0, +INF, 0}}},
22  P)
23  , m_base_edge(m_P[0])
24  , m_height(m_P[1])
25 {
26  onChange();
27 }
28 
29 FormFactorPrism6::FormFactorPrism6(double base_edge, double height)
30  : FormFactorPrism6(std::vector<double>{base_edge, height})
31 {
32 }
33 
35  kvector_t translation) const
36 {
37  auto effects = computeSlicingEffects(limits, translation, m_height);
38  FormFactorPrism6 slicedff(m_base_edge, m_height - effects.dz_bottom - effects.dz_top);
39  return createTransformedFormFactor(slicedff, rot, effects.position);
40 }
41 
43 {
44  double a = m_base_edge;
45  double as = a * sqrt(3) / 2;
46  double ac = a / 2;
47  std::vector<kvector_t> V{{a, 0., 0.}, {ac, as, 0.}, {-ac, as, 0.},
48  {-a, 0., 0.}, {-ac, -as, 0.}, {ac, -as, 0.}};
49  setPrism(true, V);
50 }
Defines class FormFactorPrism6.
const double INF
Definition: INode.h:25
A prism based on a regular hexagonal.
double height() const final
IFormFactor * sliceFormFactor(ZLimits limits, const IRotation &rot, kvector_t translation) const final
Actually slices the form factor or throws an exception.
const double & m_base_edge
void onChange() final
Action to be taken in inherited class when a parameter has changed.
FormFactorPrism6(const std::vector< double > P)
const double & m_height
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