BornAgain  1.18.0
Simulate and fit neutron and x-ray scattering at grazing incidence
FormFactorCantellatedCube.cpp
Go to the documentation of this file.
1 // ************************************************************************** //
2 //
3 // BornAgain: simulate and fit scattering at grazing incidence
4 //
5 //! @file Sample/HardParticle/FormFactorCantellatedCube.cpp
6 //! @brief Implements class FormFactorCantellatedCube.
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 "Base/Types/Exceptions.h"
17 
19  {
20  /* 0 */ {{0, 1, 2, 3}, true},
21  /* 1 */ {{0, 8, 5, 1}, true},
22  /* 2 */ {{1, 9, 6, 2}, true},
23  /* 3 */ {{2, 10, 7, 3}, true},
24  /* 4 */ {{3, 11, 4, 0}, true},
25  /* 5 */ {{0, 4, 8}, false},
26  /* 6 */ {{1, 5, 9}, false},
27  /* 7 */ {{2, 6, 10}, false},
28  /* 8 */ {{3, 7, 11}, false},
29  /* 9 */ {{4, 12, 16, 8}, true},
30  /* 10 */ {{5, 13, 17, 9}, true},
31  /* 11 */ {{4, 11, 19, 12}, true},
32  /* 12 */ {{5, 8, 16, 13}, true},
33  /* 13 */ {{7, 10, 18, 15}, true},
34  /* 14 */ {{6, 9, 17, 14}, true},
35  /* 15 */ {{7, 15, 19, 11}, true},
36  /* 16 */ {{6, 14, 18, 10}, true},
37  /* 17 */ {{13, 21, 17}, false},
38  /* 18 */ {{12, 20, 16}, false},
39  /* 19 */ {{15, 23, 19}, false},
40  /* 20 */ {{14, 22, 18}, false},
41  /* 21 */ {{14, 17, 21, 22}, true},
42  /* 22 */ {{13, 16, 20, 21}, true},
43  /* 23 */ {{12, 19, 23, 20}, true},
44  /* 24 */ {{15, 18, 22, 23}, true},
45  /* 25 */ {{20, 23, 22, 21}, true},
46  },
47  true};
48 
51  {"CantellatedCube",
52  "a cube with truncated edges and vertices",
53  {{"Length", "nm", "length of untruncated edge", 0, +INF, 0},
54  {"RemovedLength", "nm",
55  "side length of the trirectangular tetrahedron removed one corner", 0, +INF, 0}}},
56  P),
57  m_length(m_P[0]), m_removed_length(m_P[1])
58 {
59  onChange();
60 }
61 
63  : FormFactorCantellatedCube(std::vector<double>{length, removed_length})
64 {
65 }
66 
68 {
69  if (m_removed_length > 0.5 * m_length) {
70  std::ostringstream ostr;
71  ostr << "::FormFactorCantellatedCube() -> Error in class initialization ";
72  ostr << "with parameters 'length':" << m_length;
73  ostr << " 'removed_length':" << m_removed_length << "\n\n";
74  ostr << "Check for removed_length <= 0.5*length failed.";
76  }
77  double a = m_length / 2;
78  double b = m_removed_length;
79 
80  setPolyhedron(topology, -a, {{-a + b, -a + b, +a}, // point 0
81  {+a - b, -a + b, +a}, {+a - b, +a - b, +a}, {-a + b, +a - b, +a},
82  {-a, -a + b, +a - b}, // point 4
83  {+a - b, -a, +a - b}, {+a, +a - b, +a - b}, {-a + b, +a, +a - b},
84  {-a + b, -a, +a - b}, // point 8
85  {+a, -a + b, +a - b}, {+a - b, +a, +a - b}, {-a, +a - b, +a - b},
86  {-a, -a + b, -a + b}, // point 12
87  {+a - b, -a, -a + b}, {+a, +a - b, -a + b}, {-a + b, +a, -a + b},
88  {-a + b, -a, -a + b}, // point 16
89  {+a, -a + b, -a + b}, {+a - b, +a, -a + b}, {-a, +a - b, -a + b},
90  {-a + b, -a + b, -a}, // point 20
91  {+a - b, -a + b, -a}, {+a - b, +a - b, -a}, {-a + b, +a - b, -a}});
92 }
Defines many exception classes in namespace Exceptionss.
Defines class FormFactorCantellatedCube.
const double INF
Definition: INode.h:24
A cube, with truncation of all edges and corners, as in Croset (2017) Fig 7.
FormFactorCantellatedCube(const std::vector< double > P)
void onChange() override final
Action to be taken in inherited class when a parameter has changed.
static const PolyhedralTopology topology
A polyhedron, for form factor computation.
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.
For internal use in IFormFactorPolyhedron.