Code_TYMPAN  4.4.0
Industrial site acoustic simulation
TYChemin.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_CHEMIN_9613__
17 #define __TY_CHEMIN_9613__
18 
19 #include <deque>
20 #include "TYEtape.h"
23 
31 enum class TYTypeChemin
32 {
34  CHEMIN_SOL,
37 };
38 
39 ::std::ostream& operator<<(::std::ostream& out, const TYTypeChemin& value);
40 
42 {
48  DZ_TOP,
49  DZ_LEFT,
50  DZ_RIGHT,
56 };
57 
59 {
62 };
63 
70 class TYChemin
71 {
72  // Methods
73 public:
78  TYChemin();
83  TYChemin(const TYChemin& other);
88  virtual ~TYChemin();
89 
91  TYChemin& operator=(const TYChemin& other);
93  bool operator==(const TYChemin& other) const;
95  bool operator!=(const TYChemin& other) const;
96 
110  void calcAttenuation(const TYTabEtape& tabEtapes, const AtmosphericConditions& atmos, double dp = 0.0,
111  double hs = 0.0, double hr = 0.0, double Gs = 0.5, double Gm = 0.5, double Gr = 0.5);
112 
117  void computeBarAttenuation(const OSpectreOctave& Dz, const bool vertical, const bool left);
118 
126 
127  // const OSpectreOctave& getAttenuation(TYTypeAttenuation type) const
128  // {
129  // return _attenuations[type];
130  //}
131 
132  // Kept for compatibility
133  // TODO delete when 9613 is over
135  {
136  return _attenuation;
137  }
138 
140  {
141  return _attenuation;
142  }
143 
148  void setAttenuation(const TYTypeAttenuation& type, const OSpectreOctave& att)
149  {
150  _attenuations[type] = att;
151  }
152 
157  void setAttenuationBarWhenNoPath(bool vertical, bool left);
158 
166  double getLongueur()
167  {
168  return _longueur;
169  }
170  const double getLongueur() const
171  {
172  return _longueur;
173  }
174 
175  void setLongueur(const double& longueur)
176  {
177  _longueur = longueur;
178  }
179 
188  double getDistance()
189  {
190  return _distance;
191  }
192  const double getDistance() const
193  {
194  return _distance;
195  }
196 
197  void setDistance(const double& distance)
198  {
199  _distance = distance;
200  }
201 
206  void setType(const TYTypeChemin& type)
207  {
208  _typeChemin = type;
209  }
210 
216  const TYTypeChemin getType() const
217  {
218  return _typeChemin;
219  }
220  // Members
225  void build_eq_path(const TYTabEtape& tabEtapes);
227 
228 protected:
231 
233  double _longueur;
234 
236  double _distance;
237 
239  std::map<TYTypeAttenuation, OSpectreOctave> _attenuations;
240 
241  // Kept for compatibility
242  // TODO delete when 9613 is over
244 
247 
248 private:
249  void calcGroundAttenuations(double distance, double hs, double hr, double Gs, double Gm, double Gr);
250  OSpectreOctave calcGroundAttenuationSR(double dp, double h, double G);
251  OSpectreOctave calcGroundAttenuationM(double q, double Gm);
252 };
253 
255 typedef std::deque<TYChemin> TYTabChemin;
256 
257 #endif // __TY_CHEMIN_9613__
TYTypeAttenuation
Definition: TYChemin.h:42
TYTypeChemin
Definition: TYChemin.h:32
::std::ostream & operator<<(::std::ostream &out, const TYTypeChemin &value)
Definition: TYChemin.cpp:249
std::deque< TYChemin > TYTabChemin
TYChemin collection.
Definition: TYChemin.h:255
std::deque< TYEtape > TYTabEtape
TYEtape collection.
Definition: TYEtape.h:193
Class for the definition of atmospheric conditions.
The 3D point class.
Definition: 3d.h:487
Representation of one of the most optimal path between source and receptor: S—>R. The class TYChemin ...
Definition: TYChemin.h:71
const double getDistance() const
Definition: TYChemin.h:192
OSpectreOctave calcGroundAttenuationM(double q, double Gm)
Definition: TYChemin.cpp:236
double getDistance()
Get/Set the distance between source and receptor.
Definition: TYChemin.h:188
double getLongueur()
Get/Set the path length.
Definition: TYChemin.h:166
const TYTypeChemin getType() const
Definition: TYChemin.h:216
double _distance
Direct distance between source and receptor.
Definition: TYChemin.h:236
OSpectreOctave & getAttenuation()
Return the path attenuation.
Definition: TYChemin.h:134
void calcAttenuation(const TYTabEtape &tabEtapes, const AtmosphericConditions &atmos, double dp=0.0, double hs=0.0, double hr=0.0, double Gs=0.5, double Gm=0.5, double Gr=0.5)
Definition: TYChemin.cpp:87
void computeBarAttenuation(const OSpectreOctave &Dz, const bool vertical, const bool left)
Definition: TYChemin.cpp:126
TYChemin()
Constructor.
Definition: TYChemin.cpp:19
bool operator==(const TYChemin &other) const
Operator ==.
Definition: TYChemin.cpp:53
virtual ~TYChemin()
Destructor.
Definition: TYChemin.cpp:30
TYTypeChemin _typeChemin
Path type (has an influence on the algorithm)
Definition: TYChemin.h:230
acoustic_path * _eq_path
Equivalent acoustic_path.
Definition: TYChemin.h:246
const OSpectreOctave & getAttenuation() const
Definition: TYChemin.h:139
bool operator!=(const TYChemin &other) const
Operator !=.
Definition: TYChemin.cpp:82
OSpectreOctave _attenuation
Definition: TYChemin.h:243
void setType(const TYTypeChemin &type)
Change the path type.
Definition: TYChemin.h:206
void setAttenuation(const TYTypeAttenuation &type, const OSpectreOctave &att)
Definition: TYChemin.h:148
void setDistance(const double &distance)
Definition: TYChemin.h:197
TYChemin & operator=(const TYChemin &other)
Operator =.
Definition: TYChemin.cpp:39
OSpectreOctave calcGroundAttenuationSR(double dp, double h, double G)
Definition: TYChemin.cpp:223
void setLongueur(const double &longueur)
Definition: TYChemin.h:175
void calcGroundAttenuations(double distance, double hs, double hr, double Gs, double Gm, double Gr)
Definition: TYChemin.cpp:205
const double getLongueur() const
Definition: TYChemin.h:170
void build_eq_path(const TYTabEtape &tabEtapes)
Definition: TYChemin.cpp:187
std::map< TYTypeAttenuation, OSpectreOctave > _attenuations
Attenuations spectra of the path.
Definition: TYChemin.h:239
void setAttenuationBarWhenNoPath(bool vertical, bool left)
Set attenuation bar to max to traduce the lack of diffracted ray on this path.
Definition: TYChemin.cpp:168
acoustic_path * get_ray(OPoint3D ptR)
Definition: TYChemin.cpp:196
double _longueur
Total path length.
Definition: TYChemin.h:233
Acoustic path.
Definition: acoustic_path.h:78
OSpectreOctave attenuation
Definition: TYChemin.h:61
TYTypeAttenuation type
Definition: TYChemin.h:60