Code_TYMPAN  4.2.0
Industrial site acoustic simulation
TYTrajet.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_TRAJET__
17 #define __TY_TRAJET__
18 
19 
20 #include "TYChemin.h"
25 #include <gtest/gtest_prod.h>
26 
35 class TYTrajet
36 {
37 
38  // Methods
39 public:
47 
52  TYTrajet(const TYTrajet& other);
57  virtual ~TYTrajet();
58 
60  TYTrajet& operator=(const TYTrajet& other);
62  bool operator==(const TYTrajet& other) const;
64  bool operator!=(const TYTrajet& other) const;
65 
70  void reset();
71 
78  double getDistance() { return _distance; }
79  const double getDistance() const { return _distance; }
80 
81  void setDistance(const double& distance) { _distance = distance; }
82 
88  size_t getNbChemins() { return _chemins.size(); }
89 
96 
103 
108  void addChemin(const TYChemin& chemin);
109 
114  void addCheminDirect(const TYChemin& chemin);
115 
121  TYChemin getChemin(int index) { return _chemins.at(index); }
122 
127  OSpectre getPNoOp();
128 
134  void setPtSetPtR(const OPoint3D& pt1, const OPoint3D& pt2) { _ptS = pt1; _ptR = pt2; }
135  void getPtSetPtR(OPoint3D& pt1, OPoint3D& pt2) { pt1 = _ptS; pt2 = _ptR; }
136 
142  void setPtSetPtRfromOSeg3D(const OSegment3D& seg) { _ptS = seg._ptA; _ptR = seg._ptB; }
143  void getPtSetPtRfromOSeg3D(OSegment3D& seg) const { seg._ptA = _ptS, seg._ptB = _ptR; }
144 
152  //TYSpectre& getSpectre() { return _sLP; }
153  //const TYSpectre getSpectre() const { return _sLP; }
154  //void setSpectre(const TYSpectre& spectre) { _sLP = spectre; }
155  OSpectre& getSpectre() { return _sLP; }
156  const OSpectre getSpectre() const { return _sLP; }
157  void setSpectre(const OSpectre& spectre) { _sLP = spectre; }
158 
159 
165 
171 
172  //Get the tab of rays
173  std::vector<acoustic_path*>& get_tab_rays();
174 private:
175  OSpectre correctTiers(const OSpectreComplex& si, const OSpectreComplex& sj, const AtmosphericConditions& atmos, const double& ri, const double& rj) const;
176  void build_tab_rays();
177  FRIEND_TEST(test_TYTrajet, getPInterference);
178  FRIEND_TEST(test_TYTrajet, getPEnergetique);
179 
180 public :
184 
188 
189 
190  // Members
191 protected:
194 
197 
200 
203 
205  double _distance;
206 
208  //TYSpectre _sLP;
210 
212  std::vector<acoustic_path*> _tabRays;
213 };
214 #endif // __TY_TRAJET__
This file provides the declaration of the entities of the model, which inherit from BaseEntity...
TYTabChemin _chemins
Paths collection.
Definition: TYTrajet.h:199
void setSpectre(const OSpectre &spectre)
Definition: TYTrajet.h:157
Representation of one of the most optimal path between source and receptor: S—>R. The class TYChemin represents a path between a Source and a receptor (Recepteur class). It&#39;s constituted of a collection of steps (TYEtape class).
Definition: TYChemin.h:38
void setDistance(const double &distance)
Definition: TYTrajet.h:81
size_t source_idx
Definition: entities.hpp:335
void setPtSetPtR(const OPoint3D &pt1, const OPoint3D &pt2)
Get/Set points for source and receptor.
Definition: TYTrajet.h:134
size_t getNbChemins()
Return the number of path in *this (in addition to the direct path).
Definition: TYTrajet.h:88
OSpectre getPInterference(const AtmosphericConditions &atmos)
Compute the quadratic pressure on the journey.
Definition: TYTrajet.cpp:181
void build_tab_rays()
Definition: TYTrajet.cpp:373
OPoint3D _ptB
Point B of the segment.
Definition: 3d.h:1199
OPoint3D _ptA
Point A of the segment.
Definition: 3d.h:1197
tympan::receptor_idx arcpt_idx
Definition: TYTrajet.h:187
void addChemin(const TYChemin &chemin)
Add a new path.
Definition: TYTrajet.cpp:96
OSpectre _sLP
Spectrum at the receptor point of the journey which integrates geometrical divergence and the source ...
Definition: TYTrajet.h:209
size_t receptor_idx
Definition: entities.hpp:353
OPoint3D _ptR
Receptor point definition in the site frame.
Definition: TYTrajet.h:196
TYTrajet & operator=(const TYTrajet &other)
Operator =.
Definition: TYTrajet.cpp:56
bool operator==(const TYTrajet &other) const
Operator ==.
Definition: TYTrajet.cpp:73
std::deque< TYChemin > TYTabChemin
TYChemin collection.
Definition: TYChemin.h:149
OSpectre getPEnergetique(const AtmosphericConditions &atmos)
Compute the acoustic pressure (phase modulation) on the journey.
Definition: TYTrajet.cpp:111
double getDistance()
Get/Set the distance between source and receptor.
Definition: TYTrajet.h:78
tympan::AcousticReceptor & arcpt
Business receptor.
Definition: TYTrajet.h:186
TYTabChemin _cheminsDirect
Direct paths collection (without obstacles)
Definition: TYTrajet.h:202
FRIEND_TEST(test_TYTrajet, getPInterference)
TYTrajet(tympan::AcousticSource &asrc_, tympan::AcousticReceptor &arcpt_)
Constructor.
Definition: TYTrajet.cpp:20
OSpectre & getSpectre()
Get/Set the spectrum at the receptor point.
Definition: TYTrajet.h:155
TYTabChemin & getCheminsDirect()
Return an array of the direct paths.
Definition: TYTrajet.h:102
void reset()
Reset method.
Definition: TYTrajet.cpp:49
void getPtSetPtRfromOSeg3D(OSegment3D &seg) const
Definition: TYTrajet.h:143
TYTabChemin & getChemins()
Return the collection of paths of *this.
Definition: TYTrajet.h:95
TYChemin getChemin(int index)
Return a path thanks to its index.
Definition: TYTrajet.h:121
void setPtSetPtRfromOSeg3D(const OSegment3D &seg)
Get/Set points for source and receptor with an OSegment3D.
Definition: TYTrajet.h:142
This class TYTrajet (journey) links a couple Source-Receptor and a collection of paths, in addition to the direct path.
Definition: TYTrajet.h:35
virtual ~TYTrajet()
Destructor.
Definition: TYTrajet.cpp:44
void getPtSetPtR(OPoint3D &pt1, OPoint3D &pt2)
Definition: TYTrajet.h:135
double _distance
Distance between source and receptor.
Definition: TYTrajet.h:205
void addCheminDirect(const TYChemin &chemin)
Add a new path to the array of direct paths.
Definition: TYTrajet.cpp:101
const OSpectre getSpectre() const
Definition: TYTrajet.h:156
OSpectre correctTiers(const OSpectreComplex &si, const OSpectreComplex &sj, const AtmosphericConditions &atmos, const double &ri, const double &rj) const
Definition: TYTrajet.cpp:338
const double getDistance() const
Definition: TYTrajet.h:79
OSpectre getPNoOp()
Return the attenuation without computation (computed by an external function)
Definition: TYTrajet.cpp:106
Describes an acoustic receptor.
Definition: entities.hpp:341
std::vector< acoustic_path * > _tabRays
Vector of rays equivalent to chemin.
Definition: TYTrajet.h:212
Representation of one of the most optimal path between source and receptor: S—>R.
Class to define a segment.
Definition: 3d.h:1087
tympan::source_idx asrc_idx
Definition: TYTrajet.h:183
OPoint3D _ptS
Source point definition in the site frame.
Definition: TYTrajet.h:193
Describes an acoustic source.
Definition: entities.hpp:315
The 3D point class.
Definition: 3d.h:484
Class for the definition of atmospheric conditions.
Store acoustic power values for different frequencies.
Definition: spectre.h:49
std::vector< acoustic_path * > & get_tab_rays()
Definition: TYTrajet.cpp:382
tympan::AcousticSource & asrc
Business source.
Definition: TYTrajet.h:182
bool operator!=(const TYTrajet &other) const
Operator !=.
Definition: TYTrajet.cpp:91