Code_TYMPAN  4.4.0
Industrial site acoustic simulation
TYAcousticFaceSet.cpp
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 #if TY_USE_IHM
18 #endif
19 #include "TYAcousticFaceSet.h"
20 
22 
24 {
26 
28  _pMateriau->setParent(this);
29 }
30 
32 {
33  *this = other;
34 }
35 
37 
39 {
40  if (this != &other)
41  {
43  _faces = other._faces;
44  }
45  return *this;
46 }
47 
49 {
50  if (this != &other)
51  {
52  if (TYAcousticVolume::operator!=(other))
53  {
54  return false;
55  }
56  if (_faces != other._faces)
57  {
58  return false;
59  }
60  }
61  return true;
62 }
63 
65 {
66  return !operator==(other);
67 }
68 
69 bool TYAcousticFaceSet::deepCopy(const TYElement* pOther, bool copyId /*=true*/, bool pUseCopyTag /*=false*/)
70 {
71  if (!TYAcousticVolume::deepCopy(pOther, copyId))
72  {
73  return false;
74  }
75 
76  _faces.deepCopy(&((TYAcousticFaceSet*)pOther)->_faces, copyId);
77  return true;
78 }
79 
80 std::string TYAcousticFaceSet::toString() const
81 {
82  return "TYAcousticFaceSet";
83 }
84 
86 {
87  DOM_Element domNewElem = TYAcousticVolume::toXML(domElement);
88  _faces.toXML(domNewElem); // les faces sont reconstruites depuis le squelette dans TYEcran
89  return domNewElem;
90 }
91 
93 {
94  TYAcousticVolume::fromXML(domElement);
95  _faces.fromXML(domElement);
96  return 1;
97 }
98 
99 DOM_Element TYAcousticFaceSet::toXML(DOM_Element& domElement, bool withfaces)
100 {
101  DOM_Element domNewElem = TYAcousticVolume::toXML(domElement);
102 
103  if (withfaces)
104  {
105  _faces.toXML(domNewElem);
106  }
107 
108  return domNewElem;
109 }
110 
111 int TYAcousticFaceSet::fromXML(DOM_Element domElement, bool withfaces)
112 {
113  TYAcousticVolume::fromXML(domElement);
114 
115  if (withfaces)
116  {
117  _faces.fromXML(domElement);
118  }
119 
120  return 1;
121 }
122 
123 void TYAcousticFaceSet::getChilds(LPTYElementArray& childs, bool recursif /*=true*/) {}
124 
126 {
128 }
129 
131 {
132  setIsAcousticModified(true);
133 
135 }
136 
138 {
140 }
141 
143 {
144  return TYSourcePonctuelle();
145 }
146 
148 
150 
152 {
153  return false;
154 }
155 
156 bool TYAcousticFaceSet::updateAcoustic(const bool& force) // force = false
157 {
158  return true;
159 }
160 
162 {
163  return _faces.activeSurface();
164 }
165 
167 {
168  return _faces.activeSurface();
169 }
170 
172 {
173  return _faces.volume();
174 }
175 
177 {
178  return _faces.surface();
179 }
180 
182 {
183  return _faces.normals();
184 }
185 
187 {
188  return _faces.sommets();
189 }
190 
192 {
193  return _faces.faces();
194 }
195 
197 {
198  return _faces.volEnglob();
199 }
200 
202 {
203  return _faces.centreGravite();
204 }
205 
207 {
208  return _faces.intersects(seg, ptList);
209 }
210 
211 int TYAcousticFaceSet::intersects(const TYSegment& seg, TYTabPoint& ptList) const
212 {
213  OPoint3D ptA(seg._ptA._x, seg._ptA._y, seg._ptA._z);
214  OPoint3D ptB(seg._ptB._x, seg._ptB._y, seg._ptB._z);
215  OSegment3D oSeg(ptA, ptB);
216  return _faces.intersects(oSeg, ptList);
217 }
218 
220 {
221  return _faces.isInside(pt);
222 }
223 
225 {
227 }
228 
230 {
231  return false;
232 }
233 
234 TYSpectre TYAcousticFaceSet::setGlobalLW(const TYSpectre& spectre, const double& surfGlobale,
235  const int& regime /*=-1*/)
236 {
237  TYSpectre LWv;
238 
240  {
241  double surfOfVol = activeSurface();
242  LWv =
243  spectre.toGPhy().mult(surfOfVol / surfGlobale).toDB(); // Spectre pondere de la surface du volume
244 
245  setRegime(LWv, regime, false);
246  }
247 
248  return getCurrentSpectre().toGPhy(); // On retourne le spectre obtenu
249 }
250 
252 {
253  TYTabLPAcousticSurface tabSubFaces;
254  return tabSubFaces;
255 }
256 
258 {
259  _pMateriau = pMat;
260 
261  if (_pMateriau)
262  {
263  _pMateriau->setParent(this);
264  }
265 
266  setIsGeometryModified(true);
267 }
268 
269 void TYAcousticFaceSet::setIsRayonnant(bool rayonnant, bool recursif)
270 {
272 }
QDomElement DOM_Element
Definition: QT2DOM.h:30
TY_EXTENSION_INST(TYAcousticFaceSet)
std::vector< LPTYAcousticSurface > TYTabLPAcousticSurface
Tableau de TYAcousticSurfaces.
std::vector< LPTYAcousticSurfaceGeoNode > TYTabAcousticSurfaceGeoNode
Collection de noeuds geometriques de type TYAcousticSurface.
std::vector< TYPoint > TYTabPoint
Collection de TYPoint.
Definition: TYDefines.h:340
std::vector< OVector3D > TYTabVector
Collection de OVector3D.
Definition: TYDefines.h:398
std::vector< LPTYPolygon > TYTabLPPolygon
Collection de pointeurs de TYPolygon.
Definition: TYDefines.h:349
std::vector< LPTYElement > LPTYElementArray
Definition: TYElement.h:345
std::vector< LPTYSourcePonctuelleGeoNode > TYTabSourcePonctuelleGeoNode
Collection de noeuds geometriques de type TYSourcePonctuelle.
double _y
y coordinate of OCoord3D
Definition: 3d.h:283
double _z
z coordinate of OCoord3D
Definition: 3d.h:284
double _x
x coordinate of OCoord3D
Definition: 3d.h:282
The 4x4 matrix class.
Definition: 3d.h:625
The 3D point class.
Definition: 3d.h:487
virtual const char * getClassName() const
Definition: TYElement.h:249
Class to define a segment.
Definition: 3d.h:1089
OPoint3D _ptA
Point A of the segment.
Definition: 3d.h:1201
OPoint3D _ptB
Point B of the segment.
Definition: 3d.h:1203
OSpectreAbstract & toGPhy() const
Converts to physical quantity.
Definition: spectre.cpp:634
OSpectreAbstract & toDB() const
Converts to dB.
Definition: spectre.cpp:590
OSpectreAbstract & mult(const OSpectreAbstract &spectre) const
Multiplication of two spectrums.
Definition: spectre.cpp:243
virtual TYSourcePonctuelle srcPonctEquiv() const
bool operator==(const TYAcousticFaceSet &other) const
Operateur ==.
bool operator!=(const TYAcousticFaceSet &other) const
Operateur !=.
virtual int isInside(const TYPoint &pt) const
virtual void propagateAtt(LPTYAttenuateur pAtt)
virtual int intersects(const OSegment3D &seg, TYTabPoint &ptList) const
virtual double activeSurface() const
virtual void distriSrcs()
virtual int fromXML(DOM_Element domElement)
virtual TYTabLPAcousticSurface getSubFace()
virtual void remAllSrcs()
virtual TYBox volEnglob() const
virtual bool deepCopy(const TYElement *pOther, bool copyId=true, bool pUseCopyTag=false)
virtual DOM_Element toXML(DOM_Element &domElement)
virtual void getChilds(LPTYElementArray &childs, bool recursif=true)
virtual void propagateRegime()
virtual bool setSrcsLw()
virtual TYTabVector normals() const
TYAcousticFaceSet & operator=(const TYAcousticFaceSet &other)
Operateur =.
virtual TYTabPoint sommets() const
virtual TYPoint centreGravite() const
virtual TYTabLPPolygon faces() const
virtual TYTabSourcePonctuelleGeoNode getSrcs() const
virtual TYTabAcousticSurfaceGeoNode acousticFaces()
void setMateriau(LPTYMateriauConstruction pMat)
virtual double volume() const
virtual std::string toString() const
virtual bool findAcousticSurface(const TYAcousticSurface *pAccSurf, OMatrix *pMatrix=0)
virtual bool updateAcoustic(const bool &force=false)
virtual double surface() const
TYFaceSet _faces
Ensemble des faces.
virtual void setIsRayonnant(bool rayonnant=true, bool recursif=true)
virtual TYSpectre setGlobalLW(const TYSpectre &spectre, const double &surfGlobale, const int &regime=-1)
int _typeDistribution
Indique le type de distribution a utiliser. pour l'etat courant.
TYSpectre & getCurrentSpectre()
virtual void setRegime(TYSpectre &Spectre, int regime=-1, bool recursif=false)
virtual void setIsRayonnant(bool rayonnant=true, bool recursif=true)
LPTYMateriauConstruction _pMateriau
Materiau de contruction pour les faces de ce Volume.
virtual void propagateRegime()
TYAcousticVolume & operator=(const TYAcousticVolume &other)
Operateur =.
virtual DOM_Element toXML(DOM_Element &domElement)
virtual int fromXML(DOM_Element domElement)
virtual bool deepCopy(const TYElement *pOther, bool copyId=true, bool pUseCopyTag=false)
virtual void propagateAtt(LPTYAttenuateur pAtt)
virtual void setIsAcousticModified(bool isModified)
Definition: TYBox.h:34
QString _name
Nom courant de l'element.
Definition: TYElement.h:966
void setParent(TYElement *pParent)
Definition: TYElement.h:692
virtual void setIsGeometryModified(bool isModified)
Definition: TYElement.cpp:253
virtual DOM_Element toXML(DOM_Element &domElement)
Definition: TYFaceSet.cpp:130
virtual double volume() const
Definition: TYFaceSet.cpp:172
virtual int intersects(const OSegment3D &seg, TYTabPoint &ptList) const
Definition: TYFaceSet.cpp:254
virtual TYPoint centreGravite() const
Definition: TYFaceSet.cpp:221
virtual double surface() const
Definition: TYFaceSet.cpp:183
virtual bool deepCopy(const TYElement *pOther, bool copyId=true, bool pUseCopyTag=false)
Definition: TYFaceSet.cpp:89
virtual TYTabVector normals() const
Definition: TYFaceSet.cpp:206
virtual int isInside(const TYPoint &pt) const
Definition: TYFaceSet.cpp:259
virtual int fromXML(DOM_Element domElement)
Definition: TYFaceSet.cpp:146
virtual TYTabLPPolygon faces() const
Definition: TYFaceSet.cpp:216
virtual TYTabPoint sommets() const
Definition: TYFaceSet.cpp:211
virtual double activeSurface() const
Definition: TYFaceSet.cpp:194
QString generateName(const char *classname)
Retourne le nom de la classe associe a un nombre.
static TYNameManager * get()
Retourne l'instance singleton.
virtual TYBox volEnglob() const