15 #include "../quadinterpolator.hpp" 16 #include "../../general/forall.hpp" 17 #include "../../linalg/dtensor.hpp" 18 #include "../../linalg/kernels.hpp" 19 #include "../kernels.hpp" 27 namespace quadrature_interpolator
30 template<QVectorLayout Q_LAYOUT>
31 static void Values1D(
const int NE,
39 const auto b =
Reshape(b_, q1d, d1d);
40 const auto x =
Reshape(x_, d1d, vdim, NE);
47 for (
int c = 0; c < vdim; c++)
49 for (
int q = 0; q < q1d; q++)
52 for (
int d = 0; d < d1d; d++)
54 u +=
b(q, d) * x(d, c, e);
65 int T_VDIM = 0,
int T_D1D = 0,
int T_Q1D = 0,
67 static void Values2D(
const int NE,
75 static constexpr
int NBZ = T_NBZ ? T_NBZ : 1;
77 const int D1D = T_D1D ? T_D1D : d1d;
78 const int Q1D = T_Q1D ? T_Q1D : q1d;
79 const int VDIM = T_VDIM ? T_VDIM : vdim;
81 const auto b =
Reshape(b_, Q1D, D1D);
82 const auto x =
Reshape(x_, D1D, D1D, VDIM, NE);
84 Reshape(y_, Q1D, Q1D, VDIM, NE):
85 Reshape(y_, VDIM, Q1D, Q1D, NE);
87 MFEM_FORALL_2D(e, NE, Q1D, Q1D, NBZ,
89 const int D1D = T_D1D ? T_D1D : d1d;
90 const int Q1D = T_Q1D ? T_Q1D : q1d;
91 const int VDIM = T_VDIM ? T_VDIM : vdim;
92 constexpr
int MQ1 = T_Q1D ? T_Q1D :
MAX_Q1D;
93 constexpr
int MD1 = T_D1D ? T_D1D :
MAX_D1D;
94 constexpr
int MDQ = (MQ1 > MD1) ? MQ1 : MD1;
95 const int tidz = MFEM_THREAD_ID(z);
97 MFEM_SHARED
double sB[MQ1*MD1];
98 MFEM_SHARED
double sm0[NBZ][MDQ*MDQ];
99 MFEM_SHARED
double sm1[NBZ][MDQ*MDQ];
101 kernels::internal::LoadB<MD1,MQ1>(D1D,Q1D,
b,sB);
108 for (
int c = 0; c < VDIM; c++)
110 kernels::internal::LoadX(e,D1D,c,x,DD);
111 kernels::internal::EvalX(D1D,Q1D,B,DD,DQ);
112 kernels::internal::EvalY(D1D,Q1D,B,DQ,QQ);
113 MFEM_FOREACH_THREAD(qy,y,Q1D)
115 MFEM_FOREACH_THREAD(qx,x,Q1D)
117 double u = QQ(qx,qy);
129 int T_VDIM = 0,
int T_D1D = 0,
int T_Q1D = 0,
131 static void Values3D(
const int NE,
139 const int D1D = T_D1D ? T_D1D : d1d;
140 const int Q1D = T_Q1D ? T_Q1D : q1d;
141 const int VDIM = T_VDIM ? T_VDIM : vdim;
143 const auto b =
Reshape(b_, Q1D, D1D);
144 const auto x =
Reshape(x_, D1D, D1D, D1D, VDIM, NE);
146 Reshape(y_, Q1D, Q1D, Q1D, VDIM, NE):
147 Reshape(y_, VDIM, Q1D, Q1D, Q1D, NE);
149 MFEM_FORALL_3D(e, NE, Q1D, Q1D, Q1D,
151 const int D1D = T_D1D ? T_D1D : d1d;
152 const int Q1D = T_Q1D ? T_Q1D : q1d;
153 const int VDIM = T_VDIM ? T_VDIM : vdim;
154 constexpr
int MQ1 = T_Q1D ? T_Q1D :
MAX_Q1D;
155 constexpr
int MD1 = T_D1D ? T_D1D :
MAX_D1D;
156 constexpr
int MDQ = (MQ1 > MD1) ? MQ1 : MD1;
158 MFEM_SHARED
double sB[MQ1*MD1];
159 MFEM_SHARED
double sm0[MDQ*MDQ*MDQ];
160 MFEM_SHARED
double sm1[MDQ*MDQ*MDQ];
162 kernels::internal::LoadB<MD1,MQ1>(D1D,Q1D,
b,sB);
170 for (
int c = 0; c < VDIM; c++)
172 kernels::internal::LoadX(e,D1D,c,x,DDD);
173 kernels::internal::EvalX(D1D,Q1D,B,DDD,DDQ);
174 kernels::internal::EvalY(D1D,Q1D,B,DDQ,DQQ);
175 kernels::internal::EvalZ(D1D,Q1D,B,DQQ,QQQ);
176 MFEM_FOREACH_THREAD(qz,z,Q1D)
178 MFEM_FOREACH_THREAD(qy,y,Q1D)
180 MFEM_FOREACH_THREAD(qx,x,Q1D)
182 const double u = QQQ(qz,qy,qx);
DeviceTensor< 2, const double > ConstDeviceMatrix
DeviceTensor< 2, double > DeviceMatrix
DeviceTensor< 3, double > DeviceCube
QVectorLayout
Type describing possible layouts for Q-vectors.
NQPT x VDIM x NE (values) / NQPT x VDIM x DIM x NE (grads)
double u(const Vector &xvec)
MFEM_HOST_DEVICE DeviceTensor< sizeof...(Dims), T > Reshape(T *ptr, Dims... dims)
Wrap a pointer as a DeviceTensor with automatically deduced template parameters.
VDIM x NQPT x NE (values) / VDIM x DIM x NQPT x NE (grads)