Bayeux  3.4.1
Core Foundation library for SuperNEMO
stacked_model.h
Go to the documentation of this file.
1 /* Author(s) : Francois Mauger <mauger@lpccaen.in2p3.fr>
3  * Creation date: 2010-04-02
4  * Last modified: 2017-02-23
5  *
6  * License:
7  *
8  * Description:
9  *
10  * Geometry model with multiple stacked boxes.
11  *
12  */
13 
14 #ifndef GEOMTOOLS_STACKED_MODEL_H
15 #define GEOMTOOLS_STACKED_MODEL_H 1
16 
17 // Standard library:
18 #include <string>
19 #include <iostream>
20 #include <map>
21 
22 // This project:
25 #include <geomtools/placement.h>
26 #include <geomtools/box.h>
27 #include <geomtools/cylinder.h>
29 
30 namespace geomtools {
31 
33  class stacked_model : public i_boxed_model
34  {
35  public:
36 
37  static const std::string STACKED_PROPERTY_PREFIX;
38  static const std::string STACKED_MODEL_PROPERTY_PREFIX;
39  static const std::string STACKED_LABEL_PROPERTY_PREFIX;
40  static const std::string DEFAULT_STACKED_LABEL_PREFIX;
41  static const double DEFAULT_MECHANICS_PLAY;
42  static const double DEFAULT_NUMERICS_PLAY;
43 
49  };
50 
51  struct stacked_item
52  {
53  std::string label;
54  const i_model * model;
57  double limit_min;
58  double limit_max;
59 
60  public:
61 
62  stacked_item ();
63 
64  bool has_limit_min () const;
65 
66  bool has_limit_max () const;
67 
68  double get_limit_min () const;
69 
70  double get_limit_max () const;
71 
72  const std::string & get_label () const;
73 
74  const i_model & get_model () const;
75 
76  const placement & get_placement () const;
77 
78  const physical_volume & get_physical_volume () const;
79  };
80 
81  typedef std::map<int, stacked_item> stacked_dict_type;
82  typedef std::map<std::string, int> labels_dict_type;
83 
84  public:
85 
86  bool is_box_solid() const;
87 
88  bool is_cylinder_solid() const;
89 
90  const std::string & get_material_name () const;
91 
92  void set_material_name (const std::string &);
93 
94  void set_stacking_axis (int a_);
95 
96  int get_stacking_axis () const;
97 
98  bool is_stacking_along_x () const;
99 
100  bool is_stacking_along_y () const;
101 
102  bool is_stacking_along_z () const;
103 
104  void set_envelope_shape(const std::string &);
105 
106  const std::string & get_envelope_shape() const;
107 
108  //
109  virtual const geomtools::box & get_box () const;
110 
111  const geomtools::box & get_solid () const;
112 
113  const geomtools::cylinder & get_cyl_solid () const;
114 
115  size_t get_number_of_stacked_models () const;
116 
117  void add_stacked_model (int i_, const i_model &, const std::string & label_ = "");
118 
119  bool has_stacked_model (const std::string & label_) const;
120 
121  const i_model & get_stacked_model (int i_) const;
122 
123  const stacked_item & get_stacked_item (int i_) const;
124 
125  const i_model & get_stacked_model (const std::string & label_) const;
126 
127  const stacked_item & get_stacked_item (const std::string & label_) const;
128 
129  const labels_dict_type & get_labels () const;
130 
131  const stacked_dict_type & get_models () const;
132 
133  virtual std::string get_model_id () const;
134 
136  stacked_model ();
137 
139  virtual ~stacked_model ();
140 
142  virtual void tree_dump (std::ostream & out_ = std::clog,
143  const std::string & title_ = "",
144  const std::string & indent_ = "",
145  bool inherit_ = false) const;
146 
147  protected:
148 
150  virtual void _at_construct (const std::string & name_,
151  const datatools::properties & config_,
152  models_col_type * models_ = 0);
153 
154  private:
155 
156  std::string _material_name_;
157  int _stacking_axis_;
158  stacked_dict_type _stacked_models_;
159  labels_dict_type _labels_;
160  std::string _envelope_shape_;
161  geomtools::box _solid_;
162  geomtools::cylinder _cyl_solid_;
163  double _numerics_play_;
164  double _mechanics_play_;
165 
166  // 2011-12-05 FM : add support for additional internal objects :
167  MWIM _internals_;
168 
169  // registration interface :
171 
172  };
173 
174 } // end of namespace geomtools
175 
176 #include <datatools/ocd_macros.h>
178 
179 #endif // GEOMTOOLS_STACKED_MODEL_H
180 
181 /*
182 ** Local Variables: --
183 ** mode: c++ --
184 ** c-file-style: "gnu" --
185 ** tab-width: 2 --
186 ** End: --
187 */
std::map< int, stacked_item > stacked_dict_type
Definition: stacked_model.h:81
The base class for geometry models.
Definition: i_model.h:45
Z axis.
Definition: utils.h:391
double limit_min
Definition: stacked_model.h:57
const placement & get_placement() const
const geomtools::cylinder & get_cyl_solid() const
static const double DEFAULT_NUMERICS_PLAY
Definition: stacked_model.h:42
size_t get_number_of_stacked_models() const
virtual std::string get_model_id() const
const i_model & get_model() const
int get_stacking_axis() const
The 3D shape model for a box.
Definition: box.h:44
A physical geometry volume (ala GDML)
Definition: physical_volume.h:36
bool has_stacked_model(const std::string &label_) const
Handler for internal items.
Definition: model_with_internal_items_tools.h:37
static const std::string STACKED_MODEL_PROPERTY_PREFIX
Definition: stacked_model.h:38
std::map< std::string, i_model * > models_col_type
Type alias for dictionary of geometry model plain handles.
Definition: model_tools.h:29
const std::string & get_envelope_shape() const
virtual void _at_construct(const std::string &name_, const datatools::properties &config_, models_col_type *models_=0)
Construction.
A geometry model with some stacked boxed models along a specific axis (X, Y or Z)
Definition: stacked_model.h:33
const i_model * model
Definition: stacked_model.h:54
virtual const geomtools::box & get_box() const
std::map< std::string, int > labels_dict_type
Definition: stacked_model.h:82
bool is_stacking_along_y() const
stacked_model()
Default constructor.
const stacked_dict_type & get_models() const
const i_model & get_stacked_model(int i_) const
Definition: stacked_model.h:48
virtual void tree_dump(std::ostream &out_=std::clog, const std::string &title_="", const std::string &indent_="", bool inherit_=false) const
Smart print.
bool is_stacking_along_x() const
DOCD_CLASS_DECLARATION(my::algo)
Declaration of the OCD support for the my::algo class.
void set_material_name(const std::string &)
const labels_dict_type & get_labels() const
bool is_cylinder_solid() const
std::string label
Definition: stacked_model.h:53
const geomtools::box & get_solid() const
bool is_stacking_along_z() const
const std::string & get_material_name() const
physical_volume phys
Definition: stacked_model.h:56
const std::string & get_label() const
const physical_volume & get_physical_volume() const
static const double DEFAULT_MECHANICS_PLAY
Definition: stacked_model.h:41
static const std::string DEFAULT_STACKED_LABEL_PREFIX
Definition: stacked_model.h:40
X axis.
Definition: utils.h:389
void set_stacking_axis(int a_)
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
void add_stacked_model(int i_, const i_model &, const std::string &label_="")
double limit_max
Definition: stacked_model.h:58
Y axis.
Definition: utils.h:390
static const std::string STACKED_PROPERTY_PREFIX
Definition: stacked_model.h:37
Definition: stacked_model.h:46
placement placmt
Definition: stacked_model.h:55
static const std::string STACKED_LABEL_PROPERTY_PREFIX
Definition: stacked_model.h:39
#define GEOMTOOLS_MODEL_REGISTRATION_INTERFACE(ModelClassName)
Definition: model_macros.h:30
const stacked_item & get_stacked_item(int i_) const
Definition: stacked_model.h:51
void set_envelope_shape(const std::string &)
stacking_axis_t
Definition: stacked_model.h:44
Definition: stacked_model.h:47
Top-level namespace of the Bayeux/geomtools module library.
Definition: electromagnetic_field_manager.h:39
A dictionary of arbitrary properties.
Definition: properties.h:125
virtual ~stacked_model()
Destructor.