Code_TYMPAN  4.2.0
Industrial site acoustic simulation
TYMaillage.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_Maillage__
17 #define __TY_Maillage__
18 
19 
20 #include "Tympan/core/defines.h"
25 
26 class TYCalcul;
27 
29 static const double TY_MAILLAGE_DEFAULT_DENSITE = 0.1; // 1 point tous les 10m
30 
31 struct MPoint
32 {
35 };
36 
37 struct MTriangle
38 {
39  MPoint pts[3];
40 };
41 
51 class TYMaillage: public TYElement
52 {
55 
56  // Methodes
57 public:
63  TYMaillage();
64 
70  TYMaillage(const TYMaillage& other);
71 
77  virtual ~TYMaillage();
78 
80  TYMaillage& operator=(const TYMaillage& other);
81 
83  bool operator==(const TYMaillage& other) const;
84 
86  bool operator!=(const TYMaillage& other) const;
87 
88  virtual bool deepCopy(const TYElement* pOther, bool copyId = true, bool pUseCopyTag = false);
89 
90  virtual std::string toString() const;
91 
92  virtual DOM_Element toXML(DOM_Element& domElement);
93  virtual int fromXML(DOM_Element domElement);
94 
98  void exportCSV(const std::string& fileName);
99 
103  virtual void clearResult();
104 
109  virtual void updateFromCalcul(LPTYCalcul pCalcul);
110 
116  TYTabLPPointCalcul& getPtsCalcul() { return _ptsCalcul; }
117 
121  const TYTabLPPointCalcul& getPtsCalcul() const { return _ptsCalcul; }
122 
126  void setPtsCalcul(const TYTabLPPointCalcul& list) { _ptsCalcul = list; setIsGeometryModified(true); }
127 
133  bool addPointCalcul(LPTYPointCalcul pPtCalcul);
134 
140  bool remPointCalcul(const LPTYPointCalcul pPtCalcul);
141 
147  bool remPointCalcul(QString idPtCalcul);
148 
153  void remAllPointCalcul();
154 
161  void setHauteur(double hauteur) { _hauteur = hauteur; setIsGeometryModified(true); }
162 
167  double getHauteur() const { return _hauteur; }
168 
175  void setComputeAlti(bool state) { _computeAlti = state; setIsGeometryModified(true); }
176 
181  bool getComputeAlti() const { return _computeAlti; }
182 
189  void setDataType(int type) { _dataType = type; setIsGeometryModified(true); }
193  int getDataType() { return _dataType; }
194 
201  void setDataFreq(float freq) { _dataFreq = freq; setIsGeometryModified(true); }
205  float getDataFreq() { return _dataFreq; }
206 
213  void setPalette(LPTYPalette pPalette) { _pPalette = pPalette; }
214  LPTYPalette getPalette() { return _pPalette; }
215 
220  void setPanel(LPTYPanel pPanel) { _pPanel = pPanel; }
221 
227  LPTYPanel getPanel() { return _pPanel; }
228 
233  void make(const TYTabPoint& points);
234 
243  {
246  DataFreq
247  };
248 
256  {
258  Inactif
259  };
260 
261  static bool checkSimilar(const TYMaillage* const pMaillage1, const TYMaillage* const pMaillage2);
262 
272  void computeMesh(std::vector<MTriangle> &mesh) const;
273 
281  MTriangle computeTriangle(TYPointCalcul& pt1, TYPointCalcul& pt2, TYPointCalcul& pt3) const;
282 
288  double getSpectrumValue(TYPointCalcul& pt) const;
289 
301  void computeIsoCurve(std::vector<MTriangle> &mesh, std::vector<MPoint> &isoCurve) const;
302 
315  bool computeIsoPoint(const OHPlane3D& plane, const MPoint& pt1, const MPoint& pt2, MPoint& mp) const;
316 
323  virtual int getIndexPtCalcul(int x, int y) const {return 0;}
324 
330  virtual void getDimensions(int& x, int& y) const {}
331 
335  virtual void setEtat(const TYUUID& id_calc, bool etat);
336  virtual bool etat();
337  virtual bool etat(const TYUUID& id_calc);
338  virtual bool etat(const TYCalcul* pCalc);
339 
341  void copyEtats(TYMaillage* pOther);
342 
348  void duplicateEtat(const TYUUID& idCalculRef, const TYUUID& idCalculNew);
349 
351  bool remEtat(TYCalcul* pCalcul);
352 
353  // Membres
354 protected:
357 
360 
362  double _hauteur;
363 
366 
369 
371  float _dataFreq;
372 
375 
378 };
379 
380 
386 typedef std::vector<LPTYMaillageGeoNode> TYTabMaillageGeoNode;
388 typedef std::vector<LPTYMaillage> TYTabLPMaillage;
389 
390 
391 #endif // __TY_Maillage__
bool _computeAlti
Indique si l&#39;altitude des points constituant ce maillage doit etre calculee.
Definition: TYMaillage.h:365
TYMapIdBool _tabEtats
L&#39;etat du maillage pour un calcul donne.
Definition: TYMaillage.h:359
MaillageDataType
Les differents type pour les donnees a representer.
Definition: TYMaillage.h:242
The 3D vector class.
Definition: 3d.h:296
The 3D Plane class using Hessian normal form.
Definition: 3d.h:1507
QDomElement DOM_Element
Definition: QT2DOM.h:31
LPTYPanel _pPanel
Panel.
Definition: TYMaillage.h:377
float _dataFreq
La frequence des donnees a representer lorsque _dataType vaut DataFreq.
Definition: TYMaillage.h:371
std::vector< LPTYPointCalcul > TYTabLPPointCalcul
Collection de pointeurs de TYPointCalcul.
Definition: TYDefines.h:363
void setHauteur(double hauteur)
Set/Get de la hauteur de ce maillage par rapport au sol (a l&#39;altimetrie en fait). ...
Definition: TYMaillage.h:161
OVector3D pt
Definition: TYMaillage.h:33
MaillageState
Etat du Maillage : Actif / Bloque.
Definition: TYMaillage.h:255
virtual void getDimensions(int &x, int &y) const
Return the dimensions in x and y (should be pure virtual)
Definition: TYMaillage.h:330
void setPalette(LPTYPalette pPalette)
Set/Get de la palette.
Definition: TYMaillage.h:213
std::vector< LPTYMaillageGeoNode > TYTabMaillageGeoNode
Collection de noeuds geometriques de type TYMaillage.
Definition: TYMaillage.h:386
Programme de calcul.
Definition: TYCalcul.h:49
void setComputeAlti(bool state)
Set/Get de l&#39;indicateur de calcul de l&#39;altitude des points de ce maillage.
Definition: TYMaillage.h:175
std::vector< LPTYMaillage > TYTabLPMaillage
Collection de maillages.
Definition: TYMaillage.h:388
TYTabLPPointCalcul _ptsCalcul
Liste des points de calcul.
Definition: TYMaillage.h:356
std::vector< TYPoint > TYTabPoint
Collection de TYPoint.
Definition: TYDefines.h:345
#define OPROTODECL(classname)
Definition: TYElement.h:67
double _hauteur
La hauteur par rapport au sol (a l&#39;altimetrie en fait) a laquelle se trouve ce maillage.
Definition: TYMaillage.h:362
SmartPtr< TYMaillageGeoNode > LPTYMaillageGeoNode
Smart Pointer sur TYMaillageGeoNode.
Definition: TYMaillage.h:384
std::map< TYUUID, bool > TYMapIdBool
Tableau associant un booleen a un id (identifiant d&#39;objet)
Definition: TYDefines.h:378
float values_type
The real number type used to store values (typically double or float)
Definition: TYPalette.h:50
#define TY_EXTENSION_DECL_ONLY(classname)
Definition: TYElement.h:375
void setDataFreq(float freq)
Set/Get de la frequence des donnees a representer lorsque _dataType vaut DataFreq.
Definition: TYMaillage.h:201
void setPanel(LPTYPanel pPanel)
Set du panel.
Definition: TYMaillage.h:220
int getDataType()
Definition: TYMaillage.h:193
LPTYPalette _pPalette
Palette.
Definition: TYMaillage.h:374
void setDataType(int type)
Set/Get de l&#39;indicateur de type des donnees a representer.
Definition: TYMaillage.h:189
float getDataFreq()
Definition: TYMaillage.h:205
double getHauteur() const
Definition: TYMaillage.h:167
class OGenID TYUUID
Definition: TYDefines.h:63
TYGeometryNode TYMaillageGeoNode
Noeud geometrique de type TYMaillage.
Definition: TYMaillage.h:382
bool getComputeAlti() const
Definition: TYMaillage.h:181
Classe de definition d&#39;un maillage.
Definition: TYMaillage.h:51
const TYTabLPPointCalcul & getPtsCalcul() const
Definition: TYMaillage.h:121
Classe de definition d&#39;un point de calcul.C&#39;est une classe derivee a TYPoint avec en plus un spectrep...
Definition: TYPointCalcul.h:33
TYTabLPPointCalcul & getPtsCalcul()
Set/Get de la liste des points de calcul.
Definition: TYMaillage.h:116
virtual int getIndexPtCalcul(int x, int y) const
Return the index (should be pure virtual)
Definition: TYMaillage.h:323
void setPtsCalcul(const TYTabLPPointCalcul &list)
Definition: TYMaillage.h:126
LPTYPanel getPanel()
Get du panel.
Definition: TYMaillage.h:227
int _dataType
Indique le type des donnees a representer.
Definition: TYMaillage.h:368
LPTYPalette getPalette()
Definition: TYMaillage.h:214
TYPalette::values_type scalar
Definition: TYMaillage.h:34