openPSTD  2.0
Open source simulation for sound propagation in urban environments
Solver.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:
22 // 2-11-15
23 //
24 // Authors:
25 // Louis van Harten, Omar Richardson
26 //
27 // Purpose:
28 // The openPSTD solver. Subclasses should implement the various
29 // solvers present in OpenPSTD v1.1
30 //
32 
33 #ifndef OPENPSTD_SOLVER_H
34 #define OPENPSTD_SOLVER_H
35 
36 #include "KernelInterface.h"
37 #include "core/Scene.h"
38 #include "PSTDKernel.h"
39 
40 namespace OpenPSTD {
41  namespace Kernel {
42 
51  class Solver {
52  private:
54  std::shared_ptr<PSTDSettings> settings;
56  std::shared_ptr<Scene> scene;
57 
58  protected:
59  KernelCallback *callback;
64 
70  void update_field_values(std::shared_ptr<Domain> domain, unsigned long rk_step);
71 
76  PSTD_FRAME_PTR get_pressure_vector();
77 
78  public:
85  Solver(std::shared_ptr<Scene> scene, KernelCallback *callback);
86 
92  void compute_propagation();
93  };
94 
98  class SingleThreadSolver : public Solver {
99  public:
104  SingleThreadSolver(std::shared_ptr<Scene> scene, KernelCallback *callback);
105  };
106 
110  class MultiThreadSolver : public Solver {
111  public:
116  MultiThreadSolver(std::shared_ptr<Scene> scene, KernelCallback *callback);
117  };
118 
122  class GPUSingleThreadSolver : public Solver {
123  public:
128  GPUSingleThreadSolver(std::shared_ptr<Scene> scene, KernelCallback *callback);
129  };
130 
134  class GPUMultiThreadSolver : public Solver {
135  public:
140  GPUMultiThreadSolver(std::shared_ptr<Scene> scene, KernelCallback *callback);
141  };
142  }
143 }
144 
145 #endif //OPENPSTD_SOLVER_H
This is the general namespace of the OpenPSTD application.
Definition: Boundary.cpp:33
PSTD_FRAME_PTR get_pressure_vector()
The GUI format for pressure fields.
Definition: Solver.cpp:121
Solver that performs the computational intensive parts on a GPU.
Definition: Solver.h:122
Solver that exploits the multiple CPU cores of a machine.
Definition: Solver.h:110
Solver that both utilized multiple cores and the GPU.
Definition: Solver.h:134
int number_of_time_steps
The final number of computed frames.
Definition: Solver.h:63
Solver(std::shared_ptr< Scene > scene, KernelCallback *callback)
Solver constructor (abstract).
Definition: Solver.cpp:33
Component that computes the state variables of the scene for consecutive time steps.
Definition: Solver.h:51
void update_field_values(std::shared_ptr< Domain > domain, unsigned long rk_step)
Updates the pressure and velocity fields of the domains to the new values computed in the RK scheme...
Definition: Solver.cpp:104
void compute_propagation()
Start the simulation solver.
Definition: Solver.cpp:63
Callback interface for communication with the CLI or the GUI.
Definition: KernelInterface.h:212
Default singlethreaded solver.
Definition: Solver.h:98