121 using namespace internal;
127 const int ND =
static_cast<int>(pow(d1d,
DIM));
142 const bool CHANGE_BASIS = (
d2q !=
nullptr);
150 const real_t *b_orig =
nullptr;
151 const real_t *d2q_B =
nullptr;
152 const real_t *q2d_B =
nullptr;
153 const real_t *q2d_Bt =
nullptr;
169 static constexpr int NB = Q1D ? Q1D : 1;
177 DGMassBasis<DIM,D1D>(e, NE, q2d_Bt, b_orig, b2, d1d);
181 DGMassBasis<DIM,D1D>(e, NE, d2q_B,
u,
u, d1d);
185 const int tid = MFEM_THREAD_ID(x) + NB*MFEM_THREAD_ID(y);
190 DGMassApply<DIM,D1D,Q1D>(e, NE, B, Bt, pa_data,
u, r, d1d, q1d);
191 DGMassAxpy(e, NE, ND, 1.0,
b, -1.0, r, r);
196 const int BX = MFEM_THREAD_SIZE(x);
197 const int BY = MFEM_THREAD_SIZE(y);
198 const int bxy = BX*BY;
202 for (
int i = tid; i < ND; i += bxy)
210 DGMassPreconditioner(e, NE, ND, dinv, r, z);
211 DGMassAxpy(e, NE, ND, 1.0, z, 0.0, z, d);
213 real_t nom = DGMassDot<NB>(e, NE, ND, d, r);
214 if (nom < 0.0) {
return; }
215 real_t r0 = fmax(nom*RELTOL*RELTOL, ABSTOL*ABSTOL);
216 if (nom <= r0) {
return; }
218 DGMassApply<DIM,D1D,Q1D>(e, NE, B, Bt, pa_data, d, z, d1d, q1d);
219 real_t den = DGMassDot<NB>(e, NE, ND, z, d);
222 DGMassDot<NB>(e, NE, ND, d, d);
224 if (den == 0.0) {
return; }
232 DGMassAxpy(e, NE, ND, 1.0,
u,
alpha, d,
u);
233 DGMassAxpy(e, NE, ND, 1.0, r, -
alpha, z, r);
235 DGMassPreconditioner(e, NE, ND, dinv, r, z);
237 real_t betanom = DGMassDot<NB>(e, NE, ND, r, z);
238 if (betanom < 0.0) {
return; }
239 if (betanom <= r0) {
break; }
241 if (++i > MAXIT) {
break; }
244 DGMassAxpy(e, NE, ND, 1.0, z,
beta, d, d);
245 DGMassApply<DIM,D1D,Q1D>(e, NE, B, Bt, pa_data, d, z, d1d, q1d);
246 den = DGMassDot<NB>(e, NE, ND, d, z);
249 DGMassDot<NB>(e, NE, ND, d, d);
251 if (den == 0.0) {
break; }
258 DGMassBasis<DIM,D1D>(e, NE, q2d_B,
u,
u, d1d);