Bayeux  3.4.1
Core Foundation library for SuperNEMO
tube.h
Go to the documentation of this file.
1 /* Author(s): F.Mauger <mauger@lpccaen.in2p3.fr>
3  * Creation date: 2006-11-28
4  * Last modified: 2015-02-22
5  *
6  * License:
7  *
8  * Description:
9  * 3D tube description
10  *
11  * History:
12  *
13  */
14 
15 #ifndef GEOMTOOLS_TUBE_H
16 #define GEOMTOOLS_TUBE_H 1
17 
18 // Standard library:
19 #include <iostream>
20 #include <string>
21 
22 // Third party:
23 // - Bayeux/datatools:
25 
26 // This project:
27 #include <geomtools/i_shape_3d.h>
28 #include <geomtools/i_stackable.h>
30 
31 namespace datatools {
32  // Forward class declaration:
33  class properties;
34 }
35 
36 namespace geomtools {
37 
38  // Class forward declarations:
39  class cylinder;
40  class disk;
41  class cylindrical_sector;
42  class rectangle;
43 
45  class tube : public i_shape_3d,
46  public i_stackable
47  {
48  public:
49 
60  | FACE_BOTTOM
61  | FACE_TOP
65  };
66 
72  };
73 
75  static const std::string & tube_label();
76 
79  disk & face_,
80  placement & face_placement_) const;
81 
83  void compute_side_face(faces_mask_type face_id_,
84  cylindrical_sector & face_,
85  placement & face_placement_) const;
86 
89  rectangle & face_,
90  placement & face_placement_) const;
91 
93  bool has_inner_face() const;
94 
96  virtual unsigned int compute_faces(face_info_collection_type & faces_) const;
97 
99  double get_xmin() const;
100 
102  double get_xmax() const;
103 
105  double get_ymin() const;
106 
108  double get_ymax() const;
109 
111  double get_zmin() const;
112 
114  double get_zmax() const;
115 
117  double get_z() const;
118 
120  void set_z(double);
121 
123  double get_half_z() const;
124 
126  void set_half_z(double);
127 
129  bool has_inner_r() const;
130 
132  double get_inner_r() const;
133 
135  void set_inner_r(double);
136 
138  void set_radii(double inner_r_, double outer_r_);
139 
141  double get_outer_r() const;
142 
144  void set_outer_r(double);
145 
147  void set(double outer_r_, double z_);
148 
150  void set(double inner_r_, double outer_r_, double z_);
151 
153  void set_half(double inner_r_, double outer_r_, double half_z_);
154 
156  void set(double inner_r_, double outer_r_, double z_, double start_phi_, double delta_phi_);
157 
159  const angular_range & get_phi_domain() const;
160 
162  bool has_partial_phi() const;
163 
165  bool has_start_phi() const;
166 
168  void set_start_phi(double);
169 
171  double get_start_phi() const;
172 
174  bool has_delta_phi() const;
175 
177  void set_delta_phi(double);
178 
180  double get_delta_phi() const;
181 
182  void set_phi(double start_phi_, double delta_phi_);
183 
185  void compute_inner_cylinder(cylinder & ic_);
186 
188  void compute_outer_cylinder(cylinder & oc_);
189 
191  tube();
192 
194  tube(double outer_radius_, double z_);
195 
197  tube(double inner_radius_, double outer_radius_, double z_);
198 
200  tube(double inner_radius_, double outer_radius_, double z_, double start_phi_, double delta_phi_);
201 
203  virtual ~tube();
204 
206  virtual std::string get_shape_name() const;
207 
209  virtual double get_parameter(const std::string &) const;
210 
212  bool is_extruded() const;
213 
215  bool is_valid() const;
216 
218  virtual void initialize(const datatools::properties &, const handle_dict_type * = 0);
219 
221  virtual void reset();
222 
224  virtual double get_surface(uint32_t mask_ = FACE_ALL) const;
225 
227  virtual double get_volume(uint32_t flags_ = VOLUME_BULK) const;
228 
230  virtual bool is_inside(const vector_3d &,
231  double skin_ = GEOMTOOLS_PROPER_TOLERANCE) const;
232 
234  virtual bool is_outside(const vector_3d &,
235  double skin_ = GEOMTOOLS_PROPER_TOLERANCE) const;
236 
238  virtual face_identifier on_surface(const vector_3d &,
239  const face_identifier & a_surface_mask = face_identifier::face_bits_any(),
240  double a_skin = GEOMTOOLS_PROPER_TOLERANCE) const;
241 
243  virtual vector_3d get_normal_on_surface(const vector_3d & a_position,
244  const face_identifier & a_surface_bit) const;
245 
247  virtual bool find_intercept(const vector_3d & from_,
248  const vector_3d & direction_,
249  face_intercept_info & intercept_,
250  double skin_ = GEOMTOOLS_PROPER_TOLERANCE) const;
251 
253  friend std::ostream &
254  operator<<(std::ostream &, const tube &);
255 
257  friend std::istream &
258  operator>>(std::istream &, tube &);
259 
261  virtual void tree_dump(std::ostream & out_ = std::clog,
262  const std::string & title_ = "",
263  const std::string & indent_ = "",
264  bool inherit_ = false) const;
265 
281  };
282 
284  virtual void generate_wires_self(wires_type & wires_,
285  uint32_t options_ = 0) const;
286 
289 
290  protected:
291 
293  void _set_defaults();
294 
296  virtual void _build_bounding_data();
297 
298  private:
299 
300  double _z_;
301  double _inner_r_;
302  double _outer_r_;
303  angular_range _phi_domain_;
304 
305  // Registration interface :
307 
308  };
309 
310 } // end of namespace geomtools
311 
313 // @arg geomtools::tube the name the class
315 
316 #endif // GEOMTOOLS_TUBE_H
317 
318 /*
319 ** Local Variables: --
320 ** mode: c++ --
321 ** c-file-style: "gnu" --
322 ** tab-width: 2 --
323 ** End: --
324 */
virtual bool find_intercept(const vector_3d &from_, const vector_3d &direction_, face_intercept_info &intercept_, double skin_=GEOMTOOLS_PROPER_TOLERANCE) const
Find the intercept point with a face of the tube.
tube()
Default constructor.
double get_zmax() const
Return the maximum Z.
Definition: tube.h:59
void set_start_phi(double)
Set the start phi.
virtual double get_surface(uint32_t mask_=FACE_ALL) const
Compute the surface.
Last defined bit.
Definition: tube.h:274
double get_ymax() const
Return the maximum Y.
tube_wires_rendering_option_type
3D rendering options
Definition: tube.h:267
Definition: tube.h:70
bool is_valid() const
Check if the tube is valid.
Definition: tube.h:54
double get_outer_r() const
Return the outer radius.
Do not render the inner face.
Definition: tube.h:270
Mother abstract class for all 3D solid shapes.
Definition: i_shape_3d.h:46
double get_ymin() const
Return the minimum Y.
Do not render the outer face.
Definition: tube.h:271
virtual void tree_dump(std::ostream &out_=std::clog, const std::string &title_="", const std::string &indent_="", bool inherit_=false) const
Smart print.
friend std::istream & operator>>(std::istream &, tube &)
Input operator.
static const uint32_t bit01
Definition: bit_mask.h:28
double get_half_z() const
Return half the Z dimension.
void set_half(double inner_r_, double outer_r_, double half_z_)
Set the dimensions by halves.
static const uint32_t bit03
Definition: bit_mask.h:30
Do not render the start angle face.
Definition: tube.h:272
Identifier of a face attached to a solid shape.
Definition: face_identifier.h:32
void compute_inner_cylinder(cylinder &ic_)
Compute the inner nappe.
void _set_defaults()
Set default attributes.
void set_half_z(double)
Set half the Z dimension.
static const std::string & tube_label()
Return the identifier label for the class.
bool has_inner_r() const
Check the inner radius.
double get_xmax() const
Return the maximum X.
static const uint32_t bit04
Definition: bit_mask.h:31
void set_z(double)
Set the Z dimension.
An object that describes the way an object of a given class can be configured through properties.
Definition: object_configuration_description.h:234
virtual vector_3d get_normal_on_surface(const vector_3d &a_position, const face_identifier &a_surface_bit) const
Return the vector normal to the surface at some position.
virtual void generate_wires_self(wires_type &wires_, uint32_t options_=0) const
Generate a sequence of polylines for wires 3D rendering.
Definition: tube.h:69
Definition: tube.h:71
virtual void reset()
Reset the tube.
void compute_top_bottom_face(faces_mask_type face_id_, disk &face_, placement &face_placement_) const
Compute the top or bottom face and placement.
The face_intercept_info class hosts the parameters of.
Definition: face_intercept_info.h:31
double get_zmin() const
Return the minimum Z.
#define GEOMTOOLS_PROPER_TOLERANCE
Definition: geomtools_config.h:26
double get_start_phi() const
Return the start phi.
double get_inner_r() const
Return the inner radius.
Do not render the stop angle face.
Definition: tube.h:273
Abstract base stackable object.
Definition: i_stackable.h:32
virtual void _build_bounding_data()
Build bounding data.
The 3D shape model for a tube.
Definition: tube.h:45
A spherical sector (2D shape)
Definition: cylindrical_sector.h:24
Definition: tube.h:55
void set_outer_r(double)
Set the inner radius.
virtual double get_volume(uint32_t flags_=VOLUME_BULK) const
Compute the volume.
void set_radii(double inner_r_, double outer_r_)
Set the inner and outer radii.
DOCD_CLASS_DECLARATION(my::algo)
Declaration of the OCD support for the my::algo class.
volumes_mask_type
Volume flags.
Definition: tube.h:68
void compute_outer_cylinder(cylinder &oc_)
Compute the outer nappe.
static const face_identifier & face_bits_any()
Return a singleton face identifier with any bit.
Rendering options bit mask.
Definition: tube.h:275
std::map< std::string, object_entry > handle_dict_type
Dictionary of handle of 3D object entries.
Definition: i_object_3d.h:124
static const uint32_t bit02
Definition: bit_mask.h:29
static const uint32_t FACE_BITS_NONE
No valid or known face bit.
Definition: face_identifier.h:45
Angular range.
Definition: angular_range.h:33
virtual std::string get_shape_name() const
Return the identifier/name of the shape.
static const uint32_t bit05
Definition: bit_mask.h:32
const angular_range & get_phi_domain() const
Return the phi domain.
void compute_side_face(faces_mask_type face_id_, cylindrical_sector &face_, placement &face_placement_) const
Compute the side bottom face and placement.
bool has_start_phi() const
Check the start phi.
bool has_partial_phi() const
Check for the partial arc.
virtual ~tube()
Destructor.
void set(double outer_r_, double z_)
Set the dimensions.
void set_inner_r(double)
Set the inner radius.
virtual void initialize(const datatools::properties &, const handle_dict_type *=0)
Initialize the tube from properties.
virtual bool is_outside(const vector_3d &, double skin_=GEOMTOOLS_PROPER_TOLERANCE) const
Check if a point is outside the tube.
double get_delta_phi() const
Return the delta phi.
#define GEOMTOOLS_OBJECT_3D_REGISTRATION_INTERFACE(ModelClassName)
Definition: i_object_3d.h:260
static void init_ocd(datatools::object_configuration_description &)
OCD support.
bool has_delta_phi() const
Check the dedislta phi.
CLHEP::Hep3Vector vector_3d
Alias for the CLHEP 3D-vector class.
Definition: clhep.h:63
virtual double get_parameter(const std::string &) const
Return a parameter given its name.
A rectangular surface (2D shape)
Definition: rectangle.h:30
double get_xmin() const
Return the minimum X.
Do not render the bottom face.
Definition: tube.h:268
Last defined bit.
Definition: i_wires_3d_rendering.h:62
friend std::ostream & operator<<(std::ostream &, const tube &)
Output operator.
Do not render the top face.
Definition: tube.h:269
The Bayeux/datatools library top-level namespace.
Definition: algo.h:13
The 3D shape model for a cylinder.
Definition: cylinder.h:41
The placement for a geometry volume with its translation and rotation with respect to some mother ref...
Definition: placement.h:34
bool has_inner_face() const
Check for an inner face.
virtual unsigned int compute_faces(face_info_collection_type &faces_) const
Return a collection of face info objects.
std::list< polyline_type > wires_type
Alias for a list of 3D-polylines.
Definition: utils.h:61
virtual bool is_inside(const vector_3d &, double skin_=GEOMTOOLS_PROPER_TOLERANCE) const
Check if a point is inside the tube.
static const uint32_t bit00
Definition: bit_mask.h:27
double get_z() const
Return the Z dimension.
Definition: tube.h:52
bool is_extruded() const
Check if the tube is extruded.
faces_mask_type
Face flags.
Definition: tube.h:51
void set_delta_phi(double)
Set the delta phi.
void compute_start_stop_angle_face(faces_mask_type face_id_, rectangle &face_, placement &face_placement_) const
Compute the top or bottom face and placement.
virtual face_identifier on_surface(const vector_3d &, const face_identifier &a_surface_mask=face_identifier::face_bits_any(), double a_skin=GEOMTOOLS_PROPER_TOLERANCE) const
Return the surface bit a point belongs to.
void set_phi(double start_phi_, double delta_phi_)
std::vector< face_info > face_info_collection_type
Type alias for a collection of face information objects.
Definition: face_info.h:168
A disk/ring sector surface (2D shape)
Definition: disk.h:26
Top-level namespace of the Bayeux/geomtools module library.
Definition: electromagnetic_field_manager.h:39
A dictionary of arbitrary properties.
Definition: properties.h:125