Code_TYMPAN  4.4.0
Industrial site acoustic simulation
TYCalcul.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 #ifdef _MSC_VER
17  #pragma warning(disable : 4786)
18 #endif
19 
20 #include <math.h>
21 #include <stdlib.h>
22 #include <string>
23 #include <qregexp.h>
24 
25 #include "Tympan/core/defines.h"
26 #include "Tympan/core/logging.h"
31 #include "Tympan/models/business/DefaultSolverConfig.h"
34 
35 #if TY_USE_IHM
38 #endif
39 
42 
43 #define TR(id) OLocalizator::getString("OMessageManager", (id))
44 
45 #define MAX_SOURCES 1024
46 #define MAX_RECEPTEURS 131072
47 
49  : solverParams(DEFAULT_SOLVER_CONFIG), _solverId(OGenID("{A98B320C-44C4-47a9-B689-1DD352DAA8B2}")),
50  _numero(1), _auteur("Auteur"), _dateCreation("2001-10-01"), _dateModif("2001-10-01"),
51  _comment("Commentaire"), _upTodate(true), _state(TYCalcul::Actif), _pResultat(new TYResultat()),
52  _hasResuCtrlPnts(false)
53 {
55  _pResultat->setParent(this);
56 }
57 
59 {
60  *this = other;
61 }
62 
64 {
65  purge();
66 }
67 
69 {
71 }
72 
74 {
75  _tabRays.clear();
76  if (this != &other)
77  {
78  TYElement::operator=(other);
79  _numero = other._numero;
80  _auteur = other._auteur;
82  _dateModif = other._dateModif;
83  _comment = other._comment;
84  _upTodate = other._upTodate;
85  _state = other._state;
86  //_maillages = other._maillages;
87  _pResultat = other._pResultat;
91  _solverId = other._solverId;
92  _tabRays = other._tabRays;
93  solverParams = other.solverParams;
95  }
96 
97  return *this;
98 }
99 
100 bool TYCalcul::operator==(const TYCalcul& other) const
101 {
102  if (this != &other)
103  {
104  if (TYElement::operator!=(other))
105  {
106  return false;
107  }
108  if (_auteur != other._auteur)
109  {
110  return false;
111  }
112  if (_dateCreation != other._dateCreation)
113  {
114  return false;
115  }
116  if (_dateModif != other._dateModif)
117  {
118  return false;
119  }
120  if (_comment != other._comment)
121  {
122  return false;
123  }
124  if (_numero != other._numero)
125  {
126  return false;
127  }
128  if (_upTodate != other._upTodate)
129  {
130  return false;
131  }
132  if (_state != other._state)
133  {
134  return false;
135  }
136  // if (_maillages != other._maillages) { return false; }
137  if (_pResultat != other._pResultat)
138  {
139  return false;
140  }
141  if (_emitAcVolNode != other._emitAcVolNode)
142  {
143  return false;
144  }
146  {
147  return false;
148  }
150  {
151  return false;
152  }
154  {
155  return false;
156  }
157  if (_solverId != other._solverId)
158  {
159  return false;
160  }
161  if (_tabRays != other._tabRays)
162  {
163  return false;
164  }
165  if (_hasResuCtrlPnts != other._hasResuCtrlPnts)
166  {
167  return false;
168  }
169  }
170  return true;
171 }
172 
173 bool TYCalcul::operator!=(const TYCalcul& other) const
174 {
175  return !operator==(other);
176 }
177 
178 bool TYCalcul::deepCopy(const TYElement* pOther, bool copyId /*=true*/, bool pUseCopyTag /*=false*/)
179 {
180  if (!TYElement::deepCopy(pOther, copyId, true))
181  {
182  return false;
183  }
184 
185  purge();
186 
187  TYCalcul* pOtherCalcul = (TYCalcul*)pOther;
188 
189  // copie du parent
190  _pParent = pOther->getParent();
191 
192  _numero = pOtherCalcul->_numero;
193  _auteur = pOtherCalcul->_auteur;
194  _dateCreation = pOtherCalcul->_dateCreation;
195  _dateModif = pOtherCalcul->_dateModif;
196  _comment = pOtherCalcul->_comment;
197  _upTodate = pOtherCalcul->_upTodate;
198  _state = pOtherCalcul->_state;
199 
200  _pResultat->deepCopy(pOtherCalcul->_pResultat, copyId);
201 
202  _elementSelection = pOtherCalcul->_elementSelection;
203  _emitAcVolNode = pOtherCalcul->_emitAcVolNode;
204  _mapElementRegime = pOtherCalcul->_mapElementRegime;
205 
206  // Use same points but initialize spectrum
209 
210  _hasResuCtrlPnts = pOtherCalcul->_hasResuCtrlPnts;
211 
212  // Use Same NoiseMap but initialize spectrums
214 
215  _solverId = pOtherCalcul->_solverId;
216  solverParams = pOtherCalcul->solverParams;
217 
218  for (unsigned int i = 0; i < pOtherCalcul->_tabRays.size(); i++)
219  {
220  LPTYRay aRay = new TYRay();
221  aRay->deepCopy(pOtherCalcul->_tabRays.at(i), copyId);
222  _tabRays.push_back(aRay);
223  }
224 
225  return true;
226 }
227 
228 std::string TYCalcul::toString() const
229 {
230  return "TYCalcul";
231 }
232 
234 {
235  DOM_Element domNewElem = TYElement::toXML(domElement);
236 
237  if (_upTodate)
238  {
239  domNewElem.setAttribute("isUpTodate", "1");
240  }
241  else
242  {
243  domNewElem.setAttribute("isUpTodate", "0");
244  }
245 
246  TYXMLTools::addElementIntValue(domNewElem, "numero", _numero);
247  TYXMLTools::addElementStringValue(domNewElem, "auteur", _auteur);
248  TYXMLTools::addElementStringValue(domNewElem, "dateCreation", _dateCreation);
249  TYXMLTools::addElementStringValue(domNewElem, "dateModif", _dateModif);
250  TYXMLTools::addElementStringValue(domNewElem, "comment", _comment);
251  TYXMLTools::addElementStringValue(domNewElem, "solverId", _solverId.toString());
252  TYXMLTools::addElementIntValue(domNewElem, "etat", _state); // 16/08/2005 Possibilite de bloquer un calcul
253  TYXMLTools::addElementStringValue(domNewElem, "solverParams", solverParams);
254 
255  // Ajout du site node sur lequel s'effectue le calcul
256  DOM_Document domDoc = domElement.ownerDocument();
257 
258  // Selection
259  TYListID::iterator ite;
260  DOM_Element listIDNode = domDoc.createElement("ListID");
261  domNewElem.appendChild(listIDNode);
262 
263  for (ite = _elementSelection.begin(); ite != _elementSelection.end(); ++ite)
264  {
265  DOM_Element tmpNode = domDoc.createElement("Element");
266  listIDNode.appendChild(tmpNode);
267 
268  tmpNode.setAttribute("id", (*ite).toString());
269  }
270 
271  // Etats des AccVolNodes en emission
272  TYMapPtrElementBool::iterator iter3;
273  DOM_Element emissionAccVolNodesNode = domDoc.createElement("EmissionAccVolNodes");
274  domNewElem.appendChild(emissionAccVolNodesNode);
275 
276  for (iter3 = _emitAcVolNode.begin(); iter3 != _emitAcVolNode.end(); iter3++)
277  {
278  DOM_Element tmpNode = domDoc.createElement("EmissionAccVolNode");
279  emissionAccVolNodesNode.appendChild(tmpNode);
280 
281  tmpNode.setAttribute("accVolNodeId", (*iter3).first->getID().toString());
282  tmpNode.setAttribute("state", QString(intToStr((*iter3).second).c_str()));
283  }
284 
285  // Regimes associes a chaque source
286  TYMapPtrElementInt::iterator iter4;
287  DOM_Element regimeAccElementNodesNode = domDoc.createElement("RegimeAccNode");
288  domNewElem.appendChild(regimeAccElementNodesNode);
289 
290  for (iter4 = _mapElementRegime.begin(); iter4 != _mapElementRegime.end(); iter4++)
291  {
292  DOM_Element tmpNode = domDoc.createElement("RegimeAccNode");
293  regimeAccElementNodesNode.appendChild(tmpNode);
294 
295  tmpNode.setAttribute("accVolNodeId", (*iter4).first->getID().toString());
296  tmpNode.setAttribute("state", QString(intToStr((*iter4).second).c_str()));
297  }
298 
299  // Points de controle
300  DOM_Element resuRecepteursNode = domDoc.createElement("ResuCtrlPnts");
301  domNewElem.appendChild(resuRecepteursNode);
302  TYMapIdSpectre::iterator itRec;
303  for (itRec = _mapPointCtrlSpectre.begin(); itRec != _mapPointCtrlSpectre.end(); itRec++)
304  {
305  DOM_Element tmpNode = domDoc.createElement("Recepteur");
306  resuRecepteursNode.appendChild(tmpNode);
307  tmpNode.setAttribute("receptor_id", (*itRec).first.toString());
308  (*itRec).second->toXML(tmpNode);
309  }
310 
311  // Noise maps
312  DOM_Element resuNoiseMapNode = domDoc.createElement("ResuNoiseMaps");
313  domNewElem.appendChild(resuNoiseMapNode);
314  TYMapIdTabSpectre::iterator itNM;
315  for (itNM = _noiseMapsSpectrums.begin(); itNM != _noiseMapsSpectrums.end(); itNM++)
316  {
317  DOM_Element tmpNode = domDoc.createElement("NoiseMap");
318  resuNoiseMapNode.appendChild(tmpNode);
319  tmpNode.setAttribute("noise_map_id", (*itNM).first.toString());
320  for (unsigned int i = 0; i < (*itNM).second.size(); i++)
321  {
322  (*itNM).second.at(i)->toXML(tmpNode);
323  }
324  }
325 
326  // Resultat
328  {
329  _pResultat->toXML(domNewElem);
330  }
331  else
332  {
333  TYResultat tmp;
334  tmp.toXML(domNewElem);
335  }
336 
337  // Sauvegarde de rayons (chemins acoustiques)
338  DOM_Element listRaysNode = domDoc.createElement("ListRayons");
339  domNewElem.appendChild(listRaysNode);
340  for (size_t i = 0; i < _tabRays.size(); i++)
341  {
342  _tabRays.at(i)->toXML(listRaysNode);
343  }
344 
345  return domNewElem;
346 }
347 
349 {
350  purge(); // Cleaning before loading
351 
352  TYElement::fromXML(domElement);
353 
354  bool getOk[19];
355  unsigned int i = 0;
356  for (i = 0; i < 19; i++)
357  {
358  getOk[i] = false;
359  }
360  int retVal = -1;
361  LPTYMaillageGeoNode pMaillageGeoNode = new TYMaillageGeoNode(NULL, this);
362  LPTYRay aRay = new TYRay();
363  _tabRays.clear();
364 
365  // CLM-NT33: Compatibiltité ancien format XML
366  LPTYPointControl pPointControl = new TYPointControl();
367  TYProjet* pProjet = getProjet();
368 
369  int etat = -1; // Etat du calcul
370  bool useSol = false, useEcran = false, useReflexion = false;
371  bool condFav = false, calculTrajetHorizontaux = false, interference = false;
372  float h1 = NAN, distanceSRMin = NAN;
373 
374  TYListID tempElementSelection;
375  QString strSolverId;
376 
377  int readOk = 0; // Indicateur de bonne relecture des resultats
378 
379  _upTodate = (TYXMLTools::getElementAttributeToInt(domElement, "isUpTodate") == 1);
380 
381  DOM_Element elemCur;
382  QDomNodeList childs = domElement.childNodes();
383  for (i = 0; i < childs.length(); i++)
384  {
385  elemCur = childs.item(i).toElement();
386  TYXMLTools::getElementIntValue(elemCur, "numero", _numero, getOk[0]);
387  TYXMLTools::getElementStringValue(elemCur, "auteur", _auteur, getOk[1]);
388  TYXMLTools::getElementStringValue(elemCur, "dateCreation", _dateCreation, getOk[2]);
389  TYXMLTools::getElementStringValue(elemCur, "dateModif", _dateModif, getOk[3]);
390  TYXMLTools::getElementStringValue(elemCur, "comment", _comment, getOk[4]);
391  TYXMLTools::getElementStringValue(elemCur, "solverId", strSolverId, getOk[5]);
392  TYXMLTools::getElementIntValue(elemCur, "etat", etat, getOk[6]);
393  TYXMLTools::getElementStringValue(elemCur, "solverParams", solverParams, getOk[7]);
394  // Remove spaces and carriage returns from solverParams
395  solverParams = solverParams.replace(" ", "");
396  solverParams = solverParams.replace("\r", "");
397 
398  // Gestion des évolutions des paramètres des solveurs
399  if (elemCur.nodeName() == "solverParams")
400  {
401  // Introduction des conditions de propagation mixtes en version 4.1 de Code_TYMPAN
402  QRegExp propaCond_reg("(PropaConditions\\s?=\\s?)(True|False)");
403  int pos = propaCond_reg.indexIn(solverParams);
404  if (pos > -1)
405  {
406  QString propaConditions = propaCond_reg.cap(2);
407  int value = 0;
408  (propaConditions == "True") ? value = 1 : value = 0;
409  solverParams.replace(propaCond_reg, "PropaConditions=" + QString::number(value));
410  }
411  // Suppression d'Anime3D entre la version 4.2 et la version 4.3
412  // 1. Renommage d'Anime3DKeepRays en KeepRays et déplacement dans le bloc DEFAULTSOLVER
413  QRegularExpression keepRays_reg("(Anime3D)(KeepRays\\s?=\\s?)(True|False)"),
414  h1parameter_reg("(H1parameter\\s?=\\s?[0-9]+.[0-9]*)");
415  QRegularExpressionMatch match_keepRays = keepRays_reg.match(solverParams);
416  if (match_keepRays.hasMatch())
417  {
418  QString keepRays = "\n" + match_keepRays.captured(2) + match_keepRays.captured(3);
419  QRegularExpressionMatch match_h1parameter_reg = h1parameter_reg.match(solverParams);
420  int insert_pos = match_h1parameter_reg.capturedEnd();
421  if (insert_pos > -1)
422  {
423  solverParams.insert(insert_pos, keepRays);
424  }
425  }
426 
427  // 2. Suppression du bloc ANIME3DSOLVER
428  QRegularExpression anime3DUnit_reg("\\[ANIME3DSOLVER\\][^\\[]*\\[{1}");
429  anime3DUnit_reg.setPatternOptions(QRegularExpression::DotMatchesEverythingOption);
430  QRegularExpressionMatch match_anime3DUnit = anime3DUnit_reg.match(solverParams);
431  if (match_anime3DUnit.hasMatch())
432  {
433  int begin_anime3D_unit = match_anime3DUnit.capturedStart();
434  int length_anime3D_unit = match_anime3DUnit.capturedLength() - 1;
435  solverParams.remove(begin_anime3D_unit, length_anime3D_unit);
436  }
437  }
438  // Gestion de la compatibilité avec la version 3 de Code_TYMPAN
439  TYXMLTools::getElementBoolValue(elemCur, "useSol", useSol, getOk[8]);
440  TYXMLTools::getElementBoolValue(elemCur, "useEcran", useEcran, getOk[9]);
441  TYXMLTools::getElementBoolValue(elemCur, "useReflexion", useReflexion, getOk[10]);
442  TYXMLTools::getElementBoolValue(elemCur, "interference", interference, getOk[11]);
443  TYXMLTools::getElementBoolValue(elemCur, "calculTrajetHorizontaux", calculTrajetHorizontaux,
444  getOk[12]);
445  TYXMLTools::getElementBoolValue(elemCur, "condFav", condFav, getOk[13]);
446  TYXMLTools::getElementFloatValue(elemCur, "h1", h1, getOk[14]);
447  TYXMLTools::getElementFloatValue(elemCur, "distanceSRMin", distanceSRMin, getOk[15]);
448 
449  if (elemCur.nodeName() == "distanceSRMin")
450  {
451  // Conversion des boolean recuperes en string
452  QString useSol_str, useEcran_str, useReflexion_str, interference_str, calculTrajetHorizontaux_str;
453  int condPropa = 0;
454  useSol ? useSol_str = "True" : useSol_str = "False";
455  useEcran ? useEcran_str = "True" : useEcran_str = "False";
456  useReflexion ? useReflexion_str = "True" : useReflexion_str = "False";
457  interference ? interference_str = "True" : interference_str = "False";
458  calculTrajetHorizontaux ? calculTrajetHorizontaux_str = "True"
459  : calculTrajetHorizontaux_str = "False";
460  condFav ? condPropa = 1 : condPropa = 0;
461 
462  // Creation des lignes a modifier dans le bloc de text de parametres
463  QString useRealGround = "UseRealGround=" + useSol_str;
464  QString useScreen = "UseScreen=" + useEcran_str;
465  QString useReflection = "UseReflection=" + useReflexion_str;
466  QString modSummation = "ModSummation=" + interference_str;
467  QString useLateralDiffraction = "UseLateraDiffraction=" + calculTrajetHorizontaux_str;
468  QString propaConditions = "PropaConditions=" + QString::number(condPropa);
469  QString h1parameter = "H1parameter=" + QString::number(h1);
470  QString minSRDistance = "MinSRDistance=" + QString::number(distanceSRMin);
471 
472  // Expressions regulières liées aux lignes recherchées
473  QRegExp useSol_reg("UseRealGround=(True|False)"), useEcran_reg("UseScreen=(True|False)"),
474  useReflexion_reg("UseReflection=(True|False)"), interference_reg("ModSummation=(True|False)"),
475  calculTrajetHorizontaux_reg("UseLateraDiffraction=(True|False)"),
476  condFav_reg("PropaConditions=[0-2]"), h1parameter_reg("H1parameter=[0-9]+.[0-9]*"),
477  minSRDistance_reg("MinSRDistance=[0-9]+.[0-9]*");
478 
479  // Rechercher et remplacer
480  solverParams.replace(useSol_reg, useRealGround);
481  solverParams.replace(useEcran_reg, useScreen);
482  solverParams.replace(useReflexion_reg, useReflection);
483  solverParams.replace(interference_reg, modSummation);
484  solverParams.replace(calculTrajetHorizontaux_reg, useLateralDiffraction);
485  solverParams.replace(condFav_reg, propaConditions);
486  solverParams.replace(h1parameter_reg, h1parameter);
487  solverParams.replace(minSRDistance_reg, minSRDistance);
488  }
489  // Récupérer les parametres météo de la version 3
490  if (elemCur.nodeName() == "Atmosphere")
491  {
492  double pression = 0;
493  double temperature = 0;
494  double hygrometrie = 0;
495  DOM_Element elemCur2;
496  QDomNodeList childs2 = elemCur.childNodes();
497 
498  for (unsigned int j = 0; j < childs2.length(); j++)
499  {
500  elemCur2 = childs2.item(j).toElement();
501  if (elemCur2.nodeName() == "pression")
502  {
503  TYXMLTools::getElementDoubleValue(elemCur2, "pression", pression, getOk[16]);
504  QString atmosPressure = "AtmosPressure=" + QString::number(pression);
505  QRegExp atmosPressure_reg("AtmosPressure=[0-9]+.[0-9]*");
506  solverParams.replace(atmosPressure_reg, atmosPressure);
507  continue;
508  }
509  if (elemCur2.nodeName() == "temperature")
510  {
511  TYXMLTools::getElementDoubleValue(elemCur2, "temperature", temperature, getOk[17]);
512  QString atmosTemperature = "AtmosTemperature=" + QString::number(temperature);
513  QRegExp atmosTemperature_reg("AtmosTemperature=[0-9]+.[0-9]*");
514  solverParams.replace(atmosTemperature_reg, atmosTemperature);
515  continue;
516  }
517  if (elemCur2.nodeName() == "hygrometrie")
518  {
519  TYXMLTools::getElementDoubleValue(elemCur2, "hygrometrie", hygrometrie, getOk[18]);
520  QString atmosHygrometry = "AtmosHygrometry=" + QString::number(hygrometrie);
521  QRegExp atmosHygrometry_reg("AtmosHygrometry=[0-9]+.[0-9]*");
522  solverParams.replace(atmosHygrometry_reg, atmosHygrometry);
523  continue;
524  }
525  }
526  }
527  // Selection
528  if (elemCur.nodeName() == "ListID")
529  {
530  DOM_Element elemCur2;
531  QDomNodeList childs2 = elemCur.childNodes();
532 
533  for (unsigned int j = 0; j < childs2.length(); j++)
534  {
535  elemCur2 = childs2.item(j).toElement();
536  if (elemCur2.nodeName() == "Element")
537  {
538  QString id = TYXMLTools::getElementAttributeToString(elemCur2, "id");
539  tempElementSelection.push_back(id);
540  }
541  }
542  }
543  else if (elemCur.nodeName() == "EtatSources") // Etats des sources
544  {
545  DOM_Element elemCur2;
546  QDomNodeList childs2 = elemCur.childNodes();
547 
548  for (unsigned int j = 0; j < childs2.length(); j++)
549  {
550  elemCur2 = childs2.item(j).toElement();
551 
552  if (elemCur2.nodeName() == "EtatSource")
553  {
554  QString srcId = TYXMLTools::getElementAttributeToString(elemCur2, "srcId");
555  bool state = TYXMLTools::getElementAttributeToInt(elemCur2, "state");
556 
557  TYElement* pSrc = TYElement::getInstance(srcId);
558 
559  if (pSrc)
560  {
561  _emitAcVolNode.insert(TYMapPtrElementBool::value_type(pSrc, state));
562  }
563  }
564  }
565  }
566  else if (elemCur.nodeName() == "EmissionAccVolNodes") // Etats des AccVolNodes en emission
567  {
568  DOM_Element elemCur2;
569  QDomNodeList childs2 = elemCur.childNodes();
570 
571  for (unsigned int j = 0; j < childs2.length(); j++)
572  {
573  elemCur2 = childs2.item(j).toElement();
574 
575  if (elemCur2.nodeName() == "EmissionAccVolNode")
576  {
577  QString accVolNodeId = TYXMLTools::getElementAttributeToString(elemCur2, "accVolNodeId");
578  bool state = TYXMLTools::getElementAttributeToInt(elemCur2, "state");
579 
580  TYElement* pAccVolNode = TYElement::getInstance(accVolNodeId);
581 
582  if (pAccVolNode)
583  {
584  _emitAcVolNode.insert(TYMapPtrElementBool::value_type(pAccVolNode, state));
585  }
586  }
587  }
588  }
589  else if (elemCur.nodeName() == "RegimeAccNode") // Regime associe a chaque source
590  {
591  DOM_Element elemCur2;
592  QDomNodeList childs2 = elemCur.childNodes();
593 
594  for (unsigned int j = 0; j < childs2.length(); j++)
595  {
596  elemCur2 = childs2.item(j).toElement();
597 
598  if (elemCur2.nodeName() == "RegimeAccNode")
599  {
600  QString accVolNodeId = TYXMLTools::getElementAttributeToString(elemCur2, "accVolNodeId");
601  int state = TYXMLTools::getElementAttributeToInt(elemCur2, "state");
602 
603  TYElement* pAccVolNode = TYElement::getInstance(accVolNodeId);
604 
605  if (pAccVolNode)
606  {
607  _mapElementRegime.insert(TYMapPtrElementInt::value_type(pAccVolNode, state));
608  }
609  }
610  }
611  }
612  else if (elemCur.nodeName() == "ResuCtrlPnts")
613  {
614  DOM_Element elemCur2;
615  QDomNodeList childs2 = elemCur.childNodes();
616  LPTYSpectre spectrum = new TYSpectre();
617  _hasResuCtrlPnts = true;
618 
619  for (unsigned int j = 0; j < childs2.length(); j++)
620  {
621  elemCur2 = childs2.item(j).toElement();
622  if (elemCur2.nodeName() == "Recepteur")
623  {
624  QString strReceptor_id = TYXMLTools::getElementAttributeToString(elemCur2, "receptor_id");
625  TYUUID receptor_id;
626  receptor_id.FromString(strReceptor_id);
627 
628  // Get the spectrum
629  DOM_Element elemCur3;
630  QDomNodeList childs3 = elemCur2.childNodes();
631  for (unsigned int k = 0; k < childs3.length(); k++)
632  {
633  elemCur3 = childs3.item(k).toElement();
634  if (spectrum->callFromXMLIfEqual(elemCur3, &retVal))
635  {
636  if (retVal == 1)
637  {
638  _mapPointCtrlSpectre[receptor_id] = new TYSpectre(*spectrum);
639  }
640  }
641  }
642  }
643  }
644  }
645  else if (elemCur.nodeName() == "ResuNoiseMaps")
646  {
647  DOM_Element elemCur2;
648  QDomNodeList childs2 = elemCur.childNodes();
649 
650  LPTYSpectre spectrum = new TYSpectre();
651  std::vector<LPTYSpectre> tabSpectre;
652 
653  for (unsigned int j = 0; j < childs2.length(); j++)
654  {
655  elemCur2 = childs2.item(j).toElement();
656 
657  if (elemCur2.nodeName() == "NoiseMap")
658  {
659  tabSpectre.clear();
660 
661  QString strnoise_map_id =
662  TYXMLTools::getElementAttributeToString(elemCur2, "noise_map_id");
663  TYUUID noise_map_id;
664  noise_map_id.FromString(strnoise_map_id);
665 
666  DOM_Element elemCur3;
667  QDomNodeList childs3 = elemCur2.childNodes();
668  for (unsigned int k = 0; k < childs3.length(); k++)
669  {
670  elemCur3 = childs3.item(k).toElement();
671  if (spectrum->callFromXMLIfEqual(elemCur3, &retVal))
672  {
673  if (retVal == 1)
674  {
675  tabSpectre.push_back(new TYSpectre(*spectrum));
676  }
677  }
678  }
679 
680  _noiseMapsSpectrums[noise_map_id] = tabSpectre;
681  }
682  }
683  }
684  else if (elemCur.nodeName() == "ListRayons")
685  {
686  DOM_Element elemCur2;
687  QDomNodeList childs2 = elemCur.childNodes();
688 
689  for (int j = 0; j < childs2.length(); j++)
690  {
691  elemCur2 = childs2.item(j).toElement();
692  if (aRay->callFromXMLIfEqual(elemCur2, &retVal))
693  {
694  if (retVal == 1)
695  {
696  _tabRays.push_back(aRay);
697  aRay = new TYRay();
698  }
699  }
700  }
701  }
702 
703  // CLM-NT33: Compatibilitité avec ancien format XML
704  // Points de controle
705  if (elemCur.nodeName() == "PointsControl")
706  {
707  DOM_Element elemCur2;
708  QDomNodeList childs2 = elemCur.childNodes();
709 
710  for (unsigned int j = 0; j < childs2.length(); j++)
711  {
712  elemCur2 = childs2.item(j).toElement();
713 
714  // ajoute l'attribut id du calcul au spectre
715  QDomNodeList childs3 = elemCur2.childNodes();
716  for (unsigned int k = 0; k < childs3.length(); k++)
717  {
718  DOM_Element elemCur3 = childs3.item(k).toElement();
719  if (elemCur3.nodeName() == "Spectre")
720  {
721  elemCur3.setAttribute("idCalcul", getID().toString());
722  }
723  }
724 
725  if (pPointControl->callFromXMLIfEqual(elemCur2))
726  {
727  pProjet->addPointControl(pPointControl);
728  pPointControl = new TYPointControl();
729  }
730  }
731  }
732 
734  if (pMaillageGeoNode->callFromXMLIfEqual(elemCur, &retVal))
735  {
736  if (retVal == 1)
737  {
738  pProjet->addMaillage(pMaillageGeoNode);
739  dynamic_cast<TYMaillage*>(pMaillageGeoNode->getElement())->setEtat(getID(), true);
740  pMaillageGeoNode = new TYMaillageGeoNode(NULL, this);
741  }
742  }
743 
744  // Resultat
745  _pResultat->callFromXMLIfEqual(elemCur, &readOk);
746  }
747 
748  if (getOk[5])
749  {
750  _solverId.FromString(strSolverId);
751  } // Recuperation de l'Id du solveur
752 
753  // On supprime les IDs de la selection des elements non presents dans le site
754  TYListID::iterator next = tempElementSelection.begin();
755 
756  while (next != tempElementSelection.end())
757  {
758  if (!TYElement::getInstance((*next)))
759  {
760  next = tempElementSelection.erase(next);
761  }
762  else
763  {
764  next++;
765  }
766  }
767 
768  // On ajoute ceux qui restent dans le calcul
769  for (next = tempElementSelection.begin(); next != tempElementSelection.end(); next++)
770  {
771  _elementSelection.push_back((*next));
772  }
773 
774  // Si le tableau associatif element/regime est vide (fichier 3.1), on le cree,
775  // ainsi que le tableau des etats de rayonnement
776  if (_mapElementRegime.size() == 0)
777  {
778  TYListID::iterator iter;
779  int regime = 0;
780  bool bEmit = false;
781  for (iter = _elementSelection.begin(); iter != _elementSelection.end(); iter++)
782  {
783  TYElement* pElement = TYElement::getInstance(*iter);
784  TYAcousticVolumeNode* pVolNode = dynamic_cast<TYAcousticVolumeNode*>(pElement);
785  if (pVolNode != nullptr)
786  {
787  regime = pVolNode->getCurRegime();
788  bEmit = pVolNode->getIsRayonnant();
789  }
790  else
791  {
792  TYAcousticLine* pLine = dynamic_cast<TYAcousticLine*>(pElement);
793  if (pLine != nullptr)
794  {
795  regime = pLine->getCurRegime();
796  bEmit = pLine->getIsRayonnant();
797  }
798  else if (pElement->isA("TYUserSourcePonctuelle"))
799  {
800  regime = TYUserSourcePonctuelle::safeDownCast(pElement)->getCurrentRegime();
801  bEmit = true;
802  }
803  }
804  _mapElementRegime[pElement] = regime;
805  _emitAcVolNode[pElement] = bEmit;
806 
807  regime = 0;
808  bEmit = false;
809  }
810  }
811 
812  if (etat != -1)
813  {
814  setState(etat);
815  } // Si un etat a ete relu (fichier format TYMPAN 3.3) mise a jour de l'etat
816  if (readOk == -1)
817  {
818  _pResultat->purge();
819  return readOk;
820  }
821  return 1;
822 }
823 
825 {
826  // remAllMaillage();
827  _tabRays.clear();
828 
829  _elementSelection.clear();
830 
831  _pResultat->purge();
832  _mapElementRegime.clear();
833  _emitAcVolNode.clear();
834 
835  // Cleaning control point / spectrum association
836  _mapPointCtrlSpectre.clear();
837 
838  // Cleaning noise map / spectrums association
839  _noiseMapsSpectrums.clear();
840 
841  setIsGeometryModified(true);
842 }
843 
845 {
846  TYTabLPPointControl::iterator ite;
849 
850  _pResultat->purge();
851  _tabRays.clear();
852 
853  setIsGeometryModified(true);
854 }
855 
857 {
858  TYProjet* pProjet = getProjet();
859  if (pProjet)
860  {
861  return pProjet->getSite();
862  }
863 
864  return NULL;
865 }
866 
868 {
869  _pSiteCalcul = pSite;
870 }
871 
873 {
874  bool res = false;
875 
876  if (!isInSelection(id))
877  {
878  _elementSelection.push_back(id);
879  res = true;
880  }
881 
882  return res;
883 }
884 
885 void TYCalcul::addToSelection(TYElement* pElt, bool recursif /*=true*/)
886 {
887  if (!pElt)
888  {
889  return;
890  }
891 
892  TYUUID id = pElt->getID();
893 
894  if (addToSelection(id))
895  {
896  bool etat = true;
897  if (pElt->isA("TYInfrastructure"))
898  {
899  // Si un objet est ajoute son parent l'est forcemment
900  addToSelection(pElt->getParent(), false);
901  }
902  else if (dynamic_cast<TYSiteNode*>(pElt) != nullptr)
903  {
904  // Si un objet est ajoute son parent l'est forcemment
905  addToSelection(pElt->getParent(), false);
906 
907  // Si c'est un site on n'ajoute pas systématiquement tous les enfants
908  recursif = false;
909  }
910  else if (dynamic_cast<TYAcousticVolumeNode*>(pElt) != nullptr)
911  {
912  TYAcousticVolumeNode* pVolNode = dynamic_cast<TYAcousticVolumeNode*>(pElt);
913  etat = pVolNode->getIsRayonnant();
914  _emitAcVolNode[pElt] = etat;
915  _mapElementRegime[pElt] = 0;
916 
917  // Si un objet est ajoute son parent l'est forcemment
918  addToSelection(pElt->getParent(), false);
919  }
920  else if (dynamic_cast<TYAcousticLine*>(pElt) != nullptr)
921  {
922  TYAcousticLine* pLine = dynamic_cast<TYAcousticLine*>(pElt);
923  etat = pLine->getIsRayonnant();
924  _emitAcVolNode[pElt] = etat;
925  _mapElementRegime[pElt] = 0;
926 
927  // Si un objet est ajoute son parent l'est forcemment
928  addToSelection(pElt->getParent(), false);
929  }
930  else if (dynamic_cast<TYUserSourcePonctuelle*>(pElt) != nullptr)
931  {
932  TYUserSourcePonctuelle* pSource = dynamic_cast<TYUserSourcePonctuelle*>(pElt);
933  if (pSource != nullptr)
934  {
935  etat = pSource->getIsRayonnant();
936  }
937  _emitAcVolNode[pElt] = etat;
938  _mapElementRegime[pElt] = 0;
939 
940  // Si un objet est ajoute son parent l'est forcemment
941  addToSelection(pElt->getParent(), false);
942  }
943 
944  // Informe l'element qu'il est dans le calcul courant
945  pElt->setInCurrentCalcul(true, false);
946 
947  // Si recursif on ajoute les enfants
948  if (recursif)
949  {
950  LPTYElementArray childs;
951  pElt->getChilds(childs, false);
952 
953  for (int i = 0; i < childs.size(); i++)
954  {
955  addToSelection(childs[i], recursif);
956  }
957  }
958  }
959 }
960 
962 {
963  _elementSelection.remove(id);
964  setIsGeometryModified(true);
965  return true;
966 }
967 
968 bool TYCalcul::remToSelection(TYElement* pElt, bool recursif /*=true*/)
969 {
970  assert(pElt);
971  bool ret = false;
972  TYUUID id = pElt->getID();
973 
974  if (isInSelection(id))
975  {
976  // Reset des resultats precedents (car plus valables)
977  _pResultat->purge();
978 
979  // On supprime l'element lui meme des differents tableaux associatifs
980  _elementSelection.remove(id);
981  _emitAcVolNode.erase(pElt);
982  _mapElementRegime.erase(pElt);
983 
984  // On informe l'element qu'ils ne sont plua dans le calcul
985  pElt->setInCurrentCalcul(false, false, false);
986 
987  // On désactive ses enfants
988  LPTYElementArray childs;
989  pElt->getChilds(childs, false);
990 
991  for (int i = 0; i < childs.size(); i++)
992  {
993  remToSelection(childs[i], recursif);
994  }
995 
996  pElt->setIsGeometryModified(true);
997 
998  ret = true;
999  }
1000  return ret;
1001 }
1002 
1004 {
1005  bool present = false;
1006  TYListID::iterator ite;
1007 
1008  for (ite = _elementSelection.begin(); ite != _elementSelection.end(); ++ite)
1009  {
1010  if ((*ite) == id)
1011  {
1012  present = true;
1013  break;
1014  }
1015  }
1016 
1017  return present;
1018 }
1019 
1021 {
1022  // Create result map (business sources --> micro sources)
1023  TYMapElementTabSources& mapElementSources = _pResultat->getMapEmetteurSrcs();
1024  getProjet()->getSite()->getInfrastructure()->getAllSrcs(this, mapElementSources);
1025  // build sources spectra
1027 
1028  // Le calcul a proprement parler est termine
1029  // Il est necessaire de reattribuer les parents des elements du site merges
1030  getProjet()->getSite()->reparent();
1031 
1032  TYNameManager::get()->enable(true);
1033 
1034  setIsAcousticModified(true); // Les données acoustiques ont été actualisées
1035 }
1036 
1038 {
1039  unsigned int i = 0;
1040  // bool ok = true;
1041 
1042  if (getProjet()->getCurrentCalcul() != this)
1043  {
1044  return;
1045  }
1046 
1047  // Pour chaque element, 2 cas :
1048  // - il sont dans la liste des elements du calcul mais ne sont pas "inCurrentCalcul"
1049  // --> il faut les informer (setInCurrentCalcul(true))
1050  // - ils sont "inCurrentCalcul" mais ne sont pas dans la liste
1051  // --> il faut les "desactiver" (setInCurrentCalcul(false))
1052 
1053  for (i = 0; i < pSite->getInfrastructure()->getListBatiment().size(); i++)
1054  {
1055  LPTYBatiment pBatiment =
1056  TYBatiment::safeDownCast(pSite->getInfrastructure()->getListBatiment()[i]->getElement());
1057 
1058  if ((pBatiment->isInCurrentCalcul()) && (_emitAcVolNode.find(pBatiment) == _emitAcVolNode.end()))
1059  {
1060  // On l'informe qu'il ne fait pas partie du calcul
1061  pBatiment->setInCurrentCalcul(false);
1062  }
1063  else if ((!pBatiment->isInCurrentCalcul()) &&
1064  (_emitAcVolNode.find(pBatiment) != _emitAcVolNode.end()))
1065  {
1066  // On l'informe qu'il fait partie du calcul
1067  pBatiment->setInCurrentCalcul(true);
1068  }
1069  }
1070 
1071  for (i = 0; i < pSite->getInfrastructure()->getListMachine().size(); i++)
1072  {
1073  LPTYMachine pMachine =
1074  TYMachine::safeDownCast(pSite->getInfrastructure()->getListMachine()[i]->getElement());
1075 
1076  if ((pMachine->isInCurrentCalcul()) && (_emitAcVolNode.find(pMachine) == _emitAcVolNode.end()))
1077  {
1078  // On l'informe qu'il ne fait pas partie du calcul
1079  pMachine->setInCurrentCalcul(false);
1080  }
1081  else if ((!pMachine->isInCurrentCalcul()) && (_emitAcVolNode.find(pMachine) != _emitAcVolNode.end()))
1082  {
1083  // On l'informe qu'il fait partie du calcul
1084  pMachine->setInCurrentCalcul(true);
1085  }
1086  }
1087 
1088  for (i = 0; i < pSite->getInfrastructure()->getSrcs().size(); i++)
1089  {
1090  LPTYSourcePonctuelle pSrcPonct =
1091  TYSourcePonctuelle::safeDownCast(pSite->getInfrastructure()->getSrc(i)->getElement());
1092 
1093  if ((pSrcPonct->isInCurrentCalcul()) && (_emitAcVolNode.find(pSrcPonct) == _emitAcVolNode.end()))
1094  {
1095  // On l'informe qu'il ne fait pas partie du calcul
1096  pSrcPonct->setInCurrentCalcul(false);
1097  }
1098  else if ((!pSrcPonct->isInCurrentCalcul()) &&
1099  (_emitAcVolNode.find(pSrcPonct) != _emitAcVolNode.end()))
1100  {
1101  // On l'informe qu'il fait partie du calcul
1102  pSrcPonct->setInCurrentCalcul(true);
1103  }
1104  }
1105 #if WITH_NMPB
1106  for (i = 0; i < pSite->getInfrastructure()->getListRoute().size(); i++)
1107  {
1108  LPTYRoute pRoute = pSite->getInfrastructure()->getRoute(i);
1109 
1110  if ((pRoute->isInCurrentCalcul()) && (_emitAcVolNode.find(pRoute) == _emitAcVolNode.end()))
1111  {
1112  // On l'informe qu'il ne fait pas partie du calcul
1113  pRoute->setInCurrentCalcul(false);
1114  }
1115  else if ((!pRoute->isInCurrentCalcul()) && (_emitAcVolNode.find(pRoute) != _emitAcVolNode.end()))
1116  {
1117  // On l'informe qu'il fait partie du calcul
1118  pRoute->setInCurrentCalcul(true);
1119  }
1120  }
1121 #endif
1122  for (i = 0; i < pSite->getInfrastructure()->getListResTrans().size(); i++)
1123  {
1124  LPTYReseauTransport pResTrans = pSite->getInfrastructure()->getResTrans(i);
1125 
1126  if ((pResTrans->isInCurrentCalcul()) && (_emitAcVolNode.find(pResTrans) == _emitAcVolNode.end()))
1127  {
1128  // On l'informe qu'il ne fait pas partie du calcul
1129  pResTrans->setInCurrentCalcul(false);
1130  }
1131  else if ((!pResTrans->isInCurrentCalcul()) &&
1132  (_emitAcVolNode.find(pResTrans) != _emitAcVolNode.end()))
1133  {
1134  // On l'informe qu'il fait partie du calcul
1135  pResTrans->setInCurrentCalcul(true);
1136  }
1137  }
1138 }
1139 
1141 {
1142  // Create point control entry if not done
1143  TYUUID id_point = pPoint->getID();
1144  if (_mapPointCtrlSpectre.find(id_point) == _mapPointCtrlSpectre.end())
1145  {
1146  LPTYSpectre spectre = new TYSpectre();
1147  _mapPointCtrlSpectre[id_point] = spectre;
1148 
1149  // Set control point on for this calcul
1150  pPoint->setEtat(getID(), true);
1151 
1152  if (_pResultat->addRecepteur(pPoint) == true)
1153  {
1155  }
1156 
1157  return true;
1158  }
1159 
1160  return false;
1161 }
1162 
1164 {
1165  // Remove point control entry
1166  TYMapIdSpectre::iterator it = _mapPointCtrlSpectre.find(pPoint->getID());
1167  if (it != _mapPointCtrlSpectre.end())
1168  {
1169  _mapPointCtrlSpectre.erase(it);
1170  }
1171 
1172  // Set control point off for this calcul
1173  pPoint->setEtat(getID(), false);
1174 
1175  // Cleaning results
1176  _pResultat->purge();
1177 
1178  return true;
1179 }
1180 
1182 {
1183  TYMapIdSpectre::iterator it;
1184  for (it = _mapPointCtrlSpectre.begin(); it != _mapPointCtrlSpectre.end(); it++)
1185  {
1186  (*it).second = new TYSpectre();
1187  }
1188 }
1189 
1191 {
1192  TYMapIdTabSpectre::iterator it;
1193  for (it = _noiseMapsSpectrums.begin(); it != _noiseMapsSpectrums.end(); it++)
1194  {
1195  for (unsigned int i = 0; i < (*it).second.size(); i++)
1196  {
1197  (*it).second.at(i)->deepCopy(new TYSpectre());
1198  }
1199  }
1200 }
1201 
1203 {
1204  TYMapIdTabSpectre::iterator it;
1205  for (it = otherNoiseMap.begin(); it != otherNoiseMap.end(); it++)
1206  {
1207  TYUUID id = (*it).first;
1208  std::vector<LPTYSpectre> tabSpectres;
1209  for (unsigned int i = 0; i < (*it).second.size(); i++)
1210  {
1211  tabSpectres.push_back(new TYSpectre());
1212  }
1213 
1214  _noiseMapsSpectrums[id] = tabSpectres;
1215  }
1216 }
1217 
1219 {
1220  return getSpectre(pPoint->getID());
1221 }
1222 
1224 {
1225  TYSpectre* ret = new TYSpectre();
1226 
1227  TYMapIdSpectre::iterator it = _mapPointCtrlSpectre.find(id_pt);
1228 
1229  if (it != _mapPointCtrlSpectre.end())
1230  {
1231  ret = (*it).second;
1232  }
1233 
1234  return ret;
1235 }
1236 
1238 {
1239  TYMapIdSpectre::iterator it = _mapPointCtrlSpectre.find(pPoint->getID());
1240 
1241  // Add only if the control point is known from the calcul
1242  if (it != _mapPointCtrlSpectre.end())
1243  {
1244  (*it).second = pSpectre;
1245  }
1246  else // other case point is owned by a TYMaillage
1247  {
1248  if (dynamic_cast<TYMaillage*>(pPoint->getParent()))
1249  {
1250  LPTYSpectre currentSpectre = pPoint->getSpectre();
1251  currentSpectre->deepCopy(pSpectre);
1252  }
1253  }
1254 }
1255 
1256 void TYCalcul::setSpectre(const TYUUID& id_pt, TYSpectre* pSpectre)
1257 {
1258  assert(true && "NOT IMPLEMENTED");
1259 }
1260 
1262 {
1263  TYMapIdSpectre::iterator it = _mapPointCtrlSpectre.find(id_pt);
1264 
1265  if (it != _mapPointCtrlSpectre.end())
1266  {
1267  return true;
1268  }
1269 
1270  return false;
1271 }
1272 
1273 void TYCalcul::setPtCtrlStatus(const TYUUID& id_pt, bool bStatus)
1274 {
1275  // Suppression de la map des spectres aux points
1276  TYMapIdSpectre::iterator it = _mapPointCtrlSpectre.find(id_pt);
1277 
1278  if (it != _mapPointCtrlSpectre.end())
1279  {
1280  _mapPointCtrlSpectre.erase(it);
1281  }
1282 
1283  // Information du point de controle
1284  TYElement* pElem = TYElement::getInstance(id_pt);
1285  if (pElem)
1286  {
1287  TYPointControl* pPoint = dynamic_cast<TYPointControl*>(pElem);
1288  if (pPoint)
1289  {
1290  pPoint->setEtat(getID(), bStatus);
1291  }
1292  }
1293 }
1294 
1295 std::vector<LPTYSpectre>* TYCalcul::getSpectrumDatas(TYMaillage* pMaillage)
1296 {
1297  return getSpectrumDatas(pMaillage->getID());
1298 }
1299 
1300 std::vector<LPTYSpectre>* TYCalcul::getSpectrumDatas(const TYUUID& id)
1301 {
1302  TYMapIdTabSpectre::iterator it = _noiseMapsSpectrums.find(id);
1303 
1304  if (it != _noiseMapsSpectrums.end())
1305  {
1306  return &(*it).second;
1307  }
1308 
1309  return nullptr;
1310 }
1311 
1313 {
1314  TYUUID id = pMaillage->getID();
1315 
1316  // Test if map is already selected for this calcul
1317  if (_noiseMapsSpectrums.find(id) != _noiseMapsSpectrums.end())
1318  {
1319  return false;
1320  }
1321 
1322  size_t nbPoints = pMaillage->getPtsCalcul().size();
1323  std::vector<LPTYSpectre> tabSpectres;
1324  for (unsigned int i = 0; i < nbPoints; i++)
1325  {
1326  tabSpectres.push_back(new TYSpectre());
1327  }
1328 
1329  _noiseMapsSpectrums[id] = tabSpectres;
1330 
1331  pMaillage->setEtat(getID(), true);
1332 
1333  return true;
1334 }
1335 
1337 {
1338  TYUUID id = pMaillage->getID();
1339 
1340  // Test if map is selected for this calcul
1341  if (_noiseMapsSpectrums.find(id) == _noiseMapsSpectrums.end())
1342  {
1343  return false;
1344  }
1345 
1346  _noiseMapsSpectrums[id].clear(); // cleaning old noise map datas
1347  size_t nbPoints = pMaillage->getPtsCalcul().size();
1348  std::vector<LPTYSpectre> tabSpectres;
1349  for (unsigned int i = 0; i < nbPoints; i++)
1350  {
1351  tabSpectres.push_back(new TYSpectre());
1352  }
1353 
1354  _noiseMapsSpectrums[id] = tabSpectres;
1355  return true;
1356 }
1357 
1359 {
1360  TYUUID id = pMaillage->getID();
1361  TYMapIdTabSpectre::iterator it = _noiseMapsSpectrums.find(id);
1362 
1363  if (it != _noiseMapsSpectrums.end())
1364  {
1365  _noiseMapsSpectrums.erase(it);
1366 
1367  pMaillage->setEtat(getID(), false);
1368 
1369  return true;
1370  }
1371 
1372  return false;
1373 }
1374 
1375 void TYCalcul::setNoiseMapSpectrums(const TYMaillage* pMaillage, TYTabLPSpectre& tabSpectrum)
1376 {
1377  TYUUID id = pMaillage->getID();
1378  setNoiseMapSpectrums(id, tabSpectrum);
1379 }
1380 
1382 {
1383  _noiseMapsSpectrums[id] = tabSpectrum;
1384 }
1385 
1387 {
1388  return _mapPointCtrlSpectre;
1389 }
QDomDocument DOM_Document
Definition: QT2DOM.h:33
QDomElement DOM_Element
Definition: QT2DOM.h:30
Representation graphique d'un calcul (fichier header)
outil IHM pour un calcul (fichier header)
TY_EXTENSION_INST(TYCalcul)
TY_EXT_GRAPHIC_INST(TYCalcul)
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::vector< LPTYSpectre > TYTabLPSpectre
Collection de TYSpectre.
Definition: TYDefines.h:337
std::list< TYUUID > TYListID
Collection d'identifiants.
Definition: TYDefines.h:331
std::vector< LPTYElement > LPTYElementArray
Definition: TYElement.h:345
TYGeometryNode TYMaillageGeoNode
Noeud geometrique de type TYMaillage.
Definition: TYMaillage.h:434
int id
std::map< TYElement *, TYTabSourcePonctuelleGeoNode > TYMapElementTabSources
Definition: idgen.h:28
void FromString(const char *strUuid)
Definition: idgen.h:83
const QString toString() const
Definition: idgen.h:78
virtual const char * getClassName() const
Definition: TYElement.h:249
static OPrototype * safeDownCast(OPrototype *pObject)
Definition: TYElement.cpp:71
bool isA(const char *className) const
Definition: TYElement.cpp:65
int getCurRegime() const
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
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
bool addPtCtrlToResult(LPTYPointControl pPoint)
Add a checkpoint to the results array.
Definition: TYCalcul.cpp:1140
int _numero
Calculation number.
Definition: TYCalcul.h:559
TYCalcul()
Definition: TYCalcul.cpp:48
TYMapPtrElementBool _emitAcVolNode
State (radiating/non-radiating) of the elements of the scene.
Definition: TYCalcul.h:581
OGenID _solverId
Definition: TYCalcul.h:556
void purge()
Reset this calculation.
Definition: TYCalcul.cpp:824
TYCalcul & operator=(const TYCalcul &other)
Operator =.
Definition: TYCalcul.cpp:73
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
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
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
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
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
LPTYSpectre getSpectre(const TYUUID &id_pt)
Definition: TYCalcul.cpp:1223
bool operator==(const TYCalcul &other) const
Operator ==.
Definition: TYCalcul.cpp:100
LPTYSiteNode _pSiteCalcul
Site on which the calculation will be carried out.
Definition: TYCalcul.h:575
void clearNoiseMapsSpectrums()
Definition: TYCalcul.cpp:1190
virtual bool deepCopy(const TYElement *pOther, bool copyId=true, bool pUseCopyTag=false)
Definition: TYCalcul.cpp:178
bool addMaillage(TYMaillage *pMaillage)
Add this maillage to calcul.
Definition: TYCalcul.cpp:1312
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
void setState(int state)
Set editable attribute.
Definition: TYCalcul.h:406
QString _dateCreation
Creation date.
Definition: TYCalcul.h:563
void goPostprocessing()
Definition: TYCalcul.cpp:1020
TYMapIdSpectre getMapPointCtrlSpectre()
Returns map of control points with spectrum.
Definition: TYCalcul.cpp:1386
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
TYElement * getParent() const
Definition: TYElement.h:699
virtual bool isInCurrentCalcul()
Definition: TYElement.h:541
virtual bool deepCopy(const TYElement *pOther, bool copyId=true, bool pUseCopyTag=false)
Definition: TYElement.cpp:307
virtual DOM_Element toXML(DOM_Element &domElement)
Definition: TYElement.cpp:368
QString _name
Nom courant de l'element.
Definition: TYElement.h:966
TYElement & operator=(const TYElement &other)
Definition: TYElement.cpp:265
bool callFromXMLIfEqual(DOM_Element &domElement, int *pRetVal=NULL)
Definition: TYElement.cpp:544
const TYUUID & getID() const
Definition: TYElement.cpp:176
TYElement * _pParent
Reference sur l'element parent.
Definition: TYElement.h:969
virtual void setInCurrentCalcul(bool state, bool recurschild=true, bool recursparent=true)
Definition: TYElement.cpp:410
virtual void getChilds(LPTYElementArray &childs, bool recursif=true)
Definition: TYElement.h:532
void setParent(TYElement *pParent)
Definition: TYElement.h:692
virtual int fromXML(DOM_Element domElement)
Definition: TYElement.cpp:381
virtual void setIsAcousticModified(bool isModified)
Definition: TYElement.cpp:248
static TYElement * getInstance(TYUUID uuid)
Definition: TYElement.cpp:158
virtual void setIsGeometryModified(bool isModified)
Definition: TYElement.cpp:253
TYElement * getElement() const
TYTabBatimentGeoNode & getListBatiment()
LPTYUserSourcePonctuelleGeoNode getSrc(int index)
LPTYReseauTransport getResTrans(int index)
TYTabMachineGeoNode & getListMachine()
void getAllSrcs(const TYCalcul *pCalcul, TYMapElementTabSources &mapElementSrcs)
Classe de definition d'un maillage.
Definition: TYMaillage.h:51
TYTabLPPointCalcul & getPtsCalcul()
Set/Get de la liste des points de calcul.
Definition: TYMaillage.h:123
virtual void setEtat(const TYUUID &id_calc, bool etat)
Definition: TYMaillage.cpp:642
QString generateName(const char *classname)
Retourne le nom de la classe associe a un nombre.
void enable(bool enable)
Active la generation de nom.
Definition: TYNameManager.h:64
static TYNameManager * get()
Retourne l'instance singleton.
Classe de definition d'un point de calcul.C'est une classe derivee a TYPoint avec en plus un spectrep...
Definition: TYPointCalcul.h:33
virtual LPTYSpectre getSpectre()
Get du spectre resultat d'un calcul donne.
Classe de definition d'un point de controle.Le point de controle est un point de calcul avec une haut...
virtual void setEtat(const TYUUID &id_calc, bool etat)
classe de definition d'un projet.
Definition: TYProjet.h:45
bool addMaillage(LPTYMaillageGeoNode pMaillageGeoNode)
Ajout d'un maillage.
Definition: TYProjet.cpp:783
bool addPointControl(LPTYPointControl pPointControl)
Definition: TYProjet.cpp:394
LPTYSiteNode getSite()
Get du site.
Definition: TYProjet.h:169
static bool gSaveValues
Definition: TYProjet.h:587
Classe decrivant un rayon acoustique gere par un lancer de rayon. Cette classe doit permettre la mode...
Definition: TYRay.h:35
Classe qui Permet de centraliser les resultats d'un calcul acoustique.
Definition: TYResultat.h:48
void buildMatrix()
Construit la matrice resultat a partir des sources et recepteurs entres.
Definition: TYResultat.cpp:427
virtual DOM_Element toXML(DOM_Element &domElement)
Definition: TYResultat.cpp:91
void buildMapSourceSpectre()
Build and store powerSpectrum of all sources in calcul.
Definition: TYResultat.cpp:857
void purge()
Reinitialise la matrice resultat.
Definition: TYResultat.cpp:317
bool addRecepteur(TYElement *pRecepteur)
Ajoute un recepteur et indique s'il faut reconstruire la matrice.
Definition: TYResultat.cpp:384
TYMapElementTabSources & getMapEmetteurSrcs()
Retourne le tableau associatif "emetteur/Liste de sources".
Definition: TYResultat.h:253
virtual void reparent()
Definition: TYSiteNode.cpp:487
LPTYInfrastructure getInfrastructure()
Definition: TYSiteNode.h:173
virtual bool deepCopy(const TYElement *pOther, bool copyId=true, bool pUseCopyTag=false)
Definition: TYSpectre.cpp:142
static int getElementAttributeToInt(DOM_Element parentElem, DOMString attName, bool *ok=NULL)
Definition: TYXMLTools.cpp:293
static bool getElementBoolValue(DOM_Element parentElem, DOMString nodeName, bool &nodeValue)
Definition: TYXMLTools.cpp:179
static bool getElementStringValue(DOM_Element parentElem, DOMString nodeName, QString &nodeValue)
Definition: TYXMLTools.cpp:93
static QString getElementAttributeToString(DOM_Element parentElem, DOMString attName)
Definition: TYXMLTools.cpp:276
static void addElementIntValue(DOM_Element &parentElem, DOMString nodeName, int nodeValue)
Definition: TYXMLTools.cpp:72
static bool getElementFloatValue(DOM_Element parentElem, DOMString nodeName, float &nodeValue)
Definition: TYXMLTools.cpp:211
static bool getElementIntValue(DOM_Element parentElem, DOMString nodeName, int &nodeValue)
Definition: TYXMLTools.cpp:129
static bool getElementDoubleValue(DOM_Element parentElem, DOMString nodeName, double &nodeValue)
Definition: TYXMLTools.cpp:243
static void addElementStringValue(DOM_Element &parentElem, DOMString nodeName, DOMString nodeValue)
Definition: TYXMLTools.cpp:24
std::string intToStr(int val)
Definition: macros.h:158