Bayeux  3.4.1
Core Foundation library for SuperNEMO
regular_linear_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-03-31
5  *
6  * License:
7  *
8  * Description:
9  *
10  * Regular linear placement.
11  *
12  * History:
13  *
14  */
15 
16 #ifndef GEOMTOOLS_REGULAR_LINEAR_PLACEMENT_H
17 #define GEOMTOOLS_REGULAR_LINEAR_PLACEMENT_H 1
18 
19 // Standard library:
20 #include <iostream>
21 #include <iomanip>
22 #include <string>
23 
24 // This project:
25 #include <geomtools/i_placement.h>
26 #include <geomtools/placement.h>
27 
28 namespace geomtools {
29 
30 
33  {
34  public:
35 
37  enum axis_t
38  {
43  };
44 
45  public:
46 
47  virtual size_t get_dimension() const;
48 
49  virtual bool is_replica() const;
50 
51  virtual bool has_only_one_rotation() const;
52 
53  void set_replicant_axis(int);
54  int get_replicant_axis() const;
55  bool is_replicant_x_axis() const;
56  bool is_replicant_y_axis() const;
57  bool is_replicant_z_axis() const;
58 
59  bool is_valid() const;
60 
61  void invalidate();
62 
63  void set_replicant_step_x(double x_);
64 
65  void set_replicant_step_y(double y_);
66 
67  void set_replicant_step_z(double z_);
68 
69  void set_step(double x_, double y_, double z_);
70 
71  void set_step(const vector_3d & step_);
72 
73  const vector_3d & get_step() const;
74 
75  void set_basic_placement(const placement & bp_);
76 
77  const placement & get_basic_placement() const;
78 
80 
81  void set_number_of_items(size_t n_);
82 
83  virtual size_t get_number_of_items() const;
84 
85  virtual void get_placement(int item_, placement & p_) const;
86 
87  virtual size_t compute_index_map(std::vector<uint32_t> & map_,
88  int item_) const;
89 
92 
94  regular_linear_placement(const placement & basic_placement_,
95  const vector_3d & step_,
96  size_t number_of_items_);
97 
99  regular_linear_placement(const placement & basic_placement_,
100  double step_,
101  size_t number_of_items_,
102  int replicant_axis_ = REPLICANT_AXIS_NONE);
103 
105  virtual ~regular_linear_placement();
106 
108  void init(const placement & basic_placement_,
109  const vector_3d & step_,
110  size_t number_of_items_);
111 
113  void init(const placement & basic_placement_,
114  double step_,
115  size_t number_of_items_,
116  int replicant_axis_ = REPLICANT_AXIS_X);
117 
119  virtual void reset();
120 
122  virtual void tree_dump(std::ostream & out_ = std::clog,
123  const std::string & title_ = "",
124  const std::string & indent_ = "",
125  bool inherit_ = false) const;
126 
127  private:
128 
129  placement _basic_placement_;
130  vector_3d _step_;
131  size_t _number_of_items_;
132  int _replicant_axis_;
133 
134  };
135 
136 } // end of namespace geomtools
137 
138 #endif // GEOMTOOLS_REGULAR_LINEAR_PLACEMENT_H
139 
140 /*
141 ** Local Variables: --
142 ** mode: c++ --
143 ** c-file-style: "gnu" --
144 ** tab-width: 2 --
145 ** End: --
146 */
Definition: regular_linear_placement.h:39
virtual ~regular_linear_placement()
Destructor.
virtual bool has_only_one_rotation() const
Check if the placement is based on one unique rotation.
const placement & get_basic_placement() const
void set_step(double x_, double y_, double z_)
void init(const placement &basic_placement_, const vector_3d &step_, size_t number_of_items_)
Initialization.
Definition: regular_linear_placement.h:40
virtual void get_placement(int item_, placement &p_) const
Compute the placement at given item rank/index.
virtual size_t get_number_of_items() const
Return the number of placement items.
CLHEP::Hep3Vector vector_3d
Alias for the CLHEP 3D-vector class.
Definition: clhep.h:63
Abstract interface for all placement objects.
Definition: i_placement.h:42
The placement for a geometry volume with its translation and rotation with respect to some mother ref...
Definition: placement.h:34
virtual size_t get_dimension() const
regular_linear_placement()
Default constructor.
Definition: regular_linear_placement.h:42
void set_basic_placement(const placement &bp_)
virtual void tree_dump(std::ostream &out_=std::clog, const std::string &title_="", const std::string &indent_="", bool inherit_=false) const
Smart print.
Definition: regular_linear_placement.h:41
axis_t
Type of the replication axis.
Definition: regular_linear_placement.h:37
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.
const vector_3d & get_step() const
virtual bool is_replica() const
Check if the placement is a replica (GDML/Geant4 concept for multiple placement objects)
Regular linear placement.
Definition: regular_linear_placement.h:32
Top-level namespace of the Bayeux/geomtools module library.
Definition: electromagnetic_field_manager.h:39