Code_TYMPAN  4.4.0
Industrial site acoustic simulation
TYSolverDefaultSolver.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 "TYSolverDefaultSolver.h"
22 
24 {
25  // Creation du acoustic model
27 }
28 
30 {
32 }
33 
34 std::unique_ptr<TYAcousticModelDefaultSolver> TYSolverDefaultSolver::make_acoustic_model()
35 {
36  return std::unique_ptr<TYAcousticModelDefaultSolver>(new TYAcousticModelDefaultSolver(*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  TYTrajetDefaultSolver* trajet =
52  new TYTrajetDefaultSolver(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 TYTaskDefaultSolver(*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 TYSolverDefaultSolver::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:145
Acoustic model for the default solver.
std::unique_ptr< TYAcousticModelDefaultSolver > make_acoustic_model()
TYAcousticModel builder.
void addNewTaskForOneTrajetSrcRcp(const tympan::AcousticProblemModel &aproblem, unsigned int src_index, unsigned int rcp_index, int nbTrajetsForThisSource, int nNbTrajets) override
Instanciate a new task to compute a Trajet.
std::vector< TYTrajetDefaultSolver * > _tabTrajets
Vector of TYTrajetDefaultSolver.
void displayRaysInGUI(tab_acoustic_path &) override
Keep rays in tab in order to display them in GUI.
void initAcousticModel() override
Initialize the acoustic model.
void clearTabTrajets() override
Clear the array of TYTrajetDefaultSolver.
void buildAcousticModel() override
Build the acoustic model.
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 deleteTrajets() override
Delete all the Trajets.
virtual ~TYSolverDefaultSolver()
Destructor.
std::unique_ptr< TYAcousticModelDefaultSolver > _acousticModel
Pointer to the TYAcousticModel.
Class which represents the Solver for 9613 family solvers.
Definition: TYSolver.h:36
OThreadPool * _pool
Definition: TYSolver.h:151
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:409
size_t receptor_idx
Definition: entities.hpp:426