Code_TYMPAN  4.4.0
Industrial site acoustic simulation
TYSolver9613Solver.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 #include "Tympan/core/logging.h"
19 #include "TYSolver9613Solver.h"
22 
24 {
25  // Creation du acoustic model
27 }
28 
30 {
32 }
33 
34 std::unique_ptr<TYAcousticModel9613Solver> TYSolver9613Solver::make_acoustic_model()
35 {
36  return std::unique_ptr<TYAcousticModel9613Solver>(new TYAcousticModel9613Solver(*this));
37 }
38 
40 {
41  if (_tabTrajets.size() > 0)
42  {
43  _tabTrajets.clear();
44  }
45 }
46 
48  unsigned int src_index, unsigned int rcp_index,
49  int nbTrajectsForOneSource, int nNbTrajets)
50 {
51  TYTrajet9613Solver* trajet =
52  new TYTrajet9613Solver(const_cast<tympan::AcousticProblemModel&>(aproblem).source(src_index),
53  const_cast<tympan::AcousticProblemModel&>(aproblem).receptor(rcp_index));
54  trajet->asrc_idx = src_index;
55  trajet->arcpt_idx = rcp_index;
56  _tabTrajets.push_back(trajet);
57 
58  _pool->push(new TYTask9613Solver(*this, aproblem.nodes(), aproblem.triangles(), aproblem.materials(),
59  *_tabTrajets.at(nbTrajectsForOneSource), nNbTrajets + 1));
60 }
61 
63 {
64  if (!_acousticModel)
65  {
67  }
68 }
69 
71 {
72  _acousticModel->init();
73 }
74 
76 {
77  for (unsigned int i = 0; i < _tabTrajets.size(); i++)
78  {
79  for (size_t j = 0; j < _tabTrajets.at(i)->get_tab_rays().size(); j++)
80  {
81  tabRays.push_back(_tabTrajets.at(i)->get_tab_rays()[j]);
82  }
83  }
84 }
85 
86 void TYSolver9613Solver::buildResultsMatrix(int nSourceTrajectsNumber, tympan::SpectrumMatrix& matrix)
87 {
88  for (int i = 0; i < nSourceTrajectsNumber; i++)
89  {
90  tympan::source_idx sidx = _tabTrajets.at(i)->asrc_idx;
91  tympan::receptor_idx ridx = _tabTrajets.at(i)->arcpt_idx;
92 
93  matrix(ridx, sidx) = _tabTrajets.at(i)->getSpectre();
94  }
95 }
96 
98 {
99  for (unsigned int cnt = 0; cnt < _tabTrajets.size(); cnt++)
100  {
101  delete _tabTrajets.at(cnt);
102  }
103 }
std::vector< acoustic_path * > tab_acoustic_path
virtual void push(OTask *task)
Add a task to the queue.
Definition: threading.cpp:140
Acoustic model for the 9613Solver.
void buildAcousticModel() override
Build the acoustic model.
std::unique_ptr< TYAcousticModel9613Solver > make_acoustic_model()
TYAcousticModel builder.
void deleteTrajets() override
Delete all the Trajets.
void initAcousticModel() override
Initialize the acoustic model.
std::unique_ptr< TYAcousticModel9613Solver > _acousticModel
Pointer to the TYAcousticModel.
TYSolver9613Solver()
Constructor.
void addNewTaskForOneTrajetSrcRcp(const tympan::AcousticProblemModel &aproblem, unsigned int src_index, unsigned int rcp_index, int nbTrajectsForThisSource, int nNbTrajets) override
Instanciate a new task to compute a Trajet.
void clearTabTrajets() override
Clear the array of TYTrajet9613Solver.
std::vector< TYTrajet9613Solver * > _tabTrajets
Vector of TYTrajet9613Solver.
void buildResultsMatrix(int nSourceTrajetsNumber, tympan::SpectrumMatrix &matrix) override
Build the matrix of the results for a given source and all the receptors These results are the result...
void displayRaysInGUI(tab_acoustic_path &) override
Keep rays in tab in order to display them in GUI.
virtual ~TYSolver9613Solver()
Destructor.
Class which represents the Solver for 9613 family solvers.
Definition: TYSolver.h:36
OThreadPool * _pool
Definition: TYSolver.h:145
Task of a thread collection for Tympan.
This class TYTrajet (journey) links a couple Source-Receptor and a collection of paths,...
tympan::source_idx asrc_idx
Definition: TYTrajet.h:127
tympan::receptor_idx arcpt_idx
Definition: TYTrajet.h:131
Class to describe the acoustic problem.
const material_pool_t & materials() const
Return array of materials.
const nodes_pool_t & nodes() const
Return array of nodes.
const triangle_pool_t & triangles() const
Return array of triangles.
Spectrum matrix N*M used to store results. N is the number of receptors. M is the number of sources.
size_t source_idx
Definition: entities.hpp:396
size_t receptor_idx
Definition: entities.hpp:413