Neko-TOP
A portable framework for high-order spectral element flow toplogy optimization.
Loading...
Searching...
No Matches
Borrvall_Petersson_mapping_kernel.h
Go to the documentation of this file.
1
37#ifndef __NEKO_HIP_BORRVALL_PETERSSON_MAPPING_KERNELS__
38#define __NEKO_HIP_BORRVALL_PETERSSON_MAPPING_KERNELS__
39
43template <typename T>
45 const T f_min, const T f_max, const T q, T* __restrict__ X_out_d,
46 T* __restrict__ X_in_d, const int n) {
47
48 const int idx = blockIdx.x * blockDim.x + threadIdx.x;
49 const int str = blockDim.x * gridDim.x;
50
51 for (int i = idx; i < n; i += str) {
52 X_out_d[i] = f_min
53 + (f_max - f_min) * X_in_d[i] * (1.0 + q) / (X_in_d[i] + q);
54 }
55}
56
60template <typename T>
62 const T f_min, const T f_max, const T q, T* __restrict__ sens_out_d,
63 T* __restrict__ sens_in_d, T* __restrict__ X_in_d, const int n) {
64
65 const int idx = blockIdx.x * blockDim.x + threadIdx.x;
66 const int str = blockDim.x * gridDim.x;
67
68 for (int i = idx; i < n; i += str) {
69 sens_out_d[i] = (f_max - f_min) * q
70 * (q + 1.0) / ( (X_in_d[i] + q) * (X_in_d[i] + q)) * sens_in_d[i];
71 }
72}
73#endif // __NEKO_HIP_BORRVALL_PETERSSON_MAPPING_KERNELS__
__global__ void Borrvall_Petersson_mapping_apply_kernel(const T f_min, const T f_max, const T q, T *__restrict__ X_out_d, T *__restrict__ X_in_d, const int n)
__global__ void Borrvall_Petersson_mapping_apply_backward_kernel(const T f_min, const T f_max, const T q, T *__restrict__ sens_out_d, T *__restrict__ sens_in_d, T *__restrict__ X_in_d, const int n)