BornAgain  1.18.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 scattering at grazing incidence
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]), m_height(m_P[1])
24 {
25  onChange();
26 }
27 
28 FormFactorPrism6::FormFactorPrism6(double base_edge, double height)
29  : FormFactorPrism6(std::vector<double>{base_edge, height})
30 {
31 }
32 
34  kvector_t translation) const
35 {
36  auto effects = computeSlicingEffects(limits, translation, m_height);
37  FormFactorPrism6 slicedff(m_base_edge, m_height - effects.dz_bottom - effects.dz_top);
38  return createTransformedFormFactor(slicedff, rot, effects.position);
39 }
40 
42 {
43  double a = m_base_edge;
44  double as = a * sqrt(3) / 2;
45  double ac = a / 2;
46  std::vector<kvector_t> V{{a, 0., 0.}, {ac, as, 0.}, {-ac, as, 0.},
47  {-a, 0., 0.}, {-ac, -as, 0.}, {ac, -as, 0.}};
48  setPrism(true, V);
49 }
Defines class FormFactorPrism6.
IFormFactor * createTransformedFormFactor(const IFormFactor &formfactor, const IRotation &rot, kvector_t translation)
Definition: IFormFactor.cpp:77
const double INF
Definition: INode.h:24
A prism based on a regular hexagonal.
double height() const final
const double & m_base_edge
void onChange() override final
Action to be taken in inherited class when a parameter has changed.
IFormFactor * sliceFormFactor(ZLimits limits, const IRotation &rot, kvector_t translation) const override final
Actually slices the form factor or throws an exception.
FormFactorPrism6(const std::vector< double > P)
const double & m_height
SlicingEffects computeSlicingEffects(ZLimits limits, const kvector_t &position, double height) const
Helper method for slicing.
A prism with a polygonal base, for form factor computation.
void setPrism(bool symmetry_Ci, const std::vector< kvector_t > &vertices)
Pure virtual base class for all form factors.
Definition: IFormFactor.h:40
Pure virtual interface for rotations.
Definition: Rotations.h:27
Class that contains upper and lower limits of the z-coordinate for the slicing of form factors.
Definition: ZLimits.h:41