35#ifndef __BC_CONSTRAIN_MIXED_BC_KERNEL__
36#define __BC_CONSTRAIN_MIXED_BC_KERNEL__
40 const int * __restrict__ mixed_msk,
44 const int constraint_n,
45 const int constraint_t1,
46 const int constraint_t2,
47 const T * __restrict__ n,
48 const T * __restrict__ t1,
49 const T * __restrict__ t2,
52 const int idx = blockIdx.x * blockDim.x + threadIdx.x;
53 const int str = blockDim.x * gridDim.x;
55 for (
int i = idx;
i < m;
i += str) {
56 const int k = mixed_msk[
i];
57 const int off = 3 *
i;
63 T uloc_n = u1 * n[off] + u2 * n[off + 1] + u3 * n[off + 2];
64 T uloc_t1 = u1 * t1[off] + u2 * t1[off + 1] + u3 * t1[off + 2];
65 T uloc_t2 = u1 * t2[off] + u2 * t2[off + 1] + u3 * t2[off + 2];
67 if (constraint_n != 0)
69 if (constraint_t1 != 0)
71 if (constraint_t2 != 0)
74 x[k] = uloc_n * n[off] + uloc_t1 * t1[off] + uloc_t2 * t2[off];
75 y[k] = uloc_n * n[off + 1] + uloc_t1 * t1[off + 1] +
76 uloc_t2 * t2[off + 1];
77 z[k] = uloc_n * n[off + 2] + uloc_t1 * t1[off + 2] +
78 uloc_t2 * t2[off + 2];
84 const int * __restrict__ mixed_msk,
88 const int constraint_n,
89 const int constraint_t1,
90 const int constraint_t2,
91 const T * __restrict__ n,
92 const T * __restrict__ t1,
93 const T * __restrict__ t2,
94 const T * __restrict__ values_n,
95 const T * __restrict__ values_t1,
96 const T * __restrict__ values_t2,
99 const int idx = blockIdx.x * blockDim.x + threadIdx.x;
100 const int str = blockDim.x * gridDim.x;
102 for (
int i = idx;
i < m;
i += str) {
103 const int k = mixed_msk[
i];
104 const int off = 3 *
i;
110 T uloc_n = u1 * n[off] + u2 * n[off + 1] + u3 * n[off + 2];
111 T uloc_t1 = u1 * t1[off] + u2 * t1[off + 1] + u3 * t1[off + 2];
112 T uloc_t2 = u1 * t2[off] + u2 * t2[off + 1] + u3 * t2[off + 2];
114 T glb_1 = values_n[
i];
115 T glb_2 = values_t1[
i];
116 T glb_3 = values_t2[
i];
117 T glb_n = glb_1 * n[off] + glb_2 * n[off + 1] + glb_3 * n[off + 2];
118 T glb_t1 = glb_1 * t1[off] + glb_2 * t1[off + 1] + glb_3 * t1[off + 2];
119 T glb_t2 = glb_1 * t2[off] + glb_2 * t2[off + 1] + glb_3 * t2[off + 2];
121 if (constraint_n != 0)
123 if (constraint_t1 != 0)
125 if (constraint_t2 != 0)
128 x[k] = uloc_n * n[off] + uloc_t1 * t1[off] + uloc_t2 * t2[off];
129 y[k] = uloc_n * n[off + 1] + uloc_t1 * t1[off + 1] +
130 uloc_t2 * t2[off + 1];
131 z[k] = uloc_n * n[off + 2] + uloc_t1 * t1[off + 2] +
132 uloc_t2 * t2[off + 2];
136template<
typename T >
138 const int * __restrict__ mixed_msk,
142 const int constraint_n,
143 const int constraint_t1,
144 const int constraint_t2,
145 const T * __restrict__ n,
146 const T * __restrict__ t1,
147 const T * __restrict__ t2,
153 const int idx = blockIdx.x * blockDim.x + threadIdx.x;
154 const int str = blockDim.x * gridDim.x;
156 for (
int i = idx;
i < m;
i += str) {
157 const int k = mixed_msk[
i];
158 const int off = 3 *
i;
164 T uloc_n = u1 * n[off] + u2 * n[off + 1] + u3 * n[off + 2];
165 T uloc_t1 = u1 * t1[off] + u2 * t1[off + 1] + u3 * t1[off + 2];
166 T uloc_t2 = u1 * t2[off] + u2 * t2[off + 1] + u3 * t2[off + 2];
168 T glb_n = value_n * n[off] + value_t1 * n[off + 1] +
169 value_t2 * n[off + 2];
170 T glb_t1 = value_n * t1[off] + value_t1 * t1[off + 1] +
171 value_t2 * t1[off + 2];
172 T glb_t2 = value_n * t2[off] + value_t1 * t2[off + 1] +
173 value_t2 * t2[off + 2];
175 if (constraint_n != 0)
177 if (constraint_t1 != 0)
179 if (constraint_t2 != 0)
182 x[k] = uloc_n * n[off] + uloc_t1 * t1[off] + uloc_t2 * t2[off];
183 y[k] = uloc_n * n[off + 1] + uloc_t1 * t1[off + 1] +
184 uloc_t2 * t2[off + 1];
185 z[k] = uloc_n * n[off + 2] + uloc_t1 * t1[off + 2] +
186 uloc_t2 * t2[off + 2];
__global__ void const T *__restrict__ x
__global__ void constrain_mixed_bc_zero_kernel(const int *__restrict__ mixed_msk, T *__restrict__ x, T *__restrict__ y, T *__restrict__ z, const int constraint_n, const int constraint_t1, const int constraint_t2, const T *__restrict__ n, const T *__restrict__ t1, const T *__restrict__ t2, const int m)
__global__ void constrain_mixed_bc_set_kernel(const int *__restrict__ mixed_msk, T *__restrict__ x, T *__restrict__ y, T *__restrict__ z, const int constraint_n, const int constraint_t1, const int constraint_t2, const T *__restrict__ n, const T *__restrict__ t1, const T *__restrict__ t2, const T *__restrict__ values_n, const T *__restrict__ values_t1, const T *__restrict__ values_t2, const int m)
__global__ void constrain_mixed_bc_set_const_kernel(const int *__restrict__ mixed_msk, T *__restrict__ x, T *__restrict__ y, T *__restrict__ z, const int constraint_n, const int constraint_t1, const int constraint_t2, const T *__restrict__ n, const T *__restrict__ t1, const T *__restrict__ t2, const T value_n, const T value_t1, const T value_t2, const int m)