Bayeux  3.4.1
Core Foundation library for SuperNEMO
model_with_internal_mesh_tools.h
Go to the documentation of this file.
1 /* Author(s) : Francois Mauger <mauger@lpccaen.in2p3.fr>
3  * Arnaud Chapon <chapon@lpccaen.in2p3.fr>
4  * Creation date: 2015-07-06
5  * Last modified: 2015-07-06
6  *
7  * License:
8  *
9  * Description:
10  *
11  * Some tools to make a model owning internal items
12  * positioned on a regular 3D mesh within its mother shape
13  *
14  * History:
15  *
16  */
17 
18 #ifndef GEOMTOOLS_MODEL_WITH_INTERNAL_MESH_TOOLS_H
19 #define GEOMTOOLS_MODEL_WITH_INTERNAL_MESH_TOOLS_H
20 
21 // Standard library:
22 #include <string>
23 #include <map>
24 
25 // Third party:
26 // - Boost:
27 #include <boost/scoped_ptr.hpp>
28 // - Bayeux/datatools:
30 #include <datatools/i_tree_dump.h>
31 #include <datatools/properties.h>
32 #include <datatools/logger.h>
33 
34 // This project:
36 #include <geomtools/detail/model_tools.h> // for models_col_type
38 
39 namespace geomtools {
40 
41  class i_model;
42 
45  {
46  public:
47 
48  static const std::string INTERNAL_MESH_PREFIX; // "internal_mesh."
49  static const std::string INTERNAL_MESH_LABELS_KEY; // "internal_mesh.labels"
50  static const std::string INTERNAL_MESH_MODEL_PREFIX; // "internal_mesh.model."
51  static const std::string INTERNAL_MESH_RANK_PREFIX; // "internal_mesh.rank."
52  static const std::string INTERNAL_MESH_PLACEMENT_PREFIX; // "internal_mesh.placement."
53 
54  public:
55 
57  struct mesh_type
58  {
59  public:
60 
62  static const int INVALID_RANK = -1;
63 
65  mesh_type();
66 
68  ~mesh_type();
69 
72 
74  bool has_mother_logical() const;
75 
77  const logical_volume & get_mother_logical() const;
78 
81 
83  void set_label(const std::string &);
84 
86  const std::string & get_label() const;
87 
89  void set_rank(int rank_);
90 
92  int get_rank() const;
93 
95  void set_model(const i_model &);
96 
98  const i_model & get_model() const;
99 
101 
103 
104  void reset_mesh_placement();
105 
107 
108  const physical_volume & get_physical_volume() const;
109 
111 
113  bool is_initialized() const;
114 
116  void initialize();
117 
119  void reset();
120 
121  private:
122  // Configuration parameters:
123  std::string _label_;
124  logical_volume * _mother_log_;
125  const i_model * _model_;
126  int _rank_;
127  datatools::properties _mesh_placement_config_;
128 
129  // Internal data:
130  regular_3d_mesh_placement * _mesh_placement_;
131  physical_volume _phys_;
132 
133  };
134 
135  typedef std::map<std::string, mesh_type> mesh_dict_type;
136 
139 
142 
145 
148 
150  const mesh_dict_type & get_meshes() const;
151 
154 
156  size_t get_number_of_meshes() const;
157 
159  bool has_mesh(const std::string &) const;
160 
162  const mesh_type & get_mesh(const std::string &) const;
163 
165  mesh_type & grab_mesh(const std::string &);
166 
168  void add_mesh(const std::string & label_,
169  logical_volume & mother_log_,
170  const i_model & model_,
171  int rank_,
172  const datatools::properties & mesh_placement_config_
173  );
174 
176  void initialize();
177 
179  void reset();
180 
182  void plug_internal_meshes(const datatools::properties & setup_,
183  logical_volume & log_,
184  models_col_type * models_);
185 
186  /*
187  static void init_ocd(datatools::object_configuration_description & ocd_,
188  const std::string & prefix_ = "");
189  */
190 
191  virtual void tree_dump(std::ostream & out_ = std::clog,
192  const std::string & title_ = "",
193  const std::string & indent_ = "",
194  bool inherit_ = false) const;
195 
196  private:
197 
198  datatools::logger::priority _logging_;
199  mesh_dict_type _meshes_;
200 
201  };
202 
203  // Type alias:
204  // typedef model_with_internal_mesh_data MWIH;
205 
206 } // end of namespace geomtools
207 
208 #endif // GEOMTOOLS_MODEL_WITH_INTERNAL_MESH_TOOLS_H
209 
210 /*
211 ** Local Variables: --
212 ** mode: c++ --
213 ** c-file-style: "gnu" --
214 ** tab-width: 2 --
215 ** End: --
216 */
const i_model & get_model() const
Return the geometry model of the mesh node.
static const std::string INTERNAL_MESH_RANK_PREFIX
Definition: model_with_internal_mesh_tools.h:51
The base class for geometry models.
Definition: i_model.h:45
virtual void tree_dump(std::ostream &out_=std::clog, const std::string &title_="", const std::string &indent_="", bool inherit_=false) const
Main old interface method for printing.
priority
Priority levels for logging from most to least critical.
Definition: logger.h:82
std::map< std::string, mesh_type > mesh_dict_type
Definition: model_with_internal_mesh_tools.h:135
const mesh_type & get_mesh(const std::string &) const
Return the mesh by name.
void plug_internal_meshes(const datatools::properties &setup_, logical_volume &log_, models_col_type *models_)
Plug internal meshes in a mother logical volume.
static const std::string INTERNAL_MESH_MODEL_PREFIX
Definition: model_with_internal_mesh_tools.h:50
An interface with utilities for printable objects.
Definition: i_tree_dump.h:36
void set_logging(datatools::logger::priority)
Set the logging priprity threshold.
A physical geometry volume (ala GDML)
Definition: physical_volume.h:36
Handler to add daughter volumes on a regular 3D mesh in a mother logical volume.
Definition: model_with_internal_mesh_tools.h:44
static const int INVALID_RANK
Invalid mesh rank.
Definition: model_with_internal_mesh_tools.h:62
static const std::string INTERNAL_MESH_PREFIX
Definition: model_with_internal_mesh_tools.h:48
mesh_type & grab_mesh(const std::string &)
Return the mesh by name.
const mesh_dict_type & get_meshes() const
Return a const reference to the dictionary of internal meshes.
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
Regular 3D mesh placement of small daughter volumes with respect to a mother logical volume.
Definition: regular_3d_mesh_placement.h:38
const datatools::properties & get_mesh_placement_config() const
void set_mother_logical(logical_volume &)
Set the mother logical volume.
bool has_mother_logical() const
Check if the mother logical is defined.
static const std::string INTERNAL_MESH_PLACEMENT_PREFIX
Definition: model_with_internal_mesh_tools.h:52
bool has_mesh(const std::string &) const
Check if a mesh exists.
datatools::logger::priority get_logging() const
Return the logging priprity threshold.
size_t get_number_of_meshes() const
Return the number of meshes.
logical_volume & grab_mother_logical()
Return a mutable reference to the mother logical.
Utilities for logging information.
void add_mesh(const std::string &label_, logical_volume &mother_log_, const i_model &model_, int rank_, const datatools::properties &mesh_placement_config_)
Add a mesh.
static const std::string INTERNAL_MESH_LABELS_KEY
Definition: model_with_internal_mesh_tools.h:49
bool is_initialized() const
Check initialization flag.
void set_mesh_placement_config(const datatools::properties &)
void set_label(const std::string &)
Set the internal daughter mesh label.
Mesh record.
Definition: model_with_internal_mesh_tools.h:57
const regular_3d_mesh_placement & get_mesh_placement() const
const physical_volume & get_physical_volume() const
void set_model(const i_model &)
Set the geometry model of the mesh node.
const std::string & get_label() const
Return the internal daughter mesh label.
mesh_dict_type & grab_meshes()
Return a mutable reference to the dictionary of internal meshes.
model_with_internal_mesh_data()
Default constructor.
void set_rank(int rank_)
Set the internal daughter mesh rank.
const logical_volume & get_mother_logical() const
Return a const reference to the mother logical.
Top-level namespace of the Bayeux/geomtools module library.
Definition: electromagnetic_field_manager.h:39
A dictionary of arbitrary properties.
Definition: properties.h:125
int get_rank() const
Return the internal daughter mesh rank.