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 
48  virtual bool solve(const tympan::AcousticProblemModel& aproblem, tympan::AcousticResultModel& aresult,
49  tympan::LPSolverConfiguration configuration);
50 
51  const std::vector<TYStructSurfIntersect>& getTabPolygon() const
52  {
53  return _tabPolygon;
54  }
55 
57  {
58  return _faceSelector.get();
59  }
61  {
62  return _acousticPathFinder.get();
63  }
64 
65  const Scene* getScene() const
66  {
67  return _scene.get();
68  }
69 
76  void selectFaces(std::deque<TYSIntersection>& tabIntersect, const OSegment3D& rayon,
77  const string& sourceVolumeId);
78 
79 protected:
80  std::unique_ptr<TYFaceSelector> make_face_selector();
81  std::unique_ptr<TYAcousticPathFinder> make_path_finder();
82 
83  std::unique_ptr<TYFaceSelector> _faceSelector;
84  std::unique_ptr<TYAcousticPathFinder> _acousticPathFinder;
85 
86 private:
87  bool buildCalcStruct(const tympan::AcousticProblemModel& aproblem);
88 
94  bool appendTriangleToScene();
95 
100  virtual void clearTabTrajets() = 0;
101 
112  unsigned int src_index, unsigned int rcp_index,
113  int nbTrajetsForThisSource, int nNbTrajets) = 0;
118  virtual void buildAcousticModel() = 0;
119 
123  virtual void initAcousticModel() = 0;
128  virtual void displayRaysInGUI(tab_acoustic_path& tabRays) = 0;
135  virtual void buildResultsMatrix(int nSourceTrajetsNumber, tympan::SpectrumMatrix& matrix) = 0;
136 
141  virtual void deleteTrajets() = 0;
142 
143  std::vector<TYStructSurfIntersect> _tabPolygon;
144 protected:
146 
147 private:
148  std::unique_ptr<Scene> _scene;
149 };
150 
151 #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:143
TYAcousticPathFinder * getAcousticPathFinder()
Get the acoustic path finder.
Definition: TYSolver.h:60
const Scene * getScene() const
Get the Scene.
Definition: TYSolver.h:65
std::unique_ptr< TYFaceSelector > _faceSelector
Pointer to the TYFaceSelector.
Definition: TYSolver.h:83
std::unique_ptr< TYAcousticPathFinder > make_path_finder()
TYAcousticPathFinder builder.
Definition: TYSolver.cpp:153
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:148
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:188
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:142
const std::vector< TYStructSurfIntersect > & getTabPolygon() const
Get the array of polygons.
Definition: TYSolver.h:51
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:84
virtual bool solve(const tympan::AcousticProblemModel &aproblem, tympan::AcousticResultModel &aresult, tympan::LPSolverConfiguration configuration)
Launch the resolution and get the results.
Definition: TYSolver.cpp:52
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.
bool buildCalcStruct(const tympan::AcousticProblemModel &aproblem)
Definition: TYSolver.cpp:158
OThreadPool * _pool
Definition: TYSolver.h:145
TYFaceSelector * getFaceSelector()
Get the face selector.
Definition: TYSolver.h:56
std::unique_ptr< TYFaceSelector > make_face_selector()
TYFaceSelector builder.
Definition: TYSolver.cpp:148
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