Code_TYMPAN  4.4.0
Industrial site acoustic simulation
Simulation.cpp
Go to the documentation of this file.
1 /*
2  * Copyright (C) <2012> <EDF-R&D> <FRANCE>
3  * This program is free software; you can redistribute it and/or modify
4  * it under the terms of the GNU General Public License as published by
5  * the Free Software Foundation; either version 2 of the License, or
6  * (at your option) any later version.
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10  * See the GNU General Public License for more details.
11  * You should have received a copy of the GNU General Public License along
12  * with this program; if not, write to the Free Software Foundation, Inc.,
13  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
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  ss << "Lancement de la simulation." << std::endl;
33  if (solver)
34  {
35  solver->clean();
36  }
37  if (engine)
38  {
39  delete engine;
40  }
41  // Create the engine from engineC enum
42  switch (engineC)
43  {
44  case DEFAULT:
46  break;
47  case PARALLELDEFAULT:
49  break;
50  default:
52  break;
53  }
54  return engine->process();
55 }
56 #else
58 {
59  if (solver)
60  {
61  solver->clean();
62  }
63  if (engine)
64  {
65  delete engine;
66  }
67  switch (engineC)
68  {
69  case DEFAULT:
71  break;
72  case PARALLELDEFAULT:
74  break;
75  default:
77  break;
78  }
79 
80  return engine->process();
81 }
82 #endif // TEST_ACCELERATION_RECEPTORS
std::stringstream ss
Definition: Logger.cpp:21
@ DEFAULT
Definition: Simulation.h:32
@ PARALLELDEFAULT
Definition: Simulation.h:33
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:33
engineChoice engineC
Enum giving the Engine choice.
Definition: Simulation.h:219
Solver * solver
Pointer to a solver (acoustic method)
Definition: Simulation.h:212
Scene scene
Description of the geometry in an accelerated structure.
Definition: Simulation.h:207
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:216
Engine * engine
Pointer to the selected Engine.
Definition: Simulation.h:218
std::vector< Source > sources
All the acoustic sources for the Simulation.
Definition: Simulation.h:215
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:209
unsigned int compteurRecepteur
Receptor counter.
Definition: Simulation.h:222
unsigned int compteurSource
Source counter.
Definition: Simulation.h:221
virtual void clean()
Delete the valid rays array.
Definition: Solver.cpp:54