Bayeux  3.4.1
Core Foundation library for SuperNEMO
regular_grid_placement.h
Go to the documentation of this file.
1 /* Author(s): Francois Mauger <mauger@lpccaen.in2p3.fr>
3  * Creation date: 2010-02-26
4  * Last modified: 2010-02-26
5  *
6  * License:
7  *
8  * Description:
9  * XY grid 2D placement
10  *
11  * y^
12  * | column 0 1 2 3 4
13  * | : : : : : row
14  * | x......x......x......x......x......2
15  * | :10 :11 :12 :13 :14
16  * yc +.......... x......x......c......x......x......1
17  * | dy :5 :6 :7 :8 :9
18  * yo +...........o......x......x......x......x......0
19  * | :0 dx 1 :2 3 4
20  * | : :
21  * +-----------+-------------+--------------------> x
22  * O xo xc
23  *
24  *
25  *
26  * History:
27  *
28  */
29 
30 #ifndef GEOMTOOLS_REGULAR_GRID_PLACEMENT_H_
31 #define GEOMTOOLS_REGULAR_GRID_PLACEMENT_H_ 1
32 
33 // Standard library:
34 #include <iostream>
35 #include <iomanip>
36 #include <string>
37 
38 // This project:
39 #include <geomtools/i_placement.h>
40 #include <geomtools/placement.h>
41 
42 namespace geomtools {
43 
45  : public i_placement
46  {
47  public:
48 
50  enum mode_type {
51  MODE_XY = 0,
52  MODE_YZ = 1,
53  MODE_XZ = 2
54  };
55 
56  static const bool CENTERED = true;
57  static const bool UNCENTERED = false;
58 
59  public:
60 
61  bool is_valid () const;
62 
63  void invalidate ();
64 
65  int get_mode () const;
66 
67  bool is_mode_xy () const;
68 
69  bool is_mode_yz () const;
70 
71  bool is_mode_xz () const;
72 
73  void set_mode (int m_);
74 
75  bool is_centered () const;
76 
77  void set_centered (bool c_);
78 
79  void set_column_step (double dx_);
80 
81  void set_row_step (double dx_);
82 
83  void set_steps (double dx_, double dy_);
84 
85  double get_column_step () const;
86 
87  double get_row_step () const;
88 
89  double get_x_step () const;
90 
91  double get_y_step () const;
92 
93  double get_z_step () const;
94 
95  void set_basic_placement (const placement & bp_);
96 
97  const placement & get_basic_placement () const;
98 
101 
103 
104  void set_number_of_rows (size_t nr_);
105 
106  void set_number_of_columns (size_t nc_);
107 
108  size_t get_number_of_rows () const;
109 
110  size_t get_number_of_columns () const;
111 
112  void get_placement (int col_, int row_, placement & p_) const;
113 
114  placement get_placement (int col_, int row_) const;
115 
116  virtual bool has_only_one_rotation () const;
117 
118  virtual size_t get_dimension () const;
119 
120  virtual bool is_replica () const;
121 
122  virtual size_t get_number_of_items () const;
123 
124  virtual void get_placement (int item_, placement & p_) const;
125 
126  virtual size_t compute_index_map (std::vector<uint32_t> & map_,
127  int item_) const;
128 
130 
131  regular_grid_placement (const placement & basic_placement_,
132  double column_step_,
133  double row_step_,
134  size_t number_of_columns_,
135  size_t number_of_rows_,
136  int mode_,
137  bool centered_ = true);
138 
139  virtual ~regular_grid_placement ();
140 
141  void init (const placement & basic_placement_,
142  double column_step_,
143  double row_step_,
144  size_t number_of_columns_,
145  size_t number_of_rows_,
146  int mode_,
147  bool centered_ = true);
148 
149  virtual void reset ();
150 
151  virtual void tree_dump (std::ostream & out_ = std::clog,
152  const std::string & title_ = "geomutils::regular_grid_placement",
153  const std::string & indent_ = "",
154  bool inherit_ = false) const;
155 
156  private:
157 
158  placement _basic_placement_;
159  double _column_step_;
160  double _row_step_;
161  size_t _number_of_columns_;
162  size_t _number_of_rows_;
163  int _mode_;
164  bool _centered_;
165 
166  };
167 
168 } // end of namespace geomtools
169 
170 #endif // GEOMTOOLS_REGULAR_GRID_PLACEMENT_H
171 
172 /*
173 ** Local Variables: --
174 ** mode: c++ --
175 ** c-file-style: "gnu" --
176 ** tab-width: 2 --
177 ** End: --
178 */
virtual size_t get_number_of_items() const
Return the number of placement items.
Definition: regular_grid_placement.h:44
mode_type
Orientation of the grid placement.
Definition: regular_grid_placement.h:50
Definition: regular_grid_placement.h:51
void get_placement(int col_, int row_, placement &p_) const
Definition: regular_grid_placement.h:53
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.
Definition: regular_grid_placement.h:52
static const bool UNCENTERED
Definition: regular_grid_placement.h:57
void set_steps(double dx_, double dy_)
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.
virtual bool is_replica() const
Check if the placement is a replica (GDML/Geant4 concept for multiple placement objects)
virtual size_t get_dimension() const
void set_number_of_columns(size_t nc_)
Abstract interface for all placement objects.
Definition: i_placement.h:42
virtual bool has_only_one_rotation() const
Check if the placement is based on one unique rotation.
The placement for a geometry volume with its translation and rotation with respect to some mother ref...
Definition: placement.h:34
const placement & get_basic_placement() const
static const bool CENTERED
Definition: regular_grid_placement.h:56
void set_basic_placement(const placement &bp_)
void init(const placement &basic_placement_, double column_step_, double row_step_, size_t number_of_columns_, size_t number_of_rows_, int mode_, bool centered_=true)
Top-level namespace of the Bayeux/geomtools module library.
Definition: electromagnetic_field_manager.h:39