Bayeux  3.4.1
Core Foundation library for SuperNEMO
simple_shaped_model.h
Go to the documentation of this file.
1 /* Author(s) : Francois Mauger <mauger@lpccaen.in2p3.fr>
3  * Creation date: 2010-10-13
4  * Last modified: 2014-05-19
5  *
6  * License:
7  *
8  * Description:
9  *
10  * Model implementing a logical volume with a simple shape
11  * box, cylinder, sphere, tube, polycone, polyhedra or whatever solid (3D-shape)
12  * registerable in a shape factory.
13  *
14  * History:
15  *
16  */
17 
18 #ifndef GEOMTOOLS_SIMPLE_SHAPED_MODEL_H
19 #define GEOMTOOLS_SIMPLE_SHAPED_MODEL_H 1
20 
21 // Standard library:
22 #include <string>
23 
24 // This project:
25 #include <geomtools/i_model.h>
26 #include <geomtools/placement.h>
30 
31 namespace geomtools {
32 
33  // Forward declarations:
34  class box;
35  class cylinder;
36  class tube;
37  class sphere;
38  class polycone;
39  class polyhedra;
40  class i_shape_3d;
41  class logical_volume;
42 
45  {
46  public:
47 
51  SBM_LEGACY = 1,
54  };
55 
56  MWIM & grab_internals ();
57 
58  const MWIM & get_internals () const;
59 
60  const std::string & get_material_name () const;
61 
62  const std::string & get_filled_material_name () const;
63 
65 
66  const std::string & get_shape_type_id () const;
67 
68  const geomtools::box & get_box () const;
69 
70  const geomtools::cylinder & get_cylinder () const;
71 
72  const geomtools::tube & get_tube () const;
73 
74  const geomtools::sphere & get_sphere () const;
75 
76  const geomtools::polycone & get_polycone () const;
77 
78  const geomtools::polyhedra & get_polyhedra () const;
79 
80  const geomtools::i_shape_3d & get_solid () const;
81 
82  bool is_filled () const;
83 
84  bool is_filled_by_envelope () const;
85 
86  bool is_filled_by_extrusion () const;
87 
89 
90  virtual ~simple_shaped_model ();
91 
92  virtual std::string get_model_id () const;
93 
94  virtual void tree_dump (std::ostream & out_ = std::clog,
95  const std::string & title_ = "",
96  const std::string & indent_ = "",
97  bool inherit_ = false) const;
98 
99  protected:
100 
101  virtual void _pre_construct (datatools::properties & setup_,
102  models_col_type * models_);
103 
104  virtual void _post_construct (datatools::properties & setup_,
105  models_col_type * models_);
106 
107  virtual void _at_construct (const std::string & name_,
108  const datatools::properties & config_,
109  models_col_type * models_ = 0);
110 
111  virtual void _construct_box (const std::string & name_,
112  const datatools::properties & config_,
113  models_col_type * models_);
114 
115  virtual void _construct_cylinder (const std::string & name_,
116  const datatools::properties & config_,
117  models_col_type * models_);
118 
119  virtual void _construct_sphere (const std::string & name_,
120  const datatools::properties & config_,
121  models_col_type * models_);
122 
123  virtual void _construct_tube (const std::string & name_,
124  const datatools::properties & config_,
125  models_col_type * models_);
126 
127  virtual void _construct_polycone (const std::string & name_,
128  const datatools::properties & config_,
129  models_col_type * models_);
130 
131  virtual void _construct_polyhedra (const std::string & name_,
132  const datatools::properties & config_,
133  models_col_type * models_);
134 
135  private:
136 
137  shape_build_mode_type _sbm_;
138  std::string _shape_type_id_;
139  std::string _material_name_;
140  filled_utils::filled_type _filled_mode_;
141  std::string _filled_material_name_;
142  std::string _filled_label_;
143 
144  // Effective solids:
145  geomtools::box * _box_;
146  geomtools::cylinder * _cylinder_;
147  geomtools::tube * _tube_;
148  geomtools::sphere * _sphere_;
149  geomtools::polycone * _polycone_;
150  geomtools::polyhedra * _polyhedra_;
151 
152  geomtools::i_shape_3d * _solid_;
153  geomtools::i_shape_3d * _inner_shape_;
154  geomtools::i_shape_3d * _outer_shape_;
155 
156  placement _inner_placement_;
157  logical_volume _inner_logical_;
158  physical_volume _inner_phys_;
159 
160  //logical_volume * _daughter_owner_logical_; //!< The logical volume that is the top level mother of all daughter volumes implied by this model
161 
162  MWIM _internals_;
163  MWIM _filled_internals_;
164 
165  // registration interface :
167 
168  };
169 
170 } // end of namespace geomtools
171 
172 #include <datatools/ocd_macros.h>
174 
175 #endif // GEOMTOOLS_SIMPLE_SHAPED_MODEL_H
176 
177 /*
178 ** Local Variables: --
179 ** mode: c++ --
180 ** c-file-style: "gnu" --
181 ** tab-width: 2 --
182 ** End: --
183 */
virtual void _construct_box(const std::string &name_, const datatools::properties &config_, models_col_type *models_)
shape_build_mode_type
Shape build mode.
Definition: simple_shaped_model.h:49
virtual std::string get_model_id() const
Get the model ID.
The base class for geometry models.
Definition: i_model.h:45
const std::string & get_filled_material_name() const
A spherical volume (3D solid)
Definition: sphere.h:44
Build shape from hardcoded (legacy)
Definition: simple_shaped_model.h:51
Mother abstract class for all 3D solid shapes.
Definition: i_shape_3d.h:46
Polycone 3D solid shape.
Definition: polycone.h:39
virtual void tree_dump(std::ostream &out_=std::clog, const std::string &title_="", const std::string &indent_="", bool inherit_=false) const
Smart print.
const std::string & get_material_name() const
virtual void _at_construct(const std::string &name_, const datatools::properties &config_, models_col_type *models_=0)
The main construction hook.
const geomtools::tube & get_tube() const
virtual void _pre_construct(datatools::properties &setup_, models_col_type *models_)
Pre-construction hook.
The 3D shape model for a box.
Definition: box.h:44
A physical geometry volume (ala GDML)
Definition: physical_volume.h:36
virtual void _post_construct(datatools::properties &setup_, models_col_type *models_)
Post-construction hook.
Handler for internal items.
Definition: model_with_internal_items_tools.h:37
virtual void _construct_polycone(const std::string &name_, const datatools::properties &config_, models_col_type *models_)
A logical geometry volume (ala GDML)
Definition: logical_volume.h:40
std::map< std::string, i_model * > models_col_type
Type alias for dictionary of geometry model plain handles.
Definition: model_tools.h:29
Build shape from a factory (needs a reference shape factory)
Definition: simple_shaped_model.h:52
virtual void _construct_cylinder(const std::string &name_, const datatools::properties &config_, models_col_type *models_)
A geometry model implementing an unique simple 3D shape, possibly with internal/daughter volumes.
Definition: simple_shaped_model.h:44
The 3D shape model for a tube.
Definition: tube.h:45
shape_build_mode_type get_shape_build_mode() const
filled_type
Definition: utils.h:228
DOCD_CLASS_DECLARATION(my::algo)
Declaration of the OCD support for the my::algo class.
const geomtools::polyhedra & get_polyhedra() const
Polyhedra 3D solid shape.
Definition: polyhedra.h:35
const geomtools::cylinder & get_cylinder() const
virtual void _construct_tube(const std::string &name_, const datatools::properties &config_, models_col_type *models_)
const geomtools::box & get_box() const
virtual void _construct_polyhedra(const std::string &name_, const datatools::properties &config_, models_col_type *models_)
const MWIM & get_internals() const
const geomtools::i_shape_3d & get_solid() const
virtual void _construct_sphere(const std::string &name_, const datatools::properties &config_, models_col_type *models_)
const geomtools::sphere & get_sphere() const
const std::string & get_shape_type_id() const
Invalid.
Definition: simple_shaped_model.h:50
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
Definition: simple_shaped_model.h:53
const geomtools::polycone & get_polycone() const
#define GEOMTOOLS_MODEL_REGISTRATION_INTERFACE(ModelClassName)
Definition: model_macros.h:30
Top-level namespace of the Bayeux/geomtools module library.
Definition: electromagnetic_field_manager.h:39
A dictionary of arbitrary properties.
Definition: properties.h:125