Code_TYMPAN  4.4.0
Industrial site acoustic simulation
acoustic_path.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) <2012> <EDF-R&D> <FRANCE>
3  * This program is free software; you can redistribute it and/or modify
4  * it under the terms of the GNU General Public License as published by
5  * the Free Software Foundation; either version 2 of the License, or
6  * (at your option) any later version.
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10  * See the GNU General Public License for more details.
11  * You should have received a copy of the GNU General Public License along
12  * with this program; if not, write to the Free Software Foundation, Inc.,
13  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
14  */
15 
16 #ifndef TY_MC_ACOUSTIC_PATH
17 #define TY_MC_ACOUSTIC_PATH
18 
20 
22 {
28  TYSOURCE = 16,
31 };
32 
33 class Event;
34 
40 {
41 public:
45  acoustic_event(const OPoint3D& pt);
47  acoustic_event(const acoustic_event& ev);
50 
52 
54  double distNextEvent;
55  double distEndEvent;
57  double distPrevNext;
58  double angle;
59  double angletheta;
61  int idFace1;
62  int idFace2;
67 };
68 
69 typedef std::vector<acoustic_event*> tab_acoustic_events;
70 
71 class Ray;
72 class IGeometryModifier;
73 
78 {
79 public:
81  acoustic_path();
83  virtual ~acoustic_path();
84 
91 
96  acoustic_path(const acoustic_path& ray);
97 
102  virtual void cleanEventsTab();
103 
108  virtual acoustic_path& operator=(const acoustic_path& other);
109 
114  virtual bool deepCopy(acoustic_path* pOther);
115 
120  virtual void setSource(unsigned int source_idx_, OPoint3D& globalPosition);
121 
126  virtual void setSource(unsigned int source_idx_)
127  {
128  source_idx = source_idx_;
129  }
130 
135  virtual unsigned int getSource_idx()
136  {
137  return source_idx;
138  }
139 
144  virtual void setRecepteur(unsigned int receptor_idx_, OPoint3D& globalPosition);
145 
150  virtual void setRecepteur(unsigned int receptor_idx_)
151  {
152  receptor_idx = receptor_idx_;
153  }
154 
159  virtual unsigned int getRecepteur_idx()
160  {
161  return receptor_idx;
162  }
163 
168  virtual void setIdentifiant(unsigned int id)
169  {
170  _identifiant = id;
171  }
172 
177  virtual unsigned int getIdentifiant() const
178  {
179  return _identifiant;
180  }
181 
186  virtual void addEvent(acoustic_event* TYEvent)
187  {
188  _events.push_back(TYEvent);
189  }
190 
196  {
197  return _events;
198  }
199  virtual const tab_acoustic_events& getEvents() const
200  {
201  return _events;
202  }
203 
209  virtual void setEvents(tab_acoustic_events& tabEvents)
210  {
211  _events = tabEvents;
212  }
213 
220  virtual std::vector<int> getIndexOfEvents(const int& eventType) const;
221 
226  virtual size_t getNbEventType(const ACOUSTIC_EVENT_TYPES& eventType)
227  {
228  return getIndexOfEvents(eventType).size();
229  }
230 
235  virtual void copyEvents(const acoustic_path* tyRay, ACOUSTIC_EVENT_TYPES eventType);
236 
242  virtual void setNextDistance(ACOUSTIC_EVENT_TYPES eventType);
243 
248  virtual void setAngles(ACOUSTIC_EVENT_TYPES eventType);
249 
254  virtual double getLength();
255 
260  virtual size_t getnbEvents()
261  {
262  return _events.size();
263  }
264 
269  virtual void setPosSourceGlobal(const OPoint3D& pos)
270  {
271  _posSourceGlobal = pos;
272  }
273 
279  {
280  return _posSourceGlobal;
281  }
282 
287  virtual void setPosReceptGlobal(const OPoint3D& pos)
288  {
289  _posReceptGlobal = pos;
290  }
291 
297  {
298  return _posReceptGlobal;
299  }
300 
302  static void set_sampler_step(double sampler_step_)
303  {
304  sampler_step = sampler_step_;
305  }
306 
313 
318  void compute_shot_angle();
319 
320 protected:
321  static double sampler_step;
322  unsigned int _identifiant;
323  unsigned int source_idx;
324  unsigned int receptor_idx;
327 
330 };
331 
332 typedef std::vector<acoustic_path*> tab_acoustic_path;
333 
334 #endif // TY_MC_ACOUSTIC_PATH
All base classes related to 3D manipulation.
int id
std::vector< acoustic_path * > tab_acoustic_path
ACOUSTIC_EVENT_TYPES
Definition: acoustic_path.h:22
@ TYREFLEXION
Definition: acoustic_path.h:25
@ TYRECEPTEUR
Definition: acoustic_path.h:29
@ TYSOURCE
Definition: acoustic_path.h:28
@ TY_NO_TYPE
Definition: acoustic_path.h:23
@ TYREFLEXIONSOL
Definition: acoustic_path.h:26
@ TYREFRACTION
Definition: acoustic_path.h:27
@ TY_ALL_TYPE
Definition: acoustic_path.h:30
@ TYDIFFRACTION
Definition: acoustic_path.h:24
std::vector< acoustic_event * > tab_acoustic_events
Definition: acoustic_path.h:69
Class describing an event (reflection, diffraction, ...)
Definition: Event.h:37
The 3D point class.
Definition: 3d.h:487
: Describes a ray by a pair of unsigned int. The first one gives the source number (in the range 0-40...
Definition: Ray.h:38
This class store data and provide functions to manipulate event in the acoustic context.
Definition: acoustic_path.h:40
double distNextEvent
Distance between this event and the next one in TYRay's list of events.
Definition: acoustic_path.h:54
acoustic_event & operator=(const acoustic_event &other)
ACOUSTIC_EVENT_TYPES type
Event type.
Definition: acoustic_path.h:60
double distEndEvent
Definition: acoustic_path.h:55
double distPrevNext
Distance between event-1 and event +1.
Definition: acoustic_path.h:57
OPoint3D pos
Event position.
Definition: acoustic_path.h:53
int idFace1
Face id on which the event happens (reflection & diffraction)
Definition: acoustic_path.h:61
double angle
Ray incident angle (for a shooting angle - plan x,z -)
Definition: acoustic_path.h:58
int idFace2
Face id on which the event happens (diffraction only)
Definition: acoustic_path.h:62
acoustic_event * next
Pointer to the next event in TYRay's list of events.
Definition: acoustic_path.h:64
acoustic_event()
Default constructor.
~acoustic_event()
Destructor.
acoustic_event * endEvent
Definition: acoustic_path.h:65
double angletheta
Shooting angle on a horizontal plane (x,y)
Definition: acoustic_path.h:59
acoustic_event * previous
Pointer to the previous event in TYRay's list of events.
Definition: acoustic_path.h:63
Acoustic path.
Definition: acoustic_path.h:78
OPoint3D _posReceptGlobal
Receptor position in the global frame.
virtual size_t getnbEvents()
Return the number of events of the ray.
static void set_sampler_step(double sampler_step_)
Set the sampler step.
virtual void cleanEventsTab()
clean tab of events
virtual void addEvent(acoustic_event *TYEvent)
Add an event to the events list of the ray.
virtual void setPosReceptGlobal(const OPoint3D &pos)
Set the receptor position in the global frame.
virtual ~acoustic_path()
Destructor.
virtual double getLength()
Return total length of the ray taking account of all events.
virtual size_t getNbEventType(const ACOUSTIC_EVENT_TYPES &eventType)
return the number of events of a type
static double sampler_step
max size of step between events after spatial sampling
virtual bool deepCopy(acoustic_path *pOther)
Deep copy of a ray mainly the events tab.
acoustic_path(unsigned int source_idx, unsigned int receptor_idx, tab_acoustic_events &_events)
Build the acoustic path with a source id, a receptor id and a list of acoustic events positions (refl...
unsigned int source_idx
Source id.
virtual unsigned int getIdentifiant() const
Get the ray id.
virtual void setNextDistance(ACOUSTIC_EVENT_TYPES eventType)
Compute distance between events of the type "eventType" and set distNextEvent to each event matching ...
virtual acoustic_path & operator=(const acoustic_path &other)
equal operator
virtual void setSource(unsigned int source_idx_, OPoint3D &globalPosition)
Set the ray source.
virtual void setSource(unsigned int source_idx_)
Set the ray source.
unsigned int _identifiant
Ray id.
virtual unsigned int getRecepteur_idx()
Get the receptor id.
OPoint3D _posSourceGlobal
Source position in the global frame.
acoustic_path()
Default constructor.
virtual void setRecepteur(unsigned int receptor_idx_, OPoint3D &globalPosition)
Set the ray receptor. The last polyline point is updated.
virtual void setEvents(tab_acoustic_events &tabEvents)
Set the events list of the ray.
virtual OPoint3D & getPosReceptGlobal()
Get the receptor position in the global frame.
virtual std::vector< int > getIndexOfEvents(const int &eventType) const
return a tab of indexes of events of the same type in a ray you can merge two types of events (exampl...
void compute_shot_angle()
Compute shot angle from source.
unsigned int receptor_idx
Receptor id.
virtual unsigned int getSource_idx()
Get the source id.
virtual const tab_acoustic_events & getEvents() const
virtual void setIdentifiant(unsigned int id)
Set the ray id.
virtual void setPosSourceGlobal(const OPoint3D &pos)
Set the source position in the global frame.
virtual void copyEvents(const acoustic_path *tyRay, ACOUSTIC_EVENT_TYPES eventType)
copy only events matching eventType to _events tab
virtual void setRecepteur(unsigned int receptor_idx_)
Set the ray receptor.
void build_links_between_events()
TYRayEvent has to know is direct neighbourg (before and after him)
virtual OPoint3D & getPosSourceGlobal()
Get the source position in the global frame.
tab_acoustic_events _events
Events vector containing the events list (and their positions) of the associated ray.
virtual tab_acoustic_events & getEvents()
Get the events list of the ray.
virtual void setAngles(ACOUSTIC_EVENT_TYPES eventType)
Compute angles of incoming ray segment at event point.