35 #ifndef __BC_FACET_NORMAL_KERNEL__
36 #define __BC_FACET_NORMAL_KERNEL__
43 #define coef_normal_area_idx(i, j, k, l, lx, nf) \
44 (((i) + (lx) * (((j) - 1) + (lx) * (((k) - 1) + (nf) * (((l) - 1))))) - 1)
52 const int idx2 = idx -1;
53 index[3] = idx2/(lx * lx * lx) ;
54 index[2] = (idx2 - (lx*lx*lx)*index[3])/(lx * lx);
55 index[1] = (idx2 - (lx*lx*lx)*index[3] - (lx*lx) * index[2]) / lx;
56 index[0] = (idx2 - (lx*lx*lx)*index[3] - (lx*lx) * index[2]) - lx*index[1];
67 template<
typename T >
70 const int * __restrict__ facet,
74 const T * __restrict__
u,
75 const T * __restrict__
v,
76 const T * __restrict__
w,
77 const T * __restrict__ nx,
78 const T * __restrict__ ny,
79 const T * __restrict__ nz,
80 const T * __restrict__ area,
84 const int idx = blockIdx.x * blockDim.x + threadIdx.x;
85 const int str = blockDim.x * gridDim.x;
87 for (
int i = (idx + 1);
i < m;
i += str) {
88 const int k = (msk[
i] - 1);
89 const int f = (facet[
i]);
99 x[k] =
u[k] * nx[na_idx] * area[na_idx];
100 y[k] =
v[k] * ny[na_idx] * area[na_idx];
101 z[k] =
w[k] * nz[na_idx] * area[na_idx];
109 x[k] =
u[k] * nx[na_idx] * area[na_idx];
110 y[k] =
v[k] * ny[na_idx] * area[na_idx];
111 z[k] =
w[k] * nz[na_idx] * area[na_idx];
119 x[k] =
u[k] * nx[na_idx] * area[na_idx];
120 y[k] =
v[k] * ny[na_idx] * area[na_idx];
121 z[k] =
w[k] * nz[na_idx] * area[na_idx];
__global__ void T *__restrict__ T *__restrict__ const T *__restrict__ const T *__restrict__ const T *__restrict__ w
__global__ void T *__restrict__ T *__restrict__ const T *__restrict__ u
__global__ void T *__restrict__ T *__restrict__ const T *__restrict__ const T *__restrict__ v
__global__ void const T *__restrict__ x
__device__ void nonlinear_index(const int idx, const int lx, int *index)
__global__ void facet_normal_apply_surfvec_kernel(const int *__restrict__ msk, const int *__restrict__ facet, T *__restrict__ x, T *__restrict__ y, T *__restrict__ z, const T *__restrict__ u, const T *__restrict__ v, const T *__restrict__ w, const T *__restrict__ nx, const T *__restrict__ ny, const T *__restrict__ nz, const T *__restrict__ area, const int lx, const int m)
#define coef_normal_area_idx(i, j, k, l, lx, nf)