Code_TYMPAN  4.4.0
Industrial site acoustic simulation
Simulation.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 "Simulation.h"
18 {
19  scene.clean();
20 
21  // Nettoyage des sources et des recepteurs
22  sources.clear();
23  recepteurs.clear();
24 
25  compteurSource = 0;
27 }
28 
29 #ifdef TEST_ACCELERATION_RECEPTORS
31 {
32  if (solver)
33  {
34  solver->clean();
35  }
36  if (engine)
37  {
38  delete engine;
39  }
40  // Create the engine from engineC enum
41  switch (engineC)
42  {
43  case DEFAULT:
45  break;
46  case PARALLELDEFAULT:
48  break;
49  default:
51  break;
52  }
53  return engine->process();
54 }
55 #else
57 {
58  if (solver)
59  {
60  solver->clean();
61  }
62  if (engine)
63  {
64  delete engine;
65  }
66  switch (engineC)
67  {
68  case DEFAULT:
70  break;
71  case PARALLELDEFAULT:
73  break;
74  default:
76  break;
77  }
78 
79  return engine->process();
80 }
81 #endif // TEST_ACCELERATION_RECEPTORS
@ DEFAULT
Definition: Simulation.h:31
@ PARALLELDEFAULT
Definition: Simulation.h:32
Default Engine class.
Definition: DefaultEngine.h:26
virtual bool process()
If implemented, process and return true if success.
Definition: Engine.h:90
Parallel default engine class.
void clean()
Clear all arrays.
Definition: Scene.cpp:32
engineChoice engineC
Enum giving the Engine choice.
Definition: Simulation.h:218
Solver * solver
Pointer to a solver (acoustic method)
Definition: Simulation.h:211
Scene scene
Description of the geometry in an accelerated structure.
Definition: Simulation.h:206
void clean()
Clean the simulation: the scene, sources, and receptors and all the rays are deleted.
Definition: Simulation.cpp:17
std::vector< Recepteur > recepteurs
All the acoustic receptors for the Simulation.
Definition: Simulation.h:215
Engine * engine
Pointer to the selected Engine.
Definition: Simulation.h:217
std::vector< Source > sources
All the acoustic sources for the Simulation.
Definition: Simulation.h:214
bool launchSimulation()
Program main loop. Extract all the rays from the sources then treat them. The loop finishes when the ...
Definition: Simulation.cpp:30
Scene receptors_landscape
Geometric distribution of receptors.
Definition: Simulation.h:208
unsigned int compteurRecepteur
Receptor counter.
Definition: Simulation.h:221
unsigned int compteurSource
Source counter.
Definition: Simulation.h:220
virtual void clean()
Delete the valid rays array.
Definition: Solver.cpp:52