openPSTD  2.0
Open source simulation for sound propagation in urban environments
Speaker.h
1 // This file is part of openPSTD. //
3 // //
4 // openPSTD is free software: you can redistribute it and/or modify //
5 // it under the terms of the GNU General Public License as published by //
6 // the Free Software Foundation, either version 3 of the License, or //
7 // (at your option) any later version. //
8 // //
9 // openPSTD is distributed in the hope that it will be useful, //
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of //
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
12 // GNU General Public License for more details. //
13 // //
14 // You should have received a copy of the GNU General Public License //
15 // along with openPSTD. If not, see <http://www.gnu.org/licenses/>. //
16 // //
18 
20 //
21 // Date: 17-9-15
22 //
23 //
24 // Authors: Omar Richardson
25 //
26 //
27 // Purpose: This class models a speaker: the source of sound propagation
28 // in the domain.
29 //
30 //
32 #ifndef OPENPSTD_SPEAKER_H
33 #define OPENPSTD_SPEAKER_H
34 
35 #include "Domain.h"
36 #include <string>
37 #include <memory>
38 #include <vector>
39 #include <Eigen/Dense>
40 #include <math.h>
41 
42 namespace OpenPSTD {
43  namespace Kernel {
51  class Speaker {
52 
53  public:
54  const float x;
55  const float y;
56  const float z;
57  std::vector<float> location;
58  Point grid_point = Point((int) x, (int) y, (int) z);
59  std::vector<float> grid_offset;
60 
65  Speaker(std::vector<float> location);
66 
75  void addDomainContribution(std::shared_ptr<Domain> domain);
76 
77  };
78  }
79 }
80 
81 #endif //OPENPSTD_SPEAKER_H
This is the general namespace of the OpenPSTD application.
Definition: Boundary.cpp:33
The points of the grid, represented by 2D integer vectors.
Definition: Geometry.h:43
void addDomainContribution(std::shared_ptr< Domain > domain)
Adds the initial sound pressure to the domain values.
Definition: Speaker.cpp:21
Locations and amplitude of initial sound pressure.
Definition: Speaker.h:51
Speaker(std::vector< float > location)
Speaker initialization with coordinates from scene.
Definition: Speaker.cpp:13