Code_TYMPAN  4.2.0
Industrial site acoustic simulation
Lancer.h
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 
21 #ifndef __LANCER_H
22 #define __LANCER_H
23 
25 #include "Step.h"
26 
27 
28 using namespace std;
29 
30 class RayCourb;
31 class Sampler;
32 class meteo;
33 
37 class Lancer
38 {
39 public:
41  Lancer();
43  Lancer(Lancer& L);
45  ~Lancer();
46 
47  //--------------------------------------------------------------------------------------------------------//
48  // Member functions :
49  //--------------------------------------------------------------------------------------------------------//
50 
52  void setMeteo(const meteo* Meteo) { _weather = const_cast<meteo*>(Meteo); }
53 
55  void purgeMatRes();
56 
58  void clear() { sources.clear(); recepteurs.clear(); _plan.clear(); temps.clear(); purgeMatRes(); }
59 
61  void setNbRay(const unsigned int& nb) {nbRay = nb;}
62 
64  void setTMax(const double& TmpMax) { TMax = (decimal)TmpMax; }
65 
67  void setDMax(const double& DistMax) { dmax = (decimal)DistMax; }
68 
70  void setTimeStep(const decimal& tt) { h = tt; }
71 
73  void setTriangle(vec3* triangle) { _plan.push_back(triangle); }
74 
76  decimal distance_max();
77 
79  void createTemps();
80 
86  Step EqRay(const Step& y0);
87 
98  vec3 valideIntersection(const vec3& S, const vec3& R, const vec3* A, int& reflexion, const vec3& nExt_plan, const vec3& SR);
99 
100  void intersection(const unsigned int& timer, RayCourb& current, Step& Y_t0, Step& Y_t1);
101 
107  RayCourb RK4(const Step& y0);
108 
110  void RemplirMat();
111 
113  void run() { createTemps(); RemplirMat(); }
114 
119  void loadRayFile(vector<vec3>& tableau_norm);
120 
122  void setSampler(Sampler* generator) { _sampler = generator; }
123 
125  Sampler* getSampler() { return _sampler; }
126 
128  void setLaunchType(const unsigned int& launchType) { _launchType = launchType; init_sampler(); }
129 
131  void addSource(const vec3& source) { sources.push_back(source); }
132 
133 
134 private :
136  void init_sampler();
137 
139  void save();
140 
142  Step compute_next_step(const Step& current_step);
143 
144 
145 public :
146  vector<vec3> sources;
147  vector<vec3> recepteurs;
148  vector<vec3*> _plan;
151 
154  vector<decimal> temps;
160 
161  unsigned int nbRay;
162  unsigned int _launchType;
163  bool wantOutFile;
164  string ray_fileName;
165  string out_fileName;
166 
167  vector<RayCourb*> MatRes;
168 };
169 
178 decimal angle_depart(const decimal& a, const decimal& c, const decimal& d, const decimal& h);
179 
180 #endif // __LANCER_H
vector< vec3 * > _plan
List of objects defined by 3 points.
Definition: Lancer.h:148
void clear()
Clear all the arrays.
Definition: Lancer.h:58
Sampler * _sampler
Pointer to a ray generator.
Definition: Lancer.h:150
decimal angle_depart(const decimal &a, const decimal &c, const decimal &d, const decimal &h)
Compute the shooting angle ray in order to travel the given minimal distance.
Definition: Lancer.cpp:478
meteo * _weather
Pointer to weather.
Definition: Lancer.h:149
decimal TMax
Maximal propagation time.
Definition: Lancer.h:153
decimal finalAnglePhi
Final shot angle according phi.
Definition: Lancer.h:159
Describes analytical ray curve tracing.
Definition: Lancer.h:37
string ray_fileName
Filename of file containing angles of rays.
Definition: Lancer.h:164
decimal finalAngleTheta
Final shot angle according theta.
Definition: Lancer.h:157
Sampler class and its sub-classes describe ray generators used in AcousticRayTracer. In these classes :
Definition: Sampler.h:29
unsigned int nbRay
Launched rays number.
Definition: Lancer.h:161
void setSampler(Sampler *generator)
Set a pointer to the ray generator.
Definition: Lancer.h:122
STL namespace.
void setLaunchType(const unsigned int &launchType)
Set how rays will be created (launch type)
Definition: Lancer.h:128
decimal initialAngleTheta
Initial shot angle according theta.
Definition: Lancer.h:156
vector< RayCourb * > MatRes
Array containing the resulting rays for each source.
Definition: Lancer.h:167
void run()
Run the calculation.
Definition: Lancer.h:113
void setTMax(const double &TmpMax)
Change the maximal propagation time.
Definition: Lancer.h:64
decimal h
Discretization step.
Definition: Lancer.h:152
void setNbRay(const unsigned int &nb)
Set the rays number to launch.
Definition: Lancer.h:61
NxReal c
Definition: NxVec3.cpp:345
3D vector Vector defined with 3 float numbers
Definition: mathlib.h:107
decimal dmax
Maximal distance traveled by the rays.
Definition: Lancer.h:155
vector< vec3 > sources
Sources vector.
Definition: Lancer.h:146
float decimal
Definition: mathlib.h:46
Weather data class for the simulation.
Definition: meteo.h:30
Math library.
void setDMax(const double &DistMax)
Set the maximal distance.
Definition: Lancer.h:67
decimal initialAnglePhi
Initial shot angle according phi.
Definition: Lancer.h:158
void setMeteo(const meteo *Meteo)
Set the pointer to the weather object.
Definition: Lancer.h:52
string out_fileName
Filename of the output file.
Definition: Lancer.h:165
vector< decimal > temps
[0:h:TMax] Vector containing the different times solved
Definition: Lancer.h:154
void setTimeStep(const decimal &tt)
Set the discretization step.
Definition: Lancer.h:70
vector< vec3 > recepteurs
Receptors vector.
Definition: Lancer.h:147
void setTriangle(vec3 *triangle)
Add a triangle to the geometry.
Definition: Lancer.h:73
unsigned int _launchType
Launch type with 1:horizontal / 2:vertical / 3:spherical / 4:file.
Definition: Lancer.h:162
Describe a step in the ray path.
Definition: Step.h:31
bool wantOutFile
True if an output file is wanted.
Definition: Lancer.h:163
void addSource(const vec3 &source)
Add a source into the sources list.
Definition: Lancer.h:131
Sampler * getSampler()
Get ray generator for modification.
Definition: Lancer.h:125
Class to describe a ray curve.
Definition: RayCourb.h:28