Bayeux  3.4.1
Core Foundation library for SuperNEMO
geomtools_driver.h
Go to the documentation of this file.
1 /* Author(s) : Francois Mauger <mauger@lpccaen.in2p3.fr>
3  * Creation date: 2013-08-24
4  * Last modified: 2016-09-07
5  *
6  * License:
7  *
8  * Description:
9  *
10  * Geomtools model factory and manager driver.
11  *
12  * History:
13  *
14  */
15 
16 #ifndef GEOMTOOLS_GEOMTOOLS_DRIVER_H
17 #define GEOMTOOLS_GEOMTOOLS_DRIVER_H
18 
19 // Standard Library:
20 #include <iostream>
21 #include <string>
22 #include <vector>
23 #include <memory>
24 
25 // Third Party:
26 // - Boost:
27 #include <boost/cstdint.hpp>
28 // #include <boost/scoped_ptr.hpp>
29 // - Bayeux/datatools:
30 #include <datatools/logger.h>
31 
32 // This project:
34 #include <geomtools/display_data.h>
35 
37 namespace geomtools {
38 
39  class model_factory;
40  class manager;
41  class id_mgr;
42 
44  public:
46  void reset();
47  int parse(const std::vector<std::string> & argv_,
48  std::ostream & out_ = std::clog);
49  bool can_initialize() const;
50 
51  public:
52 
54  bool mute;
56  std::vector<std::string> LL_dlls;
57  std::string LL_config;
58  std::string geo_mgr_config_file;
59  std::vector<std::string> setup_filenames;
61  std::string categories_filename;
63  std::vector<std::string> mapping_only_categories;
64  std::vector<std::string> mapping_excluded_categories;
66  std::string materials_plugin_name;
67 
68 #if GEOMTOOLS_WITH_GNUPLOT_DISPLAY == 1
69  bool visu;
70  std::string visu_drawer_view;
71  std::string visu_object_name;
72  bool visu_drawer_labels;
73 #endif // GEOMTOOLS_WITH_GNUPLOT_DISPLAY
74 
75  };
76 
78 
79  public:
80 
83 
85  virtual ~geomtools_driver();
86 
88  bool is_initialized() const;
89 
91  void initialize(const geomtools_driver_params &);
92 
94  void reset();
95 
97  bool has_manager() const;
98 
101 
103  const std::vector<std::string> & get_error_message_stack() const;
104 
105  private:
106 
107  void _error_message_stack_push_(const std::string & message_);
108 
109  void _error_message_stack_backtrace_();
110 
111  public:
112  /*
113  // Common command line interface ?
114  int exec_command(const std::string & command_,
115  const std::vector<std::string> & argv_,
116  std::ostream & out_ = std::cout,
117  std::ostream & log_ = std::clog);
118  */
119 
120  // Initialization from a list of arguments
121  int command_initialize(const std::vector<std::string> & argv_,
122  std::ostream & out_ = std::clog);
123 
125  int command_reset();
126 
128  int command_status(std::ostream & out_) const;
129 
131  int command_print_manager(std::ostream & out_) const;
132 
134  int command_print_factory(std::ostream & out_) const;
135 
137  int command_print_mapping(std::ostream & out_,
138  const std::string & mapping_name_ = "") const;
139 
141  int command_print_list_of_models(std::ostream & out_, const std::string & print_models_options_ = "") const;
142 
144  int command_print_list_of_logicals(std::ostream & out_, const std::string & print_logicals_options_ = "") const;
145 
147  int command_print_list_of_gids(std::ostream & out_, const std::string & print_gids_options_ = "") const;
148 
150  int command_print_list_of_categories(std::ostream & out_, const std::vector<std::string> & argv_) const;
151 
153  int command_print_model(const std::string & model_name_, std::ostream & out_) const;
154 
156  int command_print_logical(const std::string & logical_name_, std::ostream & out_) const;
157 
159  int command_print_list_of_display_data(std::ostream & out_, const std::vector<std::string> & argv_) const;
160 
162  int command_load_display_data(const std::vector<std::string> & argv_,
163  std::ostream & out_ = std::clog);
164 
166  int command_unload_display_data(const std::vector<std::string> & argv_,
167  std::ostream & out_ = std::clog);
168 
170  int command_clear_display_data(const std::vector<std::string> & argv_,
171  std::ostream & out_ = std::clog);
172 
173  // /// Set the rendering options attached to a logical volume given by name
174  // int command_set_rendering_options(const std::vector<std::string> & argv_,
175  // std::ostream & out_) const;
176 
178  int command_export_gdml(const std::vector<std::string> & argv_,
179  std::ostream & out_ = std::clog) const;
180 
181 #if GEOMTOOLS_WITH_GNUPLOT_DISPLAY == 1
182  int command_gnuplot_display(const std::vector<std::string> & argv_,
184  std::ostream & out_ = std::clog);
185 #endif // GEOMTOOLS_WITH_GNUPLOT_DISPLAY
186 
187 #if GEOMTOOLS_WITH_GNUPLOT_DISPLAY == 1
188  static std::string get_drawer_view (const std::string & view_label_);
190 #endif // GEOMTOOLS_WITH_GNUPLOT_DISPLAY
191 
193  static int export_gdml(const geomtools::manager & geo_mgr_,
194  const std::string & materials_plugin_name_ = "",
195  const std::string & top_mapping_model_name_ = "",
196  const std::string & gdml_file_= "",
197  bool replica_support_ = true,
198  bool root_display_ = false,
199  int root_vis_option_ = 1,
200  int root_vis_level_ = 100,
201  const std::string & root_top_volume_ = "",
203 
204  private:
205 
206  bool _initialized_ = false;
207  geomtools_driver_params _params_;
208 
209  // Geometry setup model:
210  std::unique_ptr<manager> _geo_mgr_;
211  std::unique_ptr<model_factory> _geo_factory_;
212  const model_factory * _geo_factory_ref_ = nullptr;
213  bool _has_world_ = false;
214  // std::map<std::string, datatools::properties> _ropts_; //!< Rendering options associated to displayed objects
215  std::map<std::string, display_data> _dds_;
216  std::vector<std::string> _error_message_stack_;
217 
218 
219  };
220 
221 } // end of namespace geomtools
222 
223 #endif // GEOMTOOLS_GEOMTOOLS_DRIVER_H
224 
225 // Local Variables: --
226 // mode: c++ --
227 // c-file-style: "gnu" --
228 // tab-width: 2 --
229 // End: --
int command_print_factory(std::ostream &out_) const
Print factory status.
int command_export_gdml(const std::vector< std::string > &argv_, std::ostream &out_=std::clog) const
Export to GDML format.
priority
Priority levels for logging from most to least critical.
Definition: logger.h:82
std::string geo_mgr_config_file
Definition: geomtools_driver.h:58
bool has_manager() const
Check for an embeded manager.
int command_print_list_of_categories(std::ostream &out_, const std::vector< std::string > &argv_) const
Print the list of registered geometry categories.
bool interactive
Definition: geomtools_driver.h:55
static int export_gdml(const geomtools::manager &geo_mgr_, const std::string &materials_plugin_name_="", const std::string &top_mapping_model_name_="", const std::string &gdml_file_="", bool replica_support_=true, bool root_display_=false, int root_vis_option_=1, int root_vis_level_=100, const std::string &root_top_volume_="", datatools::logger::priority logging_=datatools::logger::PRIO_WARNING)
Export to GDML format.
std::string LL_config
Definition: geomtools_driver.h:57
int command_print_mapping(std::ostream &out_, const std::string &mapping_name_="") const
Print mapping status.
int command_print_list_of_gids(std::ostream &out_, const std::string &print_gids_options_="") const
Print the list of registered GIDs.
void clear_error_message_stack()
Clear the error message stack.
geomtools_driver()
Constructor.
std::string top_mapping_model_name
Definition: geomtools_driver.h:62
int command_status(std::ostream &out_) const
Print driver status.
std::vector< std::string > mapping_excluded_categories
Definition: geomtools_driver.h:64
std::vector< std::string > LL_dlls
Definition: geomtools_driver.h:56
int command_unload_display_data(const std::vector< std::string > &argv_, std::ostream &out_=std::clog)
Unload a display data.
int32_t mapping_max_depth
Definition: geomtools_driver.h:65
bool mapping_requested
Definition: geomtools_driver.h:60
std::vector< std::string > setup_filenames
Definition: geomtools_driver.h:59
int command_print_logical(const std::string &logical_name_, std::ostream &out_) const
Print a logical volume given by name.
int command_print_manager(std::ostream &out_) const
Print manager status.
int command_print_list_of_logicals(std::ostream &out_, const std::string &print_logicals_options_="") const
Print the list of logicals volumes.
std::string materials_plugin_name
Definition: geomtools_driver.h:66
std::vector< std::string > mapping_only_categories
Definition: geomtools_driver.h:63
bool mute
Definition: geomtools_driver.h:54
Definition: geomtools_driver.h:77
Definition: geomtools_driver.h:43
virtual ~geomtools_driver()
Destructor.
int command_print_list_of_models(std::ostream &out_, const std::string &print_models_options_="") const
Print the list of geometry models.
int command_print_model(const std::string &model_name_, std::ostream &out_) const
Print a geometry model given by name.
datatools::logger::priority logging
Definition: geomtools_driver.h:53
Utilities for logging information.
Geometry manager for virtual geometry modelling. Main geometry manager for the modelisation of variou...
Definition: manager.h:70
int command_print_list_of_display_data(std::ostream &out_, const std::vector< std::string > &argv_) const
Print the list of embedded display data.
int command_initialize(const std::vector< std::string > &argv_, std::ostream &out_=std::clog)
The factory of geometry models.
Definition: model_factory.h:40
int command_clear_display_data(const std::vector< std::string > &argv_, std::ostream &out_=std::clog)
Unload several/all display data.
A warning. An operation completed with an unexpected result.
Definition: logger.h:88
void initialize(const geomtools_driver_params &)
Initialization from a dedicated structure.
std::string categories_filename
Definition: geomtools_driver.h:61
int parse(const std::vector< std::string > &argv_, std::ostream &out_=std::clog)
int command_load_display_data(const std::vector< std::string > &argv_, std::ostream &out_=std::clog)
Load a display data.
const std::vector< std::string > & get_error_message_stack() const
Return the error message stack.
bool is_initialized() const
Check initialization flag.
Top-level namespace of the Bayeux/geomtools module library.
Definition: electromagnetic_field_manager.h:39