Code_TYMPAN  4.4.0
Industrial site acoustic simulation
TYChemin.cpp
Go to the documentation of this file.
1 /*
2  * Copyright (C) <2012-2024> <EDF-DTG> <FRANCE>
3  * This file is part of Code_TYMPAN (R).
4  * Code_TYMPAN (R) is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation, either version 3 of the License, or
7  * (at your option) any later version.
8  * Code_TYMPAN (R) is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
11  * See the GNU General Public License for more details.
12  * You should have received a copy of the GNU General Public License along
13  * with Code_TYMPAN (R). If not, see <https://www.gnu.org/licenses/>.
14  */
15 
16 #include "TYChemin.h"
18 
19 TYChemin::TYChemin() : _typeChemin(TYTypeChemin::CHEMIN_DIRECT), _longueur(0.0), _distance(0.0)
20 {
21  _eq_path = new acoustic_path();
22 }
23 
25 {
26  *this = other;
27 }
28 
30 {
31  if (tympan::SolverConfiguration::get()->KeepRays == false && _eq_path != nullptr)
32  {
34  }
35 }
36 
38 {
39  if (this != &other)
40  {
41  _typeChemin = other._typeChemin;
42  _distance = other._distance;
43  _longueur = other._longueur;
44  _eq_path = other._eq_path;
45  }
46 
47  return *this;
48 }
49 
50 bool TYChemin::operator==(const TYChemin& other) const
51 {
52  if (this != &other)
53  {
54  if (_typeChemin != other._typeChemin)
55  {
56  return false;
57  }
58  if (_distance != other._distance)
59  {
60  return false;
61  }
62  if (_longueur != other._longueur)
63  {
64  return false;
65  }
66  if (_eq_path != other._eq_path)
67  {
68  return false;
69  };
70  }
71 
72  return true;
73 }
74 
75 bool TYChemin::operator!=(const TYChemin& other) const
76 {
77  return !operator==(other);
78 }
79 
81 {
82  // Les chemins écran contiennent déjà le récepteur
84  {
85  acoustic_event* receptor_event = new acoustic_event();
86  receptor_event->pos = ptR;
87  receptor_event->type = TYRECEPTEUR;
88  _eq_path->addEvent(receptor_event);
89  }
90  return _eq_path;
91 }
92 
93 ::std::ostream& operator<<(::std::ostream& out, const TYTypeChemin& value)
94 {
95  static std::map<TYTypeChemin, std::string> strings;
96  if (strings.size() == 0)
97  {
98  strings[TYTypeChemin::CHEMIN_DIRECT] = "DIRECT";
99  strings[TYTypeChemin::CHEMIN_SOL] = "SOL";
100  strings[TYTypeChemin::CHEMIN_ECRAN] = "ECRAN";
101  strings[TYTypeChemin::CHEMIN_REFLEX] = "REFLEX";
102  }
103 
104  return out << strings[value];
105 }
::std::ostream & operator<<(::std::ostream &out, const TYTypeChemin &value)
Definition: TYChemin.cpp:93
Representation of one of the most optimal path between source and receptor: S—>R.
TYTypeChemin
Definition: TYChemin.h:31
@ TYRECEPTEUR
Definition: acoustic_path.h:29
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:66
double _distance
Direct distance between source and receptor.
Definition: TYChemin.h:176
TYChemin()
Constructor.
Definition: TYChemin.cpp:19
bool operator==(const TYChemin &other) const
Operator ==.
Definition: TYChemin.cpp:50
virtual ~TYChemin()
Destructor.
Definition: TYChemin.cpp:29
TYTypeChemin _typeChemin
Path type (has an influence on the algorithm)
Definition: TYChemin.h:170
bool operator!=(const TYChemin &other) const
Operator !=.
Definition: TYChemin.cpp:75
acoustic_path * _eq_path
Equivalent acoustic_path.
Definition: TYChemin.h:179
TYChemin & operator=(const TYChemin &other)
Operator =.
Definition: TYChemin.cpp:37
acoustic_path * get_ray(OPoint3D ptR)
Definition: TYChemin.cpp:80
double _longueur
Total path length.
Definition: TYChemin.h:173
This class store data and provide functions to manipulate event in the acoustic context.
Definition: acoustic_path.h:40
ACOUSTIC_EVENT_TYPES type
Event type.
Definition: acoustic_path.h:60
OPoint3D pos
Event position.
Definition: acoustic_path.h:53
Acoustic path.
Definition: acoustic_path.h:78
virtual void cleanEventsTab()
clean tab of events
virtual void addEvent(acoustic_event *TYEvent)
Add an event to the events list of the ray.
static LPSolverConfiguration get()
Get the configuration.
Definition: config.cpp:94
This file provides class for solver configuration.