Code_TYMPAN  4.4.0
Industrial site acoustic simulation
acoustic_problem_model.hpp
Go to the documentation of this file.
1 
10 #ifndef TYMPAN__ACOUSTIC_PROBLEM_MODEL_H__INCLUDED
11 #define TYMPAN__ACOUSTIC_PROBLEM_MODEL_H__INCLUDED
12 
13 #include <string>
14 #include <memory>
15 
16 #include "data_model_common.hpp"
17 #include "entities.hpp"
18 
19 namespace tympan
20 {
33 std::deque<triangle_idx> scene_volume_intersection(const triangle_pool_t& triangles,
34  const nodes_pool_t& nodes, float l, float h,
35  OPoint3D source, OPoint3D receptor); // L
40 {
41 public:
43  virtual ~AcousticProblemModel(){};
44 
50  node_idx make_node(const Point& point);
52  node_idx make_node(double x, double y, double z)
53  {
54  return make_node(Point(x, y, z));
55  }
56 
58 
59  size_t npoints() const // TODO move to implementation file
60  {
61  return all_nodes.size();
62  }
63 
64  size_t ntriangles() const // TODO move to implementation file
65  {
66  return all_triangles.size();
67  }
68 
69  size_t nsources() const // TODO move to implementation file
70  {
71  return all_sources.size();
72  }
73 
74  size_t nreceptors() const // TODO move to implementation file
75  {
76  return all_receptors.size();
77  }
78 
80  {
81  return all_triangles.at(tri_idx);
82  }
83 
84  const AcousticTriangle& triangle(triangle_idx tri_idx) const
85  {
86  return all_triangles.at(tri_idx);
87  }
88 
90  {
91  return all_nodes.at(idx);
92  }
93 
94  const Point& node(node_idx idx) const
95  {
96  return all_nodes.at(idx);
97  }
98 
100  {
101  return all_sources.at(idx);
102  }
103 
104  const AcousticSource& source(source_idx idx) const
105  {
106  return all_sources.at(idx);
107  }
108 
110  {
111  return all_receptors.at(idx);
112  }
113 
115  {
116  return all_receptors.at(idx);
117  }
118 
119  size_t nmaterials() const // TODO move to implementation file
120  {
121  return all_materials.size();
122  }
123 
124  const AcousticMaterialBase& material(size_t mat_idx) const
125  {
126  return *all_materials.at(mat_idx);
127  }
128 
130  {
131  return *all_materials.at(mat_idx);
132  }
133 
144  material_ptr_t make_material(const string& name, double resistivity, double deviation, double length,
145  double factor_g);
146 
153  material_ptr_t make_material(const string& name, const ComplexSpectrum& spectrum);
154 
162  source_idx make_source(const Point& point_, const Spectrum& spectrum_,
163  SourceDirectivityInterface* directivity);
164 
168  receptor_idx make_receptor(const Point& position_);
169 
170  const nodes_pool_t& nodes() const
171  {
172  return all_nodes;
173  }
174  const triangle_pool_t& triangles() const
175  {
176  return all_triangles;
177  }
178  const material_pool_t& materials() const
179  {
180  return all_materials;
181  }
182  const source_pool_t& sources() const
183  {
184  return all_sources;
185  }
186  const receptor_pool_t& receptors() const
187  {
188  return all_receptors;
189  }
190 
191 public: // XXX Could / should be protected but this complicates testing
192  /*
193  // Comparison utilities
194  static bool equal_to (const node_idx & lhs, const node_idx & rhs)
195  { return *lhs == *rhs; };
196  static bool equal_to (const Point& point, const node_idx & pnode)
197  { return point == *pnode; }
198  static bool equal_to (const node_idx & pnode, const Point& point)
199  { return equal_to(point, pnode); };
200 
201  static bool less_than (const node_idx & lhs, const node_idx & rhs);
202  static bool less_than (const Point& lhs, const Point& rhs);
203  */
204 
205 protected: // data members
211 }; // class AcousticProblemModel
212 
213 std::unique_ptr<AcousticProblemModel> make_AcousticProblemModel();
214 
215 } // namespace tympan
216 
217 #endif // TYMPAN__ACOUSTIC_PROBLEM_MODEL_H__INCLUDED
const char * name
The 3D point class.
Definition: 3d.h:487
Base class for material.
Definition: entities.hpp:22
Class to describe the acoustic problem.
source_pool_t all_sources
Array of all sources.
virtual ~AcousticProblemModel()
Constructor.
AcousticMaterialBase & material(size_t mat_idx)
Return a material by its id.
receptor_idx make_receptor(const Point &position_)
Push a new acoustic receptor into the model.
triangle_idx make_triangle(node_idx n1, node_idx n2, node_idx n3)
const source_pool_t & sources() const
Return array of sources.
AcousticReceptor & receptor(receptor_idx idx)
Return a receptor by its id.
node_idx make_node(const Point &point)
Destructor.
AcousticTriangle & triangle(triangle_idx tri_idx)
Return a triangle by its id.
const receptor_pool_t & receptors() const
Return array of receptors.
size_t ntriangles() const
Return the total number of triangles.
const Point & node(node_idx idx) const
Return a node by its id.
material_ptr_t make_material(const string &name, double resistivity, double deviation, double length, double factor_g)
Push a representation of a ground material into the model. If an instance of a ground material with s...
AcousticSource & source(source_idx idx)
Return a source by its id.
material_pool_t all_materials
Array of all materials.
nodes_pool_t all_nodes
Array of all nodes.
const AcousticSource & source(source_idx idx) const
Return a source by its id.
const material_pool_t & materials() const
Return array of materials.
receptor_pool_t all_receptors
Array of all receptors.
size_t npoints() const
Return the total number of nodes.
node_idx make_node(double x, double y, double z)
Call make_node(Point) with a point given by its coordinates.
const AcousticReceptor & receptor(receptor_idx idx) const
Return a receptor by its id.
size_t nsources() const
Return the total number of sources.
const AcousticTriangle & triangle(triangle_idx tri_idx) const
Return a triangle by its id.
const AcousticMaterialBase & material(size_t mat_idx) const
Return a material by its id.
size_t nreceptors() const
Return the total number of receptors.
const nodes_pool_t & nodes() const
Return array of nodes.
Point & node(node_idx idx)
Return a node by its id.
triangle_pool_t all_triangles
Array of all triangles.
source_idx make_source(const Point &point_, const Spectrum &spectrum_, SourceDirectivityInterface *directivity)
Push a new acoustic source into the model.
size_t nmaterials() const
Return the total number of materials.
const triangle_pool_t & triangles() const
Return array of triangles.
Describes an acoustic receptor.
Definition: entities.hpp:388
Describes an acoustic source.
Definition: entities.hpp:366
Describing a triangle.
Definition: entities.hpp:189
Interface for source directivity classes (SphericalSourceDirectivity, CommonFaceDirectivity,...
Definition: entities.hpp:208
Common utilities and includes for all data models.
This file provides the declaration of the entities of the model, which inherit from BaseEntity.
std::deque< AcousticSource > source_pool_t
Array of sources.
Definition: entities.hpp:380
size_t triangle_idx
Definition: entities.hpp:200
size_t source_idx
Definition: entities.hpp:381
std::deque< AcousticReceptor > receptor_pool_t
Array of receptors.
Definition: entities.hpp:397
OPoint3D Point
deque< triangle_idx > scene_volume_intersection(const triangle_pool_t &triangle_soup, const nodes_pool_t &nodes, float w, float h, OPoint3D source, OPoint3D receptor)
Find the intersection between some triangles (triangles, nodes) and a volume given by a width,...
std::deque< Point > nodes_pool_t
size_t receptor_idx
Definition: entities.hpp:398
std::unique_ptr< AcousticProblemModel > make_AcousticProblemModel()
std::deque< material_ptr_t > material_pool_t
Definition: entities.hpp:41
shared_ptr< AcousticMaterialBase > material_ptr_t
Definition: entities.hpp:40
std::deque< AcousticTriangle > triangle_pool_t
Array of AcousticTriangle.
Definition: entities.hpp:199
size_t node_idx