17#ifdef MFEM_HAVE_GCC_PRAGMA_DIAGNOSTIC
18#pragma GCC diagnostic push
19#pragma GCC diagnostic ignored "-Wunused-function"
22#ifndef GSLIB_RELEASE_VERSION
23#define GSLIB_RELEASE_VERSION 10007
25#ifdef MFEM_HAVE_GCC_PRAGMA_DIAGNOSTIC
26#pragma GCC diagnostic pop
30#if GSLIB_RELEASE_VERSION >= 10009
31#define CODE_INTERNAL 0
33#define CODE_NOT_FOUND 2
35static MFEM_HOST_DEVICE
void lagrange_eval(
double *p0,
double x,
37 double *z,
double *lagrangeCoeff)
39 double p_i = (1 << (p_Nq - 1));
40 for (
int j = 0; j < p_Nq; ++j)
42 double d_j = x - z[j];
43 p_i *= j == i ? 1 : d_j;
45 p0[i] = lagrangeCoeff[i] * p_i;
48template<
int T_D1D = 0>
49static void InterpolateLocal3DKernel(
const double *
const gf_in,
52 double *
const int_out,
61 const int Nfields = ncomp;
62 const int MD1 = T_D1D ? T_D1D : DofQuadLimits::MAX_D1D;
63 const int D1D = T_D1D ? T_D1D : pN;
64 const int p_Np = D1D*D1D*D1D;
65 MFEM_VERIFY(MD1 <= DofQuadLimits::MAX_D1D,
66 "Increase Max allowable polynomial order.");
67 MFEM_VERIFY(D1D != 0,
"Polynomial order not specified.");
68#define MAXC(a, b) (((a) > (b)) ? (a) : (b))
69 const int nThreadsy = MAXC(D1D, 3);
72 MFEM_SHARED
double wtr[3*MD1];
73 MFEM_SHARED
double sums[MD1*MD1];
76 MFEM_FOREACH_THREAD(j,x,D1D)
78 MFEM_FOREACH_THREAD(k,y,3)
80 lagrange_eval(wtr + k*D1D, r[3*i+k], j, D1D, gll1D, lagcoeff);
85 for (
int fld = 0; fld < Nfields; ++fld)
90 const int elemOffset = el[i] * p_Np * Nfields + fld * p_Np;
91 MFEM_FOREACH_THREAD(j,x,D1D)
93 MFEM_FOREACH_THREAD(k,y,D1D)
95 sums[j + k*D1D] = 0.0;
96 for (
int l = 0; l < D1D; ++l)
98 sums[j + k*D1D] += gf_in[elemOffset + j + k*D1D + l*D1D*D1D] *
101 sums[j+k*D1D] *= wtr[D1D+k]*wtr[j];
106 MFEM_FOREACH_THREAD(j,x,1)
108 MFEM_FOREACH_THREAD(k,y,1)
111 for (
int jj = 0; jj < D1D*D1D; ++jj)
115 int_out[i + fld * npt] = sumv;
128 int nel,
int dof1Dsol)
130 if (npt == 0) {
return; }
131 const int gf_offset = field_in.
Size()/ncomp;
132 auto pfin = field_in.
Read();
135 auto pfout = field_out.
Write();
136 auto pgll =
DEV.gll1d_sol.ReadWrite();
137 auto plcf =
DEV.lagcoeff_sol.ReadWrite();
140 case 2:
return InterpolateLocal3DKernel<2>(pfin, pgsle, pgslr, pfout,
141 npt, ncomp, nel, gf_offset,
143 case 3:
return InterpolateLocal3DKernel<3>(pfin, pgsle, pgslr, pfout,
144 npt, ncomp, nel, gf_offset,
146 case 4:
return InterpolateLocal3DKernel<4>(pfin, pgsle, pgslr, pfout,
147 npt, ncomp, nel, gf_offset,
149 case 5:
return InterpolateLocal3DKernel<5>(pfin, pgsle, pgslr, pfout,
150 npt, ncomp, nel, gf_offset,
152 default:
return InterpolateLocal3DKernel(pfin, pgsle, pgslr, pfout,
153 npt, ncomp, nel, gf_offset,
154 pgll, plcf, dof1Dsol);
168 int nel,
int dof1Dsol) {};
T * ReadWrite(bool on_dev=true)
Shortcut for mfem::ReadWrite(a.GetMemory(), a.Size(), on_dev).
struct mfem::FindPointsGSLIB::@24 DEV
void InterpolateLocal3(const Vector &field_in, Array< int > &gsl_elem_dev_l, Vector &gsl_ref_l, Vector &field_out, int npt, int ncomp, int nel, int dof1dsol)
virtual const real_t * Read(bool on_dev=true) const
Shortcut for mfem::Read(vec.GetMemory(), vec.Size(), on_dev).
virtual real_t * ReadWrite(bool on_dev=true)
Shortcut for mfem::ReadWrite(vec.GetMemory(), vec.Size(), on_dev).
int Size() const
Returns the size of the vector.
virtual real_t * Write(bool on_dev=true)
Shortcut for mfem::Write(vec.GetMemory(), vec.Size(), on_dev).
void forall_2D(int N, int X, int Y, lambda &&body)