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