Code_TYMPAN  4.4.0
Industrial site acoustic simulation
TYTrajet.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 
18 
20  : asrc(asrc_), arcpt(arcpt_), _distance(0.0)
21 {
22  _ptS = asrc.position;
25 }
26 
27 TYTrajet::TYTrajet(const TYTrajet& other) : asrc(other.asrc), arcpt(other.arcpt)
28 {
29  *this = other;
30  if (tympan::SolverConfiguration::get()->KeepRays == false)
31  {
32  for (unsigned int i = 0; i < _tabRays.size(); i++)
33  {
34  delete _tabRays.at(i);
35  _tabRays.at(i) = nullptr;
36  }
37  _tabRays.clear();
38  }
39 }
40 
42 
44 {
45  if (this != &other)
46  {
47  _ptS = other._ptS;
48  _ptR = other._ptR;
49  _distance = other._distance;
50  asrc = other.asrc;
51  arcpt = other.arcpt;
52  asrc_idx = other.asrc_idx;
53  arcpt_idx = other.arcpt_idx;
54  }
55  return *this;
56 }
57 
58 bool TYTrajet::operator==(const TYTrajet& other) const
59 {
60  if (this != &other)
61  {
62  if (_ptS != other._ptS)
63  {
64  return false;
65  }
66  if (_ptR != other._ptR)
67  {
68  return false;
69  }
70  if (_distance != other._distance)
71  {
72  return false;
73  }
74  // if (asrc != other.asrc) { return false; };
75  // if (arcpt != other.arcpt) ;
76  if (asrc_idx != other.asrc_idx)
77  {
78  return false;
79  };
80  if (arcpt_idx != other.arcpt_idx)
81  {
82  return false;
83  };
84  }
85 
86  return true;
87 }
88 
89 bool TYTrajet::operator!=(const TYTrajet& other) const
90 {
91  return !operator==(other);
92 }
93 
94 std::vector<acoustic_path*>& TYTrajet::get_tab_rays()
95 {
96  return _tabRays;
97 }
double distFrom(const OPoint3D &pt) const
Computes the distance from this point to another.
Definition: 3d.cpp:371
This class TYTrajet (journey) links a couple Source-Receptor and a collection of paths,...
Definition: TYTrajet.h:33
OPoint3D _ptS
Source point definition in the site frame.
Definition: TYTrajet.h:136
OPoint3D _ptR
Receptor point definition in the site frame.
Definition: TYTrajet.h:139
std::vector< acoustic_path * > _tabRays
Vector of rays equivalent to chemin.
Definition: TYTrajet.h:145
TYTrajet & operator=(const TYTrajet &other)
Operator =.
Definition: TYTrajet.cpp:43
tympan::AcousticSource & asrc
Business source.
Definition: TYTrajet.h:126
bool operator!=(const TYTrajet &other) const
Operator !=.
Definition: TYTrajet.cpp:89
tympan::source_idx asrc_idx
Definition: TYTrajet.h:127
virtual ~TYTrajet()
Destructor.
Definition: TYTrajet.cpp:41
tympan::receptor_idx arcpt_idx
Definition: TYTrajet.h:131
std::vector< acoustic_path * > & get_tab_rays()
Definition: TYTrajet.cpp:94
double _distance
Distance between source and receptor.
Definition: TYTrajet.h:142
bool operator==(const TYTrajet &other) const
Operator ==.
Definition: TYTrajet.cpp:58
tympan::AcousticReceptor & arcpt
Business receptor.
Definition: TYTrajet.h:130
TYTrajet(tympan::AcousticSource &asrc_, tympan::AcousticReceptor &arcpt_)
Constructor.
Definition: TYTrajet.cpp:19
Describes an acoustic receptor.
Definition: entities.hpp:403
Point position
Destructor.
Definition: entities.hpp:407
Describes an acoustic source.
Definition: entities.hpp:381
Point position
Destructor.
Definition: entities.hpp:386
static LPSolverConfiguration get()
Get the configuration.
Definition: config.cpp:94
This file provides class for solver configuration.