Bayeux  3.4.1
Core Foundation library for SuperNEMO
multi_zone_field.h
Go to the documentation of this file.
1 /* Author(s): Francois Mauger <mauger@lpccaen.in2p3.fr>
3  * Creation date: 2015-04-19
4  * Last modified: 2015-04-19
5  *
6  * License:
7  *
8  * Description:
9  *
10  * Multi zone field
11  *
12  * History:
13  *
14  */
15 
16 #ifndef EMFIELD_MULTI_ZONE_FIELD_H
17 #define EMFIELD_MULTI_ZONE_FIELD_H 1
18 
19 // Standard library:
20 #include <string>
21 #include <vector>
22 #include <map>
23 
24 // Third party:
25 // - Bayeux/geomtools:
26 #include <geomtools/placement.h>
27 #include <geomtools/i_shape_3d.h>
29 
30 // This project:
32 
33 namespace emfield {
34 
40  {
41  public:
42 
52  };
53 
55  static std::string zone_priority_to_label(zone_priority_type);
56 
58  static zone_priority_type label_to_zone_priority(const std::string &);
59 
62  public:
63 
66 
68  void reset();
69 
70  protected:
71 
73  void _set_defaults();
74 
76  static bool _higher_zone_priority(const zone_field_entry * zfe1_,
77  const zone_field_entry * zfe2_);
78 
79  private:
80 
81  std::string _label_;
82  geomtools::placement _zone_positioning_;
83  double _zone_tolerance_;
84  const geomtools::i_shape_3d * _zone_shape_;
85  const base_electromagnetic_field * _zone_field_;
86  bool _absolute_positioning_;
87  zone_priority_type _priority_;
88 
89  friend class multi_zone_field;
90  };
91 
93  typedef std::map<std::string, zone_field_entry> zone_field_dict_type;
94 
96  multi_zone_field(uint32_t = 0);
97 
99  virtual ~multi_zone_field();
100 
102  virtual void initialize(const ::datatools::properties &,
105 
107  virtual void reset();
108 
111  double time_,
112  ::geomtools::vector_3d & electric_field_) const;
113 
116  double time_,
117  geomtools::vector_3d & magnetic_field_) const;
118 
120  void add_zone_field(const std::string & zone_label_,
121  const geomtools::placement & zone_positioning_,
122  const geomtools::i_shape_3d & zone_shape_,
123  double zone_tolerance_,
124  const base_electromagnetic_field & zone_field_,
125  bool absolute_positioning_ = true,
127 
129  const zone_field_entry & get_zone_field(const std::string & zone_label_) const;
130 
132  void fine_zones(const geomtools::vector_3d & position_,
133  std::vector<const zone_field_entry *> & zones_) const;
134 
136  bool owns_shape_factory() const;
137 
139  bool has_shape_factory() const;
140 
142  void reset_shape_factory();
143 
145  void set_shape_factory(const geomtools::shape_factory & shfact_);
146 
148  void create_shape_factory(const ::datatools::properties & setup_);
149 
151  virtual void tree_dump (std::ostream & out_ = std::clog,
152  const std::string & title_ = "",
153  const std::string & indent_ = "",
154  bool inherit_ = false) const;
155 
156  protected:
157 
159  void _set_defaults();
160 
161  private:
162 
163  bool _own_shape_factory_;
164  geomtools::shape_factory * _shape_factory_;
165  zone_field_dict_type _zone_fields_;
166 
167  // Macro to automate the registration of the EM field :
169 
170  };
171 
172 } // end of namespace emfield
173 
174 #endif // EMFIELD_MULTI_ZONE_FIELD_H
175 
176 // Local Variables: --
177 // mode: c++ --
178 // c-file-style: "gnu" --
179 // tab-width: 2 --
180 // End: --
Definition: multi_zone_field.h:49
void _set_defaults()
Set default values to attributes.
#define EMFIELD_REGISTRATION_INTERFACE(EMFIELD_CLASS_NAME)
Definition: electromagnetic_field_macros.h:157
const zone_field_entry & get_zone_field(const std::string &zone_label_) const
Return the zone field entry associated to a given label.
static bool _higher_zone_priority(const zone_field_entry *zfe1_, const zone_field_entry *zfe2_)
Check if a zone field entry has higher priority than another one.
bool has_shape_factory() const
Check if the shape factory is set.
void _set_defaults()
Set default attributes values.
The factory of shapes.
Definition: shape_factory.h:36
Definition: multi_zone_field.h:50
void reset()
Reset.
Mother abstract class for all 3D solid shapes.
Definition: i_shape_3d.h:46
bool owns_shape_factory() const
Check the ownership flag for the shape factory.
Definition: multi_zone_field.h:45
void reset_shape_factory()
Reset the shape factory.
The information associated to a given zone.
Definition: multi_zone_field.h:61
multi_zone_field(uint32_t=0)
Default constructor.
zone_priority_type
Definition: multi_zone_field.h:43
void fine_zones(const geomtools::vector_3d &position_, std::vector< const zone_field_entry * > &zones_) const
Find all zones where a position lies.
std::map< std::string, handle_type > field_dict_type
Definition: base_electromagnetic_field.h:49
void set_shape_factory(const geomtools::shape_factory &shfact_)
Set an external shape factory.
Abstract base class for all electromagnetic field.
Definition: base_electromagnetic_field.h:43
void create_shape_factory(const ::datatools::properties &setup_)
Create an embedded shape factory.
static std::string zone_priority_to_label(zone_priority_type)
Return the label associated to a given zone priority.
Definition: multi_zone_field.h:46
virtual int compute_magnetic_field(const ::geomtools::vector_3d &position_, double time_, geomtools::vector_3d &magnetic_field_) const
Compute magnetic field.
zone_field_entry()
Default constructor.
virtual ~multi_zone_field()
Destructor.
virtual void initialize(const ::datatools::properties &, ::datatools::service_manager &, ::emfield::base_electromagnetic_field::field_dict_type &)
Initialization.
A class that computes the value of the EM field that depends on the position with respect to the coor...
Definition: multi_zone_field.h:39
void add_zone_field(const std::string &zone_label_, const geomtools::placement &zone_positioning_, const geomtools::i_shape_3d &zone_shape_, double zone_tolerance_, const base_electromagnetic_field &zone_field_, bool absolute_positioning_=true, zone_priority_type priority_=ZONE_PRIORITY_DEFAULT)
Add a zone field.
virtual void reset()
Reset.
std::map< std::string, zone_field_entry > zone_field_dict_type
Type alias for a dictionary of zone fields.
Definition: multi_zone_field.h:93
Top-level namespace of the Bayeux/emfield module library.
Definition: base_electromagnetic_field.h:40
Definition: multi_zone_field.h:51
Definition: multi_zone_field.h:44
virtual int compute_electric_field(const ::geomtools::vector_3d &position_, double time_, ::geomtools::vector_3d &electric_field_) const
Compute electric field.
CLHEP::Hep3Vector vector_3d
Alias for the CLHEP 3D-vector class.
Definition: clhep.h:63
The placement for a geometry volume with its translation and rotation with respect to some mother ref...
Definition: placement.h:34
static zone_priority_type label_to_zone_priority(const std::string &)
Return the zone priority associated to a given label.
Service management class.
Definition: service_manager.h:57
Definition: multi_zone_field.h:47
virtual void tree_dump(std::ostream &out_=std::clog, const std::string &title_="", const std::string &indent_="", bool inherit_=false) const
Smart print.