Code_TYMPAN  4.4.0
Industrial site acoustic simulation
TYSolver.h
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 #ifndef __TY_SOLVER__
17 #define __TY_SOLVER__
18 
19 #include <vector>
20 #include "Tympan/core/interfaces.h"
25 
26 class OThreadPool;
27 class TYAcousticModel;
29 class TYFaceSelector;
30 class Scene;
31 
35 class TYSolver : public SolverInterface
36 {
37 public:
38  TYSolver();
39  virtual ~TYSolver();
40 
45  void init();
46 
54  virtual bool solve(const tympan::AcousticProblemModel& aproblem, tympan::AcousticResultModel& aresult,
55  tympan::LPSolverConfiguration configuration);
56 
57  const std::vector<TYStructSurfIntersect>& getTabPolygon() const
58  {
59  return _tabPolygon;
60  }
61 
63  {
64  return _faceSelector.get();
65  }
67  {
68  return _acousticPathFinder.get();
69  }
70 
71  const Scene* getScene() const
72  {
73  return _scene.get();
74  }
75 
82  void selectFaces(std::deque<TYSIntersection>& tabIntersect, const OSegment3D& rayon,
83  const string& sourceVolumeId);
84 
85 protected:
86  std::unique_ptr<TYFaceSelector> make_face_selector();
87  std::unique_ptr<TYAcousticPathFinder> make_path_finder();
88 
89  std::unique_ptr<TYFaceSelector> _faceSelector;
90  std::unique_ptr<TYAcousticPathFinder> _acousticPathFinder;
91 
92 private:
93  bool buildCalcStruct(const tympan::AcousticProblemModel& aproblem);
94 
100  bool appendTriangleToScene();
101 
106  virtual void clearTabTrajets() = 0;
107 
118  unsigned int src_index, unsigned int rcp_index,
119  int nbTrajetsForThisSource, int nNbTrajets) = 0;
124  virtual void buildAcousticModel() = 0;
125 
129  virtual void initAcousticModel() = 0;
134  virtual void displayRaysInGUI(tab_acoustic_path& tabRays) = 0;
141  virtual void buildResultsMatrix(int nSourceTrajetsNumber, tympan::SpectrumMatrix& matrix) = 0;
142 
147  virtual void deleteTrajets() = 0;
148 
149  std::vector<TYStructSurfIntersect> _tabPolygon;
150 protected:
152 
153 private:
154  std::unique_ptr<Scene> _scene;
155 };
156 
157 #endif // __TY_SOLVER__
std::vector< acoustic_path * > tab_acoustic_path
This file provides the top-level declaration for the acoustic problem model.
This file provides the top-level declaration for the acoustic result model.
Class to define a segment.
Definition: 3d.h:1141
Slave threads collection.
Definition: threading.h:259
This class mainly define a mesh (list of Shape) used by the Simulation object.
Definition: Scene.h:51
Interface class for solvers.
Definition: interfaces.h:33
Acoustic model for the considered solver.
Build the acoustic path for the 9613 family solvers.
Building class of the faces list.
Class which represents the Solver for 9613 family solvers.
Definition: TYSolver.h:36
virtual void clearTabTrajets()=0
Clear the specific array of TYTrajet depending on the solver.
std::vector< TYStructSurfIntersect > _tabPolygon
Vector of TYStructSurfIntersect.
Definition: TYSolver.h:149
TYAcousticPathFinder * getAcousticPathFinder()
Get the acoustic path finder.
Definition: TYSolver.h:66
const Scene * getScene() const
Get the Scene.
Definition: TYSolver.h:71
std::unique_ptr< TYFaceSelector > _faceSelector
Pointer to the TYFaceSelector.
Definition: TYSolver.h:89
std::unique_ptr< TYAcousticPathFinder > make_path_finder()
TYAcousticPathFinder builder.
Definition: TYSolver.cpp:159
virtual void addNewTaskForOneTrajetSrcRcp(const tympan::AcousticProblemModel &aproblem, unsigned int src_index, unsigned int rcp_index, int nbTrajetsForThisSource, int nNbTrajets)=0
Instanciate a new task to compute a Trajet.
std::unique_ptr< Scene > _scene
Pointer to the Scene.
Definition: TYSolver.h:154
virtual ~TYSolver()
Destructor.
Definition: TYSolver.cpp:43
virtual void buildAcousticModel()=0
Build the acoustic model.
TYSolver()
Constructor.
Definition: TYSolver.cpp:27
bool appendTriangleToScene()
Convertion des triangles Tympan en primitives utilisables par ray tracer.
Definition: TYSolver.cpp:195
void selectFaces(std::deque< TYSIntersection > &tabIntersect, const OSegment3D &rayon, const string &sourceVolumeId)
Delegate to _faceSelector the build of the array of intersections.
Definition: TYSolver.cpp:148
const std::vector< TYStructSurfIntersect > & getTabPolygon() const
Get the array of polygons.
Definition: TYSolver.h:57
virtual void buildResultsMatrix(int nSourceTrajetsNumber, tympan::SpectrumMatrix &matrix)=0
Build the matrix of the results for a given source and all the receptors These results are the result...
std::unique_ptr< TYAcousticPathFinder > _acousticPathFinder
Pointer to the TYAcousticPathFinder.
Definition: TYSolver.h:90
virtual bool solve(const tympan::AcousticProblemModel &aproblem, tympan::AcousticResultModel &aresult, tympan::LPSolverConfiguration configuration)
Launch the resolution and get the results.
Definition: TYSolver.cpp:70
virtual void deleteTrajets()=0
Delete all the Trajets.
virtual void displayRaysInGUI(tab_acoustic_path &tabRays)=0
Keep rays in tab in order to display them in GUI.
void init()
Initialize solver This method must be called after instantiation of a solver.
Definition: TYSolver.cpp:52
bool buildCalcStruct(const tympan::AcousticProblemModel &aproblem)
Definition: TYSolver.cpp:164
OThreadPool * _pool
Definition: TYSolver.h:151
TYFaceSelector * getFaceSelector()
Get the face selector.
Definition: TYSolver.h:62
std::unique_ptr< TYFaceSelector > make_face_selector()
TYFaceSelector builder.
Definition: TYSolver.cpp:154
virtual void initAcousticModel()=0
Initialize the acoustic model.
Class to describe the acoustic problem.
Contains the results of the model solved.
Spectrum matrix N*M used to store results. N is the number of receptors. M is the number of sources.
This file provides class for solver configuration.
boost::shared_ptr< SolverConfiguration > LPSolverConfiguration
Definition: interfaces.h:25