Code_TYMPAN  4.2.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,
35  float l, float h,
36  OPoint3D source, OPoint3D receptor); // L
41 {
42 public:
43 
45  virtual ~AcousticProblemModel() {};
46 
52  node_idx make_node(const Point& point);
54  node_idx make_node(double x, double y, double z)
55  {return make_node(Point(x, y, z)); }
56 
58 
59  size_t npoints() const //TODO move to implementation file
60  { return all_nodes.size(); }
61 
62  size_t ntriangles() const //TODO move to implementation file
63  { return all_triangles.size(); }
64 
65  size_t nsources() const //TODO move to implementation file
66  { return all_sources.size(); }
67 
68  size_t nreceptors() const //TODO move to implementation file
69  { return all_receptors.size(); }
70 
72  { return all_triangles.at(tri_idx); }
73 
74  const AcousticTriangle& triangle(triangle_idx tri_idx) const
75  { return all_triangles.at(tri_idx); }
76 
78  { return all_nodes.at(idx); }
79 
80  const Point& node(node_idx idx) const
81  { return all_nodes.at(idx); }
82 
84  { return all_sources.at(idx); }
85 
86  const AcousticSource& source(source_idx idx) const
87  { return all_sources.at(idx); }
88 
90  { return all_receptors.at(idx); }
91 
93  { return all_receptors.at(idx); }
94 
95 
96  size_t nmaterials() const //TODO move to implementation file
97  { return all_materials.size(); }
98 
99  const AcousticMaterialBase& material(size_t mat_idx) const
100  { return *all_materials.at(mat_idx); }
101 
103  { return *all_materials.at(mat_idx); }
104 
113  material_ptr_t make_material(const string& name, double resistivity, double deviation, double length);
114 
121  material_ptr_t make_material(const string& name, const ComplexSpectrum& spectrum);
122 
131  const Point& point_,
132  const Spectrum& spectrum_,
133  SourceDirectivityInterface* directivity);
134 
139  const Point& position_);
140 
141 
142  const nodes_pool_t& nodes() const { return all_nodes; }
143  const triangle_pool_t& triangles() const { return all_triangles; }
144  const material_pool_t& materials() const { return all_materials; }
145  const source_pool_t& sources() const { return all_sources; }
146  const receptor_pool_t& receptors() const { return all_receptors; }
147 
148 public: // XXX Could / should be protected but this complicates testing
149 
150  /*
151  // Comparison utilities
152  static bool equal_to (const node_idx & lhs, const node_idx & rhs)
153  { return *lhs == *rhs; };
154  static bool equal_to (const Point& point, const node_idx & pnode)
155  { return point == *pnode; }
156  static bool equal_to (const node_idx & pnode, const Point& point)
157  { return equal_to(point, pnode); };
158 
159  static bool less_than (const node_idx & lhs, const node_idx & rhs);
160  static bool less_than (const Point& lhs, const Point& rhs);
161  */
162 
163 protected: // data members
164 
170 }; // class AcousticProblemModel
171 
172  std::unique_ptr<AcousticProblemModel> make_AcousticProblemModel();
173 
174 } // namespace tympan
175 
176 
177 
178 
179 #endif // TYMPAN__ACOUSTIC_PROBLEM_MODEL_H__INCLUDED
This file provides the declaration of the entities of the model, which inherit from BaseEntity...
const AcousticReceptor & receptor(receptor_idx idx) const
Return a receptor by its id.
const Point & node(node_idx idx) const
Return a node by its id.
std::deque< material_ptr_t > material_pool_t
Definition: entities.hpp:36
size_t nreceptors() const
Return the total number of receptors.
source_pool_t all_sources
Array of all sources.
shared_ptr< AcousticMaterialBase > material_ptr_t
Definition: entities.hpp:35
size_t node_idx
const char * name
size_t source_idx
Definition: entities.hpp:335
const material_pool_t & materials() const
Return array of materials.
node_idx make_node(const Point &point)
Destructor.
receptor_idx make_receptor(const Point &position_)
Push a new acoustic receptor into the model.
node_idx make_node(double x, double y, double z)
Call make_node(Point) with a point given by its coordinates.
triangle_idx make_triangle(node_idx n1, node_idx n2, node_idx n3)
triangle_pool_t all_triangles
Array of all triangles.
std::unique_ptr< AcousticProblemModel > make_AcousticProblemModel()
AcousticMaterialBase & material(size_t mat_idx)
Return a material by its id.
const receptor_pool_t & receptors() const
Return array of receptors.
Describing a triangle.
Definition: entities.hpp:144
AcousticTriangle & triangle(triangle_idx tri_idx)
Return a triangle by its id.
size_t receptor_idx
Definition: entities.hpp:353
OPoint3D Point
size_t nmaterials() const
Return the total number of materials.
const triangle_pool_t & triangles() const
Return array of triangles.
size_t ntriangles() const
Return the total number of triangles.
source_idx make_source(const Point &point_, const Spectrum &spectrum_, SourceDirectivityInterface *directivity)
Push a new acoustic source into the model.
AcousticSource & source(source_idx idx)
Return a source by its id.
Point & node(node_idx idx)
Return a node by its id.
const AcousticSource & source(source_idx idx) const
Return a source by its id.
AcousticReceptor & receptor(receptor_idx idx)
Return a receptor by its id.
size_t triangle_idx
Definition: entities.hpp:157
nodes_pool_t all_nodes
Array of all nodes.
Common utilities and includes for all data models.
std::deque< AcousticTriangle > triangle_pool_t
Array of AcousticTriangle.
Definition: entities.hpp:156
const AcousticTriangle & triangle(triangle_idx tri_idx) const
Return a triangle by its id.
Class to describe the acoustic problem.
Describes an acoustic receptor.
Definition: entities.hpp:341
const nodes_pool_t & nodes() const
Return array of nodes.
std::deque< AcousticReceptor > receptor_pool_t
Array of receptors.
Definition: entities.hpp:352
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
Base class for material.
Definition: entities.hpp:22
size_t npoints() const
Return the total number of nodes.
size_t nsources() const
Return the total number of sources.
Describes an acoustic source.
Definition: entities.hpp:315
The 3D point class.
Definition: 3d.h:484
std::deque< AcousticSource > source_pool_t
Array of sources.
Definition: entities.hpp:334
material_pool_t all_materials
Array of all materials.
material_ptr_t make_material(const string &name, double resistivity, double deviation, double length)
Push a representation of a ground material into the model.
const source_pool_t & sources() const
Return array of sources.
Store acoustic power values for different frequencies.
Definition: spectre.h:49
virtual ~AcousticProblemModel()
Constructor.
const AcousticMaterialBase & material(size_t mat_idx) const
Return a material by its id.
receptor_pool_t all_receptors
Array of all receptors.
Interface for source directivity classes (SphericalSourceDirectivity, CommonFaceDirectivity, ...)
Definition: entities.hpp:164