33 #ifndef OPENPSTD_KERNELDOMAIN_H 34 #define OPENPSTD_KERNELDOMAIN_H 36 #include <Eigen/Dense> 43 #include "kernel_functions.h" 45 #include "../KernelInterface.h" 47 #include "WisdomCache.h" 93 bool locally_reacting;
103 class Domain :
public std::enable_shared_from_this<Domain> {
138 std::shared_ptr<WisdomCache>
wnd;
145 std::vector<std::shared_ptr<Domain>> left;
146 std::vector<std::shared_ptr<Domain>> right;
147 std::vector<std::shared_ptr<Domain>> top;
148 std::vector<std::shared_ptr<Domain>> bottom;
149 int num_neighbour_domains;
150 int num_pml_neighbour_domains;
151 bool has_horizontal_attenuation, is_corner_domain;
152 std::vector<bool> needs_reversed_attenuation;
167 Domain(std::shared_ptr<PSTDSettings> settings,
int id,
const float alpha,
168 Point top_left,
Point size,
const bool is_pml,
169 std::shared_ptr<WisdomCache> wnd, std::map<Direction, EdgeParameters> edge_param_map,
170 const std::shared_ptr<Domain> pml_for_domain);
178 Domain(std::shared_ptr<PSTDSettings> settings,
int id,
const float alpha,
179 std::vector<float> top_left_vector, std::vector<float> size_vector,
const bool is_pml,
180 std::shared_ptr<WisdomCache> wnd, std::map<Direction, EdgeParameters> edge_param_map,
181 const std::shared_ptr<Domain> pml_for_domain);
192 void clear_matrices();
197 void compute_pml_matrices();
202 void apply_pml_matrices();
209 int number_of_neighbours(
bool count_pml);
216 bool contains_point(
Point point);
224 bool contains_location(std::vector<float> location);
231 std::vector<std::shared_ptr<Domain>> get_neighbours_at(
Direction direction);
239 std::shared_ptr<Domain> get_neighbour_at(
Direction direction, std::vector<float> location);
247 void add_neighbour_at(std::shared_ptr<Domain> domain,
Direction direction);
253 bool is_neighbour_of(std::shared_ptr<Domain> domain);
258 bool is_pml_for(std::shared_ptr<Domain> domain);
278 std::vector<int> get_intersection_with(std::shared_ptr<Domain> other_domain,
Direction direction);
301 void post_initialization();
308 Eigen::ArrayXXi get_vacant_range(
Direction direction);
317 Eigen::ArrayXXf extended_zeros(
int x,
int y,
int z = 0);
320 void initialize_domain(std::shared_ptr<PSTDSettings> settings,
int id,
const float alpha,
321 Point top_left,
Point size,
const bool is_pml,
322 std::shared_ptr<WisdomCache> wnd,
323 std::map<Direction, EdgeParameters> edge_param_map,
324 const std::shared_ptr<Domain> pml_for_domain);
328 void clear_pml_arrays();
330 void find_update_directions();
332 void compute_number_of_neighbours();
334 int get_num_pmls_in_direction(
Direction direction);
336 void create_attenuation_array(
CalcDirection calc_dir,
bool ascending, Eigen::ArrayXXf &pml_pressure,
337 Eigen::ArrayXXf &pml_velocity);
340 std::ostream &operator<<(std::ostream &str,
Domain const &v);
344 #endif //OPENPSTD_KERNELDOMAIN_H This is the general namespace of the OpenPSTD application.
Definition: Boundary.cpp:33
float impedance
Impedance of the boundary.
Definition: Domain.h:113
int id
Domain identifier. Does not necessarily correspond to the GUI and CLI ids; no need for that...
Definition: Domain.h:108
FieldValues current_values
Collection of state variables in this time step (not thread-safe)
Definition: Domain.h:132
Point top_left
Start of the domain (top left)
Definition: Domain.h:121
The arrays used for attenuating the pressure and velocities at the boundaries of the domain...
Definition: Domain.h:82
Point bottom_right
End of the domain (bottom right)
Definition: Domain.h:123
float rho
Density of the domain interior. Defaults to air.
Definition: Domain.h:115
bool is_pml
Whether the domain is a perfectly matched layer.
Definition: Domain.h:127
CalcDirection
Helper enums - used to distinguish horizontal boundaries from vertical boundaries.
Definition: kernel_functions.h:71
FieldLValues l_values
Derivative approximations of the state variables.
Definition: Domain.h:136
The observed state variables.
Definition: Domain.h:57
Point size
Domain size.
Definition: Domain.h:125
The points of the grid, represented by 2D integer vectors.
Definition: Geometry.h:43
std::map< CalcDirection, bool > should_update
Map with update directions.
Definition: Domain.h:119
bool local
Another parameter (PML-related)
Definition: Domain.h:130
float alpha
Some coefficient...
Definition: Domain.h:110
std::shared_ptr< WisdomCache > wnd
Pointer to WisdomCache object.
Definition: Domain.h:138
std::vector< std::shared_ptr< Domain > > pml_for_domain_list
List of domains that this domain functions for as a PML.
Definition: Domain.h:142
std::map< Direction, EdgeParameters > edge_param_map
Map with boundary coefficients.
Definition: Domain.h:117
std::shared_ptr< PSTDSettings > settings
Settings from the PSTDKernel.
Definition: Domain.h:106
The spatial derivatives of the pressure and velocity in x and y direction.
Definition: Domain.h:68
Direction
Enum representing directions among domains.
Definition: kernel_functions.h:85
bool is_secondary_pml
Whether the domain is a PML domain for other PML domains.
Definition: Domain.h:140
A representation of one rectangular scene unit.
Definition: Domain.h:103
The impedance parameter and locally reaction switch for a boundary.
Definition: Domain.h:92
FieldValues previous_values
Collection of state variables in previous time step (should be thread-safe)
Definition: Domain.h:134
CalculationType
Helper enums - used to distinguish pressure computations from velocity computations.
Definition: kernel_functions.h:78