Bayeux  3.4.1
Core Foundation library for SuperNEMO
overlapping.h
Go to the documentation of this file.
1 // \file geomtools/overlapping.h
2 /* Author(s): Francois Mauger <mauger@lpccaen.in2p3.fr>
3  * Creation date: 2015-06-15
4  * Last modified: 2015-06-15
5  *
6  * License: GPL 3
7  *
8  * Description:
9  *
10  * Overlapping detection tools
11  *
12  */
13 
14 #ifndef GEOMTOOLS_OVERLAPPING_H
15 #define GEOMTOOLS_OVERLAPPING_H
16 
17 // Standard library:
18 #include <string>
19 #include <vector>
20 #include <set>
21 
22 // Third party:
23 // - Bayeux/datatools:
24 #include <datatools/properties.h>
25 
26 // This project:
27 #include <geomtools/utils.h>
28 #include <geomtools/i_shape_3d.h>
29 #include <geomtools/i_placement.h>
30 
31 namespace geomtools {
32 
33  class logical_volume;
34 
36  class overlapping {
37 
38  public:
39 
41  overlapping();
42 
44  ~overlapping();
45 
47  static const std::string & property_prefix();
48 
50  static std::string make_key(const std::string & label_);
51 
52  static void extract(const datatools::properties & source_,
53  datatools::properties & target_);
54 
55  static bool has_flag(const datatools::properties & config_,
56  const std::string & flag_);
57 
58  static bool has_key(const datatools::properties & config_,
59  const std::string & key_);
60 
62  enum overlap_type {
65  };
66 
68  struct overlap_info {
70  std::string name_first;
71  int item_first;
72  std::string name_second;
74  // std::string which_item; ///< Description of the overlapping volume
76  };
77 
79  struct report {
80  std::vector<overlap_info> overlaps;
81  void reset();
82  };
83 
84  enum flag_type {
85  FLAG_NONE = 0x0,
95  };
96 
97  static flag_type get_flag_from_label(const std::string & label_);
98 
100 
114  bool check_mother_daughter_surface_intersection(const i_shape_3d & mother_shape_,
115  const i_shape_3d & daughter_shape_,
116  const i_placement & daughter_placement_,
117  report & report_,
118  uint32_t flags_ = 0) const;
119 
121 
135  bool check_mother_daughter_overlap(const i_shape_3d & mother_shape_,
136  const i_shape_3d & daughter_shape_,
137  const i_placement & daughter_placement_,
138  report & report_,
139  uint32_t flags_ = 0) const;
140 
141  bool check_two_volumes_overlap(const i_shape_3d & shape_old_,
142  const i_placement & placement_old_,
143  const i_shape_3d & shape_new_,
144  const i_placement & placement_new_,
145  report &, uint32_t flags_ = 0) const;
146 
148 
150 
151  static void make_vertice_unique(const wires_type & wires_,
152  std::set<geomtools::vector_3d> & vertice_);
153 
154 
155  private:
156 
157  datatools::logger::priority _logging_;
158 
159  };
160 
161 } // end of namespace geomtools
162 
163 #endif // GEOMTOOLS_OVERLAPPING_H
164 
165 /*
166 ** Local Variables: --
167 ** mode: c++ --
168 ** c-file-style: "gnu" --
169 ** tab-width: 2 --
170 ** End: --
171 */
static void extract(const datatools::properties &source_, datatools::properties &target_)
std::string name_second
Name of the second overlapping volume.
Definition: overlapping.h:72
priority
Priority levels for logging from most to least critical.
Definition: logger.h:82
Overlapping search report.
Definition: overlapping.h:79
vector_3d vertex
Overlapping vertex.
Definition: overlapping.h:75
Mother abstract class for all 3D solid shapes.
Definition: i_shape_3d.h:46
overlap_type
Type of overlapping.
Definition: overlapping.h:62
Definition: overlapping.h:94
Definition: overlapping.h:91
A daughter volume overlaps its mother volume.
Definition: overlapping.h:64
static void make_vertice_unique(const wires_type &wires_, std::set< geomtools::vector_3d > &vertice_)
~overlapping()
Detructor.
int item_first
Copy number of the first overlapping volume.
Definition: overlapping.h:71
bool check_mother_daughter_surface_intersection(const i_shape_3d &mother_shape_, const i_shape_3d &daughter_shape_, const i_placement &daughter_placement_, report &report_, uint32_t flags_=0) const
Check if a mother volume and its daughter volume have some intersecting surfaces.
flag_type
Definition: overlapping.h:84
overlapping()
Constructor.
Information about a detected overlap.
Definition: overlapping.h:68
Two positionned volumes are overlapping.
Definition: overlapping.h:63
static bool has_key(const datatools::properties &config_, const std::string &key_)
static const std::string & property_prefix()
Return the prefix of overlapping related properties.
static bool has_flag(const datatools::properties &config_, const std::string &flag_)
static flag_type get_flag_from_label(const std::string &label_)
void set_logging(datatools::logger::priority)
static std::string make_key(const std::string &label_)
Make a key.
Definition: overlapping.h:85
bool check_mother_daughter_overlap(const i_shape_3d &mother_shape_, const i_shape_3d &daughter_shape_, const i_placement &daughter_placement_, report &report_, uint32_t flags_=0) const
Check if a daughter overlaps its mother volume's outside region.
CLHEP::Hep3Vector vector_3d
Alias for the CLHEP 3D-vector class.
Definition: clhep.h:63
Volume overlapping detection algorithms.
Definition: overlapping.h:36
Abstract interface for all placement objects.
Definition: i_placement.h:42
overlap_type type
Definition: overlapping.h:69
std::list< polyline_type > wires_type
Alias for a list of 3D-polylines.
Definition: utils.h:61
bool check_two_volumes_overlap(const i_shape_3d &shape_old_, const i_placement &placement_old_, const i_shape_3d &shape_new_, const i_placement &placement_new_, report &, uint32_t flags_=0) const
std::vector< overlap_info > overlaps
Collection of overlapping informations.
Definition: overlapping.h:80
int item_second
Copy number of the second overlapping volume.
Definition: overlapping.h:73
std::string name_first
Name of the first overlapping volume.
Definition: overlapping.h:70
datatools::logger::priority get_logging() const
Top-level namespace of the Bayeux/geomtools module library.
Definition: electromagnetic_field_manager.h:39
A dictionary of arbitrary properties.
Definition: properties.h:125