Code_TYMPAN  4.4.0
Industrial site acoustic simulation
Solver.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 
16 #ifndef SOLVER_H
17 #define SOLVER_H
18 
19 #include <vector>
20 #include <deque>
21 
22 #include "Geometry/Scene.h"
23 #include "Ray/Ray.h"
24 #include "Recepteur.h"
25 #include "Tools/SelectorManager.h"
26 #include "Acoustic/Solver.h"
27 
44 class Solver
45 {
46 public:
48  Solver() {}
49 
51  Solver(Solver* _solver) {}
52 
63  virtual bool postTreatmentScene(Scene* scene, std::vector<Source>& sources,
64  std::vector<Recepteur>& recepteurs);
65 
75  virtual double leafTreatment(vector<Intersection>& primitives);
76 
85  virtual bool valideIntersection(Ray* r, Intersection* inter);
86 
93  virtual bool valideRayon(Ray* r);
94 
101  virtual bool invalidRayon(Ray* r);
102 
104  virtual deque<Ray*>* getValidRays()
105  {
106  return &valid_rays;
107  }
108  // virtual vector<Ray*>* getValidRays() { return &valid_rays;}
109 
111  deque<Ray*>* getDebugRays()
112  {
113  return &debug_rays;
114  }
115  // vector<Ray*>* getDebugRays() { return &debug_rays;}
116 
118  virtual void finish();
120  virtual void clean();
121 
126  virtual bool loadParameters();
127 
128 protected:
129  deque<Ray*> valid_rays;
130  deque<Ray*> debug_rays;
131 };
132 
133 class BasicSolver : public Solver
134 {
135 
136 public:
139  virtual bool postTreatmentScene(Scene* scene, std::vector<Source>& sources,
140  std::vector<Recepteur>& recepteurs);
141 
142  // virtual double leafTreatment(KdTree *kdtree, BVH* bvh, Ray *r, vector<struct Isect> &primitives);
143 
144  virtual bool valideIntersection(Ray* r, Intersection* inter);
145 
146  virtual bool valideRayon(Ray* r);
147 
148  virtual bool invalidRayon(Ray* r);
149 
150  // * \fn vector<Ray*>* getValidRays()
151  // * \brief Return the list of valid rays
152  // * \return Pointer to the vector containing the rays validated by the solver
153  // */
154  // vector<Ray*>* getValidRays(){ return &valid_rays;}
155 
156  virtual void finish();
157 
158  // virtual void clean();
159 
161 
162 protected:
165 
166 #ifdef _ALLOW_TARGETING_
167 protected:
168  TargetManager targetManager;
169 #endif //_ALLOW_TARGETING_
170 };
171 
172 #endif // SOLVER_H
BasicSolver()
Definition: Solver.h:137
SelectorManager< Ray > selectorManagerIntersection
Definition: Solver.h:163
virtual void finish()
End the operations.
Definition: Solver.cpp:188
bool _useFresnelArea
Flag to use Fresnel weighting.
Definition: Solver.h:160
virtual bool invalidRayon(Ray *r)
Method to arrange the invalid rays. The invalid rays are put away into a debug_ray array in order to ...
Definition: Solver.cpp:173
virtual bool valideIntersection(Ray *r, Intersection *inter)
Validation function for an intersection. If the intersection is validated, an event is created and ad...
Definition: Solver.cpp:125
virtual bool valideRayon(Ray *r)
Ray validation. The developer may, for instance, choose a filtering on the rays and only validate sin...
Definition: Solver.cpp:159
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:82
~BasicSolver()
Definition: Solver.h:138
SelectorManager< Ray > selectorManagerValidation
Definition: Solver.h:164
: 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
This class mainly define a mesh (list of Shape) used by the Simulation object.
Definition: Scene.h:51
The Solver class gives an interface to the developer to add easily a new acoustic method using ray tr...
Definition: Solver.h:45
virtual bool valideRayon(Ray *r)
Ray validation. The developer may, for instance, choose a filtering on the rays and only validate sin...
Definition: Solver.cpp:48
deque< Ray * > valid_rays
Rays list which are validated by the solver.
Definition: Solver.h:129
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:32
virtual bool valideIntersection(Ray *r, Intersection *inter)
Validation function for an intersection. If the intersection is validated, an event is created and ad...
Definition: Solver.cpp:43
deque< Ray * > debug_rays
Rays list which are invalidated by the solver.
Definition: Solver.h:130
Solver()
Default constructor.
Definition: Solver.h:48
virtual bool loadParameters()
Load the computation parameters.
Definition: Solver.cpp:77
Solver(Solver *_solver)
Copy constructor.
Definition: Solver.h:51
deque< Ray * > * getDebugRays()
Return a pointer to the invalidated rays list.
Definition: Solver.h:111
virtual double leafTreatment(vector< Intersection > &primitives)
Leaf treatment function for accelerators. The default is to keep only the first intersection....
Definition: Solver.cpp:38
virtual bool invalidRayon(Ray *r)
Method to arrange the invalid rays. The invalid rays are put away into a debug_ray array in order to ...
Definition: Solver.cpp:70
virtual void finish()
End the operations.
Definition: Solver.cpp:65
virtual deque< Ray * > * getValidRays()
Return a pointer to the validated rays list.
Definition: Solver.h:104
virtual void clean()
Delete the valid rays array.
Definition: Solver.cpp:54
Class to manage targets.
Definition: TargetManager.h:27
Intersection struct.
Definition: Shape.h:46