Bayeux  3.4.1
Core Foundation library for SuperNEMO
regular_3d_mesh_placement.h
Go to the documentation of this file.
1 /* Author(s): Francois Mauger <mauger@lpccaen.in2p3.fr>
3  * Creation date: 2015-06-12
4  * Last modified: 2015-06-12
5  *
6  * License: GPL 3
7  *
8  * Description:
9  *
10  * Regular 3D mesh placement in a logical volume
11  *
12  */
13 
14 #ifndef GEOMTOOLS_REGULAR_3D_MESH_PLACEMENT_H
15 #define GEOMTOOLS_REGULAR_3D_MESH_PLACEMENT_H
16 
17 // Standard library:
18 #include <iostream>
19 #include <string>
20 #include <vector>
21 
22 // Third party:
23 // - Boost:
24 #include <boost/scoped_ptr.hpp>
25 #include <boost/utility.hpp>
26 // - Bayeux/datatools:
27 #include <datatools/properties.h>
28 #include <datatools/logger.h>
29 
30 // This project:
31 #include <geomtools/i_placement.h>
32 #include <geomtools/placement.h>
34 
35 namespace geomtools {
36 
39  : public i_placement
40  , private boost::noncopyable
41  {
42  public:
43 
45  bool is_valid() const;
46 
48  void invalidate();
49 
52 
55 
57  bool has_cache_file_path() const;
58 
60  const std::string & get_cache_file_path() const;
61 
63  void set_cache_file_path(const std::string &);
64 
65  void set_log_vol(const logical_volume &);
66 
67  bool has_log_vol() const;
68 
69  void set_node_log_vol(const logical_volume &);
70 
71  bool has_node_log_vol() const;
72 
73  void set_steps(double step_x_, double step_y_, double step_z_);
74 
75  void set_starts(double x0_, double y0_, double z0_);
76 
77  void set_stops(double x1_, double y1_, double z1_);
78 
79  void set_step_x(double step_x_);
80 
81  void set_step_y(double step_y_);
82 
83  void set_step_z(double step_z_);
84 
85  void set_start_x(double x0_);
86 
87  void set_start_y(double y0_);
88 
89  void set_start_z(double z0_);
90 
91  void set_stop_x(double x1_);
92 
93  void set_stop_y(double y1_);
94 
95  void set_stop_z(double z1_);
96 
97  void set_overlapping_flags(uint32_t);
98 
99  uint32_t get_overlapping_flags() const;
100 
101  virtual bool has_only_one_rotation() const;
102 
103  virtual size_t get_dimension() const;
104 
105  virtual bool is_replica() const;
106 
107  virtual size_t get_number_of_items() const;
108 
109  virtual void get_placement(int item_, placement & p_) const;
110 
111  virtual size_t compute_index_map(std::vector<uint32_t> & map_,
112  int item_) const;
113 
114  const placement & get_basic_placement() const;
115 
117 
118  virtual ~regular_3d_mesh_placement();
119 
120  bool is_initialized() const;
121 
122  void initialize();
123 
124  void initialize(const datatools::properties & config_);
125 
126  virtual void reset();
127 
128  virtual void tree_dump(std::ostream & out_ = std::clog,
129  const std::string & title_ = "geomutils::regular_grid_placement",
130  const std::string & indent_ = "",
131  bool inherit_ = false) const;
132 
133  protected:
134 
135  void _load_cache(const std::string & cache_file_path_);
136 
137  void _store_cache(const std::string & cache_file_path_);
138 
139  void _set_defaults();
140 
141  void _init(const datatools::properties & config_);
142 
143  void _fini();
144 
145  private:
146 
147  bool _initialized_ = false;
148  datatools::logger::priority _logging_;
149  const logical_volume * _log_vol_ = nullptr;
150  const logical_volume * _node_log_vol_ = nullptr;
151  uint32_t _overlapping_flags_;
152  std::string _cache_file_path_;
153  double _start_x_;
154  double _start_y_;
155  double _start_z_;
156  double _stop_x_;
157  double _stop_y_;
158  double _stop_z_;
159  double _step_x_;
160  double _step_y_;
161  double _step_z_;
162  size_t _nsamples_x_;
163  size_t _nsamples_y_;
164  size_t _nsamples_z_;
165  placement _basic_placement_;
166 
167  struct data;
168  boost::scoped_ptr<data> _data_;
169 
170  };
171 
172 } // end of namespace geomtools
173 
174 #endif // GEOMTOOLS_REGULAR_3D_MESH_PLACEMENT_H
175 
176 // Local Variables: --
177 // mode: c++ --
178 // c-file-style: "gnu" --
179 // tab-width: 2 --
180 // End: --
void invalidate()
Invalidate the mesh placement.
priority
Priority levels for logging from most to least critical.
Definition: logger.h:82
void set_logging(datatools::logger::priority)
Set the logging priprity threshold.
void set_log_vol(const logical_volume &)
virtual bool has_only_one_rotation() const
Check if the placement is based on one unique rotation.
virtual void tree_dump(std::ostream &out_=std::clog, const std::string &title_="geomutils::regular_grid_placement", const std::string &indent_="", bool inherit_=false) const
Smart print.
datatools::logger::priority get_logging() const
Return the logging priprity threshold.
bool has_cache_file_path() const
Check if a cache file path is set.
A logical geometry volume (ala GDML)
Definition: logical_volume.h:40
virtual void get_placement(int item_, placement &p_) const
Compute the placement at given item rank/index.
void set_starts(double x0_, double y0_, double z0_)
Regular 3D mesh placement of small daughter volumes with respect to a mother logical volume.
Definition: regular_3d_mesh_placement.h:38
bool is_valid() const
Check the validity of the mesh placement.
const std::string & get_cache_file_path() const
Return the cache file path.
const placement & get_basic_placement() const
void set_stops(double x1_, double y1_, double z1_)
virtual size_t get_number_of_items() const
Return the number of placement items.
void _load_cache(const std::string &cache_file_path_)
void set_node_log_vol(const logical_volume &)
virtual bool is_replica() const
Check if the placement is a replica (GDML/Geant4 concept for multiple placement objects)
void set_steps(double step_x_, double step_y_, double step_z_)
virtual size_t get_dimension() const
Abstract interface for all placement objects.
Definition: i_placement.h:42
Utilities for logging information.
The placement for a geometry volume with its translation and rotation with respect to some mother ref...
Definition: placement.h:34
void set_cache_file_path(const std::string &)
Set the cache file path.
void _init(const datatools::properties &config_)
virtual size_t compute_index_map(std::vector< uint32_t > &map_, int item_) const
Compute an array of indexes in a multidimensional frame from the item rank/index.
void _store_cache(const std::string &cache_file_path_)
Top-level namespace of the Bayeux/geomtools module library.
Definition: electromagnetic_field_manager.h:39
A dictionary of arbitrary properties.
Definition: properties.h:125