Code_TYMPAN  4.4.0
Industrial site acoustic simulation
TYEtage.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 #include <vector>
17 
18 #include "Tympan/core/defines.h"
19 #include "Tympan/core/logging.h"
22 
24 #if TY_USE_IHM
27 #endif
28 #include "TYEtage.h"
29 
30 #include <math.h>
31 
34 
35 TYEtage::TYEtage() : _closed(false), _surfAbsorbante(0.0), _volumeLibre(0.0)
36 {
38 
39  _bPourCalculTrajet = false;
40 #if TY_USE_IHM
41  if (TYPreferenceManager::exists(TYDIRPREFERENCEMANAGER, "UseNewAlgoGeom"))
42  {
43  _bPourCalculTrajet = TYPreferenceManager::getBool(TYDIRPREFERENCEMANAGER, "UseNewAlgoGeom");
44  }
45  else
46  {
47  TYPreferenceManager::setBool(TYDIRPREFERENCEMANAGER, "UseNewAlgoGeom", _bPourCalculTrajet);
48  }
49 #endif
50 
51  _pSol = new TYDalle();
52  _pSol->setParent(this);
53 
54  // Le sol est inactif par defaut
55  _pSol->setDensiteSrcs(0.0);
56  _pSol->setIsRayonnant(false, false);
57 
58  _pParoi = new TYParoi();
59 
60  _pPlafond = new TYDalle();
61  _pPlafond->setParent(this);
62 
64 
65  // On rajoute une entree dans le tableau associant les regimes
66  TYMapPtrElementInt mapElmRegime;
67  _tabRegimesMachines.push_back(mapElmRegime);
68 
69  TYMapPtrElementBool mapElmEtat;
70  _tabEtatMachines.push_back(mapElmEtat);
71 
72  _volEnglob = volEnglob(); // (re)calcul du volume englobant
73 }
74 
76 
78 {
79  *this = other;
80 }
81 
83 {
86  _closed = other._closed;
87  _pParoi = other._pParoi;
88  _tabMur = other._tabMur;
89  _pSol = other._pSol;
90  _pPlafond = other._pPlafond;
91  _tabSources = other._tabSources;
92  _tabMachine = other._tabMachine;
93  _volEnglob = other._volEnglob;
94 
97 
98  return *this;
99 }
100 
101 bool TYEtage::operator==(const TYEtage& other) const
102 {
103  if (this != &other)
104  {
105  if (TYAcousticVolume::operator!=(other))
106  {
107  return false;
108  }
109  if (_bPourCalculTrajet != (other._bPourCalculTrajet))
110  {
111  return false;
112  }
113  if (_closed != other._closed)
114  {
115  return false;
116  }
117  if (_pParoi != other._pParoi)
118  {
119  return false;
120  }
121  if (!(_tabMur == other._tabMur))
122  {
123  return false;
124  }
125  if (_pSol != other._pSol)
126  {
127  return false;
128  }
129  if (_pPlafond != other._pPlafond)
130  {
131  return false;
132  }
133  if (_tabSources != other._tabSources)
134  {
135  return false;
136  }
137  if (_tabMachine != other._tabMachine)
138  {
139  return false;
140  }
141  }
142  return true;
143 }
144 
145 bool TYEtage::operator!=(const TYEtage& other) const
146 {
147  return !operator==(other);
148 }
149 
150 bool TYEtage::deepCopy(const TYElement* pOther, bool copyId /*=true*/, bool pUseCopyTag /*=false*/)
151 {
152  if (!TYAcousticVolume::deepCopy(pOther, copyId))
153  {
154  return false;
155  }
156 
157  TYEtage* pOtherEtage = (TYEtage*)pOther;
158 
159  _bPourCalculTrajet = pOtherEtage->_bPourCalculTrajet;
160  _closed = pOtherEtage->_closed;
161 
162  _pParoi->deepCopy(pOtherEtage->_pParoi, copyId);
163 
164  _pSol->deepCopy(pOtherEtage->_pSol, copyId);
165  _pSol->setParent(this);
166  _pPlafond->deepCopy(pOtherEtage->_pPlafond, copyId);
167  _pPlafond->setParent(this);
168 
169  _tabMur.clear();
170 
171  unsigned int i = 0, j = 0;
172  for (i = 0; i < pOtherEtage->_tabMur.size(); i++)
173  {
174  LPTYMurGeoNode pMurGeoNode = new TYMurGeoNode(NULL, this);
175  pMurGeoNode->deepCopy(pOtherEtage->_tabMur[i], copyId);
176  pMurGeoNode->getElement()->setParent(this);
177  pMurGeoNode->setParent(this);
178  _tabMur.push_back(pMurGeoNode);
179  }
180 
181  _tabSources.clear();
182  for (i = 0; i < pOtherEtage->_tabSources.size(); i++)
183  {
185  pSourceGeoNode->deepCopy(pOtherEtage->_tabSources[i], copyId);
186  pSourceGeoNode->getElement()->setParent(this);
187  pSourceGeoNode->setParent(this);
188  _tabSources.push_back(pSourceGeoNode);
189  }
190 
191  _tabMachine.clear();
192  for (i = 0; i < pOtherEtage->_tabMachine.size(); i++)
193  {
194  LPTYMachineGeoNode pMachineGeoNode = new TYMachineGeoNode(new TYMachine);
195  pMachineGeoNode->deepCopy(pOtherEtage->_tabMachine[i], copyId);
196  pMachineGeoNode->getElement()->setParent(this);
197  pMachineGeoNode->setParent(this);
198  _tabMachine.push_back(pMachineGeoNode);
199  }
200 
201  // Recopie des etats des machines
202  // Il n'est pas possible de recuperer les tableaux d'etats des machines
203  // On en reconstruit un avec toutes les machines/sources en regimes 0
204  // et non rayonnant pour tous les regimes
205 
206  _tabRegimesMachines.clear();
207  for (i = 0; (int)i < getNbRegimes(); i++)
208  {
209  TYMapPtrElementInt mapSources;
210  for (j = 0; j < _tabSources.size(); j++)
211  {
212  TYElement* pElem = _tabSources[j]->getElement();
213  mapSources[pElem] = 0;
214  }
215  for (j = 0; j < _tabMachine.size(); j++)
216  {
217  TYElement* pElem = _tabMachine[j]->getElement();
218  mapSources[pElem] = 0;
219  }
220  _tabRegimesMachines.push_back(mapSources);
221  }
222 
223  _tabEtatMachines.clear();
224  for (i = 0; (int)i < getNbRegimes(); i++)
225  {
226  TYMapPtrElementBool mapEtats;
227  for (j = 0; j < _tabSources.size(); j++)
228  {
229  TYElement* pElem = _tabSources[j]->getElement();
230  mapEtats[pElem] = false;
231  }
232  for (j = 0; j < _tabMachine.size(); j++)
233  {
234  TYElement* pElem = _tabMachine[j]->getElement();
235  mapEtats[pElem] = false;
236  }
237  _tabEtatMachines.push_back(mapEtats);
238  }
239 
240  _volEnglob = volEnglob();
243 
244  return true;
245 }
246 
247 std::string TYEtage::toString() const
248 {
249  return "TYEtage";
250 }
251 
253 {
254  unsigned int i = 0;
255 
256  DOM_Element domNewElem = TYAcousticVolume::toXML(domElement);
257 
258  TYXMLTools::addElementIntValue(domNewElem, "closed", _closed);
259 
260  // Sauvegarde de la paroi par defaut du bâtiment
261  _pParoi->toXML(domNewElem);
262 
263  // Sauvegarde des murs
264  DOM_Document domDoc = domElement.ownerDocument();
265  DOM_Element listMurNode = domDoc.createElement("ListMur");
266  domNewElem.appendChild(listMurNode);
267  for (i = 0; i < _tabMur.size(); i++)
268  {
269  // Ajout du mur
270  _tabMur[i]->toXML(listMurNode);
271  }
272 
273  _pSol->toXML(domNewElem);
274  _pPlafond->toXML(domNewElem);
275 
276  // Sauvegarde des machines
277  DOM_Element listMachineNode = domDoc.createElement("ListMachine");
278  domNewElem.appendChild(listMachineNode);
279  for (i = 0; i < _tabMachine.size(); i++)
280  {
281  // Ajout de la machine si valide (i.e. contient des volumes)
283 
284  if (pNode && pNode->getNbChild() > 0)
285  {
286  _tabMachine[i]->toXML(listMachineNode);
287  }
288  }
289 
290  DOM_Element listSourceNode = domDoc.createElement("ListSource");
291  domNewElem.appendChild(listSourceNode);
292  for (i = 0; i < _tabSources.size(); i++)
293  {
294  // Ajout de la source
295  _tabSources[i]->toXML(listSourceNode);
296  }
297 
298  // Sauvegarde de l'etat des machines
299  DOM_Element listEtatNode = domDoc.createElement("TabEtatElement");
300  domNewElem.appendChild(listEtatNode);
301 
302  // Pour tous les regimes
303  for (i = 0; i < _tabRegimes.size(); i++)
304  {
305  if (_tabEtatMachines.size() == 0)
306  {
307  break;
308  }
309 
310  DOM_Element tmpNode = domDoc.createElement("Regime");
311  listEtatNode.appendChild(tmpNode);
312 
313  tmpNode.setAttribute("num", intToStr(i).data());
314 
315  TYMapPtrElementBool::iterator iter;
316  for (iter = _tabEtatMachines[i].begin(); iter != _tabEtatMachines[i].end(); iter++)
317  {
318  DOM_Element itemNode = domDoc.createElement("Element");
319  tmpNode.appendChild(itemNode);
320  itemNode.setAttribute("accVolNodeId", (*iter).first->getID().toString());
321  itemNode.setAttribute("state", intToStr((*iter).second).c_str());
322  }
323  }
324 
325  // Sauvegarde des regimes des machines
326  DOM_Element listRegimeNode = domDoc.createElement("TabRegimeElement");
327  domNewElem.appendChild(listRegimeNode);
328 
329  // Pour tous les regimes
330  for (i = 0; i < _tabRegimes.size(); i++)
331  {
332  if (_tabRegimesMachines.size() == 0)
333  {
334  break;
335  }
336 
337  DOM_Element tmpNode = domDoc.createElement("Regime");
338  listRegimeNode.appendChild(tmpNode);
339 
340  tmpNode.setAttribute("num", intToStr(i).data());
341 
342  TYMapPtrElementInt::iterator iter;
343  for (iter = _tabRegimesMachines[i].begin(); iter != _tabRegimesMachines[i].end(); iter++)
344  {
345  DOM_Element itemNode = domDoc.createElement("Element");
346  tmpNode.appendChild(itemNode);
347  itemNode.setAttribute("accVolNodeId", (*iter).first->getID().toString());
348  itemNode.setAttribute("regime", intToStr((*iter).second).c_str());
349  }
350  }
351 
352  return domNewElem;
353 }
354 
356 {
357  TYAcousticVolume::fromXML(domElement);
358 
359  // Reset
360  _tabMur.clear();
361  _tabSources.clear();
362  _tabMachine.clear();
363  _tabRegimesMachines.clear();
364  _tabEtatMachines.clear();
365 
366  bool closedOk = false;
367  bool solFound = false;
368  bool plafondFound = false;
369  bool reverbOk = false;
370  bool tabEtatElemFound = false;
371  bool tabRegimeElemFound = false;
372 
373  LPTYMurGeoNode pMurGeoNode = new TYMurGeoNode(new TYMur, this);
375  LPTYMachineGeoNode pMachineGeoNode = new TYMachineGeoNode(new TYMachine, this);
376  int retVal = -1;
377  unsigned int i = 0, j = 0;
378  DOM_Element elemCur;
379 
380  // Création d'une liste de doublons et un flag de détection de doublon (correction du bug 0006019)
381  std::map<TYUUID, TYUUID> mapDoublons;
382  // Indicateur d'existence de doublon;
383  bool bDoublon = false;
384 
385  QDomNodeList childs = domElement.childNodes();
386  for (i = 0; i < childs.length(); i++)
387  {
388  elemCur = childs.item(i).toElement();
389  TYXMLTools::getElementBoolValue(elemCur, "closed", _closed, closedOk);
390 
391  _pParoi->callFromXMLIfEqual(elemCur);
392 
393  if (elemCur.nodeName() == "ListMur")
394  {
395  DOM_Element elemCur2;
396  QDomNodeList childs2 = elemCur.childNodes();
397 
398  for (j = 0; j < childs2.length(); j++)
399  {
400  elemCur2 = childs2.item(j).toElement();
401  if (pMurGeoNode->callFromXMLIfEqual(elemCur2, &retVal))
402  {
403  if (retVal == 1)
404  {
405  _tabMur.push_back(pMurGeoNode);
406  pMurGeoNode = new TYMurGeoNode(NULL, this);
407  }
408  }
409  }
410  }
411 
412  if (!solFound)
413  {
414  solFound = _pSol->callFromXMLIfEqual(elemCur);
415  }
416  else if (!plafondFound)
417  {
418  plafondFound = _pPlafond->callFromXMLIfEqual(elemCur);
419  }
420 
421  if (elemCur.nodeName() == "ListMachine")
422  {
423  DOM_Element elemCur2;
424  QDomNodeList childs2 = elemCur.childNodes();
425 
426  // Cas des bâtiments important des machines, si non perte du lien régime bat/régime machine
427  bool bBak = TYElement::getRegenerateID();
429 
430  for (j = 0; j < childs2.length(); j++)
431  {
432  elemCur2 = childs2.item(j).toElement();
433 
434  if (pMachineGeoNode->callFromXMLIfEqual(elemCur2, &retVal))
435  {
436  if (retVal == 1)
437  {
438  // Vérification de l'existence eventuelle d'un doublon d'Id
439  TYElement* pElem = pMachineGeoNode->getElement();
440  TYUUID idOld = pElem->getID();
441  if (TYElement::testId(idOld, pElem))
442  {
443  // On change l'Id de l'element
444  pElem->regenerateID();
445  TYUUID idNew = pElem->getID();
446  // Ajout dans la liste des doublons
447  mapDoublons[idOld] = idNew;
448  // Un doublon constaté
449  bDoublon = true;
450  }
451  _tabMachine.push_back(pMachineGeoNode);
452  pMachineGeoNode = new TYMachineGeoNode(NULL, this);
453  }
454  }
455  }
456 
457  // Restauration de l'etat anterieur de regeneration de l'ID
459  }
460 
461  if (elemCur.nodeName() == "ListSource")
462  {
463  DOM_Element elemCur2;
464  QDomNodeList childs2 = elemCur.childNodes();
465 
466  // Cas des bâtiments important des machines, si non perte du lien régime bat/régime source
467  bool bBak = TYElement::getRegenerateID();
469 
470  for (j = 0; j < childs2.length(); j++)
471  {
472  elemCur2 = childs2.item(j).toElement();
473 
474  if (pSourceGeoNode->callFromXMLIfEqual(elemCur2, &retVal))
475  {
476  if (retVal == 1)
477  {
478  // Si fichier 3.1 besoin de transformer TYSourcePonctuelle en TYUserSourcePonctuelle
479  if (pSourceGeoNode->getElement()->isA("TYSourcePonctuelle"))
480  {
481  TYSourcePonctuelle* pSP =
482  TYSourcePonctuelle::safeDownCast(pSourceGeoNode->getElement());
484  pSourceGeoNode->setElement((TYElement*)pUSP);
485  }
486 
487  // Vérification de l'existence eventuelle d'un doublon d'Id
488  TYElement* pElem = pSourceGeoNode->getElement();
489  TYUUID idOld = pElem->getID();
490  if (TYElement::testId(idOld, pElem))
491  {
492  // On change l'Id de l'element
493  pElem->regenerateID();
494  TYUUID idNew = pElem->getID();
495  // Ajout dans la liste des doublons
496  mapDoublons[idOld] = idNew;
497  // Un doublon constaté
498  bDoublon = true;
499  }
500 
501  pSourceGeoNode->getElement()->setParent(this);
502  _tabSources.push_back(pSourceGeoNode);
503  pSourceGeoNode = new TYUserSourcePonctuelleGeoNode(NULL, this);
504  }
505  }
506  }
507 
508  // Restauration de l'etat anterieur de regeneration de l'ID
510  }
511 
512  if (elemCur.nodeName() == "TabEtatElement")
513  {
514  tabEtatElemFound = true;
515  DOM_Element elemCur3;
516  QDomNodeList childs3 = elemCur.childNodes();
517  // Boucle sur les regimes (de l'etage)
518  for (j = 0; j < childs3.length(); j++)
519  {
520  elemCur3 = childs3.item(j).toElement();
521  int regimeEtage = 0;
522  bool regimeMachineOk = false;
523 
524  if (elemCur3.nodeName() == "Regime")
525  {
526  TYMapPtrElementBool mapEtatRegime;
527 
528  // On relit le numero de regime
529  TYXMLTools::getElementIntValue(elemCur3, "num", regimeEtage, regimeMachineOk);
530 
531  DOM_Element elemCur4;
532 
533  QDomNodeList childs4 = elemCur3.childNodes();
534 
535  // On boucle sur tous les elements
536  for (unsigned int k = 0; k < childs4.length(); k++)
537  {
538  // bool idOk = false;
539  // bool elemOk = false;
540  QString id, oldId;
541  bool etat = false;
542  elemCur4 = childs4.item(k).toElement();
543 
544  if (elemCur4.nodeName() == "Element")
545  {
546  id = TYXMLTools::getElementAttributeToString(elemCur4, "accVolNodeId");
547  oldId = id;
548  etat = TYXMLTools::getElementAttributeToInt(elemCur4, "state");
549  }
550 
551  // Recuperation d'un pointeur sur l'element
552  if (bDoublon) // Substitution en cas de doublon détecté
553  {
554  TYUUID id2 = TYElement::fromString(id);
555  id2 = mapDoublons[id2];
556  id = TYElement::toString(id2);
557  }
558 
559  TYElement* pElement = TYElement::getInstance(id); // On essaye avec l'id
560 
561  if (!pElement)
562  {
563  pElement = TYElement::getInstance(oldId);
564  } // Si ca marche pas on essaye l'ancien
565 
566  // Ajout de l'element dans la table des etats
567  if (pElement)
568  {
569  mapEtatRegime[pElement] = etat;
570  }
571  }
572 
573  // On rajoute le map des etats dans le tableau de l'etage
574  _tabEtatMachines.push_back(mapEtatRegime);
575  }
576  }
577  }
578 
579  if (elemCur.nodeName() == "TabRegimeElement")
580  {
581  tabRegimeElemFound = true;
582 
583  DOM_Element elemCur3;
584 
585  QDomNodeList childs3 = elemCur.childNodes();
586 
587  // Boucle sur les regimes (de l'etage)
588  for (j = 0; j < childs3.length(); j++)
589  {
590  elemCur3 = childs3.item(j).toElement();
591  int regimeEtage = 0;
592  bool regimeMachineOk = false;
593  if (elemCur3.nodeName() == "Regime")
594  {
595  TYMapPtrElementInt mapRegimeMachine;
596 
597  // On relit le numero de regime
598  TYXMLTools::getElementIntValue(elemCur3, "num", regimeEtage, regimeMachineOk);
599 
600  DOM_Element elemCur4;
601 
602  QDomNodeList childs4 = elemCur3.childNodes();
603  // On boucle sur tous les elements
604  for (unsigned int k = 0; k < childs4.length(); k++)
605  {
606  elemCur4 = childs4.item(k).toElement();
607  // bool idOk = false;
608  // bool elemOk = false;
609  QString id, oldId;
610  int regimeMachine = 0;
611 
612  if (elemCur4.nodeName() == "Element")
613  {
614  id = TYXMLTools::getElementAttributeToString(elemCur4, "accVolNodeId");
615  oldId = id;
616  regimeMachine = TYXMLTools::getElementAttributeToInt(elemCur4, "regime");
617  }
618 
619  // Recuperation d'un pointeur sur l'element
620  if (bDoublon) // Substitution en cas de doublon détecté
621  {
622  TYUUID id2 = TYElement::fromString(id);
623  id2 = mapDoublons[id2];
624  id = TYElement::toString(id2);
625  }
626 
627  TYElement* pElement = TYElement::getInstance(id);
628 
629  if (!pElement)
630  {
631  pElement = TYElement::getInstance(oldId);
632  } // Si ca marche pas on essaye l'ancien
633 
634  // Ajout de l'element dans la table des etats
635  if (pElement)
636  {
637  mapRegimeMachine[pElement] = regimeMachine;
638  }
639  }
640 
641  // On rajoute le map des etats dans le tableau de l'etage
642  _tabRegimesMachines.push_back(mapRegimeMachine);
643  }
644  }
645  }
646  }
647 
648  if (!(tabEtatElemFound && tabRegimeElemFound)) // Cas ancien format de fichier
649  {
650  // On commence par vider les deux tableaux au cas ou un seul des deux aurait ete trouve
651  _tabRegimesMachines.clear();
652  _tabEtatMachines.clear();
653 
654  // Creation d'un map des etats et d'un map des regimes des machines
655  TYMapPtrElementBool mapEtatRegime;
656  TYMapPtrElementInt mapRegimeMachine;
657  _tabRegimesMachines.push_back(mapRegimeMachine);
658  _tabEtatMachines.push_back(mapEtatRegime);
659 
660  // Les sources (et machines) seront réaffectées automtiquement par la fonction
661  // verifTabRegimeSources()
662  }
663 
665  _volEnglob = volEnglob();
668 
669  if (_forceNormales)
670  {
671  inverseNormales();
672  }
673 
675 
676  return 1;
677 }
678 
680 {
681  bool bFound = false;
682 
683  for (unsigned int i = 0; i < getNbRegimes(); i++)
684  {
685  TYMapPtrElementBool& mapEtatRegime = _tabEtatMachines[i];
686  TYMapPtrElementInt& mapRegimeMachine = _tabRegimesMachines[i];
687 
688  for (unsigned int j = 0; j < _tabSources.size(); j++) // Pour toutes les sources
689  {
690  bFound = false;
691  TYElement* pElement = _tabSources[j]->getElement();
692  TYSource* pSource = dynamic_cast<TYSource*>(pElement);
693  if (pSource == nullptr)
694  {
695  continue;
696  }
697 
698  std::map<TYElement*, bool>::iterator itEtat;
699 
700  for (itEtat = mapEtatRegime.begin(); itEtat != mapEtatRegime.end(); itEtat++)
701  {
702  if (itEtat->first == pElement)
703  {
704  bFound = true;
705  break;
706  }
707  }
708 
709  if (!bFound)
710  {
711  mapEtatRegime[pElement] = false;
712  mapRegimeMachine[pElement] = 0;
713  }
714  }
715 
716  for (unsigned int j = 0; j < _tabMachine.size(); j++) // Pour toutes les machines
717  {
718  bFound = false;
719  TYElement* pElement = _tabMachine[j]->getElement();
720  if (!pElement->isA("TYMachine"))
721  {
722  continue;
723  }
724 
725  std::map<TYElement*, bool>::iterator itEtat;
726 
727  for (itEtat = mapEtatRegime.begin(); itEtat != mapEtatRegime.end(); itEtat++)
728  {
729  if (itEtat->first == pElement)
730  {
731  bFound = true;
732  break;
733  }
734  }
735 
736  if (!bFound)
737  {
738  mapEtatRegime[pElement] = false;
739  mapRegimeMachine[pElement] = 0;
740  }
741  }
742  }
743 }
744 
745 void TYEtage::exportCSV(std::ofstream& ofs)
746 {
747  // Export du nom de l'objet
748  ofs << _name.toStdString() << '\n';
749 
750  // Export des donnees acoustiques
752 
753  for (unsigned int i = 0; i < _tabMur.size(); i++)
754  {
755  TYMur* pMur = TYMur::safeDownCast(_tabMur[i]->getElement());
756  pMur->exportCSV(ofs);
757  }
758 
759  // On oublie pas les sols et plafond
760  _pSol->exportCSV(ofs);
761  _pPlafond->exportCSV(ofs);
762 
763  ofs << '\n';
764 }
765 
766 void TYEtage::getChilds(LPTYElementArray& childs, bool recursif /*=true*/)
767 {
768  TYAcousticVolume::getChilds(childs, recursif);
769 
770  unsigned int i = 0;
771 
772  for (i = 0; i < _tabMur.size(); i++)
773  {
774  childs.push_back(_tabMur[i]->getElement());
775  }
776 
777  childs.push_back(_pSol);
778  childs.push_back(_pPlafond);
779 
780  if (recursif)
781  {
782  for (i = 0; i < _tabMur.size(); i++)
783  {
784  _tabMur[i]->getChilds(childs, recursif);
785  }
786 
787  _pSol->getChilds(childs, recursif);
788  _pPlafond->getChilds(childs, recursif);
789 
790  for (i = 0; i < _tabMachine.size(); i++)
791  {
792  _tabMachine[i]->getChilds(childs, recursif);
793  }
794 
795  for (i = 0; i < _tabSources.size(); i++)
796  {
797  _tabSources[i]->getChilds(childs, recursif);
798  }
799  }
800 }
801 
803 {
804  assert(pMur);
805 
806  pMur->setParent(this);
807  pMur->setParoi(_pParoi);
808 
809  _tabMur.push_back(new TYMurGeoNode((LPTYElement)pMur));
810 
812  _volEnglob = volEnglob();
815 
816  return true;
817 }
818 
819 bool TYEtage::remMur(const LPTYMur pMur)
820 {
821  assert(pMur);
822  bool ret = false;
823  TYTabMurGeoNode::iterator ite;
824 
825  for (ite = _tabMur.begin(); ite != _tabMur.end(); ite++)
826  {
827  if (TYMur::safeDownCast((*ite)->getElement()) == pMur)
828  {
829  _tabMur.erase(ite);
830  ret = true;
831  break;
832  }
833  }
834 
836  _volEnglob = volEnglob();
839 
840  return ret;
841 }
842 
843 bool TYEtage::remMur(QString idMur)
844 {
845  bool ret = false;
846  TYTabMurGeoNode::iterator ite;
847 
848  for (ite = _tabMur.begin(); ite != _tabMur.end(); ite++)
849  {
850  if ((*ite)->getElement()->getID().toString() == idMur)
851  {
852  _tabMur.erase(ite);
853  ret = true;
854  break;
855  }
856  }
857 
859  _volEnglob = volEnglob();
862 
863  return ret;
864 }
865 
867 {
868  _tabMur.clear();
870  _volEnglob = volEnglob();
873 }
874 
875 bool TYEtage::setMurs(const TYTabPoint& tabPts, double hauteur /*=2.0*/, bool close /*=true*/)
876 {
877  TYPoint pt0, pt1;
878  size_t count = tabPts.size();
879  ORepere3D repMur;
880 
881  if ((count == 0) || (hauteur <= 0.0))
882  {
883  return false;
884  }
885 
886  // Reset
887  _tabMur.clear();
888 
889  // S'il y a moins de 2 murs, l'etage ne peut pas etre ferme
890  if (tabPts.size() > 1)
891  {
892  // On conserve l'etat
893  _closed = close;
894  }
895  else
896  {
897  _closed = false;
898  }
899 
900  // On teste le 1er point et le dernier point sont confondus avec une tolerance
901  if (tabPts[0].isEqual(tabPts[count - 1]))
902  {
903  // On ne reprend pas le dernier point
904  count -= 1;
905  }
906  else if (!_closed)
907  {
908  // On s'arrete avant de fermer les murs
909  count -= 1;
910  }
911 
912  // Une face pour chaque couple de points qui se suivent
913  for (int i = 0; i < count; i++)
914  {
915  pt1 = tabPts[i];
916  pt0 = tabPts[(i + 1) % tabPts.size()];
917 
918  // Vecteur pour la "longueur" de la face
919  OVector3D vec01(pt0, pt1);
920 
921  // Le mur pour cette face
922  LPTYMur pMur = new TYMur();
923 
924  pMur->setParent(this);
925  // Dimension du mur
926  pMur->setSize(vec01.norme(), hauteur);
927 
928  // Position du mur
929  repMur._origin = OVector3D(pt0) + (vec01 * 0.5);
930  repMur._origin._z = hauteur / 2.0;
931 
932  // Orientation du mur
933  vec01.normalize();
934  repMur._vecI = vec01;
935  repMur._vecJ = OVector3D(0.0, 0.0, 1.0);
936  repMur._vecK = vec01.cross(repMur._vecJ);
937 
938  LPTYMurGeoNode pMurGeoNode = new TYMurGeoNode();
939  pMurGeoNode->setRepere(repMur);
940  pMurGeoNode->setElement((LPTYElement)pMur);
941  _tabMur.push_back(pMurGeoNode);
942  }
943 
945  _volEnglob = volEnglob();
948 
949  return true;
950 }
951 
953 {
954  TYTabPoint res;
955  size_t nbPts = _tabMur.size();
956  size_t i = 0;
957 
958  if (!nbPts)
959  {
960  return res;
961  }
962 
963  res.reserve(nbPts);
964 
965  for (i = 0; i < nbPts; i++)
966  {
967  // On recupere le point
968  TYPoint pt = TYMur::safeDownCast(_tabMur[i]->getElement())->getBoundingRect()->_pts[2];
969 
970  // On passe dans le repere de l'etage
971  pt = _tabMur[i]->getMatrix() * pt;
972 
973  // Ajout du point
974  res.push_back(pt);
975  }
976 
977  // Si l'etage n'est pas ferme (ecran), on rajoute le dernier
978  // point manuellement
979  if (!_closed)
980  {
981  // On recupere le point
982  TYPoint pt = TYMur::safeDownCast(_tabMur[i - 1]->getElement())->getBoundingRect()->_pts[3];
983 
984  // On passe dans le repere de l'etage
985  pt = _tabMur[i - 1]->getMatrix() * pt;
986 
987  // Ajout du point
988  res.push_back(pt);
989  }
990 
991  return res;
992 }
993 
994 void TYEtage::setHauteur(double hauteur)
995 {
996  size_t nbPts = _tabMur.size();
997 
998  if (nbPts <= 0)
999  {
1000  return;
1001  }
1002 
1003  for (size_t i = 0; i < nbPts; i++)
1004  {
1005  // On applique la nouvelle hauteur
1006  TYMur::safeDownCast(_tabMur[i]->getElement())->setSizeY(hauteur);
1007 
1008  // On positionne le centre du mur a la 1/2 hauteur
1009  _tabMur[i]->getORepere3D()._origin._z = hauteur / 2.0;
1010  }
1011 
1012  updateSolPlafond();
1013  _volEnglob = volEnglob();
1016 }
1017 
1018 double TYEtage::getHauteur() const
1019 {
1020  double res = 0.0;
1021 
1022  if (_tabMur.size() > 0)
1023  {
1024  res = TYMur::safeDownCast(_tabMur[0]->getElement())->getSizeY();
1025  }
1026 
1027  return res;
1028 }
1029 
1031 {
1032  assert(pMachineGeoNode);
1033 
1034  TYMachine* pMachine = TYMachine::safeDownCast(pMachineGeoNode->getElement());
1035 
1036  assert(pMachine);
1037 
1038  pMachineGeoNode->setParent(this);
1039  pMachine->setParent(this);
1040 
1041  _tabMachine.push_back(pMachineGeoNode);
1042 
1043  // Pour tous les regimes de l'etage
1044  TYElement* pElement = (TYElement*)pMachine;
1045  for (unsigned int i = 0; i < _tabRegimes.size(); i++)
1046  {
1047  // On rajoute la machine dans le tableau associatif du regime
1048  _tabRegimesMachines[i][pElement] = 0;
1049 
1050  // On met la machine active pour ce regime
1051  _tabEtatMachines[i][pElement] = true;
1052  }
1053 
1054  setIsGeometryModified(true);
1055 
1056  return true;
1057 }
1058 
1059 bool TYEtage::addMachine(LPTYMachine pMachine, const TYRepere& pos)
1060 {
1061  return addMachine(new TYMachineGeoNode(pos, (LPTYElement)pMachine));
1062 }
1063 
1065 {
1066  return addMachine(new TYMachineGeoNode((LPTYElement)pMachine));
1067 }
1068 
1069 bool TYEtage::remMachine(const LPTYMachineGeoNode pMachineGeoNode)
1070 {
1071  assert(pMachineGeoNode);
1072  bool ret = false;
1073  TYTabMachineGeoNode::iterator ite;
1074 
1075  for (ite = _tabMachine.begin(); ite != _tabMachine.end(); ite++)
1076  {
1077  if ((*ite) == pMachineGeoNode)
1078  {
1079  _tabMachine.erase(ite);
1080  ret = true;
1081  break;
1082  }
1083  }
1084 
1085  // Pour tous les regimes de l'etage
1086  TYElement* pElement = pMachineGeoNode->getElement();
1087  TYMapPtrElementInt::iterator iter;
1088  TYMapPtrElementBool::iterator itb;
1089  for (unsigned int i = 0; i < _tabRegimes.size(); i++)
1090  {
1091  iter = _tabRegimesMachines[i].find(pElement);
1092  // On supprime la machine dans le tableau associatif du regime
1093  _tabRegimesMachines[i].erase(iter);
1094 
1095  itb = _tabEtatMachines[i].find(pElement);
1096  _tabEtatMachines[i].erase(itb);
1097  }
1098 
1099  setIsGeometryModified(true);
1100 
1101  return ret;
1102 }
1103 
1104 bool TYEtage::remMachine(const LPTYMachine pMachine)
1105 {
1106  assert(pMachine);
1107  bool ret = false;
1108  TYTabMachineGeoNode::iterator ite;
1109 
1110  for (ite = _tabMachine.begin(); ite != _tabMachine.end(); ite++)
1111  {
1112  if (TYMachine::safeDownCast((*ite)->getElement()) == pMachine)
1113  {
1114  _tabMachine.erase(ite);
1115  ret = true;
1116  break;
1117  }
1118  }
1119 
1120  // Pour tous les regimes de l'etage
1121  TYElement* pElement = (TYElement*)pMachine;
1122  TYMapPtrElementInt::iterator iter;
1123  TYMapPtrElementBool::iterator itb;
1124  for (unsigned int i = 0; i < _tabRegimes.size(); i++)
1125  {
1126  iter = _tabRegimesMachines[i].find(pElement);
1127  // On supprime la machine dans le tableau associatif du regime
1128  _tabRegimesMachines[i].erase(iter);
1129 
1130  itb = _tabEtatMachines[i].find(pElement);
1131  _tabEtatMachines[i].erase(itb);
1132  }
1133 
1134  setIsGeometryModified(true);
1135 
1136  return ret;
1137 }
1138 
1139 bool TYEtage::remMachine(QString idMachine)
1140 {
1141  bool ret = false;
1142  TYTabMachineGeoNode::iterator ite;
1143 
1144  for (ite = _tabMachine.begin(); ite != _tabMachine.end(); ite++)
1145  {
1146  if ((*ite)->getElement()->getID().toString() == idMachine)
1147  {
1148  _tabMachine.erase(ite);
1149  ret = true;
1150  break;
1151  }
1152  }
1153 
1154  // Pour tous les regimes de l'etage
1155  TYElement* pElement = (*ite)->getElement();
1156  TYMapPtrElementInt::iterator iter;
1157  TYMapPtrElementBool::iterator itb;
1158  for (unsigned int i = 0; i < _tabRegimes.size(); i++)
1159  {
1160  iter = _tabRegimesMachines[i].find(pElement);
1161  // On supprime la machine dans le tableau associatif du regime
1162  _tabRegimesMachines[i].erase(iter);
1163 
1164  itb = _tabEtatMachines[i].find(pElement);
1165  _tabEtatMachines[i].erase(itb);
1166  }
1167  setIsGeometryModified(true);
1168 
1169  return ret;
1170 }
1171 
1173 {
1174  unsigned int i = 0, j = 0;
1175 
1176  TYMapPtrElementInt::iterator iter;
1177  for (i = 0; i < _tabRegimesMachines.size(); i++)
1178  {
1179  for (j = 0; j < _tabMachine.size(); j++)
1180  {
1181  TYElement* pElement = _tabMachine[j]->getElement();
1182  iter = _tabRegimesMachines[i].find(pElement);
1183  _tabRegimesMachines[i].erase(iter);
1184  }
1185  }
1186 
1187  TYMapPtrElementBool::iterator itb;
1188  for (i = 0; i < _tabEtatMachines.size(); i++)
1189  {
1190  for (j = 0; j < _tabMachine.size(); j++)
1191  {
1192  TYElement* pElement = _tabMachine[j]->getElement();
1193  itb = _tabEtatMachines[i].find(pElement);
1194  _tabEtatMachines[i].erase(itb);
1195  }
1196  }
1197 
1198  _tabMachine.clear();
1199  setIsGeometryModified(true);
1200 }
1201 
1203 {
1204  assert(pMachine);
1205  TYTabMachineGeoNode::iterator ite;
1206 
1207  for (ite = _tabMachine.begin(); ite != _tabMachine.end(); ite++)
1208  {
1209  if (TYMachine::safeDownCast((*ite)->getElement()) == pMachine)
1210  {
1211  return (*ite);
1212  }
1213  }
1214 
1215  return NULL;
1216 }
1217 
1219 {
1220  assert(pSourceGeoNode);
1221  assert(pSourceGeoNode->getElement());
1222 
1223  if (this->isA("TYAcousticCylinder"))
1224  {
1225  return false;
1226  }
1227 
1228  pSourceGeoNode->setParent(this);
1229  pSourceGeoNode->getElement()->setParent(this);
1230 
1231  _tabSources.push_back(pSourceGeoNode);
1232 
1233  // Pour tous les regimes de l'etage
1234  TYElement* pElement = pSourceGeoNode->getElement();
1235  for (unsigned int i = 0; i < _tabRegimes.size(); i++)
1236  {
1237  // On rajoute la machine dans le tableau associatif du regime
1238  _tabRegimesMachines[i][pElement] = 0;
1239  // On met la machine active pour ce regime
1240  _tabEtatMachines[i][pElement] = true;
1241  }
1242  setIsGeometryModified(true);
1243 
1244  return true;
1245 }
1246 
1248 {
1249  return addSource(new TYUserSourcePonctuelleGeoNode(pos, (LPTYElement)pSource));
1250 }
1251 
1253 {
1254  return addSource(new TYUserSourcePonctuelleGeoNode((LPTYElement)pSource));
1255 }
1256 
1258 {
1259  assert(pSourceGeoNode);
1260 
1261  bool ret = false;
1262  TYTabUserSourcePonctuelleGeoNode::iterator ite;
1263 
1264  for (ite = _tabSources.begin(); ite != _tabSources.end(); ite++)
1265  {
1266  if ((*ite) == pSourceGeoNode)
1267  {
1268  _tabSources.erase(ite);
1269  ret = true;
1270  break;
1271  }
1272  }
1273 
1274  // Pour tous les regimes de l'etage
1275  TYElement* pElement = (*ite)->getElement();
1276  TYMapPtrElementInt::iterator iter;
1277  TYMapPtrElementBool::iterator itb;
1278  for (unsigned int i = 0; i < _tabRegimes.size(); i++)
1279  {
1280  iter = _tabRegimesMachines[i].find(pElement);
1281  // On supprime la machine dans le tableau associatif du regime
1282  _tabRegimesMachines[i].erase(iter);
1283 
1284  itb = _tabEtatMachines[i].find(pElement);
1285  _tabEtatMachines[i].erase(itb);
1286  }
1287  setIsGeometryModified(true);
1288 
1289  return ret;
1290 }
1291 
1293 {
1294  assert(pSource);
1295  bool ret = false;
1296  TYTabUserSourcePonctuelleGeoNode::iterator ite;
1297 
1298  for (ite = _tabSources.begin(); ite != _tabSources.end(); ite++)
1299  {
1300  if (TYUserSourcePonctuelle::safeDownCast((*ite)->getElement()) == pSource)
1301  {
1302  _tabSources.erase(ite);
1303  ret = true;
1304  break;
1305  }
1306  }
1307 
1308  // Pour tous les regimes de l'etage
1309  TYElement* pElement = (TYElement*)pSource;
1310  TYMapPtrElementInt::iterator iter;
1311  TYMapPtrElementBool::iterator itb;
1312  for (unsigned int i = 0; i < _tabRegimes.size(); i++)
1313  {
1314  iter = _tabRegimesMachines[i].find(pElement);
1315  // On supprime la machine dans le tableau associatif du regime
1316  _tabRegimesMachines[i].erase(iter);
1317 
1318  itb = _tabEtatMachines[i].find(pElement);
1319  _tabEtatMachines[i].erase(itb);
1320  }
1321 
1322  setIsGeometryModified(true);
1323 
1324  return ret;
1325 }
1326 
1327 bool TYEtage::remSource(QString idSource)
1328 {
1329  bool ret = false;
1330  TYTabUserSourcePonctuelleGeoNode::iterator ite;
1331 
1332  for (ite = _tabSources.begin(); ite != _tabSources.end(); ite++)
1333  {
1334  if (TYUserSourcePonctuelle::safeDownCast((*ite)->getElement())->getID().toString() == idSource)
1335  {
1336  _tabSources.erase(ite);
1337  ret = true;
1338  break;
1339  }
1340  }
1341 
1342  TYElement* pElement = (*ite)->getElement();
1343  TYMapPtrElementInt::iterator iter;
1344  TYMapPtrElementBool::iterator itb;
1345  for (unsigned int i = 0; i < _tabRegimes.size(); i++)
1346  {
1347  iter = _tabRegimesMachines[i].find(pElement);
1348  // On supprime la machine dans le tableau associatif du regime
1349  _tabRegimesMachines[i].erase(iter);
1350 
1351  itb = _tabEtatMachines[i].find(pElement);
1352  _tabEtatMachines[i].erase(itb);
1353  }
1354 
1355  setIsGeometryModified(true);
1356 
1357  return ret;
1358 }
1359 
1361 {
1362  unsigned int i = 0, j = 0;
1363 
1364  TYMapPtrElementInt::iterator iter;
1365  for (i = 0; i < _tabRegimesMachines.size(); i++)
1366  {
1367  for (j = 0; j < _tabSources.size(); j++)
1368  {
1369  TYElement* pElement = _tabSources[j]->getElement();
1370  iter = _tabRegimesMachines[i].find(pElement);
1371  _tabRegimesMachines[i].erase(iter);
1372  }
1373  }
1374 
1375  TYMapPtrElementBool::iterator itb;
1376  for (i = 0; i < _tabEtatMachines.size(); i++)
1377  {
1378  for (j = 0; j < _tabSources.size(); j++)
1379  {
1380  TYElement* pElement = _tabSources[j]->getElement();
1381  itb = _tabEtatMachines[i].find(pElement);
1382  _tabEtatMachines[i].erase(itb);
1383  }
1384  }
1385 
1386  _tabSources.clear();
1387 
1388  setIsGeometryModified(true);
1389 }
1390 
1392 {
1393  assert(pSource);
1394  TYTabUserSourcePonctuelleGeoNode::iterator ite;
1395 
1396  for (ite = _tabSources.begin(); ite != _tabSources.end(); ite++)
1397  {
1398  if (TYUserSourcePonctuelle::safeDownCast((*ite)->getElement()) == pSource)
1399  {
1400  return (*ite);
1401  }
1402  }
1403 
1404  return NULL;
1405 }
1406 
1407 void TYEtage::setRegime(TYSpectre& Spectre, int regime /*=-1*/, bool recursif /*=true*/)
1408 {
1409  if (recursif)
1410  {
1411  for (unsigned int i = 0; i < _tabMur.size(); i++)
1412  {
1413  TYMur::safeDownCast(_tabMur[i]->getElement())->setRegime(Spectre, regime, recursif);
1414  }
1415  }
1416 
1417  TYAcousticVolume::setRegime(Spectre, regime, recursif);
1418 }
1419 
1420 bool TYEtage::remRegime(int regime)
1421 {
1422  for (unsigned int i = 0; i < _tabMur.size(); i++)
1423  {
1424  TYMur::safeDownCast(_tabMur[i]->getElement())->remRegime(regime);
1425  }
1426 
1427  _pSol->remRegime(regime);
1428  _pPlafond->remRegime(regime);
1429 
1430  // On supprime le tableau associatif regime/"regime machine"
1431  _tabRegimesMachines.erase(_tabRegimesMachines.begin() + regime);
1432  _tabEtatMachines.erase(_tabEtatMachines.begin() + regime);
1433 
1434  return TYAcousticVolume::remRegime(regime);
1435 }
1436 
1437 void TYEtage::setCurRegime(int regime)
1438 {
1439  if (regime >= (int)_tabRegimesMachines.size())
1440  {
1441  return;
1442  }
1443  if (regime < 0)
1444  {
1445  regime = (int)_tabRegimes.size() - 1;
1446  }
1447 
1448  for (unsigned int i = 0; i < _tabMur.size(); i++)
1449  {
1450  TYMur::safeDownCast(_tabMur[i]->getElement())->setCurRegime(regime);
1451  }
1452 
1453  _pSol->setCurRegime(regime);
1454  _pPlafond->setCurRegime(regime);
1455 
1456  // On met les machines au regime qui correspond
1457  TYMapPtrElementInt::iterator iter;
1458  for (iter = _tabRegimesMachines[regime].begin(); iter != _tabRegimesMachines[regime].end(); iter++)
1459  {
1460  TYElement* pElement = (*iter).first;
1461  if (pElement->isA("TYMachine"))
1462  {
1463  LPTYMachine pMachine = TYMachine::safeDownCast(pElement);
1464  assert(pMachine);
1465  pMachine->setCurRegime((*iter).second);
1466  }
1467  else
1468  {
1470  assert(pSource);
1471  pSource->setCurrentRegime((*iter).second);
1472  }
1473  }
1474 
1475  // On met les machines dans l'etat (rayonnant/non rayonnant) qui correspond
1476  TYMapPtrElementBool::iterator iter2;
1477  for (iter2 = _tabEtatMachines[regime].begin(); iter2 != _tabEtatMachines[regime].end(); iter2++)
1478  {
1479  TYElement* pElement = (*iter2).first;
1480  if (pElement->isA("TYMachine"))
1481  {
1482  LPTYMachine pMachine = TYMachine::safeDownCast(pElement);
1483  assert(pMachine);
1484  bool etat = (*iter2).second;
1485  pMachine->setIsRayonnant(etat);
1486  }
1487  else
1488  {
1490  assert(pSource);
1491  pSource->setIsRayonnant((*iter2).second);
1492  }
1493  }
1494 
1496 
1497  setIsAcousticModified(true);
1498 }
1499 
1501 {
1502  int value = TYAcousticInterface::addRegime(regime);
1503 
1504  TYMapPtrElementInt mapElmRegime = _tabRegimesMachines[0];
1505  _tabRegimesMachines.push_back(mapElmRegime);
1506 
1507  TYMapPtrElementBool mapElmBool = _tabEtatMachines[0];
1508  _tabEtatMachines.push_back(mapElmBool);
1509 
1510  // Creation du nouveau regime pour tous les murs ainsi que le sol et le plafond
1511  for (unsigned int i = 0; i < _tabMur.size(); i++)
1512  {
1513  TYMur::safeDownCast(_tabMur[i]->getElement())->addRegime();
1514  }
1515 
1516  _pSol->addRegime();
1517  _pPlafond->addRegime();
1518 
1519  return value;
1520 }
1521 
1523 {
1524  int value = TYAcousticInterface::addRegime();
1525 
1526  TYMapPtrElementInt mapElmRegime = _tabRegimesMachines[0];
1527  _tabRegimesMachines.push_back(mapElmRegime);
1528 
1529  TYMapPtrElementBool mapElmBool = _tabEtatMachines[0];
1530  _tabEtatMachines.push_back(mapElmBool);
1531 
1532  // Creation du nouveau regime pour tous les murs ainsi que le sol et le plafond
1533  for (unsigned int i = 0; i < _tabMur.size(); i++)
1534  {
1535  TYMur::safeDownCast(_tabMur[i]->getElement())->addRegime();
1536  }
1537 
1538  _pSol->addRegime();
1539  _pPlafond->addRegime();
1540 
1541  return value;
1542 }
1543 
1544 void TYEtage::setNextRegimeNb(const int& next)
1545 {
1546  _nextRegime = next;
1547 
1548  for (unsigned int i = 0; i < _tabMur.size(); i++)
1549  {
1550  TYMur::safeDownCast(_tabMur[i]->getElement())->setNextRegimeNb(next);
1551  }
1552 
1553  _pSol->setNextRegimeNb(next);
1554  _pPlafond->setNextRegimeNb(next);
1555 }
1556 
1557 void TYEtage::setRegimeName(const QString& name)
1558 {
1559  bool status = true;
1560  TYRegime& reg = getRegimeNb(_curRegime, status);
1561  if (status)
1562  {
1563  reg.setRegimeName(name);
1564  }
1565 
1566  for (unsigned int i = 0; i < _tabMur.size(); i++)
1567  {
1568  TYMur::safeDownCast(_tabMur[i]->getElement())->setRegimeName(name);
1569  }
1570 
1573 }
1574 
1576 {
1579 
1580  // On recupere seulement les sources des murs
1581  // L'etage est vue comme un volume acoustique quelconque
1582  for (unsigned int i = 0; i < _tabMur.size(); i++)
1583  {
1584  LPTYMur pMur = TYMur::safeDownCast(_tabMur[i]->getElement());
1585  // Recupere l'ensemble des srcs du child...
1586  if (pMur->getIsRayonnant())
1587  {
1588  tabChild = pMur->getSrcs();
1589 
1590  // Concatenation des matrices
1591  OMatrix matrix = _tabMur[i]->getMatrix();
1592  for (unsigned int j = 0; j < tabChild.size(); j++)
1593  {
1594  tabChild[j]->setMatrix(matrix * tabChild[j]->getMatrix());
1595  }
1596 
1597  //...et ajoute au tableau a retourner
1598  tab.insert(tab.end(), tabChild.begin(), tabChild.end());
1599  }
1600  }
1601 
1602  tabChild = _pSol->getSrcs();
1603  tab.insert(tab.end(), tabChild.begin(), tabChild.end());
1604 
1605  tabChild = _pPlafond->getSrcs();
1606  tab.insert(tab.end(), tabChild.begin(), tabChild.end());
1607 
1608  return tab;
1609 }
1610 
1612 {
1613  return TYSourcePonctuelle();
1614 }
1615 
1616 void TYEtage::setDensiteSrcsH(double densite, bool recursif)
1617 {
1619 
1620  if (recursif)
1621  {
1622  for (unsigned int i = 0; i < _tabMur.size(); i++)
1623  {
1624  TYMur::safeDownCast(_tabMur[i]->getElement())->setDensiteSrcsH(getDensiteSrcsH());
1625  }
1626  // Le sol est inactif
1627  // Plafond
1629  }
1630 }
1631 
1632 void TYEtage::setDensiteSrcsV(double densite, bool recursif)
1633 {
1635 
1636  if (recursif)
1637  {
1638  for (unsigned int i = 0; i < _tabMur.size(); i++)
1639  {
1640  TYMur::safeDownCast(_tabMur[i]->getElement())->setDensiteSrcsV(getDensiteSrcsV());
1641  }
1642  // Le sol est inactif
1643  // Plafond
1645  }
1646 }
1647 
1649 {
1650  unsigned int i = 0;
1651 
1652  // On commence par effacer les sources presentes
1653  for (i = 0; i < _tabMur.size(); i++)
1654  {
1655  TYMur::safeDownCast(_tabMur[i]->getElement())->remAllSrcs();
1656  }
1657 
1658  _pSol->getSrcSurf()->remAllSrc();
1660 
1661  // Murs
1662  for (i = 0; i < _tabMur.size(); i++)
1663  {
1664  LPTYMur pMur = TYMur::safeDownCast(_tabMur[i]->getElement());
1665  if (pMur->getIsRayonnant())
1666  {
1667  pMur->distriSrcs();
1668  }
1669  }
1670 
1671  // Sol
1672  if (_pSol->getIsRayonnant())
1673  {
1674  _pSol->distriSrcs();
1675  }
1676 
1677  // Plafond
1678  if (_pPlafond->getIsRayonnant())
1679  {
1680  _pPlafond->distriSrcs();
1681  }
1682 }
1683 
1685 {
1686  bool ret = true;
1687 
1689  LWEtage.setType(SPECTRE_TYPE_LW);
1690 
1693 
1694  // ON TRAITE D'ABORD LES MURS
1695 
1696  // Pour tous les murs
1697  for (unsigned int i = 0; i < _tabMur.size(); i++)
1698  {
1699  // Matrice du mur
1700  OMatrix matMur = _tabMur[i]->getMatrix();
1701 
1702  // Mur courant
1703  LPTYMur pCurrentMur = TYMur::safeDownCast(_tabMur[i]->getElement());
1705 
1706  // Si le mur est rayonnant, on calcule sa puissance
1707  if (pCurrentMur->getIsRayonnant())
1708  {
1709  // Spectre de puissance affectee au mur
1710  double surfMur = pCurrentMur->activeSurface();
1711 
1712  // Si la puissance est calculee, la puissance du mur est mise a 0
1713  if (pCurrentMur->getTypeDistribution() == TY_PUISSANCE_IMPOSEE)
1714  {
1715  LWMur = pCurrentMur->getCurrentSpectre().toGPhy();
1716  }
1717 
1718  LWMur.setType(SPECTRE_TYPE_LW);
1719 
1720  // Pour toutes les faces du mur
1721  TYTabAcousticSurfaceGeoNode tabAcousticSurf = pCurrentMur->getTabAcousticSurf();
1722 
1723  LPTYParoi pMurParoi = TYMur::safeDownCast(_tabMur[i]->getElement())->getParoi();
1724 
1725  // Pour toutes les surfaces constituant le mur
1726  for (unsigned int j = 0; j < tabAcousticSurf.size(); j++)
1727  {
1728  LPTYAcousticSurfaceGeoNode pSurfaceNode = tabAcousticSurf[j];
1729  OMatrix matSurf = matMur * pSurfaceNode->getMatrix();
1730 
1731  LPTYAcousticSurface pCurrentSurf =
1733  assert(pCurrentSurf);
1734 
1735  if (pCurrentSurf->getIsSub() == true)
1736  {
1737  if (pCurrentSurf->getTypeDistribution() == TY_PUISSANCE_CALCULEE)
1738  {
1739  LWElt = getPuissanceRayonnee(pCurrentSurf, matSurf, pMurParoi);
1740  LWEtage = LWEtage.sum(LWElt);
1741  }
1742  else
1743  {
1744  LWEtage = LWEtage.sum(pCurrentSurf->getCurrentSpectre().toGPhy());
1745  }
1746  }
1747  else
1748  {
1749  if (pCurrentMur->getTypeDistribution() == TY_PUISSANCE_CALCULEE)
1750  {
1751  LWElt = getPuissanceRayonnee(pCurrentSurf, matSurf, pMurParoi);
1752  LWMur = LWMur.sum(LWElt);
1753  }
1754  else
1755  {
1756  double surfElt = pCurrentSurf->surface();
1757  LWElt = LWMur.mult(surfElt / surfMur);
1758  }
1759  }
1760 
1761  // CORRECTION ANOMALIE 28 - test du type d'attribution de la puissance (calculee/imposee)
1762  if (pCurrentSurf->getTypeDistribution() == TY_PUISSANCE_CALCULEE)
1763  {
1764  TYSpectre aSpectre(LWElt.toDB());
1765  pCurrentSurf->setRegime(aSpectre, -1, false);
1766  }
1767 
1768  ret &= pCurrentSurf->setSrcsLw();
1769  }
1770 
1771  // CORRECTION ANOMALIE 28 - test du type d'attribution de la puissance (calculee/imposee)
1772  if (pCurrentMur->getTypeDistribution() == TY_PUISSANCE_CALCULEE)
1773  {
1774  TYSpectre aSpectre(LWMur.toDB());
1775  pCurrentMur->setRegime(aSpectre, -1, false);
1776  }
1777  }
1778  else // Le mur n'est pas rayonnant, on lui affecte une puissance nulle
1779  {
1780  LWMur.setType(SPECTRE_TYPE_LW);
1781  }
1782 
1783  LWEtage = LWEtage.sum(LWMur);
1784  }
1785 
1786  // ON N'OUBLIE PAS LES DALLES (ENFIN LA DALLE SUPERIEURE
1787  // PARCE QU'EN GENERAL LA DALLE INEFRIEURE EST SOIT POSEE AU SOL SOIT POSEE SUR UN AUTRE ETAGE ...
1788 
1789  if (_closed) // Si c'est un bâtiment et non un simple ecran
1790  {
1791  OMatrix matDalle;
1792  if (_pSol->getIsRayonnant())
1793  {
1795  {
1796  LPTYParoi pSolParoi = _pSol->getParoi();
1797  LWElt = getPuissanceRayonnee(_pSol, matDalle, pSolParoi);
1798  TYSpectre aTYSpectre(LWElt.toDB());
1799  _pSol->setRegime(aTYSpectre, -1, false);
1800  LWEtage = LWEtage.sum(LWElt);
1801  }
1802  else
1803  {
1804  LWEtage = LWEtage.sum(_pSol->getCurrentSpectre().toGPhy());
1805  }
1806 
1807  _pSol->setSrcsLw();
1808  }
1809 
1810  if (_pPlafond->getIsRayonnant())
1811  {
1813  {
1814  LPTYParoi pPlafondParoi = _pPlafond->getParoi();
1815  LWElt = getPuissanceRayonnee(_pPlafond, matDalle, pPlafondParoi);
1816  TYSpectre aTYSpectre(LWElt.toDB());
1817  _pPlafond->setRegime(aTYSpectre, -1, false);
1818  LWEtage = LWEtage.sum(LWElt);
1819  }
1820  else
1821  {
1822  LWEtage = LWEtage.sum(_pPlafond->getCurrentSpectre().toGPhy());
1823  }
1824 
1825  _pPlafond->setSrcsLw();
1826  }
1827  }
1828  TYSpectre aTYSpectre(LWEtage.toDB());
1829  this->setRegime(aTYSpectre, -1, false);
1830  return ret;
1831 }
1832 
1833 double TYEtage::volume() const
1834 {
1835  return _pSol->surface() * getHauteur();
1836 }
1837 
1838 double TYEtage::surface() const
1839 {
1840  double res = 0.0;
1841 
1842  for (unsigned int i = 0; i < _tabMur.size(); i++)
1843  {
1844  res += TYMur::safeDownCast(_tabMur[i]->getElement())->surface();
1845  }
1846 
1847  res += _pSol->surface();
1848  res += _pPlafond->surface();
1849 
1850  return res;
1851 }
1852 
1854 {
1855  TYTabVector tab;
1856 
1857  for (unsigned int i = 0; i < _tabMur.size(); i++)
1858  {
1859  OVector3D normale = TYMur::safeDownCast(_tabMur[i]->getElement())->normal();
1860  normale = _tabMur[i]->getMatrix() * normale;
1861  tab.push_back(normale);
1862  }
1863 
1864  tab.push_back(_pSol->normal());
1865  tab.push_back(_pPlafond->normal());
1866 
1867  return tab;
1868 }
1869 
1871 {
1872  TYTabPoint tab;
1873  TYPoint pt;
1874 
1875  for (unsigned int i = 0; i < _tabMur.size(); i++)
1876  {
1877  for (int j = 0; j < 4; j++)
1878  {
1879  // On recupere le sommet
1880  pt = TYMur::safeDownCast(_tabMur[i]->getElement())->getBoundingRect()->_pts[j];
1881 
1882  // On passe dans le repere de l'etage
1883  pt = _tabMur[i]->getMatrix() * pt;
1884 
1885  // Ajout du sommet
1886  tab.push_back(pt);
1887  }
1888  }
1889 
1890  return tab;
1891 }
1892 
1894 {
1895  TYTabLPPolygon tab;
1896 
1897  for (unsigned int i = 0; i < _tabMur.size(); i++)
1898  {
1899  // Polygon representant la face
1900  TYPolygon* pPolygon = TYMur::safeDownCast(_tabMur[i]->getElement())->getBoundingRect()->toPolygon();
1901 
1902  // On convertit le polygon dans le repere de l'etage
1903  OMatrix matrix = _tabMur[i]->getMatrix();
1904 
1905  pPolygon->transform(matrix);
1906 
1907  // Ajout du polygon
1908  tab.push_back(pPolygon);
1909  }
1910 
1911  tab.push_back(new TYPolygon(*_pSol->getPolygon()));
1912  tab.push_back(new TYPolygon(*_pPlafond->getPolygon()));
1913 
1914  return tab;
1915 }
1916 
1918 {
1920 }
1921 
1923 {
1924  TYPoint centre(0.0, 0.0, 0.0);
1925 
1926  // Points au sol
1927  TYTabPoint pts = _pSol->getContour();
1928  size_t nbPts = pts.size();
1929 
1930  // On effectue la moyenne en (X,Y) des points au sol
1931  for (size_t i = 0; i < nbPts; i++)
1932  {
1933  centre._x += pts[i]._x;
1934  centre._y += pts[i]._y;
1935  }
1936 
1937  // Moyenne
1938  centre._x /= nbPts;
1939  centre._y /= nbPts;
1940 
1941  // L'altitude est la mi-hauteur de l'etage
1942  centre._z = getHauteur() / 2.0;
1943 
1944  return centre;
1945 }
1946 
1947 int TYEtage::intersects(const OSegment3D& seg, TYTabPoint& ptList) const
1948 {
1949  return TYVolumeInterface::intersects(seg, ptList);
1950 }
1951 
1952 int TYEtage::isInside(const TYPoint& pt) const
1953 {
1954  int res = INTERS_NULLE;
1955  OPoint3D ptCopy(pt);
1956 
1957  // Le test avec le volume englobant permet de tester si le pt
1958  // se trouve entre les plans du sol et du plafond,
1959  // et d'evite aussi des calculs inutiles...
1960  if (_volEnglob.isInside(pt) == INTERS_NULLE)
1961  {
1962  return res;
1963  }
1964 
1965  TYTabPoint ptsSol = _pSol->getContour();
1966  size_t nbPts = ptsSol.size();
1967 
1968  if (_closed && (nbPts >= 3))
1969  {
1970  // On pose tout au sol !
1971  ptCopy._z = 0.0;
1972 
1973  // On se ramene a un plan (z=0), on teste si le pt est a l'interieur
1974  // du polygone forme par le contour de l'etage
1975  OPoint3D* pts = new OPoint3D[nbPts];
1976 
1977  for (size_t i = 0; i < nbPts; i++)
1978  {
1979  // Creation du polygone
1980  pts[i] = ptsSol[i];
1981 
1982  // ... tout au sol !
1983  pts[i]._z = 0.0;
1984  }
1985 
1986  OPoint3D ptMin, ptMax;
1987 
1988  OGeometrie::boundingBox(pts, static_cast<int>(nbPts), ptMin, ptMax);
1989 
1990  OBox box(ptMin, ptMax);
1991 
1992 #if TY_USE_IHM
1993  res = OGeometrie::pointInPolygonRayCasting(ptCopy, pts, static_cast<int>(nbPts));
1994 #else
1995  res = OGeometrie::pointInPolygonAngleSum(ptCopy, pts, nbPts);
1996 #endif
1997 
1998  delete[] pts;
1999  }
2000 
2001  return res;
2002 }
2003 
2004 void TYEtage::setacousticFacesPourCalcul(bool bPourCalculTrajet)
2005 {
2006  _bPourCalculTrajet = bPourCalculTrajet;
2007 }
2008 
2010 {
2012 
2013  // Ajout des murs
2014  for (unsigned int i = 0; i < _tabMur.size(); i++)
2015  {
2016  // Sous-mur (MurElement) pour ce mur et sa matrice
2018  TYMur::safeDownCast(_tabMur[i]->getElement())->getTabAcousticSurf();
2019  OMatrix matrixMur = _tabMur[i]->getMatrix();
2020 
2021  // az++:
2022  unsigned int j = 0;
2023 
2024  // Pour chaque sous-mur
2025  for (j = 0; j < tabTmp.size(); j++)
2026  {
2027  // Le sous-mur
2028  LPTYAcousticSurface pAccSurf = TYAcousticSurface::safeDownCast(tabTmp[j]->getElement());
2029 
2030  // Si l'etage est un ecran on tient compte de l'epaisseur de la paroi
2031  if (!_closed && TYMurElement::safeDownCast(pAccSurf))
2032  {
2033  // Pour cela on construit 2 nouveaux GeoNodes associes a cette meme face
2034  // pour materialiser l'epaisseur
2035  LPTYAcousticSurfaceGeoNode pAccSurfGeoNode1 =
2036  new TYAcousticSurfaceGeoNode((LPTYElement)pAccSurf);
2037  LPTYAcousticSurfaceGeoNode pAccSurfGeoNode2 =
2038  new TYAcousticSurfaceGeoNode((LPTYElement)pAccSurf);
2039 
2040  // Recuperation de la demi epaisseur du mur parent
2041  double epaisseur =
2042  TYMur::safeDownCast(_tabMur[i]->getElement())->getParoi()->getEpaisseur() / 2.0;
2043  if (_bPourCalculTrajet)
2044  {
2045  epaisseur = 0; // comme ca, on a le meme nombre de point que pour un vrai contour, mais en
2046  // n'ayant que le squelette de l'ecran
2047  }
2048 
2049  // Ajout d'un offset en z seulement car les faces (plan) sont definis sur x et y
2050  ORepere3D rep = tabTmp[j]->getORepere3D();
2051  rep._origin._z = +epaisseur;
2052  pAccSurfGeoNode1->setRepere(rep);
2053  rep._origin._z = -epaisseur;
2054  pAccSurfGeoNode2->setRepere(rep);
2055 
2056  // Concatenation des matrices
2057  pAccSurfGeoNode1->setMatrix(matrixMur * pAccSurfGeoNode1->getMatrix());
2058  pAccSurfGeoNode2->setMatrix(matrixMur * pAccSurfGeoNode2->getMatrix());
2059 
2060  // Ajout des faces
2061  tab.push_back(pAccSurfGeoNode1);
2062  tab.push_back(pAccSurfGeoNode2);
2063  }
2064  // Sinon on ajoute simplement le sous-mur
2065  else
2066  {
2067  // M = M(mur) . M(sous-mur)
2068  OMatrix matrix = matrixMur * tabTmp[j]->getMatrix();
2069 
2070  // Ajout
2071  tab.push_back(new TYAcousticSurfaceGeoNode((LPTYElement)pAccSurf, matrix));
2072  }
2073  }
2074  }
2075 
2076  // Ajout du sol et plafond si cela est necessaire
2077  if (_closed)
2078  {
2079  tab.push_back(new TYAcousticSurfaceGeoNode((LPTYElement&)_pSol));
2080  tab.push_back(new TYAcousticSurfaceGeoNode((LPTYElement&)_pPlafond));
2081  }
2082 
2083  return tab;
2084 }
2085 
2086 bool TYEtage::findAcousticSurface(const TYAcousticSurface* pAccSurf, OMatrix* pMatrix /*=0*/)
2087 {
2088  bool ret = false;
2089 
2090  for (unsigned int i = 0; (i < _tabMur.size()) && !ret; i++)
2091  {
2092  // Mur elements pour ce mur
2093  TYTabAcousticSurfaceGeoNode& tabTmp =
2094  TYMur::safeDownCast(_tabMur[i]._pObj->getElement())->getTabAcousticSurf();
2095 
2096  for (unsigned int j = 0; j < tabTmp.size(); j++)
2097  {
2098  if (TYAcousticSurface::safeDownCast(tabTmp[j]._pObj->getElement()) == pAccSurf)
2099  {
2100  if (pMatrix)
2101  {
2102  // Mise a jour de la matrice
2103  *pMatrix = *pMatrix * _tabMur[i]._pObj->getMatrix() * tabTmp[j]._pObj->getMatrix();
2104  }
2105 
2106  // Surf trouvee
2107  break;
2108  }
2109  }
2110  }
2111 
2112  return ret;
2113 }
2114 
2116 {
2117  OSpectre absoElem;
2118  _absoSabine.setDefaultValue(0.0); // On reinitialise le spectre de Sabine
2119 
2120  size_t i = 0, j = 0;
2121  TYTabAcousticSurfaceGeoNode elemMur; // Elements constituant le mur
2122  TYTabAcousticVolumeGeoNode elemMachine; // Elements constituants la machine
2123  double surfElem = 0.0; // surface elementaire
2124  _surfAbsorbante = 0.0; // Initialisation surface
2125 
2126  _volumeLibre = this->volume(); // recupere le volume de l'etage
2127 
2128  // Lecture de l'absorption de chacune des faces du volume
2129  size_t nbFaces = this->getTabMur().size();
2130 
2131  for (i = 0; i < nbFaces; i++)
2132  {
2133  elemMur = TYMur::safeDownCast(_tabMur[i]->getElement())->getTabAcousticSurf();
2134 
2135  LPTYParoi pMurParoi = TYMur::safeDownCast(_tabMur[i]->getElement())->getParoi();
2136 
2137  for (j = 0; j < elemMur.size(); j++)
2138  {
2139  // Une sous-face de mur doit etre de type MurElement
2140  LPTYMurElement pMurElt = TYMurElement::safeDownCast(elemMur[j]->getElement());
2141  assert(pMurElt);
2142 
2143  // Recuperation des caracteristiques locales du mur
2144  surfElem = pMurElt->surface();
2145 
2146  // Absorption de la paroi associee a la surface
2147  if (pMurElt->getIsSub())
2148  {
2149  // Si la surface est une fenetre on prend son absorption
2150  absoElem = pMurElt->getParoi()->getMatFace1()->getSpectreAbso().mult(surfElem);
2151  }
2152  else
2153  {
2154  // Sinon on prend le materiau composant le mur
2155  absoElem = pMurParoi->getMatFace1()->getSpectreAbso().mult(surfElem);
2156  }
2157 
2158  // Cumul des alpha*S elementaire et des surfaces elementaire
2159  _absoSabine = _absoSabine.sum(absoElem);
2160  _surfAbsorbante = _surfAbsorbante + surfElem;
2161  }
2162  }
2163 
2164  // Prise en compte des dalles inferieures (sol) et superieures (plafond)
2165 
2166  // Aire occupee au sol par les machines
2167  double aireTotMachinesSol = 0.0;
2168  for (i = 0; i < _facesMachineSol.size(); i++)
2169  {
2170  aireTotMachinesSol = aireTotMachinesSol +
2171  TYAcousticSurface::safeDownCast(_facesMachineSol[i]->getElement())->surface();
2172  }
2173 
2174  // Surface sol libre = surface totale du sol - surface occupee par les machines
2175  surfElem = _pSol->surface() - aireTotMachinesSol;
2176  _surfAbsorbante = _surfAbsorbante + surfElem;
2177 
2178  absoElem = _pSol->getParoi()->getMatFace1()->getSpectreAbso().mult(surfElem);
2179  _absoSabine = _absoSabine.sum(absoElem);
2180 
2181  surfElem = _pPlafond->surface();
2182  _surfAbsorbante = _surfAbsorbante + surfElem;
2183 
2184  absoElem = _pPlafond->getParoi()->getMatFace1()->getSpectreAbso().mult(surfElem);
2185  _absoSabine = _absoSabine.sum(absoElem);
2186 
2187  // Prise en compte de l'absorption de chacune des machines
2188  size_t nbMachines = this->getTabMachine().size();
2189  TYTabAcousticSurfaceGeoNode tabPtrSurf;
2190 
2191  for (i = 0; i < nbMachines; i++)
2192  {
2193  elemMachine = TYMachine::safeDownCast(this->getTabMachine()[i]->getElement())->getTabAcousticVol();
2194 
2195  for (j = 0; j < elemMachine.size(); j++)
2196  {
2197  LPTYAcousticVolume pElemMachine = TYAcousticVolume::safeDownCast(elemMachine[j]->getElement());
2198 
2199  surfElem = pElemMachine->surface();
2200 
2201  // Considere que les volumes de la machines sont constituees d'un materiau homogene
2202  // Si on souhaite passer a un materiau par face, il faudrait mettre les deux lignes
2203  // qui suivent dans une boucle traitant chacune des faces.
2204  absoElem = pElemMachine->getMateriau()->getSpectreAbso().mult(surfElem);
2205 
2206  _absoSabine = _absoSabine.sum(absoElem);
2207  double volElem = pElemMachine->volume();
2208  _surfAbsorbante = _surfAbsorbante + surfElem;
2209  _volumeLibre = _volumeLibre - volElem;
2210  }
2211  }
2212 
2213  // Les faces des machines posees au sol ne jouent pas dans l'absorption des machines
2214  for (i = 0; i < _facesMachineSol.size(); i++)
2215  {
2217 
2218  surfElem = pSurface->surface();
2219  absoElem = pSurface->getMateriau()->getSpectreAbso().mult(surfElem);
2220 
2221  _surfAbsorbante = _surfAbsorbante - surfElem;
2222  _absoSabine = _absoSabine.subst(absoElem);
2223  }
2224 
2225  _absoSabine = _absoSabine.div(_surfAbsorbante); // On calcul le alpha moyen de la salle
2226  _absoSabine = _absoSabine.sum(1.0E-6); // Au cas ou le alpha serait nul, on lui rajoute un epsilon
2227 }
2228 
2230 {
2231  _TR = TYSpectre::getEmptyLinSpectre(); // Represente une grandeur lineaire ... Le temps
2232 
2233  // Prise en compte de l'absorbsion atmospherique
2234 
2235  // S * A
2237 
2238  // 0.16*V/(S * A)
2239  _TR = _TR.invMult(0.16 * _volumeLibre);
2240 
2241  _TR.setType(SPECTRE_TYPE_AUTRE); // unite = secondes
2242  _TR.setEtat(SPECTRE_ETAT_DB); // Pour eviter une transformation non souhaitee
2243 }
2244 
2246 {
2247  int nbPts = static_cast<int>(_tabMur.size());
2248 
2249  TYTabPoint pointsSol;
2250  TYTabPoint pointsPlafond;
2251 
2252  // for (int i = 0; i < nbPts; i++)
2253  for (int i = nbPts - 1; i >= 0; --i)
2254  {
2255  // Creation du polygone pour le sol
2256  TYPoint ptSol = TYMur::safeDownCast(_tabMur[i]->getElement())->getBoundingRect()->_pts[3];
2257  // Passage dans le repere de l'etage
2258  ptSol = _tabMur[i]->getMatrix() * ptSol;
2259  // Ajout du point
2260  pointsSol.push_back(ptSol);
2261 
2262  // Creation du polygone pour le plafond
2263  TYPoint ptPlafond = TYMur::safeDownCast(_tabMur[i]->getElement())->getBoundingRect()->_pts[0];
2264  // Passage dans le repere de l'etage
2265  ptPlafond = _tabMur[i]->getMatrix() * ptPlafond;
2266  // Ajout du point
2267  pointsPlafond.push_back(ptPlafond);
2268  }
2269 
2270  // Inversion des points du sol pour que toutes les normales soient vers l'extérieur
2271  TYTabPoint tabPtsTemp = pointsSol;
2272  pointsSol.clear();
2273  std::vector<TYPoint>::reverse_iterator it;
2274  for (it = tabPtsTemp.rbegin(); it != tabPtsTemp.rend(); it++)
2275  {
2276  pointsSol.push_back((*it));
2277  }
2278 
2279  _pSol->getPolygon()->setPoints(pointsSol);
2280  _pPlafond->getPolygon()->setPoints(pointsPlafond);
2281 
2282  setIsGeometryModified(true);
2283 }
2284 
2286 {
2289  AtmosphericConditions atmos(101325., 20., 70.);
2290 
2291  unsigned int i = 0, j = 0;
2292  double distance = NAN;
2293  OSegment3D SR; // Segment source recepteur
2294  TYTabAcousticVolumeGeoNode tabVolumes;
2295  TYTabSourcePonctuelleGeoNode tabSources;
2296  OPoint3D posSource;
2297 
2298  // Pour toutes les machines
2299  for (i = 0; i < _tabMachine.size(); i++)
2300  {
2302 
2303  if (pVolNode && pVolNode->getIsRayonnant()) // Si pas rayonnant y en a pas prendre source
2304  {
2305  TYTabSourcePonctuelleGeoNode tabSrcNode = pVolNode->getSrcs();
2306 
2307  for (j = 0; j < tabSrcNode.size(); j++)
2308  {
2309  // La source
2310  LPTYSourcePonctuelle pSrc = TYSourcePonctuelle::safeDownCast(tabSrcNode[j]->getElement());
2311 
2312  // Matrice de changement de repere vers le repere de la source
2313  OMatrix matInv = tabSrcNode[j]->getMatrix().getInvert();
2314 
2315  // Position du point dans le repere de la source
2316  OPoint3D posPtInSrcRep = matInv * unPoint;
2317 
2318  // Contribution de la source au point
2319  SR = OSegment3D(posSource, posPtInSrcRep);
2320  distance = SR.longueur();
2321 
2322  // Affectation de la directivite a la puissance de la source
2323  sTemp = OSpectre::getEmptyLinSpectre(1.0); // pSrc->lwApparenteSrcDest(SR, atmos); // Q
2324  sTemp = sTemp.mult(pSrc->getSpectre()->toGPhy()); // W
2325  sTemp =
2326  sTemp.mult(atmos.compute_z() / (4 * M_PI * distance * distance)); // Q.W.rho.C / 4.pi.d²
2327 
2328  // Cumul des spectres
2329  s = s.sum(sTemp);
2330  }
2331  }
2332  }
2333 
2334  // Pour toutes les sources ponctuelles
2335  for (i = 0; i < _tabSources.size(); i++)
2336  {
2338 
2339  if (pSrc && pSrc->getIsRayonnant())
2340  {
2341  posSource = *pSrc->getPos();
2342  SR = OSegment3D(posSource, unPoint);
2343  distance = SR.longueur();
2344 
2345  // Affectation de la directivite a la puissance de la source
2347  1.); // pSrc->lwApparenteSrcDest(SR, atmos); // Directivite de la source Q
2348  sTemp = sTemp.mult(pSrc->getSpectre()->toGPhy()); // Puissance W
2349  sTemp = sTemp.mult(atmos.compute_z() / (4 * M_PI * distance * distance)); // Q.W.rho.C/(4.pi.d²)
2350 
2351  // Cumul des spectres
2352  s = s.sum(sTemp);
2353  }
2354  }
2355 
2356  s.setType(SPECTRE_TYPE_LP);
2357 
2358  return s;
2359 }
2361 {
2362  // On commence par calculer le coefficient d'abosrption moyenne de la salle
2363  coeffSabine();
2364 
2365  // On calcule le TR
2367 
2368  // Puis le champ reverbere
2370 }
2371 
2373 {
2374  unsigned int i = 0, j = 0;
2375  AtmosphericConditions atmos(101325., 20., 70.);
2376 
2377  // Effet de salle ((4.Rho.C / (alpha.S))-(4/S) - Tr.C.AbsoATm)
2378  _reverb = TYSpectre::getEmptyLinSpectre(4.0); // Spectre initialise a la valeur 4
2379 
2380  _reverb = _reverb.div(_absoSabine.mult(_surfAbsorbante)); // 4/(alpha.S)
2381  _reverb = _reverb.mult(atmos.compute_z()); // 4.Rho.C/(alpha.S)
2382 
2383  // Champ Reverbere : W*(Effet de salle)
2385 
2386  // Pr = 4W*rho*c/a
2387  TYTabSourcePonctuelleGeoNode tabAllSources;
2388 
2389  // On recupere toutes les sources
2390  // Des machines ...
2391  for (i = 0; i < _tabMachine.size(); i++)
2392  {
2394  if (pVolNode && pVolNode->getIsRayonnant())
2395  {
2396  // Les sources de cette machine
2397  TYTabSourcePonctuelleGeoNode tabSrcMachine =
2398  TYMachine::safeDownCast(_tabMachine[i]->getElement())->getSrcs();
2399  tabAllSources.insert(tabAllSources.end(), tabSrcMachine.begin(), tabSrcMachine.end());
2400  }
2401  }
2402 
2403  for (i = 0; i < _tabSources.size(); i++)
2404  {
2406 
2407  // Si elle est rayonnante, on ajoute la source ponctuelle
2408  if (pSrc && pSrc->getIsRayonnant())
2409  {
2410  tabAllSources.push_back(_tabSources[i]);
2411  }
2412  }
2413 
2414  // Pour chacune de ces sources
2415  for (j = 0; j < tabAllSources.size(); j++)
2416  {
2417  // Cumul des spectres de toutes les sources
2418  sTemp = sTemp.sum(
2419  TYSourcePonctuelle::safeDownCast(tabAllSources[j]->getElement())->getSpectre()->toGPhy());
2420  }
2421 
2422  // Cumul des spectres
2423  _reverb = _reverb.mult(sTemp); // 4.W.Rho.C / (alpha.S)
2424 
2426 }
2427 
2429 {
2430  TYTabMurGeoNode tabMur = getTabMur();
2431 
2432  for (unsigned int i = 0; i < tabMur.size(); i++)
2433  {
2434  LPTYMur pMur = TYMur::safeDownCast(tabMur[i]->getElement());
2435  TYMur::safeDownCast(_tabMur[i]->getElement())->setParoi(_pParoi);
2436  }
2437 
2440 }
2441 
2443 {
2444  unsigned int i = 0;
2445 
2446  _facesMachineSol.clear();
2447 
2448  // On recupere toutes les faces des machines
2449  TYTabAcousticSurfaceGeoNode accFaces;
2450  for (i = 0; i < _tabMachine.size(); i++)
2451  {
2453  TYMachine::safeDownCast(_tabMachine[i]->getElement())->acousticFaces();
2454  OMatrix matrixMachine = _tabMachine[i]->getMatrix();
2455 
2456  for (unsigned int j = 0; j < tabTmp.size(); j++)
2457  {
2458  // Passage dans le repere de cet etage
2459  OMatrix matrix = matrixMachine * tabTmp[j]->getMatrix();
2460  tabTmp[j]->setMatrix(matrix);
2461 
2462  accFaces.push_back(tabTmp[j]);
2463  }
2464  }
2465 
2466  // On va rechercher les faces posees au sol de cet etage
2467  OPlan planSol = _pSol->plan();
2468  double distance = 0.0;
2469 
2470  for (i = 0; i < accFaces.size(); i++)
2471  {
2472  // La face
2473  LPTYAcousticSurfaceGeoNode pFaceGeoNode = accFaces[i];
2474 
2475  // Contour de la face
2476  LPTYAcousticSurface pSurface = TYAcousticSurface::safeDownCast(accFaces[i]->getElement());
2477  TYTabPoint contour = pSurface->getContour();
2478  if (contour.size() < 3)
2479  {
2480  continue;
2481  }
2482 
2483  OMatrix matrixFace = accFaces[i]->getMatrix();
2484 
2485  // Un point sur le plan de la face dans le repere etage
2486  OPoint3D ptPlan = matrixFace * OVector3D(contour[0]);
2487  // La normale a la face dans le repere etage
2488  OVector3D vecPlan = OVector3D(matrixFace * OPoint3D(0.0, 0.0, 0.0), matrixFace * pSurface->normal());
2489  vecPlan.normalize();
2490  // Le plan de la face dans le repere etage
2491  OPlan planFace(ptPlan, vecPlan);
2492 
2493  // Distance entre les 2 sols s'ils sont paralleles
2494  if (planFace.distancePlanParallel(planSol, distance))
2495  {
2496  // Si la face est posee au sol (avec une tolerance)
2497  if (ABS(distance) <= TYSEUILCONFONDUS)
2498  {
2499  // On "desactive" cette face de la machine
2500  pSurface->setDensiteSrcs(0.0);
2501 
2502  // On conserve les faces en contact avec le sol
2503  _facesMachineSol.push_back(accFaces[i]);
2504  }
2505  }
2506  }
2507 }
2508 
2509 bool TYEtage::updateAcoustic(const bool& force) // force=false
2510 {
2511  unsigned int i = 0;
2512  bool ret = true;
2513 
2514  // Si pas rayonnant, on ne bloque pas le calcul
2515  // (cet etat peut etre voulu, mais on ne fait pas de repartition acoustique)
2516  if (!_isRayonnant)
2517  {
2518  return true;
2519  }
2520 
2521  // On commence par ajuster la hauteur des sources
2522  updateZSource();
2523 
2524  // updateAcoustic des machines dans le bâtiment s'il y en a
2525  if ((_tabMachine.size() != 0) || (_tabSources.size() != 0))
2526  {
2528 
2529  // Machines
2530  for (i = 0; i < _tabMachine.size(); i++)
2531  {
2532  ret &= TYMachine::safeDownCast(_tabMachine[i]->getElement())->updateAcoustic();
2533  }
2534  }
2535 
2537  distriSrcs();
2538  ret &= setSrcsLw();
2539 
2540  return ret;
2541 }
2542 
2544 {
2545  // Suppression des sources sur les murs
2546  for (unsigned int i = 0; i < _tabMur.size(); i++)
2547  {
2548  TYAcousticRectangleNode::safeDownCast(_tabMur[i]->getElement())->remAllSrcs();
2549  }
2550 
2551  // Suppression des sources sur les dalles
2552  _pSol->remAllSrcs();
2553  _pPlafond->remAllSrcs();
2554 }
2555 
2557 {
2558  unsigned int i = 0;
2559  double surface = 0.0;
2560 
2561  for (i = 0; i < _tabMur.size(); i++)
2562  {
2563  LPTYMur pMur = TYMur::safeDownCast(_tabMur[i]->getElement());
2564 
2565  surface += pMur->activeSurface();
2566  }
2567 
2568  return surface;
2569 }
2570 
2571 TYSpectre TYEtage::setGlobalLW(const TYSpectre& spectre, const double& surfGlobale, const int& regime /*=-1*/)
2572 {
2573  /* Si l'etage est a "puissance imposee", on la retourne, si l'etage est a "puissance calculee, sa
2574  puissance depend des sources qu'il contient et a ete calculee prealablement par un updateAcoustic
2575  (c'est le contraire des machines)*/
2576 
2577  return getCurrentSpectre().toGPhy(); // On retourne le spectre obtenu
2578 }
2579 
2581  const LPTYParoi pMurParoi)
2582 {
2583  TYSpectre spectreEltMur = TYSpectre::getEmptyLinSpectre();
2585  OSpectre spectreAtt;
2586  OPoint3D posSrc;
2587  AtmosphericConditions atmos(101325., 20., 70.);
2588 
2589  // Une sous-face de mur doit etre de type MurElement
2590  LPTYMurElement pMurElt = TYMurElement::safeDownCast(pCurrentSurf);
2591 
2592  if (pMurElt) // IL faut prendre en compte le cas des dalles
2593  {
2594  if (pMurElt->getIsSub())
2595  {
2596  // Si la paroi est une fenetre
2597  spectreAtt = pMurElt->getParoi()->getMatStruct()->getSpectreTransm();
2598  }
2599  else
2600  {
2601  // Sinon c'est la paroi associee au mur
2602  spectreAtt = pMurParoi->getMatStruct()->getSpectreTransm();
2603  }
2604  }
2605  else // Cas des dalles
2606  {
2607  // Sinon c'est la paroi associee au mur
2608  spectreAtt = pMurParoi->getMatStruct()->getSpectreTransm();
2609  }
2610 
2611  TYTabSourcePonctuelleGeoNode tabSources = pCurrentSurf->getSrcs();
2612  double surf = pCurrentSurf->surface() / tabSources.size();
2613 
2614  // Pour toutes les sources ponctuelles de la face
2615  for (unsigned int k = 0; k < tabSources.size(); k++)
2616  {
2617  LPTYSourcePonctuelle pSource = TYSourcePonctuelle::safeDownCast(tabSources[k]->getElement());
2618 
2619  // Position de la source dans le repere de l'etage
2620  posSrc = matMur * *(pSource->getPos());
2621 
2622  s = _reverb.div(4.0); // Correction Champ reverbere (pression), intensite reverberee.
2623 
2624  s = s.sum(champDirect(posSrc));
2625 
2626  s = s.mult(surf / atmos.compute_z()); // W = P² * S / (rho.C)
2627  // s = s.sum(_reverb);// P² = champDirect + champReverbere
2628 
2629  // s = s.div(4.0); // DT 20100106 car le cas test paroi transparente de collais pas
2630 
2631  s = s.div((spectreAtt).toGPhy()); // Voir si le spectre doit etre converti en grandeur physique
2632 
2633  spectreEltMur = spectreEltMur.sum(s);
2634  }
2635 
2636  spectreEltMur.setType(SPECTRE_TYPE_LW);
2637  return spectreEltMur;
2638 }
2639 
2640 void TYEtage::setParoi(const LPTYParoi pParoi)
2641 {
2642  assert(pParoi);
2643  assert(_pParoi);
2644 
2645  *_pParoi = *pParoi;
2646 }
2647 
2649 {
2650  unsigned int i = 0;
2651  for (i = 0; i < _tabSources.size(); i++)
2652  {
2654  double h = pSource->getHauteur();
2655  pSource->getPos()->_z = h;
2656  _tabSources[i]->getORepere3D()._origin._z = h;
2657  _tabSources[i]->setIsGeometryModified(true);
2658  }
2659 
2660  for (i = 0; i < _tabMachine.size(); i++)
2661  {
2662  double h = _tabMachine[i]->getHauteur();
2663  _tabMachine[i]->getORepere3D()._origin._z = h;
2664  }
2665 
2666  setIsGeometryModified(true);
2667 }
2668 
2670 {
2671  size_t i = 0;
2672  size_t nbFaces = this->getTabMur().size();
2673 
2674  LPTYMur pMur = NULL;
2675 
2676  // On propage aux murs
2677  for (i = 0; i < nbFaces; i++)
2678  {
2679  pMur = TYMur::safeDownCast(_tabMur[i]->getElement());
2680 
2681  if (pMur)
2682  {
2683  pMur->propagateAtt(pAtt);
2684  }
2685  }
2686 
2687  // On propage aux dalles
2688  _pSol->propagateAtt(pAtt);
2689  _pPlafond->propagateAtt(pAtt);
2690 
2692 }
All base classes related to 3D manipulation.
#define TYSEUILCONFONDUS
Definition: 3d.h:47
double ABS(double a)
Return the absolute value.
Definition: 3d.h:67
#define INTERS_NULLE
No intersection.
Definition: 3d.h:35
NxReal s
Definition: NxVec3.cpp:317
QDomDocument DOM_Document
Definition: QT2DOM.h:33
QDomElement DOM_Element
Definition: QT2DOM.h:30
std::vector< LPTYAcousticFaceSetGeoNode > TYTabAcousticVolumeGeoNode
Collection de noeuds geometriques de type TYAcousticFaceSet.
TYGeometryNode TYAcousticSurfaceGeoNode
Noeud geometrique de type TYAcousticSurface.
std::vector< LPTYAcousticSurfaceGeoNode > TYTabAcousticSurfaceGeoNode
Collection de noeuds geometriques de type TYAcousticSurface.
class OGenID TYUUID
Definition: TYDefines.h:59
std::vector< TYPoint > TYTabPoint
Collection de TYPoint.
Definition: TYDefines.h:340
std::map< TYElement *, bool > TYMapPtrElementBool
Etat d'utilisation des elements (utilise par les calculs)
Definition: TYDefines.h:376
std::vector< OVector3D > TYTabVector
Collection de OVector3D.
Definition: TYDefines.h:398
std::map< TYElement *, int > TYMapPtrElementInt
Tableau associatif des elements et d'un entier (utilise pour gerer les regimes)
Definition: TYDefines.h:379
std::vector< LPTYPolygon > TYTabLPPolygon
Collection de pointeurs de TYPolygon.
Definition: TYDefines.h:349
std::vector< LPTYElement > LPTYElementArray
Definition: TYElement.h:345
#define TYDIRPREFERENCEMANAGER
Definition: TYElement.h:52
Representation graphique d'un etage (fichier header)
outil IHM pour un etage (fichier header)
TY_EXTENSION_INST(TYEtage)
TY_EXT_GRAPHIC_INST(TYEtage)
TYGeometryNode TYMachineGeoNode
Noeud geometrique de type TYMachine.
Definition: TYMachine.h:164
std::vector< LPTYMurGeoNode > TYTabMurGeoNode
Collection de noeuds geometriques de type TYMur.
Definition: TYMur.h:167
TYGeometryNode TYMurGeoNode
Noeud geometrique de type TYMur.
Definition: TYMur.h:163
int id
const char * name
TYGeometryNode TYSourcePonctuelleGeoNode
Noeud geometrique de type TYSourcePonctuelle.
std::vector< LPTYSourcePonctuelleGeoNode > TYTabSourcePonctuelleGeoNode
Collection de noeuds geometriques de type TYSourcePonctuelle.
TYGeometryNode TYUserSourcePonctuelleGeoNode
Noeud geometrique de type TYSourcePonctuelle.
Class for the definition of atmospheric conditions.
double compute_z()
compute impedance
The box class.
Definition: 3d.h:1294
double _y
y coordinate of OCoord3D
Definition: 3d.h:283
double _z
z coordinate of OCoord3D
Definition: 3d.h:284
double _x
x coordinate of OCoord3D
Definition: 3d.h:282
static void boundingBox(OPoint3D *pts, int nbPts, OPoint3D &ptMin, OPoint3D &ptMax)
Computes the simple bounding box for a volume using min-max method.
Definition: 3d.cpp:1109
static bool pointInPolygonAngleSum(const OPoint3D &ptP, const OPoint3D *pts, int nbPts)
Tests if a point is inside a polygon using angle sum algorithm.
Definition: 3d.cpp:1016
static bool pointInPolygonRayCasting(const OPoint3D &ptP, const OPoint3D *pts, int nbPts)
Tests if a point is inside a polygon using ray casting algorithm.
Definition: 3d.cpp:1046
The 4x4 matrix class.
Definition: 3d.h:625
OMatrix getInvert(int *ok=0) const
Return the inverse matrix of this matrix.
Definition: 3d.cpp:813
Plan defined by its equation : ax+by+cz+d=0.
Definition: plan.h:31
bool distancePlanParallel(const OPlan &plan, double &distance)
Calculate the distance between this plan and another parallel plane.
Definition: plan.cpp:410
The 3D point class.
Definition: 3d.h:487
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
3D frame with a point and 3 vectors.
Definition: 3d.h:1211
OVector3D _vecK
Vector K for the Z axis.
Definition: 3d.h:1285
OVector3D _vecJ
Vector J for the Y axis.
Definition: 3d.h:1283
OVector3D _vecI
Vector I for the X axis.
Definition: 3d.h:1281
OPoint3D _origin
The origin point.
Definition: 3d.h:1279
Class to define a segment.
Definition: 3d.h:1089
virtual double longueur() const
Return the segment length.
Definition: 3d.cpp:1238
OSpectreAbstract & sum(const OSpectreAbstract &spectre) const
Arithmetic sum of two spectrums in one-third Octave.
Definition: spectre.cpp:219
OSpectreAbstract & subst(const OSpectreAbstract &spectre) const
Arithmetic subtraction of two spectrums in one-third Octave.
Definition: spectre.cpp:316
OSpectreAbstract & toGPhy() const
Converts to physical quantity.
Definition: spectre.cpp:634
OSpectreAbstract & invMult(const double &coefficient=1.0) const
Division of a double constant by this spectrum.
Definition: spectre.cpp:345
void setEtat(TYSpectreEtat etat)
Force the spectrum state (to use carefully ...)
Definition: spectre.h:168
void setType(TYSpectreType type)
Set the spectrum type.
Definition: spectre.h:152
OSpectreAbstract & div(const OSpectreAbstract &spectre) const
Division of two spectrums.
Definition: spectre.cpp:273
void setDefaultValue(const double &valeur=TY_SPECTRE_DEFAULT_VALUE)
Definition: spectre.cpp:197
OSpectreAbstract & toDB() const
Converts to dB.
Definition: spectre.cpp:590
OSpectreAbstract & mult(const OSpectreAbstract &spectre) const
Multiplication of two spectrums.
Definition: spectre.cpp:243
static OSpectre getEmptyLinSpectre(const double &valInit=1.0E-20)
Create a physical quantity spectrum.
Definition: spectre.cpp:1115
The 3D vector class.
Definition: 3d.h:298
double norme() const
Computes the length of this vector.
Definition: 3d.cpp:215
void normalize()
Normalizes this vector.
Definition: 3d.cpp:225
OVector3D cross(const OVector3D &vector) const
Cross product.
Definition: 3d.cpp:196
Spectrum class.
Definition: Spectre.h:25
double getDensiteSrcsH() const
virtual void setDensiteSrcsH(double densite, bool recursif=true)
virtual void setNextRegimeNb(const int &next)
TYRegime & getRegimeNb(const int &nb, bool &status)
size_t getNbRegimes() const
double getDensiteSrcsV() const
int _curRegime
Numero du regime de fonctionnement courant.
TYSpectre & getCurrentSpectre()
virtual int addRegime(const TYRegime &regime)
TYTabRegimes _tabRegimes
Tableau des regimes de fonctionnement.
virtual void setDensiteSrcsV(double densite, bool recursif=true)
virtual void exportCSV(std::ofstream &ofs)
Export au format csv sur un flux transmis.
virtual void setRegime(TYSpectre &Spectre, int regime=-1, bool recursif=false)
virtual void setCurRegime(int regimeNumber)
int _nextRegime
Numero d'ordre du regime suivant.
virtual void setDensiteSrcs(double densite, bool recursif=true)
virtual bool remRegime(int regime)
virtual void setRegimeName(const QString &name)
bool _isRayonnant
Etat courant de l'element (rayonnant ou non rayonnant)
virtual TYTabSourcePonctuelleGeoNode getSrcs() const
virtual bool setSrcsLw()
virtual void distriSrcs()
virtual TYTabPoint getContour(int n=-1) const
virtual OPlan plan() const
virtual double surface() const
virtual LPTYPolygon getPolygon()
virtual OVector3D normal() const
virtual void exportCSV(std::ofstream &ofs)
Export au format csv sur un flux transmis.
virtual void setDensiteSrcsV(double densite, bool recursif=true)
virtual void remAllSrcs()
virtual void setCurRegime(int regime)
virtual double surface() const
virtual void propagateAtt(LPTYAttenuateur pAtt)
virtual TYTabSourcePonctuelleGeoNode getSrcs() const
virtual void exportCSV(std::ofstream &ofs)
Export au format csv sur un flux transmis.
LPTYSourceSurfacic getSrcSurf()
virtual void setDensiteSrcsH(double densite, bool recursif=true)
virtual LPTYMateriauConstruction getMateriau() const
virtual bool setSrcsLw()
virtual TYTabPoint getContour(int n=-1) const
virtual void setIsRayonnant(bool rayonnant=true, bool recursif=true)
Get/set de l'etat rayonnant ou pas.
virtual OVector3D normal() const
virtual void setIsRayonnant(bool rayonnant=true, bool recursif=true)
virtual TYTabSourcePonctuelleGeoNode getSrcs() const
virtual void setCurRegime(int regime)
TYAcousticVolume & operator=(const TYAcousticVolume &other)
Operateur =.
virtual DOM_Element toXML(DOM_Element &domElement)
virtual int fromXML(DOM_Element domElement)
virtual bool deepCopy(const TYElement *pOther, bool copyId=true, bool pUseCopyTag=false)
virtual void propagateAtt(LPTYAttenuateur pAtt)
virtual void setIsAcousticModified(bool isModified)
bool _forceNormales
Persistence du forcage des normales.
virtual void inverseNormales()
Definition: TYBox.h:34
int isInside(const TYPoint &pt) const
Definition: TYBox.cpp:236
virtual bool deepCopy(const TYElement *pOther, bool copyId=true, bool pUseCopyTag=false)
Definition: TYDalle.cpp:97
virtual DOM_Element toXML(DOM_Element &domElement)
Definition: TYDalle.cpp:118
LPTYParoi getParoi()
Definition: TYDalle.h:84
void setParoi(const LPTYParoi pParoi)
Definition: TYDalle.cpp:148
QString _name
Nom courant de l'element.
Definition: TYElement.h:966
static bool getRegenerateID()
Definition: TYElement.h:927
static TYUUID fromString(QString id)
Definition: TYElement.cpp:623
bool callFromXMLIfEqual(DOM_Element &domElement, int *pRetVal=NULL)
Definition: TYElement.cpp:544
static bool testId(const TYUUID &id, const TYElement *pElem)
Definition: TYElement.cpp:216
void regenerateID()
Definition: TYElement.cpp:243
const TYUUID & getID() const
Definition: TYElement.cpp:176
virtual std::string toString() const
Definition: TYElement.h:786
virtual void getChilds(LPTYElementArray &childs, bool recursif=true)
Definition: TYElement.h:532
static void setRegenerateID(const bool &bRegenerate)
Definition: TYElement.h:923
void setParent(TYElement *pParent)
Definition: TYElement.h:692
static TYElement * getInstance(TYUUID uuid)
Definition: TYElement.cpp:158
virtual void setIsGeometryModified(bool isModified)
Definition: TYElement.cpp:253
virtual int fromXML(DOM_Element domElement)
Definition: TYEtage.cpp:355
virtual std::string toString() const
Definition: TYEtage.cpp:247
virtual ~TYEtage()
Definition: TYEtage.cpp:75
bool _closed
Indique si les murs constituant l'etage sont fermes.
Definition: TYEtage.h:590
void updateParoi()
Definition: TYEtage.cpp:2428
virtual TYTabPoint sommets() const
Definition: TYEtage.cpp:1870
void updateSolPlafond()
Definition: TYEtage.cpp:2245
TYEtage()
Definition: TYEtage.cpp:35
OSpectre _absoSabine
Spectre du coefficient de Sabine de l'etage.
Definition: TYEtage.h:602
bool operator==(const TYEtage &other) const
Definition: TYEtage.cpp:101
virtual void setCurRegime(int regime)
Definition: TYEtage.cpp:1437
virtual double volume() const
Definition: TYEtage.cpp:1833
LPTYDalle _pSol
Dalle pour le sol.
Definition: TYEtage.h:575
virtual void distriSrcs()
Definition: TYEtage.cpp:1648
virtual bool deepCopy(const TYElement *pOther, bool copyId=true, bool pUseCopyTag=false)
Definition: TYEtage.cpp:150
void setacousticFacesPourCalcul(bool bPourCalculTrajet)
Definition: TYEtage.cpp:2004
virtual TYSourcePonctuelle srcPonctEquiv() const
Definition: TYEtage.cpp:1611
virtual void setNextRegimeNb(const int &next)
Definition: TYEtage.cpp:1544
void calculTempsReverb()
Definition: TYEtage.cpp:2229
virtual void setDensiteSrcsV(double densite, bool recursif=true)
Definition: TYEtage.cpp:1632
LPTYMachineGeoNode findMachine(const LPTYMachine pMachine)
Definition: TYEtage.cpp:1202
void calculChampReverbere()
Definition: TYEtage.cpp:2360
virtual void setDensiteSrcsH(double densite, bool recursif=true)
Definition: TYEtage.cpp:1616
virtual TYPoint centreGravite() const
Definition: TYEtage.cpp:1922
TYTabMachineGeoNode & getTabMachine()
Definition: TYEtage.h:281
virtual int isInside(const TYPoint &pt) const
Definition: TYEtage.cpp:1952
LPTYDalle _pPlafond
Dalle pour le plafond.
Definition: TYEtage.h:578
TYTabPoint getContour() const
Definition: TYEtage.cpp:952
LPTYParoi _pParoi
Paroi par defaut de l'etage.
Definition: TYEtage.h:587
bool remMur(const LPTYMur pMur)
Definition: TYEtage.cpp:819
virtual int intersects(const OSegment3D &seg, TYTabPoint &ptList) const
Definition: TYEtage.cpp:1947
bool operator!=(const TYEtage &other) const
Definition: TYEtage.cpp:145
virtual void exportCSV(std::ofstream &ofs)
Export au format csv sur un flux transmis.
Definition: TYEtage.cpp:745
double _surfAbsorbante
Surface d'absorption de la salle (comprend la suface des machines)
Definition: TYEtage.h:596
tabMapPtrElementRegime _tabRegimesMachines
Gestion des regimes des machines.
Definition: TYEtage.h:611
virtual TYTabAcousticSurfaceGeoNode acousticFaces()
Definition: TYEtage.cpp:2009
double _volumeLibre
Volume libre de la salle (volume de la salle vide - volume des machines)
Definition: TYEtage.h:599
virtual bool setSrcsLw()
Definition: TYEtage.cpp:1684
virtual bool findAcousticSurface(const TYAcousticSurface *pAccSurf, OMatrix *pMatrix=0)
Definition: TYEtage.cpp:2086
TYTabMurGeoNode & getTabMur()
Definition: TYEtage.h:143
bool addMur(LPTYMur pMur)
Definition: TYEtage.cpp:802
TYSpectre getPuissanceRayonnee(LPTYAcousticSurface pSurface, const OMatrix matMur, const LPTYParoi pMurParoi)
Definition: TYEtage.cpp:2580
TYTabMurGeoNode _tabMur
Liste des murs.
Definition: TYEtage.h:572
TYTabUserSourcePonctuelleGeoNode _tabSources
Liste des sources ponctuelles.
Definition: TYEtage.h:584
virtual bool remRegime(int regime)
Definition: TYEtage.cpp:1420
TYTabAcousticSurfaceGeoNode _facesMachineSol
Collection des faces des machines collees au sol.
Definition: TYEtage.h:620
virtual DOM_Element toXML(DOM_Element &domElement)
Definition: TYEtage.cpp:252
TYSpectre _TR
Spectre de TR.
Definition: TYEtage.h:605
virtual void getChilds(LPTYElementArray &childs, bool recursif=true)
Definition: TYEtage.cpp:766
virtual TYTabVector normals() const
Definition: TYEtage.cpp:1853
virtual void remAllSrcs()
Definition: TYEtage.cpp:2543
void coeffSabine()
Definition: TYEtage.cpp:2115
double getHauteur() const
Definition: TYEtage.cpp:1018
virtual void setRegime(TYSpectre &Spectre, int regime=-1, bool recursif=true)
Definition: TYEtage.cpp:1407
OSpectre champDirect(const OPoint3D &unPoint)
Definition: TYEtage.cpp:2285
bool remSource(const LPTYUserSourcePonctuelleGeoNode pSourceGeoNode)
Definition: TYEtage.cpp:1257
bool addSource(LPTYUserSourcePonctuelleGeoNode pSourceGeoNode)
Definition: TYEtage.cpp:1218
virtual double surface() const
Definition: TYEtage.cpp:1838
void setParoi(const LPTYParoi pParoi)
Definition: TYEtage.cpp:2640
TYTabMachineGeoNode _tabMachine
Liste des sources.
Definition: TYEtage.h:581
void verifTabRegimeSources()
Definition: TYEtage.cpp:679
TYEtage & operator=(const TYEtage &other)
Definition: TYEtage.cpp:82
TYSpectre _reverb
Spectre du champ reverbere.
Definition: TYEtage.h:608
virtual void setRegimeName(const QString &name)
Definition: TYEtage.cpp:1557
LPTYUserSourcePonctuelleGeoNode findSource(const LPTYUserSourcePonctuelle pSource)
Definition: TYEtage.cpp:1391
virtual void propagateAtt(LPTYAttenuateur pAtt)
Definition: TYEtage.cpp:2669
void calculChampRevSabine()
spectre de pression acoustique après fonction
Definition: TYEtage.cpp:2372
virtual TYTabLPPolygon faces() const
Definition: TYEtage.cpp:1893
void remAllMachine()
Definition: TYEtage.cpp:1172
bool addMachine(LPTYMachineGeoNode pMachineGeoNode)
Definition: TYEtage.cpp:1030
virtual TYSpectre setGlobalLW(const TYSpectre &spectre, const double &surfGlobale, const int &regime=-1)
Definition: TYEtage.cpp:2571
void updateZSource()
Definition: TYEtage.cpp:2648
virtual bool updateAcoustic(const bool &force=false)
Definition: TYEtage.cpp:2509
void setHauteur(double hauteur)
Definition: TYEtage.cpp:994
void remAllSources()
Definition: TYEtage.cpp:1360
tabMapPtrElementBool _tabEtatMachines
Gestion des etats des machines.
Definition: TYEtage.h:614
bool remMachine(const LPTYMachineGeoNode pMachineGeoNode)
Definition: TYEtage.cpp:1069
void remMurs()
Definition: TYEtage.cpp:866
bool setMurs(const TYTabPoint &tabPts, double hauteur=2.0, bool close=true)
Definition: TYEtage.cpp:875
virtual TYBox volEnglob() const
Definition: TYEtage.cpp:1917
virtual double activeSurface() const
Definition: TYEtage.cpp:2556
bool _bPourCalculTrajet
Definition: TYEtage.h:618
void findFaceMachineSol()
Definition: TYEtage.cpp:2442
virtual TYTabSourcePonctuelleGeoNode getSrcs() const
Definition: TYEtage.cpp:1575
virtual int addRegime()
Definition: TYEtage.cpp:1522
void setMatrix(const OMatrix &matrix)
TYElement * getElement() const
virtual bool deepCopy(const TYElement *pOther, bool copyId=true, bool pUseCopyTag=false)
OMatrix getMatrix() const
void setRepere(const ORepere3D &repere)
Definition: TYMur.h:36
QString generateName(const char *classname)
Retourne le nom de la classe associe a un nombre.
static TYNameManager * get()
Retourne l'instance singleton.
virtual DOM_Element toXML(DOM_Element &domElement)
Definition: TYParoi.cpp:119
TYMateriauConstruction * getMatStruct()
Definition: TYParoi.h:93
virtual bool deepCopy(const TYElement *pOther, bool copyId=true, bool pUseCopyTag=false)
Definition: TYParoi.cpp:96
TYMateriauConstruction * getMatFace1()
Definition: TYParoi.h:118
void transform(const OMatrix &matrix)
Definition: TYPolygon.cpp:417
void setPoints(const TYTabPoint &pts)
Definition: TYPolygon.cpp:389
void setRegimeName(const QString &nom)
Definition: TYRegime.h:78
virtual TYSpectre * getSpectre(int regime=-1) const
Definition: TYSource.h:76
static TYSpectre getEmptyLinSpectre(const double &valInit=1.0E-20)
Cree un spectre en lin.
Definition: TYSpectre.cpp:451
virtual TYSpectre * getSpectre(int regime=-1) const
void setCurrentRegime(const int &regimeNumber)
void setIsRayonnant(const bool &rayonnant)
virtual int intersects(const OSegment3D &seg, TYTabPoint &ptList) const
virtual TYBox volEnglob() const
void calculRayonSphere(const TYBox &volEnglob)
virtual void calculCentreGravite()
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 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 getElementIntValue(DOM_Element parentElem, DOMString nodeName, int &nodeValue)
Definition: TYXMLTools.cpp:129
#define M_PI
Pi.
Definition: color.cpp:25
std::string intToStr(int val)
Definition: macros.h:158
@ SPECTRE_ETAT_DB
Definition: spectre.h:45
@ SPECTRE_TYPE_LW
Definition: spectre.h:30
@ SPECTRE_TYPE_LP
Definition: spectre.h:31
@ SPECTRE_TYPE_AUTRE
Definition: spectre.h:32