Code_TYMPAN  4.4.0
Industrial site acoustic simulation
TYCalcul.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 /*
17  *
18  */
19 
20 /* ==============================================================================
21  TO DO :
22  1. Save _geomPrecision in XML
23  ============================================================================= */
24 
25 #ifndef __TY_CALCUL__
26 #define __TY_CALCUL__
27 
28 #include <memory>
29 
35 
36 class TYProjet;
37 
49 class TYCalcul : public TYElement
50 {
54 
55 public:
61  {
64  };
65 
66  TYCalcul();
67 
69  // * \brief build a calcul giving his parent.
70  // * Constructor of the TYCalcul class.
71  // * \param LPTYProjet pParent=Nulle
72  // */
73  // TYCalcul(LPTYProjet pParent);
74 
80  TYCalcul(const TYCalcul& other);
81 
86  virtual ~TYCalcul();
87 
89  TYCalcul& operator=(const TYCalcul& other);
91  bool operator==(const TYCalcul& other) const;
93  bool operator!=(const TYCalcul& other) const;
94 
108  virtual bool deepCopy(const TYElement* pOther, bool copyId = true, bool pUseCopyTag = false);
109 
110  virtual std::string toString() const;
111 
112  virtual DOM_Element toXML(DOM_Element& domElement);
113  virtual int fromXML(DOM_Element domElement);
114 
118  bool getPtCtrlStatus(const TYUUID& id_pt);
119 
123  void setPtCtrlStatus(const TYUUID& id_pt, bool bStatus);
124 
129  void purge();
130 
134  void clearResult();
135 
139  TYProjet* getProjet();
140 
146  int getNumero() const
147  {
148  return _numero;
149  }
150 
155  void setNumero(int num)
156  {
157  _numero = num;
158  }
159 
165  QString getAuteur() const
166  {
167  return _auteur;
168  }
169 
174  void setAuteur(QString auteur)
175  {
176  _auteur = auteur;
177  }
178 
185  QString getDateCreation() const
186  {
187  return _dateCreation;
188  }
189  void setDateCreation(const QString& date)
190  {
191  _dateCreation = date;
192  }
193 
199  QString getDateModif() const
200  {
201  return _dateModif;
202  }
203 
208  void setDateModif(const QString& date)
209  {
210  _dateModif = date;
211  }
212 
218  QString getComment() const
219  {
220  return _comment;
221  }
222 
227  void setComment(const QString& comment)
228  {
229  _comment = comment;
230  }
231 
237  bool getIsUpTodate() const
238  {
239  return _upTodate;
240  }
241 
246  void setIsUpTodate(bool upTodate)
247  {
248  _upTodate = upTodate;
249  }
250 
257  {
258  return _elementSelection;
259  }
260 
265  bool addToSelection(TYUUID id);
270  void addToSelection(TYElement* pElt, bool recursif = true);
271 
276  bool remToSelection(TYUUID id);
281  bool remToSelection(TYElement* pElt, bool recursif = true);
282 
287  bool isInSelection(TYUUID id);
288 
294  {
295  assert(pElt);
296  return isInSelection(pElt->getID().toString());
297  }
298 
305  {
306  return _emitAcVolNode;
307  }
314  {
315  return _emitAcVolNode;
316  }
317 
324  {
325  return _mapElementRegime;
326  }
327 
334  {
335  return _mapElementRegime;
336  }
337 
342  bool addPtCtrlToResult(LPTYPointControl pPoint);
343 
349 
353  LPTYSpectre getSpectre(const TYUUID& id_pt);
354  LPTYSpectre getSpectre(const TYPointControl* pPoint);
355 
359  void setSpectre(const TYUUID& id_pt, TYSpectre* pSpectre);
360  void setSpectre(TYPointCalcul* pPoint, TYSpectre* pSpectre);
361 
367  const LPTYResultat getResultat() const
368  {
369  return _pResultat;
370  }
371 
378  {
379  return _pResultat;
380  }
381 
387  void getCalculElements(LPTYSiteNode pSite);
388 
393  void setSite(LPTYSiteNode pSite);
394 
401 
406  void setState(int state)
407  {
408  _state = state;
409  }
410 
416  int getState()
417  {
418  return _state;
419  }
420 
426  const int getState() const
427  {
428  return _state;
429  }
430 
437  {
438  return _pResultat->getPartialState();
439  }
440 
445  void setStatusPartialResult(const bool& status)
446  {
447  _pResultat->setPartialState(status);
448  }
449 
455  void setSolverId(const OGenID& iD)
456  {
457  _solverId = iD;
458  }
459 
465  const OGenID getSolverId() const
466  {
467  return _solverId;
468  }
469 
476  {
477  return _solverId;
478  }
479 
480  void goPostprocessing();
481  // Solver parameters for this computation
482  QString solverParams;
483 
489  {
490  return _tabRays;
491  }
492 
496  std::vector<LPTYSpectre>* getSpectrumDatas(const TYUUID& id);
497 
501  std::vector<LPTYSpectre>* getSpectrumDatas(TYMaillage* pMaillage);
502 
507  bool addMaillage(TYMaillage* pMaillage);
508 
513  bool remMaillage(TYMaillage* pMaillage);
514 
518  bool updateMaillage(TYMaillage* pMaillage);
519 
524  void setNoiseMapSpectrums(const TYMaillage* pMaillage, TYTabLPSpectre& tabSpectrum);
525 
530  void setNoiseMapSpectrums(const TYUUID& id, TYTabLPSpectre& tabSpectrum);
531 
537 
544  {
545  return _hasResuCtrlPnts;
546  }
547 
548 private:
551  void copyNoiseMapSpectrums(TYMapIdTabSpectre& otherNoiseMap);
552 
553  // Members
554 protected:
555  // solver to be used to solve this "calcul"
557 
559  int _numero;
561  QString _auteur;
563  QString _dateCreation;
565  QString _dateModif;
567  QString _comment;
568 
570  bool _upTodate;
572  int _state;
573 
576 
579 
582 
585 
586  // Map control point with spectrum
588 
589  // Map NoiseMap Id with spectrum list
591 
594 
595  // Valid rays produced by ray tracing
597 
598  // Indicator used for migrating T310 project
599  // True if ResuCtrlPnts exists in xml project else false
601 };
602 
603 #endif // __TY_CALCUL__
QDomElement DOM_Element
Definition: QT2DOM.h:30
std::map< TYUUID, SmartPtr< TYSpectre > > TYMapIdSpectre
Tableau associant un spectre a un id (identifiant d'objet)
Definition: TYDefines.h:367
std::map< TYUUID, std::vector< SmartPtr< TYSpectre > > > TYMapIdTabSpectre
Tableau associant un id a un tableau de spectres.
Definition: TYDefines.h:370
class OGenID TYUUID
Definition: TYDefines.h:59
std::map< TYElement *, bool > TYMapPtrElementBool
Etat d'utilisation des elements (utilise par les calculs)
Definition: TYDefines.h:376
std::vector< LPTYSpectre > TYTabLPSpectre
Collection de TYSpectre.
Definition: TYDefines.h:337
std::map< TYElement *, int > TYMapPtrElementInt
Tableau associatif des elements et d'un entier (utilise pour gerer les regimes)
Definition: TYDefines.h:379
std::list< TYUUID > TYListID
Collection d'identifiants.
Definition: TYDefines.h:331
#define TY_EXT_GRAPHIC_DECL_ONLY(classname)
Definition: TYElement.h:432
#define OPROTODECL(classname)
Definition: TYElement.h:65
#define TY_EXTENSION_DECL_ONLY(classname)
Definition: TYElement.h:386
std::vector< LPTYRay > TYTabRay
Definition: TYRay.h:139
Definition: idgen.h:28
Calculation program.
Definition: TYCalcul.h:50
void copyNoiseMapSpectrums(TYMapIdTabSpectre &otherNoiseMap)
Definition: TYCalcul.cpp:1202
bool getPtCtrlStatus(const TYUUID &id_pt)
Get the status of a point for this calcul.
Definition: TYCalcul.cpp:1261
LPTYResultat _pResultat
Results.
Definition: TYCalcul.h:593
void clearResult()
Definition: TYCalcul.cpp:844
TYMapIdSpectre _mapPointCtrlSpectre
Definition: TYCalcul.h:587
int getState()
Get calculation state.
Definition: TYCalcul.h:416
void setSite(LPTYSiteNode pSite)
Definition of the site on which the calculation will be done.
Definition: TYCalcul.cpp:867
TYMapPtrElementInt _mapElementRegime
Regime of scene elements.
Definition: TYCalcul.h:584
void setAuteur(QString auteur)
Set author name.
Definition: TYCalcul.h:174
bool addPtCtrlToResult(LPTYPointControl pPoint)
Add a checkpoint to the results array.
Definition: TYCalcul.cpp:1140
bool isInSelection(LPTYElement pElt)
Tests if the element is present in the selection of this Calculation.
Definition: TYCalcul.h:293
TYListID getElementSelection() const
Get the selection of active elements in this Calculation.
Definition: TYCalcul.h:256
int _numero
Calculation number.
Definition: TYCalcul.h:559
CalculState
The different possible states for a calculation.
Definition: TYCalcul.h:61
@ Locked
Definition: TYCalcul.h:62
@ Actif
Definition: TYCalcul.h:63
TYCalcul()
Definition: TYCalcul.cpp:48
LPTYResultat getResultat()
Get result.
Definition: TYCalcul.h:377
TYMapPtrElementBool _emitAcVolNode
State (radiating/non-radiating) of the elements of the scene.
Definition: TYCalcul.h:581
const TYMapPtrElementBool & getEmitAcVolNode() const
Get array containing the state of each volumeNode in transmission.
Definition: TYCalcul.h:313
OGenID _solverId
Definition: TYCalcul.h:556
void purge()
Reset this calculation.
Definition: TYCalcul.cpp:824
OGenID getSolverId()
Get solver ID.
Definition: TYCalcul.h:475
bool getStatusPartialResult() const
Get conservation of partial results.
Definition: TYCalcul.h:436
TYCalcul & operator=(const TYCalcul &other)
Operator =.
Definition: TYCalcul.cpp:73
bool hasResuCtrlPoints()
Method used for migrating T310 project \ returns true if ResuCtrlPnts exists in xml project else retu...
Definition: TYCalcul.h:543
TYMapIdTabSpectre _noiseMapsSpectrums
Definition: TYCalcul.h:590
void setSpectre(const TYUUID &id_pt, TYSpectre *pSpectre)
Definition: TYCalcul.cpp:1256
int _state
Calculation state Active or Blocked.
Definition: TYCalcul.h:572
void setPtCtrlStatus(const TYUUID &id_pt, bool bStatus)
Set the status of a point for this calcul.
Definition: TYCalcul.cpp:1273
const int getState() const
Get calculation state.
Definition: TYCalcul.h:426
void getCalculElements(LPTYSiteNode pSite)
Recover all the elements of the scene which take part in the calculation.
Definition: TYCalcul.cpp:1037
void setNoiseMapSpectrums(const TYMaillage *pMaillage, TYTabLPSpectre &tabSpectrum)
set spectrum vector for a given noise map
Definition: TYCalcul.cpp:1375
bool _hasResuCtrlPnts
Definition: TYCalcul.h:600
QString getDateModif() const
Get modification date.
Definition: TYCalcul.h:199
void setStatusPartialResult(const bool &status)
Partial result retention set.
Definition: TYCalcul.h:445
virtual ~TYCalcul()
Destructor. Destructor of the TYCalcul class.
Definition: TYCalcul.cpp:63
QString solverParams
Definition: TYCalcul.h:482
bool _upTodate
Calculation up to date or not.
Definition: TYCalcul.h:570
void setDateModif(const QString &date)
Set modification date.
Definition: TYCalcul.h:208
bool updateMaillage(TYMaillage *pMaillage)
update a noisemap after modification
Definition: TYCalcul.cpp:1336
virtual int fromXML(DOM_Element domElement)
Definition: TYCalcul.cpp:348
virtual DOM_Element toXML(DOM_Element &domElement)
Definition: TYCalcul.cpp:233
bool remMaillage(TYMaillage *pMaillage)
Remove a maillage from calcul.
Definition: TYCalcul.cpp:1358
bool remToSelection(TYUUID id)
Removes the item from the selection of this Calculation.
Definition: TYCalcul.cpp:961
void setSolverId(const OGenID &iD)
Set solver ID.
Definition: TYCalcul.h:455
bool isInSelection(TYUUID id)
Tests if the element is present in the selection of this Calculation.
Definition: TYCalcul.cpp:1003
TYTabRay _tabRays
Definition: TYCalcul.h:596
QString getAuteur() const
Get zuthor name.
Definition: TYCalcul.h:165
TYMapPtrElementInt & getMapElementRegime()
Get from the regime.
Definition: TYCalcul.h:323
LPTYSpectre getSpectre(const TYUUID &id_pt)
Definition: TYCalcul.cpp:1223
void setComment(const QString &comment)
Set comments.
Definition: TYCalcul.h:227
void setDateCreation(const QString &date)
Definition: TYCalcul.h:189
QString getDateCreation() const
Set/Get of creation date.
Definition: TYCalcul.h:185
bool operator==(const TYCalcul &other) const
Operator ==.
Definition: TYCalcul.cpp:100
TYMapPtrElementBool & getEmitAcVolNode()
Get array containing the state of each volumeNode in transmission.
Definition: TYCalcul.h:304
LPTYSiteNode _pSiteCalcul
Site on which the calculation will be carried out.
Definition: TYCalcul.h:575
const TYMapPtrElementInt & getMapElementRegime() const
Get regime tab.
Definition: TYCalcul.h:333
void clearNoiseMapsSpectrums()
Definition: TYCalcul.cpp:1190
int getNumero() const
Get the number.
Definition: TYCalcul.h:146
void setIsUpTodate(bool upTodate)
Set the calculated state up to date or not link to the infrastructure.
Definition: TYCalcul.h:246
virtual bool deepCopy(const TYElement *pOther, bool copyId=true, bool pUseCopyTag=false)
Definition: TYCalcul.cpp:178
const OGenID getSolverId() const
Get solver ID.
Definition: TYCalcul.h:465
bool addMaillage(TYMaillage *pMaillage)
Add this maillage to calcul.
Definition: TYCalcul.cpp:1312
void setNumero(int num)
Set the number.
Definition: TYCalcul.h:155
QString _auteur
Author name.
Definition: TYCalcul.h:561
TYListID _elementSelection
Array of IDs of elements present in the scene.
Definition: TYCalcul.h:578
bool remPtCtrlFromResult(LPTYPointControl pPoint)
Deletes a checkpoint from the results table.
Definition: TYCalcul.cpp:1163
const LPTYResultat getResultat() const
Get result.
Definition: TYCalcul.h:367
void setState(int state)
Set editable attribute.
Definition: TYCalcul.h:406
TYTabRay & getTabRays()
Returns an array containing all the rays found by ray tracing.
Definition: TYCalcul.h:488
QString _dateCreation
Creation date.
Definition: TYCalcul.h:563
QString getComment() const
Get comments.
Definition: TYCalcul.h:218
void goPostprocessing()
Definition: TYCalcul.cpp:1020
TYMapIdSpectre getMapPointCtrlSpectre()
Returns map of control points with spectrum.
Definition: TYCalcul.cpp:1386
bool getIsUpTodate() const
Get the calculated state up to date or not link to the infrastructure.
Definition: TYCalcul.h:237
virtual std::string toString() const
Definition: TYCalcul.cpp:228
QString _comment
Comments.
Definition: TYCalcul.h:567
TYProjet * getProjet()
Definition: TYCalcul.cpp:68
void clearCtrlPointsSpectrums()
Definition: TYCalcul.cpp:1181
bool operator!=(const TYCalcul &other) const
Operator !=.
Definition: TYCalcul.cpp:173
QString _dateModif
Modification date.
Definition: TYCalcul.h:565
LPTYSiteNode getSite()
Get calculation site.
Definition: TYCalcul.cpp:856
bool addToSelection(TYUUID id)
Adds the item to the selection of this Calculation.
Definition: TYCalcul.cpp:872
std::vector< LPTYSpectre > * getSpectrumDatas(const TYUUID &id)
Return spectrums for a given noise map.
Definition: TYCalcul.cpp:1300
const TYUUID & getID() const
Definition: TYElement.cpp:176
Classe de definition d'un maillage.
Definition: TYMaillage.h:51
Classe de definition d'un point de calcul.C'est une classe derivee a TYPoint avec en plus un spectrep...
Definition: TYPointCalcul.h:33
Classe de definition d'un point de controle.Le point de controle est un point de calcul avec une haut...
classe de definition d'un projet.
Definition: TYProjet.h:45
void setPartialState(const bool &bPartial)
Get/Set du parametre de conservation de la matrice brut _bPartial.
Definition: TYResultat.cpp:850
bool getPartialState() const
Definition: TYResultat.h:288