BornAgain  1.19.79
Simulate and fit neutron and x-ray scattering at grazing incidence
geometry_inc.h
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file GUI/ba3d/model/geometry_inc.h
6 //! @brief Defines namespace GUI::RealSpace::GeometricID
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 
15 #ifndef BORNAGAIN_GUI_BA3D_MODEL_GEOMETRY_INC_H
16 #define BORNAGAIN_GUI_BA3D_MODEL_GEOMETRY_INC_H
17 
18 #include "GUI/ba3d/def.h"
19 #include <memory>
20 
21 // include to use geometry basics, without details
22 
23 namespace GUI::RealSpace {
24 
25 class Geometry;
26 
27 using GeometryHandle = std::shared_ptr<Geometry>;
28 using GeometryRef = std::weak_ptr<Geometry>;
29 
30 // some useful constants:
31 extern const float GoldenRatio;
32 extern const float IcosahedronL2R; // L/R conversion
33 extern const float DodecahedronL2R;
34 
35 namespace GeometricID {
36 
37 //! Enum id for basic shapes
38 enum class BaseShape {
39  Plane,
40  Box,
41  Sphere,
42  Column,
46  Bipyramid4,
47  Ripple
48 };
49 
50 //! Real shapes will be parameterized by BaseShape enum and possibly two floats
51 struct Key {
52  Key(BaseShape, float = 0.0f, float = 0.0f, float = 0.0f);
53 
54  bool operator==(Key const&) const;
55 
57  float p1, p2, p3;
58 };
59 
60 //! Hash functor for Key objects
61 struct KeyHash {
62  std::size_t operator()(const Key& key) const noexcept;
63 };
64 
65 } // namespace GeometricID
66 
67 } // namespace GUI::RealSpace
68 
69 #endif // BORNAGAIN_GUI_BA3D_MODEL_GEOMETRY_INC_H
Definitions in namespace GUI::RealSpace.
BaseShape
Enum id for basic shapes.
Definition: geometry_inc.h:38
const float DodecahedronL2R
const float IcosahedronL2R
const float GoldenRatio
std::shared_ptr< Geometry > GeometryHandle
Definition: geometry_inc.h:27
std::weak_ptr< Geometry > GeometryRef
Definition: geometry_inc.h:28
Hash functor for Key objects.
Definition: geometry_inc.h:61
std::size_t operator()(const Key &key) const noexcept
Real shapes will be parameterized by BaseShape enum and possibly two floats.
Definition: geometry_inc.h:51
bool operator==(Key const &) const
Key(BaseShape, float=0.0f, float=0.0f, float=0.0f)