34 #ifndef OPENPSTD_KERNEL_FUNCTIONS_H 35 #define OPENPSTD_KERNEL_FUNCTIONS_H 37 #include <Eigen/Dense> 45 #include "../KernelInterface.h" 55 std::vector<T>
arange(T start, T stop, T step = 1) {
57 for (T i = start; i < stop; i += step)
86 LEFT, RIGHT, TOP, BOTTOM
92 const std::vector<Direction>
all_directions = {Direction::LEFT, Direction::RIGHT, Direction::TOP,
95 const std::vector<CalcDirection> all_calc_directions = {CalcDirection::X, CalcDirection::Y};
96 const std::vector<CalculationType> all_calculation_types = {CalculationType::PRESSURE,
97 CalculationType::VELOCITY};
102 const std::vector<float>
rk_coefficients = {8.91421261e-4f, 7555704391e-3f, 4.0919732041e-2f,
103 1.65919771368e-1f, 5e-1, 1.f};
132 Eigen::ArrayXXf pressure;
133 Eigen::ArrayXXf velocity;
156 Eigen::ArrayXXf
spatderp3(Eigen::ArrayXXf p1, Eigen::ArrayXXf p2,
157 Eigen::ArrayXXf p3, Eigen::ArrayXcf derfact,
158 RhoArray rho_array, Eigen::ArrayXf window,
int wlen,
165 Eigen::ArrayXXf
spatderp3(Eigen::ArrayXXf p1, Eigen::ArrayXXf p2,
166 Eigen::ArrayXXf p3, Eigen::ArrayXcf derfact,
167 RhoArray rho_array, Eigen::ArrayXf window,
int wlen,
169 fftwf_plan plan, fftwf_plan plan_inv);
215 void debug(std::string msg);
219 #endif //OPENPSTD_KERNEL_FUNCTIONS_H This is the general namespace of the OpenPSTD application.
Definition: Boundary.cpp:33
A collection of parameters and settings for the simulation.
Definition: KernelInterface.h:44
std::vector< T > arange(T start, T stop, T step=1)
Helper function equivalent to numpy.arange()
Definition: kernel_functions.h:55
CalcDirection
Helper enums - used to distinguish horizontal boundaries from vertical boundaries.
Definition: kernel_functions.h:71
Eigen::ArrayXf get_window_coefficients(int window_size, int patch_error)
Gives a two-sided array of window coefficients for a given window size and patch error.
Definition: kernel_functions.cpp:280
Struct with arrays containing the reflection and transmission coefficients of the pressure and the ve...
Definition: kernel_functions.h:131
const float EPSILON
Small positive number to facilitate division and other numerical computations.
Definition: kernel_functions.h:65
CalcDirection get_orthogonal(CalcDirection direction)
Get the direction orthogonal to the provided calculation direction.
Definition: kernel_functions.cpp:95
RhoArray get_rho_array(const float rho1, const float rho_self, const float rho2)
Computes and return reflection and transmission matrices for pressure and velocity based on density o...
Definition: kernel_functions.cpp:34
int next_2_power(float n)
Computes the smallest power of 2 larger or equal to n if n positive, and 1 otherwise.
Definition: kernel_functions.cpp:58
const std::vector< Direction > all_directions
Convenience vectors.
Definition: kernel_functions.h:92
bool is_approx(float a, float b)
Perform a numerical check whether a approximately equals b.
Definition: kernel_functions.cpp:294
CalcDirection direction_to_calc_direction(Direction direction)
Obtain corresponding Calculation Direction Axis from direction.
Definition: kernel_functions.cpp:104
Direction get_opposite(Direction direction)
Return the opposite direction of the provided direction.
Definition: kernel_functions.cpp:82
Direction
Enum representing directions among domains.
Definition: kernel_functions.h:85
const std::vector< float > rk_coefficients
Coefficients for a six stage RK time integration.
Definition: kernel_functions.h:102
float get_grid_spacing(PSTDSettings cnf)
Computes the largest grid spacing possible based on the speed of the medium and the maximum frequency...
Definition: kernel_functions.cpp:66
CalculationType
Helper enums - used to distinguish pressure computations from velocity computations.
Definition: kernel_functions.h:78
Eigen::ArrayXXf spatderp3(Eigen::ArrayXXf p1, Eigen::ArrayXXf p2, Eigen::ArrayXXf p3, Eigen::ArrayXcf derfact, RhoArray rho_array, Eigen::ArrayXf window, int wlen, CalculationType ct, CalcDirection direct, fftwf_plan plan, fftwf_plan plan_inv)
Version of spatderp3 that takes cached plans as input.
Definition: kernel_functions.cpp:115