BornAgain  1.18.0
Simulate and fit neutron and x-ray scattering at grazing incidence
FormFactorTruncatedCube.cpp
Go to the documentation of this file.
1 // ************************************************************************** //
2 //
3 // BornAgain: simulate and fit scattering at grazing incidence
4 //
5 //! @file Sample/HardParticle/FormFactorTruncatedCube.cpp
6 //! @brief Implements class FormFactorTruncatedCube.
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  {{{0, 1, 7, 6, 9, 10, 4, 3}, true},
20  {{0, 2, 1}, false},
21  {{3, 4, 5}, false},
22  {{9, 11, 10}, false},
23  {{6, 7, 8}, false},
24  {{0, 3, 5, 17, 15, 12, 14, 2}, true},
25  {{4, 10, 11, 23, 22, 16, 17, 5}, true},
26  {{1, 2, 14, 13, 19, 20, 8, 7}, true},
27  {{6, 8, 20, 18, 21, 23, 11, 9}, true},
28  {{15, 17, 16}, false},
29  {{12, 13, 14}, false},
30  {{18, 20, 19}, false},
31  {{21, 22, 23}, false},
32  {{12, 15, 16, 22, 21, 18, 19, 13}, true}},
33  true};
34 
37  {"TruncatedCube",
38  "class_tooltip",
39  {{"Length", "nm", "untruncated edge length", 0, +INF, 0},
40  {"RemovedLength", "nm", "edge length removed from one corner", 0, +INF, 0}}},
41  P),
42  m_length(m_P[0]), m_removed_length(m_P[1])
43 {
44  onChange();
45 }
46 
48  : FormFactorTruncatedCube(std::vector<double>{length, removed_length})
49 {
50 }
51 
53 {
54  if (m_removed_length > 0.5 * m_length) {
55  std::ostringstream ostr;
56  ostr << "::FormFactorTruncatedCube() -> Error in class initialization ";
57  ostr << "with parameters 'length':" << m_length;
58  ostr << " 'removed_length':" << m_removed_length << "\n\n";
59  ostr << "Check for removed_length <= 0.5*length failed.";
61  }
62 
63  double a = m_length / 2;
64  double b = m_removed_length;
65 
67  {{-a + b, -a, -a}, {-a, -a + b, -a}, {-a, -a, -a + b}, {a - b, -a, -a},
68  {a, -a + b, -a}, {a, -a, -a + b}, {-a + b, a, -a}, {-a, a - b, -a},
69  {-a, a, -a + b}, {a - b, a, -a}, {a, a - b, -a}, {a, a, -a + b},
70  {-a + b, -a, a}, {-a, -a + b, a}, {-a, -a, a - b}, {a - b, -a, a},
71  {a, -a + b, a}, {a, -a, a - b}, {-a + b, a, a}, {-a, a - b, a},
72  {-a, a, a - b}, {a - b, a, a}, {a, a - b, a}, {a, a, a - b}});
73 }
Defines many exception classes in namespace Exceptionss.
Defines class FormFactorTruncatedCube.
const double INF
Definition: INode.h:24
A cube, with tetrahedral truncation of all corners.
FormFactorTruncatedCube(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.