BornAgain  1.19.0
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 geometry namespace
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 RealSpace {
24 //------------------------------------------------------------------------------
25 
26 class Geometry;
27 
28 typedef std::shared_ptr<Geometry> GeometryHandle;
29 typedef std::weak_ptr<Geometry> GeometryRef;
30 
31 // some useful constants:
32 extern const float GoldenRatio;
33 extern const float IcosahedronL2R; // L/R conversion
34 extern const float DodecahedronL2R;
35 
36 namespace GeometricID {
37 
38 // Enum id for basic shapes
39 enum class BaseShape {
40  Plane,
41  Box,
42  Sphere,
43  Column,
48  Ripple
49 };
50 
51 // Real shapes will be parameterized by BaseShape enum and possibly two floats
52 struct Key {
53  Key(BaseShape, float = 0.0f, float = 0.0f, float = 0.0f);
54 
55  bool operator==(Key const&) const;
56 
58  float p1, p2, p3;
59 };
60 
61 // Hash functor for Key objects
62 struct KeyHash {
63  std::size_t operator()(const Key& key) const noexcept;
64 };
65 
66 } // namespace GeometricID
67 } // namespace RealSpace
68 
69 #endif // BORNAGAIN_GUI_BA3D_MODEL_GEOMETRY_INC_H
Definitions.
const float DodecahedronL2R
const float GoldenRatio
std::shared_ptr< Geometry > GeometryHandle
Definition: geometry_inc.h:26
std::weak_ptr< Geometry > GeometryRef
Definition: geometry_inc.h:29
const float IcosahedronL2R
std::size_t operator()(const Key &key) const noexcept
Key(BaseShape, float=0.0f, float=0.0f, float=0.0f)
bool operator==(Key const &) const