Code_TYMPAN  4.2.0
Industrial site acoustic simulation
TYANIME3DAcousticPathFinder.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 <vector>
17 using std::vector;
18 
42 #include "TYANIME3DSolver.h"
44 
46  const size_t& tabPolygonSize,
47  const tympan::AcousticProblemModel& aproblem_,
48  tab_acoustic_path& tabTYRays,
49  AtmosphericConditions& atmos) :
50  _tabPolygon(tabPolygon),
51  _tabPolygonSize(tabPolygonSize),
52  _tabTYRays(tabTYRays),
53  _atmos(atmos),
54  _aproblem(aproblem_)
55 {
56 }
57 
59 {
60 }
61 
63 {
64  // Configuration du lancer de rayon geometriques (au debut pour initialiser les valeurs globales
65  // Nettoyage de l'objet _rayTracing si il a ete utilise precedement
67  // Ajout des parametres du _rayTracing liés à la methode acoustique
69  _rayTracing.setSolver(solver);
70 
71  vector<vec3> sources;
72  vector<vec3> recepteurs;
73  vector<tympan::VolumeFaceDirectivity*> directivities;
74  unsigned int sens = getTabsSAndR(sources, recepteurs,directivities);
75 
76  // Create geometry transformer
77  build_geometry_transformer( sources );
78 
79  //Ajout des triangles a l'objet Scene de _rayTracing
81 
82  //Importation des recepteurs ponctuels actifs
83  appendRecepteurToSimulation(recepteurs);
84 
85  //Importation des sources ponctuelles actives
86  appendSourceToSimulation(sources,directivities);
87 
88  //Une fois la scene convertie, on peut la post-traiter (ajouter de l'information : arretes de diffractions par ex)
90 
92 
93 #ifdef TEST_ACCELERATION_RECEPTORS
94  _rayTracing.get_receptors_landscape()->finish(1, leafTreatment::ALL); // Using grid accelerator
95 #endif
96 
98  // Propagation des rayons
100 
101  _rayTracing.setEngine(); //DEFAULT
102  _rayTracing.launchSimulation(); //Traitement monothread
103 
104  // This function creates TYRays from Rays .
106 
107  // This function corrects distances between events and angles at each event
109 
110  return true;
111 }
112 
113 unsigned int TYANIME3DAcousticPathFinder::getTabsSAndR(vector<vec3>& sources, vector<vec3>& recepteurs, vector<tympan::VolumeFaceDirectivity*>& directivities)
114 {
116 
117  unsigned int sens = config->RayTracingOrder;
118 
119  // Recuperation de la position des sources du projet
120  vector<vec3> srcs;
121  directivities = vector<tympan::VolumeFaceDirectivity*>(_aproblem.nsources(),nullptr);
122  vector<tympan::VolumeFaceDirectivity*> dirs = vector<tympan::VolumeFaceDirectivity*>(_aproblem.nsources(),nullptr);
123  //Conversion des sources Tympan en source lancer de rayons
124  for (unsigned int i = 0; i < _aproblem.nsources(); i++)
125  {
126  OPoint3D globalPos = _aproblem.source(i).position;
127  vec3 pos = vec3(globalPos._x, globalPos._y, globalPos._z);
128  srcs.push_back(pos);
129 
130  dirs.at(i) = dynamic_cast<tympan::VolumeFaceDirectivity*>(_aproblem.source(i).directivity);
131 
132  }
133  // Recuperation de la position des recepteurs du projet
134  vector<vec3> rcpts;
135 
136  //Conversion du recepteur Tympan en recepteur lancer de rayons
137  for (unsigned int i = 0; i < _aproblem.nreceptors(); i++)
138  {
139  OPoint3D globalPos = _aproblem.receptor(i).position;
140  vec3 pos = vec3(globalPos._x, globalPos._y, globalPos._z);
141 
142  rcpts.push_back(pos);
143  }
144 
145  // Choix du traitement S->R ou R->S
146  switch (config->RayTracingOrder)
147  {
148  case 0 :
149  sources = srcs;
150  recepteurs = rcpts;
151  directivities = dirs;
152  break;
153  case 1 :
154  sources = rcpts;
155  recepteurs = srcs;
156  break;
157  case 2 : // Choix automatique
158  if (rcpts.size() > srcs.size())
159  {
160  sources = rcpts;
161  recepteurs = srcs;
162  sens = 1;
163  }
164  else
165  {
166  sources = srcs;
167  recepteurs = rcpts;
168  directivities = dirs;
169  sens = 0;
170  }
171  default :
172  sources = srcs;
173  recepteurs = rcpts;
174  directivities = dirs;
175  break;
176  }
177  return sens;
178 }
179 
181 {
182  if (_tabPolygon == NULL || _tabPolygonSize <= 0)
183  {
184  return false;
185  }
186 
187  Scene* scene = _rayTracing.getScene();
188 
189  Material *m = new Material(); // Only for compatibility, may be suppressed;
190 
191  vec3 pos;
192 
193  for (unsigned int i = 0; i < _tabPolygonSize; i++)
194  {
195  //Recuperation et convertion de la normale de la surface
196 
197  unsigned int a, b, c;
198  double coord[3];
199 
200  _tabPolygon[i].tabPoint[0].getCoords(coord);
201  pos = transformer->fonction_h( OPoint3Dtovec3(coord) );
202  scene->addVertex(pos, a);
203 
204  _tabPolygon[i].tabPoint[1].getCoords(coord);
205  pos = transformer->fonction_h( OPoint3Dtovec3(coord) );
206  scene->addVertex(pos, b);
207 
208  _tabPolygon[i].tabPoint[2].getCoords(coord);
209  pos = transformer->fonction_h( OPoint3Dtovec3(coord) );
210  scene->addVertex(pos, c);
211 
212  //Triangle* face;
213  if ( dynamic_cast<tympan::AcousticGroundMaterial*>(_tabPolygon[i].material) )
214  {
215  // Set last parameter true means triangle is part of the ground
216  //face = (Triangle*)scene->addTriangle(a, b, c, m, true);
217  (Triangle*)scene->addTriangle(a, b, c, m, true);
218  }
219  else
220  {
221  //face = (Triangle*)scene->addTriangle(a, b, c, m);
222  (Triangle*)scene->addTriangle(a, b, c, m);
223  ss << "Ajout d'un triangle non naturel." << std::endl;
224  }
225  }
226 
227  return true;
228 }
229 
231 {
232  //Ajout des recepteurs
233  unsigned int idRecepteur = 0;
234  //Conversion du recepteur Tympan en recepteur lancer de rayons
235  for (unsigned int i = 0; i < recepteurs.size(); i++)
236  {
237  Recepteur recep( transformer->fonction_h(recepteurs[i]), tympan::SolverConfiguration::get()->SizeReceiver );
238  recep.setId(idRecepteur);
239 
240  _rayTracing.addRecepteur(recep);
241  idRecepteur++;
242  }
243 }
244 
245 void TYANIME3DAcousticPathFinder::appendSourceToSimulation(vector<vec3>& sources,vector<tympan::VolumeFaceDirectivity*>& directivities)
246 {
248  //Conversion des sources Tympan en sources lancer de rayons
249  int idSource = 0;
250  int nbRaysPerSource = config->NbRaysPerSource;
251  int realNbRaysPerSource = 0;
252  for (unsigned int i = 0; i < sources.size(); i++)
253  {
254  Source source;
255 
256  if(directivities.at(i)){ // special case when the source's directivity is a VolumeFaceDirectivity -> attach a BeamSampler with a 180° opening angle
257  vec3 dir = vec3(directivities.at(i)->get_normal()._x,directivities.at(i)->get_normal()._y,directivities.at(i)->get_normal()._z);
258 
259  source.setSampler(new UniformBeamSampler(nbRaysPerSource,(decimal)M_PI,dir));
260  realNbRaysPerSource = dynamic_cast<UniformBeamSampler*>(source.getSampler())->getRealNbRays();;
261 
262  }else{ // general case -> attach the sampler setup in the configuration
263 
264  switch (config->Discretization)
265  {
266  case 0 :
267  source.setSampler(new RandomSphericSampler(nbRaysPerSource));
268  realNbRaysPerSource = nbRaysPerSource;
269  break;
270  case 1 :
271  source.setSampler(new UniformSphericSampler(nbRaysPerSource));
272  realNbRaysPerSource = dynamic_cast<UniformSphericSampler*>(source.getSampler())->getRealNbRays();
273  break;
274  case 2 :
275  source.setSampler(new UniformSphericSampler2(nbRaysPerSource));
276  realNbRaysPerSource = dynamic_cast<UniformSphericSampler2*>(source.getSampler())->getRealNbRays();
277  break;
278  case 3 :
279  source.setSampler(new Latitude2DSampler(config->NbRaysPerSource));
280  realNbRaysPerSource = nbRaysPerSource;
281  dynamic_cast<Latitude2DSampler*>(source.getSampler())->setStartPhi(0.);
282  dynamic_cast<Latitude2DSampler*>(source.getSampler())->setEndPhi(360.);
283  dynamic_cast<Latitude2DSampler*>(source.getSampler())->setStartTheta(0.);
284  dynamic_cast<Latitude2DSampler*>(source.getSampler())->setEndTheta(0.);
285  }
286  }
287 
288  source.setPosition( transformer->fonction_h(sources[i]) );
289  source.setInitialRayCount(realNbRaysPerSource);
290  source.setId(idSource);
291 
292  ss << "Ajout d'une source (id=" << idSource << ") en (" << sources[i].x << "," << sources[i].y << "," << sources[i].y << ")" << endl;
293 
294  _rayTracing.addSource(source);
295  idSource++;
296  }
297 }
298 
300 {
301  //Recuperation de la liste des rayons valides pour la _rayTracing.
302  std::deque<Ray*>* rays = _rayTracing.getSolver()->getValidRays();
303 
304  // Dimensionnement du tableau des rayons
305  _tabTYRays.reserve(rays->size());
306 
307  //Conversion des rayons du lancer en rayons metier Tympan
308  for (unsigned int i = 0; i < rays->size(); i++)
309  {
310  Ray* ray = rays->at(i);
311  acoustic_path *tyRay = new acoustic_path( Tools::build_from_Ray(sens, ray) ); // Creation du rayon
312 
313  // Connect TYSource & TYReceptor (will be obsolete in future solver data model)
315 
317  tyRay->compute_shot_angle();
318 
319  // Ajoute le rayon au calcul
320  _tabTYRays.push_back(tyRay);
321  }
322 }
323 
325 {
327  double t_step(config->AnalyticH);
328  double c0(_atmos.compute_c());
329  acoustic_path::set_sampler_step(c0 * t_step);
330 
331  for (size_t i = 0; i < _tabTYRays.size(); i++)
332  {
333  // Compute distance to the next event
334  _tabTYRays.at(i)->nextLenghtCompute(transformer.get());
335 
336  // Compute distance to the next "pertinent" event
337  _tabTYRays.at(i)->endLenghtCompute(transformer.get());
338 
339  // Compute distance between previous and next event for each event
340  _tabTYRays.at(i)->prevNextLengthCompute(transformer.get());
341 
342  // Compute incident angles for each event
343  _tabTYRays.at(i)->angleCompute(transformer.get());
344 
345  // Compute events position in real world
346  _tabTYRays.at(i)->eventPosCompute(transformer.get());
347  }
348 }
349 
351 {
352  unsigned int idSource = 0;
353  unsigned int idRecep = 0;
354  if (sens == 1) // On inverse les identifiants de source et de recepteur
355  {
356  idSource = static_cast<Recepteur*>(ray->getRecepteur())->getId();
357  idRecep = ray->getSource()->getId();
358  }
359  else
360  {
361  idRecep = static_cast<Recepteur*>(ray->getRecepteur())->getId();
362  idSource = ray->getSource()->getId();
363  }
364 
365  //Les identifiants des recepteurs et sources sont construit pour correspondre a l'index des sources et recepteurs dans Tympan.
366  assert (static_cast<unsigned int>(idRecep) < _aproblem.nreceptors() && static_cast<unsigned int>(idSource) < _aproblem.nsources());
367 
368  tyRay->setSource(idSource);
369  tyRay->setRecepteur(idRecep);
370 }
371 
373 {
375 
376  // Geometry transformer choice
377  if (config->UseMeteo == false)
378  {
379  transformer = std::unique_ptr<IGeometryModifier>( new geometry_modifier_no_correction() ) ;
380  }
381  else
382  {
383  switch(config->AnalyticTypeTransfo)
384  {
385  case 1 :
386  default:
387  transformer = std::unique_ptr<IGeometryModifier>( new geometry_modifier_z_correction() ) ;
388  break;
389  }
390  }
391 
392  transformer->clear();
393 
394  if (config->UseMeteo)
395  {
396  // Creation du lancer de rayons courbes
397  Lancer CurveRayShot;
398 
399  // Parametrage du lancer de rayons courbe
400  CurveRayShot.clear();
401  CurveRayShot.setDMax(config->AnalyticDMax);
402 
403  CurveRayShot.setTMax(config->AnalyticTMax);
404  CurveRayShot.setTimeStep(config->AnalyticH); // Propagation time step
405  CurveRayShot.setNbRay(config->AnalyticNbRay);
406  dynamic_cast<meteoLin*>(CurveRayShot._weather)->setGradC(config->AnalyticGradC);
407  dynamic_cast<meteoLin*>(CurveRayShot._weather)->setGradV(config->AnalyticGradV);
408  CurveRayShot._weather->setWindAngle(config->WindDirection);
409  CurveRayShot._weather->setC0(_atmos.compute_c());
410  CurveRayShot.setLaunchType(1); // Indique que l'on tire les rayons sur un plan horizontal
411 
412  dynamic_cast<Latitude2DSampler*>(CurveRayShot.getSampler())->setStartPhi(config->InitialAnglePhi);
413 
414  dynamic_cast<Latitude2DSampler*>(CurveRayShot.getSampler())->setStartTheta(config->InitialAngleTheta);
415 
416 // CurveRayShot.initialAngleTheta = config->InitialAngleTheta; // Angle de tir vertical (theta) des rayons
417 
418  // Choix de la source
420  CurveRayShot.addSource(p); // source is the centroid of all sources taking account of acoustic power
421 
422  // Lancer des rayons
423  CurveRayShot.run();
424 
425  transformer->buildNappe(CurveRayShot);
426  }
427 }
428 
430 {
433 
434  raytracer_config->NbRaysPerSource = solver_config->NbRaysPerSource;
435  raytracer_config->Discretization = solver_config->Discretization;
436  raytracer_config->Accelerator = solver_config->Accelerator;
437  raytracer_config->MaxTreeDepth = solver_config->MaxTreeDepth;
438  raytracer_config->MaxProfondeur = solver_config->MaxProfondeur;
439  raytracer_config->MaxReflexion = solver_config->MaxReflexion;
440  raytracer_config->UseSol = solver_config->UseSol;
441  raytracer_config->MaxDiffraction = solver_config->MaxDiffraction;
442  raytracer_config->NbRayWithDiffraction = solver_config->NbRayWithDiffraction;
443  raytracer_config->MaxLength = solver_config->MaxLength;
444  raytracer_config->SizeReceiver = solver_config->SizeReceiver;
445  raytracer_config->AngleDiffMin = solver_config->AngleDiffMin;
446  raytracer_config->CylindreThick = solver_config->CylindreThick;
447  raytracer_config->MaxPathDifference = solver_config->MaxPathDifference;
448  raytracer_config->InitialAnglePhi = solver_config->InitialAnglePhi;
449  raytracer_config->FinalAnglePhi = solver_config->FinalAnglePhi;
450  raytracer_config->InitialAngleTheta = solver_config->InitialAngleTheta;
451  raytracer_config->FinalAngleTheta = solver_config->FinalAngleTheta;
452  raytracer_config->UsePathDifValidation = solver_config->UsePathDifValidation;
453  raytracer_config->DiffractionFilterRayAtCreation = solver_config->DiffractionFilterRayAtCreation;
454  raytracer_config->DiffractionUseDistanceAsFilter = solver_config->DiffractionUseDistanceAsFilter;
455  raytracer_config->DiffractionUseRandomSampler = solver_config->DiffractionUseRandomSampler;
456  raytracer_config->DiffractionDropDownNbRays = solver_config->DiffractionDropDownNbRays;
457  raytracer_config->UsePostFilters = solver_config->UsePostFilters;
458  raytracer_config->DebugUseCloseEventSelector = solver_config->DebugUseCloseEventSelector;
459  raytracer_config->DebugUseDiffractionAngleSelector = solver_config->DebugUseDiffractionAngleSelector;
460  raytracer_config->DebugUseDiffractionPathSelector = solver_config->DebugUseDiffractionPathSelector;
461  raytracer_config->DebugUseFermatSelector = solver_config->DebugUseFermatSelector;
462  raytracer_config->DebugUseFaceSelector = solver_config->DebugUseFaceSelector;
463  raytracer_config->KeepDebugRay = solver_config->KeepDebugRay;
464 }
unsigned int getId()
Get the Source id.
Definition: Source.h:99
double MaxPathDifference
Parameter (by default 24) for path validations during diffraction.
bool KeepDebugRay
Flag to store rays into a debug_rays array after being invalidated.
void clear()
Clear all the arrays.
Definition: Lancer.h:58
std::vector< Source > & getSources()
Return the sources list of the scene.
Definition: Simulation.h:130
bool DebugUseDiffractionAngleSelector
Flag to add the DiffractionAngleSelector filter.
This file provides the top-level declaration for the acoustic problem model.
meteo * _weather
Pointer to weather.
Definition: Lancer.h:149
size_t nreceptors() const
Return the total number of receptors.
void appendRecepteurToSimulation(vector< vec3 > &recepteurs)
Ajoute les recepteurs a la simulation.
virtual void setC0(const double &c)
Set sound speed.
Definition: meteo.h:46
std::stringstream ss
Definition: Logger.cpp:21
unsigned int MaxDiffraction
Maximal diffraction events.
Describes analytical ray curve tracing.
Definition: Lancer.h:37
Point position
Destructor.
Definition: entities.hpp:325
bool DiffractionFilterRayAtCreation
Flag to filter the created rays during diffraction.
void sampleAndCorrection()
Computes angle and length correction \ by calling the three previous functions \ Creates two matrix w...
Class defining the configuration of the acoustic ray tracer.
bool UsePathDifValidation
Flag to activate path validations during diffraction.
double compute_c() const
compute sound speed
bool exec()
Launch the research of acoustic paths.
TYANIME3DAcousticPathFinder(TYStructSurfIntersect *tabPolygon, const size_t &tabPolygonSize, const tympan::AcousticProblemModel &aproblem_, tab_acoustic_path &tabTYRays, AtmosphericConditions &atmos)
Constructor.
void setId(unsigned int _id)
Set the Source id.
Definition: Source.h:101
void appendSourceToSimulation(vector< vec3 > &sources, vector< tympan::VolumeFaceDirectivity *> &directivities)
Ajoute les sources ponctuelles actives a la simulation.
double FinalAngleTheta
Ending angle theta for the curve ray sampler.
This file provides class for solver configuration.
virtual bool postTreatmentScene(Scene *scene, std::vector< Source > &sources, std::vector< Recepteur > &recepteurs)
Virtual function to post-process the Scene. It has two phases: transform the meta-objects and load th...
Definition: Solver.cpp:33
Solver * getSolver()
Get the acoustic solver.
Definition: Simulation.h:95
base_vec3< decimal > vec3
Definition: mathlib.h:269
void setLaunchType(const unsigned int &launchType)
Set how rays will be created (launch type)
Definition: Lancer.h:128
const size_t & _tabPolygonSize
Polygons number in _tabPolygon.
bool finish(int accelerator_id=1, leafTreatment::treatment _intersectionChoice=leafTreatment::FIRST)
Build the selected accelerator on the scene.
Definition: Scene.cpp:46
TYStructSurfIntersect * _tabPolygon
Array containing all the informations relative to a site geometry and associated material to each fac...
bool appendTriangleToScene()
Convertion des triangles Tympan en primitives utilisables par le lancer de rayons.
void setSampler(Sampler *_sampler)
Set the Sampler for this Source.
Definition: Source.h:97
virtual deque< Ray * > * getValidRays()
Return a pointer to the validated rays list.
Definition: Solver.h:104
void setId(unsigned int _id)
Definition: Recepteur.h:55
acoustic_path build_from_Ray(int sens, Ray *ray)
build an acoustic_path from a geometric ray
void setInitialRayCount(int nb)
Set the initial rays counter.
Definition: Source.h:93
bool DiffractionUseDistanceAsFilter
Flag to use distance based filter during diffraction (distance from the ridge)
void run()
Run the calculation.
Definition: Lancer.h:113
void setTMax(const double &TmpMax)
Change the maximal propagation time.
Definition: Lancer.h:64
void * getRecepteur()
Return the ray receptor.
Definition: Ray.h:213
std::vector< Recepteur > & getRecepteurs()
Return a vector of all receptors of the scene.
Definition: Simulation.h:152
double CylindreThick
Diffraction cylinder diameter.
void setNbRay(const unsigned int &nb)
Set the rays number to launch.
Definition: Lancer.h:61
NxReal c
Definition: NxVec3.cpp:345
virtual void setRecepteur(unsigned int receptor_idx_, OPoint3D &globalPosition)
Set the ray receptor. The last polyline point is updated.
Class to define linear gradient for wind and sound speed.
Definition: meteoLin.h:33
tab_acoustic_path & _tabTYRays
Array containing all the Code_Tympan rays.
Shape * addTriangle(unsigned int i1, unsigned int i2, unsigned int i3, Material *m, const bool &isSol=false)
Add a triangle to the scene built with the vertices array.
Definition: Scene.cpp:121
3D vector Vector defined with 3 float numbers
Definition: mathlib.h:107
std::unique_ptr< IGeometryModifier > transformer
Object _curveRayTracing for the curved ray tracer.
void build_links_between_events()
TYRayEvent has to know is direct neighbourg (before and after him)
Point position
Destructor.
Definition: entities.hpp:347
AcousticSource & source(source_idx idx)
Return a source by its id.
A Sampler class for uniform spherical sampling.
bool DebugUseDiffractionPathSelector
Flag to add the DiffractionPathSelector filter.
Scene * getScene()
Get a pointer to the scene.
Definition: Simulation.h:74
void addSource(const Source &s)
Tool function to add a source to the simulation.
Definition: Simulation.h:124
double InitialAnglePhi
Starting angle phi for the curve ray sampler.
double _y
y coordinate of OCoord3D
Definition: 3d.h:281
AcousticReceptor & receptor(receptor_idx idx)
Return a receptor by its id.
double _x
x coordinate of OCoord3D
Definition: 3d.h:280
unsigned int NbRayWithDiffraction
Number of rays to throw during diffraction.
virtual void setSource(unsigned int source_idx_, OPoint3D &globalPosition)
Set the ray source.
Directivity for a volume face.
Definition: entities.hpp:218
TabPoint3D tabPoint
Points array used during the pre-selection.
void setEngine(engineChoice engine=DEFAULT)
Set the engine (by default, the DefaultEngine)
Definition: Simulation.h:159
void addRecepteur(Recepteur &r)
Tool function to add quickly a receptor for the simulation.
Definition: Simulation.h:137
: Describes a ray by a pair of unsigned int. The first one gives the source number (in the range 0-40...
Definition: Ray.h:38
virtual ~TYANIME3DAcousticPathFinder()
Destructor.
Triangle class.
Definition: Triangle.h:24
float decimal
Definition: mathlib.h:46
unsigned int getTabsSAndR(vector< vec3 > &sources, vector< vec3 > &recepteurs, vector< tympan::VolumeFaceDirectivity *> &directivities)
Contruit la liste des points sources et des points recepteurs en fonction du parametre de sens de pro...
void configure_raytracer()
Configure parameters of the AcousticRayTracer.
vec3 OPoint3Dtovec3(const OPoint3D &_p)
Converts a OPoint3D to vec3.
Definition: mathlib.h:313
AtmosphericConditions & _atmos
Atmospheric conditions.
Class to describe the acoustic problem.
Simulation _rayTracing
Object _rayTracing for the straigth-line ray tracer.
bool DiffractionDropDownNbRays
Flag to reduce the number of rays thrown depending on the diffraction order.
double AngleDiffMin
Minimal angle (other PI) between two face to allow building of a diffraction cylinder.
API class to run the ray tracer for the ANIME3D solver.
bool DebugUseFaceSelector
Flag to add the FaceSelector filter.
void setDMax(const double &DistMax)
Set the maximal distance.
Definition: Lancer.h:67
unsigned int MaxProfondeur
Maximal number of events for ray validation in ANIME3D solver.
Describe surface intersections.
static AcousticRaytracerConfiguration * get()
Get access to the configuration.
void set_source_idx_and_receptor_idx_to_acoustic_path(int sens, Ray *ray, acoustic_path *tyRay)
boost::shared_ptr< SolverConfiguration > LPSolverConfiguration
Definition: interfaces.h:24
bool addVertex(const vec3 &newVertex, unsigned int &index)
Add a vertex to the vertices array.
Definition: Scene.cpp:104
void setSolver(Solver *_solver)
Tool function to set the acoustic solver for the simulation.
Definition: Simulation.h:88
void clean()
Clean the simulation: the scene, sources, and receptors and all the rays are deleted.
Definition: Simulation.cpp:17
unsigned int Accelerator
Accelerator choice with 0: BruteForceAccelerator, 1: GridAccelerator, 2: BvhAccelerator, 3: KdtreeAccelerator.
bool DebugUseFermatSelector
Flag to add the FermatSelector filter.
size_t nsources() const
Return the total number of sources.
void setPosition(const vec3 _pos)
Set the position of the Source.
Definition: Source.h:80
unsigned int NbRaysPerSource
Number of rays per source for the Sampler.
SourceDirectivityInterface * directivity
Pointer to the source directivity.
Definition: entities.hpp:329
This class mainly define a mesh (list of Shape) used by the Simulation object.
Definition: Scene.h:50
The 3D point class.
Definition: 3d.h:484
void setTimeStep(const decimal &tt)
Set the discretization step.
Definition: Lancer.h:70
Class for the definition of atmospheric conditions.
double _z
z coordinate of OCoord3D
Definition: 3d.h:282
unsigned int MaxReflexion
Maximal reflection events.
unsigned int Discretization
Sampler choice with 0: RandomSphericSampler, 1: UniformSphericSampler, 2: UniformSphericSampler2, 3: Latitude2DSampler.
A Sampler class for random spherical sampling.
Acoustic path.
Definition: acoustic_path.h:75
Base class for accelerators.
Definition: Accelerator.h:26
void compute_shot_angle()
Compute shot angle from source.
const source_pool_t & sources() const
Return array of sources.
Point ComputeAcousticCentroid(const source_pool_t &tabSources_)
Definition: entities.cpp:1004
Source * getSource()
Return the ray source.
Definition: Ray.h:206
bool DiffractionUseRandomSampler
Flag to enable random (and not regular) sampling for diffraction.
A Sampler class for sampling rays uniformely from a cone.
static void set_sampler_step(double sampler_step_)
Set the sampler step.
#define M_PI
Pi.
Definition: color.cpp:24
Scene * get_receptors_landscape()
Return the geometric distribution of receptors.
Definition: Simulation.h:81
double InitialAngleTheta
Starting angle theta for the curve ray sampler.
std::vector< acoustic_path * > tab_acoustic_path
Acoustic source class.
Definition: Source.h:32
bool UsePostFilters
Flag to use some specifics Selector.
bool launchSimulation()
Program main loop. Extract all the rays from the sources then treat them. The loop finishes when the ...
Definition: Simulation.cpp:30
Another sampler class for uniform spherical sampling.
void build_geometry_transformer(const vector< vec3 > &sources)
Method to build the transformer of the scene geometry according to different parameters.
Receptor inherits from a Sphere Shape.
Definition: Recepteur.h:27
double MaxLength
LengthSelector Selector option (maximal length)
virtual void setWindAngle(const double &windAngle)
Define wind: angle given in windrose orientation (clockwise angle with 0 for a wind from north to sou...
Definition: meteo.h:54
unsigned int MaxTreeDepth
BvhAccelerator Accelerator option (Maximal tree depth)
double FinalAnglePhi
Ending angle phi for the curve ray sampler.
A Sampler class for latitude sampling.
void addSource(const vec3 &source)
Add a source into the sources list.
Definition: Lancer.h:131
bool DebugUseCloseEventSelector
Flag to add the the CloseEventSelector filter.
static LPSolverConfiguration get()
Get the configuration.
Definition: config.cpp:99
Sampler * getSampler()
Get ray generator for modification.
Definition: Lancer.h:125
const tympan::AcousticProblemModel & _aproblem
Sampler * getSampler()
Get the Sampler of this Source.
Definition: Source.h:95
void convert_Rays_to_acoustic_path(const unsigned int &sens)
convertion des rayons en rayons TYMPAN