50 istream::int_type next_char = input.peek();
56 if (buff ==
"NURBS_patches")
59 "NURBS_patches requires NURBS FE space");
64 MFEM_ABORT(
"unknown section: " << buff);
105 int g_nddofs = g_ndofs - (g_nvdofs + g_nedofs + g_nfdofs);
107 vi = ei = fi = di = 0;
108 for (
int i = 0; i < num_pieces; i++)
115 int l_nddofs = l_ndofs - (l_nvdofs + l_nedofs + l_nfdofs);
120 for (
int d = 0; d < vdim; d++)
122 memcpy(g_data+vi, l_data, l_nvdofs*
sizeof(
real_t));
125 memcpy(g_data+ei, l_data, l_nedofs*
sizeof(
real_t));
128 memcpy(g_data+fi, l_data, l_nfdofs*
sizeof(
real_t));
131 memcpy(g_data+di, l_data, l_nddofs*
sizeof(
real_t));
138 memcpy(g_data+vdim*vi, l_data, l_nvdofs*
sizeof(
real_t)*vdim);
139 l_data += vdim*l_nvdofs;
140 g_data += vdim*g_nvdofs;
141 memcpy(g_data+vdim*ei, l_data, l_nedofs*
sizeof(
real_t)*vdim);
142 l_data += vdim*l_nedofs;
143 g_data += vdim*g_nedofs;
144 memcpy(g_data+vdim*fi, l_data, l_nfdofs*
sizeof(
real_t)*vdim);
145 l_data += vdim*l_nfdofs;
146 g_data += vdim*g_nfdofs;
147 memcpy(g_data+vdim*di, l_data, l_nddofs*
sizeof(
real_t)*vdim);
148 l_data += vdim*l_nddofs;
149 g_data += vdim*g_nddofs;
193 old_data.
Swap(*
this);
196 T->
Mult(old_data, *
this);
209 const std::shared_ptr<const PRefinementTransferOperator> Tp =
214 old_data.
Swap(*
this);
215 MFEM_VERIFY(Tp->Width() == old_data.
Size(),
216 "Wrong size of PRefinementTransferOperator in UpdatePRef");
219 Tp->Mult(old_data, *
this);
223 MFEM_ABORT(
"Transfer operator undefined in GridFunction::UpdatePRef");
245 MFEM_ASSERT(v.
Size() >= v_offset +
f->GetVSize(),
"");
277 MFEM_ASSERT(tv.
Size() >= tv_offset +
f->GetTrueVSize(),
"");
296 int nfe = ufes->
GetNE();
305 for (
int i = 0; i < nfe; i++)
307 if (subdomain >= 0 && ufes->
GetAttribute(i) != subdomain)
315 u.GetSubVector(udofs, ul);
320 *ffes->
GetFE(i), fl, wcoef);
326 for (
int j = 0; j < fdofs.
Size(); j++)
342 for (
int i = 0; i < count.
Size(); i++)
344 if (count[i] != 0) { flux(i) /= count[i]; }
386 int dof = FElem->
GetDof();
399 for (
int k = 0; k < n; k++)
402 nval[k] = shape * (&loc_data[dof * vdim]);
408 for (
int k = 0; k < n; k++)
412 nval[k] = shape * (&loc_data[dof * vdim]);
420 for (
int k = 0; k < n; k++)
424 nval[k] = loc_data * (&vshape(0,vdim));
451 return (DofVal * LocVec);
458 int dof = FElem->
GetDof();
480 for (
int k = 0; k < vdim; k++)
482 val(k) = shape * (&loc_data[dof * k]);
507 int dof = FElem->
GetDof();
508 Vector DofVal(dof), loc_data(dof);
513 for (
int k = 0; k < n; k++)
516 vals(k) = DofVal * loc_data;
522 for (
int k = 0; k < n; k++)
526 vals(k) = DofVal * loc_data;
555 "invalid FE map type");
557 int dof = FElem->
GetDof();
558 Vector DofLap(dof), loc_data(dof);
560 for (
int k = 0; k < n; k++)
565 laps(k) = DofLap * loc_data;
598 "invalid FE map type");
600 int dof = FElem->
GetDof();
608 for (
int k = 0; k < n; k++)
614 for (
int j = 0; j <
size; j++)
616 for (
int d = 0; d < dof; d++)
618 hess(k,j) += DofHes(d,j) * loc_data[d];
698 int comp,
Vector *tr)
const
724 MFEM_ABORT(
"GridFunction::GetValue: Field continuity type \""
726 <<
"on mesh edges.");
739 MFEM_ABORT(
"GridFunction::GetValue: Field continuity type \""
741 <<
"on mesh faces.");
760 MFEM_ASSERT(FET !=
nullptr,
761 "FaceElementTransformation must be valid for a boundary element");
790 MFEM_ABORT(
"GridFunction::GetValue: Unsupported element type \""
808 return (DofVal * LocVec);
823 for (
int j = 0; j < nip; j++)
860 MFEM_ABORT(
"GridFunction::GetVectorValue: Field continuity type \""
862 <<
"on mesh edges.");
875 MFEM_ABORT(
"GridFunction::GetVectorValue: Field continuity type \""
877 <<
"on mesh faces.");
896 MFEM_ASSERT(FET !=
nullptr,
897 "FaceElementTransformation must be valid for a boundary element");
917 MFEM_ASSERT(FET !=
nullptr,
918 "FaceElementTransformation must be valid for a boundary element");
928 MFEM_ABORT(
"GridFunction::GetVectorValue: Unsupported element type \""
930 if (val.
Size() > 0) { val = NAN; }
952 for (
int k = 0; k < vdim; k++)
954 val(k) = shape * (&loc_data[dof * k]);
979 int dof = FElem->
GetDof();
995 for (
int j = 0; j < nip; j++)
1001 for (
int k = 0; k < vdim; k++)
1003 vals(k,j) = shape * (&loc_data[dof * k]);
1010 int vdim = std::max(spaceDim, FElem->
GetRangeDim());
1016 for (
int j = 0; j < nip; j++)
1057 MFEM_ASSERT(Transf !=
nullptr,
"FaceElementTransformation cannot be null!");
1064 MFEM_ASSERT(Transf !=
nullptr,
"FaceElementTransformation cannot be null!");
1078 Vector shape, loc_values, orig_loc_values;
1079 int i, j, d, ne, dof, odof, vdim;
1084 for (i = 0; i < ne; i++)
1093 odof = orig_fe->
GetDof();
1094 loc_values.
SetSize(dof * vdim);
1097 for (j = 0; j < dof; j++)
1101 for (d = 0; d < vdim; d++)
1103 loc_values(d*dof+j) = shape * (&orig_loc_values[d * odof]);
1117 Vector shape, loc_values, loc_values_t, orig_loc_values, orig_loc_values_t;
1118 int i, j, d, nbe, dof, odof, vdim;
1122 for (i = 0; i < nbe; i++)
1130 odof = orig_fe->
GetDof();
1131 loc_values.
SetSize(dof * vdim);
1134 for (j = 0; j < dof; j++)
1138 for (d = 0; d < vdim; d++)
1140 loc_values(d*dof+j) = shape * (&orig_loc_values[d * odof]);
1158 const int dof = fe->
GetDof();
1160 const int vdim = std::max(sdim, fe->
GetRangeDim());
1166 Vector loc_data, val(vdim);
1169 for (
int k = 0; k < n; k++)
1175 for (
int d = 0; d < vdim; d++)
1195 for (j = 0; j < ndofs; j++)
1196 for (i = 0; i < vdim; i++)
1198 temp[j+i*ndofs] =
data[k++];
1201 for (i = 0; i <
size; i++)
1229 val(vertices[k]) += vals(k, comp);
1230 overlap[vertices[k]]++;
1234 for (i = 0; i < overlap.
Size(); i++)
1236 val(i) /= overlap[i];
1251 for (
int i = 0; i < new_fes->
GetNE(); i++)
1257 const int dof = fe->
GetDof();
1258 for (
int d = 0; d < vals.
Width(); d++)
1260 for (
int k = 0; k < dof; k++)
1264 vec_field(ind) += s * vals(k, d);
1270 for (
int i = 0; i < overlap.
Size(); i++)
1272 vec_field(i) /= overlap[i];
1285 Vector pt_grad, loc_func;
1286 int i, j, k,
dim, dof, der_dof, ind;
1293 for (i = 0; i < der_fes->
GetNE(); i++)
1302 der_dof = der_fe->
GetDof();
1308 for (j = 0; j < dof; j++)
1309 loc_func(j) = ( (ind=vdofs[comp*dof+j]) >= 0 ) ?
1311 for (k = 0; k < der_dof; k++)
1319 for (j = 0; j <
dim; j++)
1321 a += inv_jac(j, der_comp) * pt_grad(j);
1323 der(der_dofs[k]) +=
a;
1324 zones_per_dof[der_dofs[k]]++;
1335 for (
int i = 0; i < overlap.
Size(); i++)
1337 der(i) /= overlap[i];
1354 MultAtB(loc_data_mat, dshape, gh);
1364 const int ND = fe.
GetDof();
1391 Vector f_e(vdim*ND*NE, my_d_mt);
1392 elem_restr->
Mult(*
this, f_e);
1413 "invalid FE map type");
1418 for (
int i = 0; i < Jinv.
Width(); i++)
1420 for (
int j = 0; j < Jinv.
Height(); j++)
1422 div_v += grad_hat(i, j) * Jinv(j, i);
1436 return (loc_data * divshape) / T.
Weight();
1478 MFEM_ABORT(
"GridFunction::GetDivergence: Unsupported element type \""
1497 "invalid FE map type");
1503 Mult(grad_hat, Jinv, grad);
1508 curl(0) = grad(2,1) - grad(1,2);
1509 curl(1) = grad(0,2) - grad(2,0);
1510 curl(2) = grad(1,0) - grad(0,1);
1512 else if (grad.
Height() == 2)
1515 curl(0) = grad(1,0) - grad(0,1);
1569 MFEM_ABORT(
"GridFunction::GetCurl: Unsupported element type \""
1583 "invalid FE map type");
1584 MFEM_ASSERT(
fes->
GetVDim() == 1,
"Defined for scalar functions.");
1634 MFEM_ABORT(
"GridFunction::GetGradient: Unsupported element type \""
1644 int elNo = tr.ElementNo;
1657 tr.SetIntPoint(&ip);
1677 Mult(grad_hat, Jinv, grad);
1716 MFEM_ABORT(
"GridFunction::GetVectorGradient: "
1717 "Unsupported element type \"" << T.
ElementType <<
"\"");
1727 Vector loc_avgs, loc_this;
1733 for (
int i = 0; i <
fes->
GetNE(); i++)
1742 loc_mass.
Mult(loc_this, loc_avgs);
1746 loc_mass.
Mult(loc_this, loc_avgs);
1749 for (
int i = 0; i < avgs.
Size(); i++)
1751 avgs(i) /= int_psi(i);
1770 if (!mesh->
GetNE()) {
return; }
1781 MFEM_VERIFY(vdim == src.
fes->
GetVDim(),
"incompatible vector dimensions!");
1787 for (
int i = 0; i < mesh->
GetNE(); i++)
1801 for (
int vd = 0; vd < vdim; vd++)
1823 MFEM_ASSERT(weights.
Size() ==
size,
"Different # of weights and dofs.");
1824 MFEM_ASSERT(lo_.
Size() ==
size,
"Different # of lower bounds and dofs.");
1825 MFEM_ASSERT(hi_.
Size() ==
size,
"Different # of upper bounds and dofs.");
1836 slbqp.
Mult(vals, new_vals);
1856 if (max_val <= min_)
1864 if (min_ <= min_val && max_val <= max_)
1870 minv = (min_ > min_val) ? min_ : min_val;
1871 maxv = (max_ < max_val) ? max_ : max_val;
1884 R->
Mult(*
this, tmp);
1885 P->
Mult(tmp, *
this);
1898 for (
int i = 0; i <
fes->
GetNE(); i++)
1902 for (
int j = 0; j < vertices.
Size(); j++)
1904 nval(vertices[j]) += values[j];
1905 overlap[vertices[j]]++;
1908 for (
int i = 0; i < overlap.
Size(); i++)
1910 nval(i) /= overlap[i];
1921 for (
int i = 0; i <
fes->
GetNE(); i++)
1925 for (
int j = 0; j < vdofs.
Size(); j++)
1927 elem_per_vdof[vdofs[j]]++;
1946 for (
int i = 0; i <
fes->
GetNE(); i++)
1954 for (
int j = 0; j < vdofs.
Size(); j++)
1958 MFEM_VERIFY(vals[j] != 0.0,
1959 "Coefficient has zeros, harmonic avg is undefined!");
1960 (*this)(vdofs[j]) += 1.0 / vals[j];
1964 (*this)(vdofs[j]) += vals[j];
1966 else { MFEM_ABORT(
"Not implemented"); }
1968 zones_per_vdof[vdofs[j]]++;
1987 for (
int i = 0; i <
fes->
GetNE(); i++)
1995 for (
int j = 0; j < vdofs.
Size(); j++)
2012 MFEM_VERIFY(vals[j] != 0.0,
2013 "Coefficient has zeros, harmonic avg is undefined!");
2014 (*this)(ldof) += isign / vals[j];
2018 (*this)(ldof) += isign*vals[j];
2021 else { MFEM_ABORT(
"Not implemented"); }
2023 zones_per_vdof[ldof]++;
2035 "vcoeff vdim != fes VDim");
2039 "Can only call ProjectBdrCoefficient on scalar value-type "
2040 "boundary elements. "
2041 "Did you intended to call ProjectBdrCoefficientNormal or "
2042 "ProjectBdrCoefficientTangent for vector finite elements?");
2058 const int fdof = fe->
GetDof();
2063 for (
int j = 0; j < fdof; j++)
2067 if (vcoeff) { vcoeff->
Eval(vc, *transf, ip); }
2068 for (
int d = 0; d < vdim; d++)
2070 if (!vcoeff && !coeff[d]) {
continue; }
2072 real_t val = vcoeff ? vc(d) : coeff[d]->
Eval(*transf, ip);
2073 int ind = vdofs[fdof*d+j];
2076 val = -val, ind = -1-ind;
2078 if (++values_counter[ind] == 1)
2084 (*this)(ind) += val;
2105 Array<int> bdr_edges, bdr_vertices, bdr_faces;
2113 for (
int d = 0; d < vdim; d++)
2115 if (!coeff[d]) {
continue; }
2117 fe.Project(*coeff[d], transf, vals);
2118 for (
int k = 0; k < vals.
Size(); k++)
2120 const int ind = vdofs[d*vals.
Size()+k];
2121 if (++values_counter[ind] == 1)
2123 (*this)(ind) = vals(k);
2127 (*this)(ind) += vals(k);
2134 vals.
SetSize(vdim*fe.GetDof());
2135 fe.Project(*vcoeff, transf, vals);
2136 for (
int k = 0; k < vals.
Size(); k++)
2138 const int ind = vdofs[k];
2139 if (++values_counter[ind] == 1)
2141 (*this)(ind) = vals(k);
2145 (*this)(ind) += vals(k);
2151 for (
auto edge : bdr_edges)
2154 if (vdofs.
Size() == 0) {
continue; }
2158 mark_dofs(*transf, *fe);
2161 for (
auto face : bdr_faces)
2164 if (vdofs.
Size() == 0) {
continue; }
2168 mark_dofs(*transf, *fe);
2176 for (
int i = 0; i < dofs.
Size(); i++)
2180 if (k < 0) { k = -1 - k; val = -val; }
2181 if (++values_counter[k] == 1)
2198 "vcoeff vdim != PhysRangeDim");
2220 fe->
Project(vcoeff, *T, lvec);
2222 accumulate_dofs(dofs, lvec, *
this, values_counter);
2230 Array<int> bdr_edges, bdr_vertices, bdr_faces;
2233 for (
auto edge : bdr_edges)
2236 if (dofs.
Size() == 0) {
continue; }
2241 fe->
Project(vcoeff, *T, lvec);
2242 accumulate_dofs(dofs, lvec, *
this, values_counter);
2245 for (
auto face : bdr_faces)
2248 if (dofs.
Size() == 0) {
continue; }
2253 fe->
Project(vcoeff, *T, lvec);
2254 accumulate_dofs(dofs, lvec, *
this, values_counter);
2266 "vcoeff vdim != fes VDim");
2271 "Can only call ProjectTraceCoefficient on scalar value-type "
2273 "Use ProjectTraceCoefficientNormal for RT and "
2274 "ProjectTraceCoefficientTangent for ND finite elements.");
2286 for (
int i = 0; i <
fes->
GetMesh()->GetNumFaces(); i++)
2290 const int fdof = fe->
GetDof();
2295 for (
int j = 0; j < fdof; j++)
2299 if (vcoeff) { vcoeff->
Eval(vc, *transf, ip); }
2300 for (
int d = 0; d < vdim; d++)
2302 if (!vcoeff && !coeff[d]) {
continue; }
2304 real_t val = vcoeff ? vc(d) : coeff[d]->
Eval(*transf, ip);
2305 int ind = vdofs[fdof*d+j];
2308 val = -val, ind = -1-ind;
2310 if (++values_counter[ind] == 1)
2316 (*this)(ind) += val;
2326 MFEM_VERIFY(
fes->
GetVDim() == 1,
"fespace VDim != 1");
2331 "Not an ND FE space!");
2334 "vcoeff vdim != PhysRangeDim");
2346 for (
int i = 0; i <
fes->
GetMesh()->GetNumFaces(); i++)
2352 fe->
Project(vcoeff, *T, lvec);
2353 accumulate_dofs(dofs, lvec, *
this, values_counter);
2364 for (
int i = 0; i <
size; i++)
2366 const int nz = zones_per_vdof[i];
2367 if (nz) { (*this)(i) /= nz; }
2372 for (
int i = 0; i <
size; i++)
2374 const int nz = zones_per_vdof[i];
2375 if (nz) { (*this)(i) = nz/(*
this)(i); }
2380 MFEM_ABORT(
"invalid AvgType");
2402 for (
int i = 0; i < mesh->
GetNV(); i++)
2406 if (dist < min_dist)
2416 if (min_dist >= delta_coeff.
Tol())
2425 Vector vals, loc_mass_vals;
2428 for (
int i = 0; i < mesh->
GetNE(); i++)
2431 for (
int j = 0; j < vertices.
Size(); j++)
2432 if (vertices[j] == v_idx)
2443 loc_mass.
Mult(vals, loc_mass_vals);
2444 integral += loc_mass_vals.
Sum();
2454 "Cannot project scalar Coefficient onto vector GridFunction");
2460 if (delta_c == NULL)
2473 for (
int i = 0; i <
fes->
GetNE(); i++)
2497 for (
int i = 0; i <
fes->
GetNE(); i++)
2514 for (
int ii = 0; ii < vals.
Size(); ii++)
2516 if (vals[ii] != signal)
2518 vdofs[s] = vdofs[ii];
2538 (*this) *= (delta_c->
Scale() / integral);
2560 cg.SetPreconditioner(prec);
2562 cg.SetMaxIter(iter);
2563 cg.SetPrintLevel(0);
2582 Vector shape,shape2, elvect, elwght;
2591 for (
int e = 0; e <
fes->
GetNE(); e++)
2613 tr.SetIntPoint (&ip);
2619 elvect.
Add(wght * val, shape);
2620 elwght.
Add(wght, shape);
2627 MFEM_WARNING(
"Error in inverting element local matrix");
2640 for (
int e = 0; e <
fes->
GetNE(); e++)
2651 MFEM_ASSERT(el2.
GetDof() == dof,
"Element dofs do not match.");
2670 tr.SetIntPoint (&ip);
2676 elvect.
Add(wght * val, shape2);
2677 elwght.
Add(wght, shape);
2683 MFEM_WARNING(
"Error in inverting element local matrix 2");
2690 MFEM_WARNING(
"Error in inverting element local matrix 3");
2710 for (
int i = 0; i < dofs.
Size(); i++)
2723 (*this)(vdof) = coeff.
Eval(*T, ip);
2730 MFEM_VERIFY(
VectorDim() == vcoeff.
GetVDim(),
"vcoeff vdim != VectorDim()");
2746 for (
int i = 0; i <
fes->
GetNE(); i++)
2769 for (
int i = 0; i <
fes->
GetNE(); i++)
2782 for (
int ii = 0; ii < vals.
Size(); ii++)
2784 if (vals[ii] != signal)
2786 vdofs[s] = vdofs[ii];
2810 MFEM_VERIFY(
FESpace()->GetVDim() == 1,
"ProjectTraceCoefficient(Coefficient&)"
2811 "is only valid for scalar GridFunction");
2819 "Incompatible vcoeff vdim and fes vdim");
2827 MFEM_VERIFY(
fes->
GetVDim() == 1,
"fespace VDim != 1");
2833 "vcoeff vdim (" << vcoeff.
GetVDim()
2834 <<
") != SpaceDimension ("
2843 for (
int i = 0; i <
fes->
GetMesh()->GetNumFaces(); i++)
2853 vcoeff.
Eval(vc, *T, ip);
2855 lvec(j) = (vc * nor);
2894 cg.SetPreconditioner(prec);
2896 cg.SetMaxIter(iter);
2897 cg.SetPrintLevel(0);
2909 Vector shapel2, elvect, elwght, val;
2918 for (
int e = 0; e <
fes->
GetNE(); e++)
2942 tr.SetIntPoint (&ip);
2944 vcoeff.
Eval(val, tr, ip);
2953 elwght.
Add(wght, shapel2);
2959 MFEM_WARNING(
"Error in inverting element local matrix");
2969 for (
int i = 0; i < vdofs.
Size(); i++)
2983 MFEM_WARNING(
"This project is not stable for"
2984 "NURBS VectorFE with order >= 5");
2986 for (
int e = 0; e <
fes->
GetNE(); e++)
2997 MFEM_ASSERT(dof2*
dim >= dof,
"Element dofs do not match.");
3017 tr.SetIntPoint (&ip);
3019 vcoeff.
Eval(val, tr, ip);
3025 for (
int k = 0; k <
dim; k++)
3027 for (
int s = 0; s < dof2; s++)
3029 elvect(dof2*k+s) += val(k) * shape2(s);
3035 for (
int k = 0; k <
dim; k++)
3037 elmat.
AddMatrix(partelmat, dof2*k, dof2*k);
3041 elwght.
Add(wght, shapel2);
3047 MFEM_WARNING(
"Error in inverting element local matrix");
3060 I.
Mult(elvect, vec);
3065 MFEM_WARNING(
"Error in inverting element local matrix");
3076 for (
int i = 0; i < vdofs.
Size(); i++)
3114 MFEM_VERIFY(
VectorDim() == vcoeff.
GetVDim(),
"vcoeff vdim != VectorDim()");
3121 for (
int i = 0; i < dofs.
Size(); i++)
3133 vcoeff.
Eval(val, *T, ip);
3137 (*this)(vdof) = val(vd);
3144 MFEM_VERIFY(
VectorDim() == vcoeff.
GetVDim(),
"vcoeff vdim != VectorDim()");
3167 int i, j, fdof, d, ind, vdim;
3182 for (j = 0; j < fdof; j++)
3186 for (d = 0; d < vdim; d++)
3188 if (!coeff[d]) {
continue; }
3190 val = coeff[d]->
Eval(*transf, ip);
3191 if ( (ind = vdofs[fdof*d+j]) < 0 )
3193 val = -val, ind = -1-ind;
3202 std::variant<Coefficient*, VectorCoefficient*> coeff,
Array<int> &dof_attr)
3204 std::visit([&](
auto* c)
3206 MFEM_VERIFY(
VectorDim() == c->GetVDim(),
"coeff vdim != VectorDim()");
3218 for (
int i = 0; i <
fes->
GetNE(); i++)
3222 std::visit([&](
auto* c)
3230 for (
int j = 0; j < vdofs.Size(); j++)
3232 if (attr > dof_attr[vdofs[j]])
3234 (*this)(vdofs[j]) = vals[j];
3235 dof_attr[vdofs[j]] = attr;
3248 "Cannot project a scalar coefficient onto a vector GridFunction");
3276 for (
int i = 0; i < values_counter.
Size(); i++)
3278 MFEM_ASSERT(
bool(values_counter[i]) ==
bool(ess_vdofs_marker[i]),
3294 ess_vdofs_marker = 0;
3298 if (!coeff[i]) {
continue; }
3300 for (
int j = 0; j<
Size(); j++)
3302 ess_vdofs_marker[j] = bool(ess_vdofs_marker[j]) ||
3303 bool(component_dof_marker[j]);
3306 for (
int i = 0; i < values_counter.
Size(); i++)
3308 MFEM_ASSERT(
bool(values_counter[i]) ==
bool(ess_vdofs_marker[i]),
3317 MFEM_VERIFY(
fes->
GetVDim() == 1,
"fespace VDim != 1");
3320 "Not an RT FE space!");
3324 "vcoeff vdim (" << vcoeff->
GetVDim()
3325 <<
") != SpaceDimension ("
3360 lvec(j) = c * T->
Weight();
3364 vcoeff->
Eval(vc, *T, ip);
3366 lvec(j) = (vc * nor);
3384 for (
int i = 0; i < values_counter.
Size(); i++)
3386 MFEM_ASSERT(
bool(values_counter[i]) ==
bool(ess_vdofs_marker[i]),
3401 int fdof, d, i, intorder, j, k;
3405 if (elems != NULL && (*elems)[i] == 0) {
continue; }
3430 for (k = 0; k < fdof; k++)
3431 if (vdofs[fdof*d+k] >= 0)
3433 a += (*this)(vdofs[fdof*d+k]) * shape(k);
3437 a -= (*this)(-1-vdofs[fdof*d+k]) * shape(k);
3439 a -= exsol[d]->
Eval(*transf, ip);
3444 error += fabs(elem_error);
3460 for (
int i = 0; i <
fes->
GetNE(); i++)
3462 if (elems != NULL && (*elems)[i] == 0) {
continue; }
3464 int intorder = 2*fe->
GetOrder() + 3;
3477 exsol.
Eval(exact_vals, *T, *ir);
3480 vals.
Norm2(loc_errs);
3485 elem_error += ip.
weight * T->
Weight() * (loc_errs(j) * loc_errs(j));
3488 error += fabs(elem_error);
3524 exgrad->
Eval(vec,*Tr,ip);
3528 return sqrt(fabs(error));
3543 for (
int i = 0; i <
fes->
GetNE(); i++)
3564 exgrad->
Eval(vec,*Tr,ip);
3569 error += fabs(elem_error);
3586 for (
int i = 0; i <
fes->
GetNE(); i++)
3607 excurl->
Eval(vec,*Tr,ip);
3609 elem_error += ip.
weight * Tr->
Weight() * ( vec * vec );
3612 error += fabs(elem_error);
3627 for (
int i = 0; i <
fes->
GetNE(); i++)
3651 error += fabs(elem_error);
3662 int fdof, intorder, k;
3667 Vector shape, el_dofs, err_val, ell_coeff_val;
3689 intorder = 2 * intorder;
3703 transf = face_elem_transf->
Elem1;
3709 for (k = 0; k < fdof; k++)
3712 el_dofs(k) = (*this)(vdofs[k]);
3716 el_dofs(k) = - (*this)(-1-vdofs[k]);
3723 ell_coeff_val(j) = ell_coeff->
Eval(*transf, eip);
3724 err_val(j) = exsol->
Eval(*transf, eip) - (shape * el_dofs);
3730 transf = face_elem_transf->
Elem2;
3736 for (k = 0; k < fdof; k++)
3739 el_dofs(k) = (*this)(vdofs[k]);
3743 el_dofs(k) = - (*this)(-1-vdofs[k]);
3750 ell_coeff_val(j) += ell_coeff->
Eval(*transf, eip);
3751 ell_coeff_val(j) *= 0.5;
3752 err_val(j) -= (exsol->
Eval(*transf, eip) - (shape * el_dofs));
3757 transf = face_elem_transf;
3763 face_error += (ip.
weight * nu * ell_coeff_val(j) *
3765 err_val(j) * err_val(j));
3768 error += fabs(face_error);
3786 int norm_type)
const
3797 return sqrt(error1 * error1 + error2 * error2);
3806 return sqrt(L2error*L2error + GradError*GradError);
3815 return sqrt(L2error*L2error + DivError*DivError);
3824 return sqrt(L2error*L2error + CurlError*CurlError);
3835 int fdof, d, i, intorder, j, k;
3862 for (k = 0; k < fdof; k++)
3863 if (vdofs[fdof*d+k] >= 0)
3865 a += (*this)(vdofs[fdof*d+k]) * shape(k);
3869 a -= (*this)(-1-vdofs[fdof*d+k]) * shape(k);
3871 a -= exsol[d]->
Eval(*transf, ip);
3888 int i, fdof,
dim, intorder, j, k;
3892 Vector e_grad, a_grad, shape, el_dofs, err_val, ell_coeff_val;
3904 for (i = 0; i < mesh->
GetNE(); i++)
3906 if (elems != NULL && (*elems)[i] == 0) {
continue; }
3924 for (k = 0; k < fdof; k++)
3927 el_dofs(k) = (*this)(vdofs[k]);
3931 el_dofs(k) = -(*this)(-1-vdofs[k]);
3938 a = (el_dofs * shape) - (exsol->
Eval(*transf, ip));
3941 error += fabs(elem_error);
3945 for (i = 0; i < mesh->
GetNE(); i++)
3947 if (elems != NULL && (*elems)[i] == 0) {
continue; }
3966 for (k = 0; k < fdof; k++)
3969 el_dofs(k) = (*this)(vdofs[k]);
3973 el_dofs(k) = -(*this)(-1-vdofs[k]);
3980 exgrad->
Eval(e_grad, *transf, ip);
3982 Mult(dshape, Jinv, dshapet);
3987 error += fabs(elem_error);
4003 for (
int i = 0; i <
fes->
GetNE(); i++)
4005 if (elems != NULL && (*elems)[i] == 0) {
continue; }
4014 int intorder = 2*fe->
GetOrder() + 3;
4024 real_t diff = fabs(vals(j) - exsol.
Eval(*T, ip));
4027 diff = pow(diff,
p);
4030 diff *=
weight->Eval(*T, ip);
4038 diff *=
weight->Eval(*T, ip);
4040 error = std::max(error, diff);
4046 error += fabs(elem_error);
4052 error = pow(error, 1./
p);
4064 "Incorrect size for result vector");
4071 for (
int i = 0; i <
fes->
GetNE(); i++)
4081 int intorder = 2*fe->
GetOrder() + 3;
4090 real_t diff = fabs(vals(j) - exsol.
Eval(*T, ip));
4093 diff = pow(diff,
p);
4096 diff *=
weight->Eval(*T, ip);
4104 diff *=
weight->Eval(*T, ip);
4106 error[i] = std::max(error[i], diff);
4112 error[i] = pow(fabs(error[i]), 1./
p);
4128 for (
int i = 0; i <
fes->
GetNE(); i++)
4138 int intorder = 2*fe->
GetOrder() + 3;
4144 exsol.
Eval(exact_vals, *T, *ir);
4151 vals.
Norm2(loc_errs);
4155 v_weight->
Eval(exact_vals, *T, *ir);
4158 for (
int j = 0; j < vals.
Width(); j++)
4161 for (
int d = 0; d < vals.
Height(); d++)
4163 errj += vals(d,j)*exact_vals(d,j);
4165 loc_errs(j) = fabs(errj);
4172 real_t errj = loc_errs(j);
4175 errj = pow(errj,
p);
4178 errj *=
weight->Eval(*T, ip);
4186 errj *=
weight->Eval(*T, ip);
4188 error = std::max(error, errj);
4194 error += fabs(elem_error);
4200 error = pow(error, 1./
p);
4214 "Incorrect size for result vector");
4222 for (
int i = 0; i <
fes->
GetNE(); i++)
4232 int intorder = 2*fe->
GetOrder() + 3;
4237 exsol.
Eval(exact_vals, *T, *ir);
4244 vals.
Norm2(loc_errs);
4248 v_weight->
Eval(exact_vals, *T, *ir);
4251 for (
int j = 0; j < vals.
Width(); j++)
4254 for (
int d = 0; d < vals.
Height(); d++)
4256 errj += vals(d,j)*exact_vals(d,j);
4258 loc_errs(j) = fabs(errj);
4265 real_t errj = loc_errs(j);
4268 errj = pow(errj,
p);
4271 errj *=
weight->Eval(*T, ip);
4279 errj *=
weight->Eval(*T, ip);
4281 error[i] = std::max(error[i], errj);
4287 error[i] = pow(fabs(error[i]), 1./
p);
4313 os <<
"NURBS_patches\n";
4332 ofstream ofs(fname);
4333 ofs.precision(precision);
4337#ifdef MFEM_USE_ADIOS2
4339 const std::string& variable_name,
4342 os.
Save(*
this, variable_name, type);
4358 os <<
"SCALARS " << field_name <<
" double 1\n"
4359 <<
"LOOKUP_TABLE default\n";
4360 for (
int i = 0; i < mesh->
GetNE(); i++)
4367 for (
int j = 0; j < val.
Size(); j++)
4369 os << val(j) <<
'\n';
4373 else if ( (vec_dim == 2 || vec_dim == 3) && mesh->
SpaceDimension() > 1)
4376 os <<
"VECTORS " << field_name <<
" double\n";
4377 for (
int i = 0; i < mesh->
GetNE(); i++)
4386 for (
int j = 0; j < vval.
Width(); j++)
4388 os << vval(0, j) <<
' ' << vval(1, j) <<
' ';
4404 for (
int vd = 0; vd < vec_dim; vd++)
4406 os <<
"SCALARS " << field_name << vd <<
" double 1\n"
4407 <<
"LOOKUP_TABLE default\n";
4408 for (
int i = 0; i < mesh->
GetNE(); i++)
4415 for (
int j = 0; j < val.
Size(); j++)
4417 os << val(j) <<
'\n';
4428 bool high_order,
int ref)
4434#ifdef MFEM_PARALLEL_HDF5
4435 VTKHDF vtkhdf(fname, pfes->GetComm());
4440 MFEM_ABORT(
"Requires HDF5 library with parallel support enabled");
4454 real_t v1[3] = { p2[0] - p1[0], p2[1] - p1[1], p2[2] - p1[2] };
4455 real_t v2[3] = { p3[0] - p1[0], p3[1] - p1[1], p3[2] - p1[2] };
4456 real_t n[] = { v1[1] * v2[2] - v1[2] * v2[1],
4457 v1[2] * v2[0] - v1[0] * v2[2],
4458 v1[0] * v2[1] - v1[1] * v2[0]
4460 real_t rl = 1.0 / sqrt(n[0] * n[0] + n[1] * n[1] + n[2] * n[2]);
4461 n[0] *= rl; n[1] *= rl; n[2] *= rl;
4463 os <<
" facet normal " << n[0] <<
' ' << n[1] <<
' ' << n[2]
4465 <<
"\n vertex " << p1[0] <<
' ' << p1[1] <<
' ' << p1[2]
4466 <<
"\n vertex " << p2[0] <<
' ' << p2[1] <<
' ' << p2[2]
4467 <<
"\n vertex " << p3[0] <<
' ' << p3[1] <<
' ' << p3[2]
4468 <<
"\n endloop\n endfacet\n";
4486 os <<
"solid GridFunction\n";
4488 bbox[0][0] = bbox[0][1] = bbox[1][0] = bbox[1][1] =
4489 bbox[2][0] = bbox[2][1] = 0.0;
4490 for (i = 0; i < mesh->
GetNE(); i++)
4497 for (k = 0; k < RG.
Size()/n; k++)
4499 for (j = 0; j < n; j++)
4502 pts[j][0] = pointmat(0,l);
4503 pts[j][1] = pointmat(1,l);
4504 pts[j][2] = values(l);
4520 bbox[0][0] = pointmat(0,0);
4521 bbox[0][1] = pointmat(0,0);
4522 bbox[1][0] = pointmat(1,0);
4523 bbox[1][1] = pointmat(1,0);
4524 bbox[2][0] = values(0);
4525 bbox[2][1] = values(0);
4528 for (j = 0; j < values.
Size(); j++)
4530 if (bbox[0][0] > pointmat(0,j))
4532 bbox[0][0] = pointmat(0,j);
4534 if (bbox[0][1] < pointmat(0,j))
4536 bbox[0][1] = pointmat(0,j);
4538 if (bbox[1][0] > pointmat(1,j))
4540 bbox[1][0] = pointmat(1,j);
4542 if (bbox[1][1] < pointmat(1,j))
4544 bbox[1][1] = pointmat(1,j);
4546 if (bbox[2][0] > values(j))
4548 bbox[2][0] = values(j);
4550 if (bbox[2][1] < values(j))
4552 bbox[2][1] = values(j);
4557 mfem::out <<
"[xmin,xmax] = [" << bbox[0][0] <<
',' << bbox[0][1] <<
"]\n"
4558 <<
"[ymin,ymax] = [" << bbox[1][0] <<
',' << bbox[1][1] <<
"]\n"
4559 <<
"[zmin,zmax] = [" << bbox[2][0] <<
',' << bbox[2][1] <<
']'
4562 os <<
"endsolid GridFunction" << endl;
4579 MFEM_ASSERT(new_vertex.
Size() == mesh->
GetNV(),
"");
4583 for (
int i = 0; i < new_vertex.
Size(); i++)
4585 old_vertex[new_vertex[i]] = i;
4592 for (
int i = 0; i < mesh->
GetNV(); i++)
4597 for (
int j = 0; j < new_vdofs.
Size(); j++)
4599 tmp(new_vdofs[j]) = (*this)(old_vdofs[j]);
4605 for (
int i = 0; i < mesh->
GetNEdges(); i++)
4608 if (old_vertex[ev[0]] > old_vertex[ev[1]])
4613 for (
int k = 0; k < dofs.
Size(); k++)
4615 int new_dof = dofs[k];
4616 int old_dof = dofs[(ind[k] < 0) ? -1-ind[k] : ind[k]];
4623 real_t sign = (ind[k] < 0) ? -1.0 : 1.0;
4624 tmp(new_vdof) = sign * (*this)(old_vdof);
4651 P.
Mult(*
this, *xMax);
4654 return std::unique_ptr<GridFunction>(xMax);
4661 int with_subdomains,
4670 int nfe = ufes->
GetNE();
4674 Vector ul, fl, fla, d_xyz;
4684 if (with_subdomains)
4689 real_t total_error = 0.0;
4690 for (
int s = 1; s <= nsd; s++)
4693 u.ComputeFlux(blfi, flux, with_coeff, (with_subdomains ? s : -1));
4695 for (
int i = 0; i < nfe; i++)
4697 if (with_subdomains && ufes->
GetAttribute(i) != s) {
continue; }
4702 u.GetSubVector(udofs, ul);
4709 *ffes->
GetFE(i), fl, with_coeff);
4714 (aniso_flags ? &d_xyz : NULL));
4716 error_estimates(i) = std::sqrt(eng);
4722 for (
int k = 0; k <
dim; k++)
4729 for (
int k = 0; k <
dim; k++)
4731 if (d_xyz[k] / sum > thresh) { flag |= (1 << k); }
4734 (*aniso_flags)[i] = flag;
4742 auto process_local_error = total_error;
4743 MPI_Allreduce(&process_local_error, &total_error, 1,
4745 MPI_SUM, pfes->GetComm());
4748 return std::sqrt(total_error);
4760 MFEM_VERIFY(
dim >= 1,
"dim must be positive");
4761 MFEM_VERIFY(
dim <= 3,
"dim cannot be greater than 3");
4762 MFEM_VERIFY(order >= 0,
"order cannot be negative");
4764 bool rotate = (angle != 0.0) || (midpoint->
Norml2() != 0.0);
4773 x[0] = tmp[0]*cos(-angle) - tmp[1]*sin(-angle);
4774 x[1] = tmp[0]*sin(-angle) + tmp[1]*cos(-angle);
4783 real_t x1 = (x(0) - xmin(0))/(xmax(0)-xmin(0)), x2, x3;
4784 Vector poly_x(order+1), poly_y(order+1), poly_z(order+1);
4788 x2 = (x(1)-xmin(1))/(xmax(1)-xmin(1));
4793 x3 = (x(2)-xmin(2))/(xmax(2)-xmin(2));
4797 int basis_dimension =
static_cast<int>(pow(order+1,
dim));
4798 poly.
SetSize(basis_dimension);
4803 for (
int i = 0; i <= order; i++)
4805 poly(i) = poly_x(i);
4811 for (
int j = 0; j <= order; j++)
4813 for (
int i = 0; i <= order; i++)
4815 int cnt = i + (order+1) * j;
4816 poly(cnt) = poly_x(i) * poly_y(j);
4823 for (
int k = 0; k <= order; k++)
4825 for (
int j = 0; j <= order; j++)
4827 for (
int i = 0; i <= order; i++)
4829 int cnt = i + (order+1) * j + (order+1) * (order+1) * k;
4830 poly(cnt) = poly_x(i) * poly_y(j) * poly_z(k);
4838 MFEM_ABORT(
"TensorProductLegendre: invalid value of dim");
4854 int num_elems = patch.
Size();
4864 if (
rotate && iface >= 0)
4870 physical_diff = 0.0;
4873 for (
int i = 0; i < 2; i++)
4876 Tr.
Transform(reference_pt, physical_pt);
4877 midpoint += physical_pt;
4878 physical_pt *= pow(-1.0,i);
4879 physical_diff += physical_pt;
4882 angle = atan2(physical_diff(1),physical_diff(0));
4885 for (
int i = 0; i < num_elems; i++)
4887 int ielem = patch[i];
4898 transip -= midpoint;
4901 transip[0] = tmp[0]*cos(-angle) - tmp[1]*sin(-angle);
4902 transip[1] = tmp[0]*sin(-angle) + tmp[1]*cos(-angle);
4904 for (
int d = 0; d <
dim; d++) { xmax(d) = max(xmax(d), transip(d)); }
4905 for (
int d = 0; d <
dim; d++) { xmin(d) = min(xmin(d), transip(d)); }
4913 bool subdomain_reconstruction,
4917 MFEM_VERIFY(tichonov_coeff >= 0.0,
"tichonov_coeff cannot be negative");
4925 int nfe = ufes->
GetNE();
4926 int nfaces = ufes->
GetNF();
4933 error_estimates = 0.0;
4944 if (subdomain_reconstruction)
4949 real_t total_error = 0.0;
4950 for (
int iface = 0; iface < nfaces; iface++)
4957 patch[0] = el1; patch[1] = el2;
4960 if (el1 == -1 || el2 == -1)
4971 if (el1_attr != el2_attr) {
continue; }
4980 int num_basis_functions =
static_cast<int>(pow(patch_order+1,
dim));
4981 int flux_order = 2*patch_order + 1;
4990 xmin, xmax, angle, midpoint, iface);
4995 for (
int i = 0; i < patch.
Size(); i++)
4997 int ielem = patch[i];
5003 u.GetSubVector(udofs, ul);
5006 const auto *dummy = ufes->
GetFE(ielem);
5008 *dummy, fl, with_coeff, ir);
5012 for (
int k = 0; k < num_integration_pts; k++)
5024 for (
int l = 0; l < num_basis_functions; l++)
5027 for (
int n = 0; n < sdim; n++)
5029 b[l + n * num_basis_functions] +=
p(l) * fl(k + n * num_integration_pts);
5041 for (
int i = 0; i < num_basis_functions; i++)
5043 A(i,i) += tichonov_coeff;
5050 if (!lu.
Factor(num_basis_functions,TOL))
5053 mfem::out <<
"LSZZErrorEstimator: Matrix A is singular.\t"
5054 <<
"Consider increasing tichonov_coeff." << endl;
5055 for (
int i = 0; i < num_basis_functions; i++)
5059 lu.
Factor(num_basis_functions,TOL);
5061 lu.
Solve(num_basis_functions, sdim,
b);
5069 for (
int i = 0; i < num_basis_functions; i++)
5071 for (
int j = 0; j < sdim; j++)
5073 f(j) +=
b[i + j * num_basis_functions] *
p(i);
5080 real_t element_error = 0.0;
5081 real_t patch_error = 0.0;
5082 for (
int i = 0; i < patch.
Size(); i++)
5084 int ielem = patch[i];
5085 element_error =
u.ComputeElementGradError(ielem, &global_poly);
5086 element_error *= element_error;
5087 patch_error += element_error;
5088 error_estimates(ielem) += element_error;
5092 total_error += patch_error;
5100 for (
int ielem = 0; ielem < nfe; ielem++)
5102 if (counters[ielem] == 0)
5104 error_estimates(ielem) =
infinity();
5108 error_estimates(ielem) /= counters[ielem]/2.0;
5109 error_estimates(ielem) = sqrt(error_estimates(ielem));
5112 return std::sqrt(total_error/
dim);
5133 for (
int j = 0; j < nip; j++)
5145 errj = pow(errj,
p);
5170 return sol_in.
Eval(*T_in, ip);
5179 sol_in.
Eval(v, *T_in, ip);
5188 const char *name =
sol->FESpace()->FEColl()->
Name();
5189 string cname = name;
5190 if (cname ==
"Linear")
5194 else if (cname ==
"Quadratic")
5198 else if (cname ==
"Cubic")
5202 else if (!strncmp(name,
"H1_", 3))
5206 else if (!strncmp(name,
"H1Pos_", 6))
5211 else if (!strncmp(name,
"L2_T", 4))
5215 else if (!strncmp(name,
"L2_", 3))
5219 else if (!strncmp(name,
"L2Int_", 6))
5226 mfem::err <<
"Extrude1DGridFunction : unknown FE collection : "
5253 const int vdim)
const
5261 MFEM_VERIFY(tbe != NULL,
"TensorBasis FiniteElement expected.");
5267 int ndofs = dof_idx.
Size();
5270 lower.
SetSize(n_c_pts*(vdim > 0 ? 1 : fes_dim));
5271 upper.
SetSize(n_c_pts*(vdim > 0 ? 1 : fes_dim));
5273 for (
int d = 0; d < fes_dim; d++)
5275 if (vdim > 0 && d != vdim-1) {
continue; }
5276 const int d_off = vdim > 0 ? 0 : d;
5278 Vector lowerT(lower, d_off*n_c_pts, n_c_pts);
5279 Vector upperT(upper, d_off*n_c_pts, n_c_pts);
5283 if (dof_map.
Size() == 0)
5290 for (
int j = 0; j < ndofs; j++)
5292 nodal_data(j) = loc_data(dof_map[j]);
5295 plb.
GetNDBounds(rdim, nodal_data, lowerT, upperT);
5304 Vector &control_pos)
const
5315 MFEM_VERIFY(tbe != NULL,
"TensorBasis FiniteElement expected.");
5318 bool lexico = (dof_map.
Size() == 0);
5320 bool h1 = (l2fec ==
nullptr);
5329 ir_in.
IntPoint((lexico || bern) ? i : dof_map[i]);
5332 for (
int d = 0; d <
dim; d++)
5334 ip_coord(d) = ref_range(d) +
5335 (ref_range(
dim+d) - ref_range(d)) * ip_coord(d);
5339 GetValues(elem, ir_new, loc_data, vdim);
5368 fe->
Project(*ntfe, *eltran, projmat);
5370 projmat.
Mult(loc_data, loc_data_temp);
5371 for (
int i = 0; i < dof_map.
Size(); i++)
5373 loc_data(i) = loc_data_temp(dof_map[i]);
5375 if (dof_map.
Size() == 0) { loc_data = loc_data_temp; }
5386 for (
int i = 0; i < ncp; i++)
5388 for (
int d = 0; d <
dim; d++)
5390 control_pos(i + d*ncp) =
5391 ref_range(d) + (ref_range(
dim+d)-ref_range(d))*control_pos_1D(i);
5398 const int vdim)
const
5406 lower.
SetSize((vdim > 0 ? 1 :fes_dim));
5407 upper.
SetSize((vdim > 0 ? 1 :fes_dim));
5408 for (
int d = 0; d < fes_dim; d++)
5410 if (vdim > 0 && d != vdim-1) {
continue; }
5411 const int d_off = vdim > 0 ? 0 : d;
5412 Vector lowerT(lowerC, d_off*n_c_pts, n_c_pts);
5413 Vector upperT(upperC, d_off*n_c_pts, n_c_pts);
5414 lower(d_off) = lowerT.
Min();
5415 upper(d_off) = upperT.
Max();
5421 const int vdim)
const
5425 lower.
SetSize(nel*(vdim > 0 ? 1 :fes_dim));
5426 upper.
SetSize(nel*(vdim > 0 ? 1 :fes_dim));
5427 for (
int e = 0; e < nel; e++)
5431 for (
int d = 0; d < fes_dim ; d++)
5433 if (vdim > 0 && d != vdim-1) {
continue; }
5434 const int d_off = vdim > 0 ? 0 : d;
5435 lower(e + d_off*nel) = lt(d_off);
5436 upper(e + d_off*nel) = ut(d_off);
5443 const int ref_factor,
5444 const int vdim)
const
5453 const int ref_factor,
const int vdim)
const
5463 lower.
SetSize(vdim > 0 ? 1 : fes_dim);
5464 upper.
SetSize(vdim > 0 ? 1 : fes_dim);
5465 for (
int d = 0; d < fes_dim; d++)
5467 if (vdim > 0 && d != vdim-1) {
continue; }
5468 const int d_off = vdim > 0 ? 0 : d;
5469 Vector lelt(lel, d_off*nel, nel);
5470 Vector uelt(uel, d_off*nel, nel);
5471 lower(d_off) = lelt.
Min();
5472 upper(d_off) = uelt.
Max();
5483 : val_min(vmin), val_max(vmax)
5487 void AddChild(IntervalNode *ch) { child.
Append(ch); }
5488 real_t GetChildMinLower()
5490 if (child.
Size() == 0)
5494 real_t valmin = numeric_limits<real_t>::max();
5495 for (
int i = 0; i < child.
Size(); i++)
5497 real_t candidate = child[i]->GetChildMinLower();
5498 valmin = std::min(valmin, candidate);
5502 real_t GetChildMinUpper()
5504 if (child.
Size() == 0)
5508 real_t valmax = numeric_limits<real_t>::max();
5509 for (
int i = 0; i < child.
Size(); i++)
5511 real_t candidate = child[i]->GetChildMinUpper();
5512 valmax = std::min(valmax, candidate);
5516 real_t GetChildMaxLower()
5518 if (child.
Size() == 0)
5522 real_t valmin = numeric_limits<real_t>::lowest();
5523 for (
int i = 0; i < child.
Size(); i++)
5525 real_t candidate = child[i]->GetChildMaxLower();
5526 valmin = std::max(valmin, candidate);
5530 real_t GetChildMaxUpper()
5532 if (child.
Size() == 0)
5536 real_t valmax = numeric_limits<real_t>::lowest();
5537 for (
int i = 0; i < child.
Size(); i++)
5539 real_t candidate = child[i]->GetChildMaxUpper();
5540 valmax = std::max(valmax, candidate);
5544 void DeleteChildren()
5546 for (
int i = 0; i < child.
Size(); i++)
5548 child[i]->DeleteChildren();
5555struct SearchInterval
5560 SearchInterval(
const Vector &ref_range_in,
int d, IntervalNode *n)
5561 : ref_range(ref_range_in), depth(d), node(n)
5565struct IntervalCompareMin
5567 bool operator()(
const SearchInterval *
a,
const SearchInterval *
b)
const
5569 return a->node->val_min >
b->node->val_min;
5573struct IntervalCompareMax
5575 bool operator()(
const SearchInterval *
a,
const SearchInterval *
b)
const
5577 return a->node->val_max <
b->node->val_max;
5582 const int elem,
const PLBound &plb,
const int vdim,
5583 const int max_depth,
const real_t tol)
const
5585 real_t min_threshold = std::numeric_limits<real_t>::max();
5591 const int elem,
const PLBound &plb,
const int vdim,
5592 const int max_depth,
const real_t tol,
real_t &min_threshold)
const
5596 Vector pos_range(2*
dim); pos_range = 0.0;
5597 for (
int d = 0; d <
dim; d++) { pos_range(d+
dim) = 1.0; }
5598 Vector lower, upper, cp_ref_loc;
5604 min_threshold = std::min(min_threshold, val_max);
5608 if (val_min >= min_threshold)
5610 return std::make_pair(val_min, val_max);
5613 if (val_min == val_max || max_depth == 0)
5615 min_threshold = std::min(min_threshold, val_min);
5616 return std::make_pair(val_min, val_max);
5618 real_t abs_tol = tol*(val_max-val_min);
5620 IntervalNode *initial_node =
new IntervalNode(val_min, val_max);
5621 SearchInterval *initial_interval =
new SearchInterval(pos_range, 0,
5624 std::priority_queue<SearchInterval*,
5625 std::vector<SearchInterval*>, IntervalCompareMin> pq;
5626 pq.push(initial_interval);
5633 SearchInterval *current = pq.top();
5635 int curr_depth = current->depth;
5638 if (current->node->val_min >= min_threshold || curr_depth >= max_depth)
5644 min_lower_bound = initial_node->GetChildMinLower();
5645 if (min_upper_bound - min_lower_bound < abs_tol)
5653 vdim, lower, upper, cp_ref_loc);
5656 for (
int k = 0; k < (
dim == 3 ? ncp-1 : 1); k++)
5658 for (
int j = 0; j < (
dim >= 2 ? ncp-1 : 1); j++)
5660 for (
int i = 0; i < ncp-1; i++)
5662 real_t lv = 0.0, uv = 0.0;
5665 lv = std::min(lower(i), lower(i+1));
5666 uv = std::min(upper(i), upper(i+1));
5670 lv = std::min({lower(i + j*ncp), lower((i+1) + j*ncp),
5671 lower(i + (j+1)*ncp),
5672 lower((i+1) + (j+1)*ncp)});
5673 uv = std::min({upper(i + j*ncp), upper((i+1) + j*ncp),
5674 upper(i + (j+1)*ncp),
5675 upper((i+1) + (j+1)*ncp)});
5679 lv = std::min({lower(i + j*ncp + k*ncp*ncp),
5680 lower((i+1) + j*ncp + k*ncp*ncp),
5681 lower(i + (j+1)*ncp + k*ncp*ncp),
5682 lower((i+1) + (j+1)*ncp + k*ncp*ncp),
5683 lower(i + j*ncp + (k+1)*ncp*ncp),
5684 lower((i+1) + j*ncp + (k+1)*ncp*ncp),
5685 lower(i + (j+1)*ncp + (k+1)*ncp*ncp),
5686 lower((i+1) + (j+1)*ncp + (k+1)*ncp*ncp)});
5687 uv = std::min({upper(i + j*ncp + k*ncp*ncp),
5688 upper((i+1) + j*ncp + k*ncp*ncp),
5689 upper(i + (j+1)*ncp + k*ncp*ncp),
5690 upper((i+1) + (j+1)*ncp + k*ncp*ncp),
5691 upper(i + j*ncp + (k+1)*ncp*ncp),
5692 upper((i+1) + j*ncp + (k+1)*ncp*ncp),
5693 upper(i + (j+1)*ncp + (k+1)*ncp*ncp),
5694 upper((i+1) + (j+1)*ncp + (k+1)*ncp*ncp)});
5696 IntervalNode *child_node =
new IntervalNode(lv, uv);
5697 current->node->AddChild(child_node);
5699 if (lv < min_threshold)
5701 min_upper_bound = std::min(min_upper_bound, uv);
5702 min_threshold = std::min(min_threshold, uv);
5703 if (curr_depth < max_depth)
5705 pos_range(0) = cp_ref_loc(i);
5706 pos_range(0+
dim) = cp_ref_loc(i+1);
5709 pos_range(1) = cp_ref_loc(ncp + j);
5710 pos_range(1+
dim) = cp_ref_loc(ncp + j+1);
5714 pos_range(2) = cp_ref_loc(2*ncp + k);
5715 pos_range(2+
dim) = cp_ref_loc(2*ncp + k+1);
5717 SearchInterval *child_interval =
5718 new SearchInterval(pos_range, curr_depth + 1,
5720 pq.push(child_interval);
5736 min_lower_bound = initial_node->GetChildMinLower();
5737 initial_node->DeleteChildren();
5738 delete initial_node;
5740 min_threshold = std::min(min_threshold, min_lower_bound);
5741 return std::make_pair(min_lower_bound, min_upper_bound);
5745 const int elem,
const PLBound &plb,
const int vdim,
5746 const int max_depth,
const real_t tol)
const
5748 real_t max_threshold = std::numeric_limits<real_t>::lowest();
5754 const int elem,
const PLBound &plb,
const int vdim,
5755 const int max_depth,
const real_t tol,
real_t &max_threshold)
const
5759 Vector pos_range(2*
dim); pos_range = 0.0;
5760 for (
int d = 0; d <
dim; d++) { pos_range(d+
dim) = 1.0; }
5761 Vector lower, upper, cp_ref_loc;
5767 max_threshold = std::max(max_threshold, val_min);
5771 if (val_max <= max_threshold)
5773 return std::make_pair(val_min, val_max);
5776 if (val_min == val_max || max_depth == 0)
5778 max_threshold = std::max(max_threshold, val_max);
5779 return std::make_pair(val_min, val_max);
5781 real_t abs_tol = tol*(val_max-val_min);
5783 IntervalNode *initial_node =
new IntervalNode(val_min, val_max);
5784 SearchInterval *initial_interval =
new SearchInterval(pos_range, 0,
5787 std::priority_queue<SearchInterval*,
5788 std::vector<SearchInterval*>, IntervalCompareMax> pq;
5789 pq.push(initial_interval);
5791 real_t max_lower_bound = val_min;
5792 real_t max_upper_bound = val_max;
5796 SearchInterval *current = pq.top();
5798 int curr_depth = current->depth;
5801 if (current->node->val_max <= max_threshold || curr_depth >= max_depth)
5807 max_upper_bound = initial_node->GetChildMaxUpper();
5808 if (max_upper_bound - max_lower_bound < abs_tol)
5816 vdim, lower, upper, cp_ref_loc);
5819 for (
int k = 0; k < (
dim == 3 ? ncp-1 : 1); k++)
5821 for (
int j = 0; j < (
dim >= 2 ? ncp-1 : 1); j++)
5823 for (
int i = 0; i < ncp-1; i++)
5825 real_t lv = 0.0, uv = 0.0;
5828 lv = std::max(lower(i), lower(i+1));
5829 uv = std::max(upper(i), upper(i+1));
5833 lv = std::max({lower(i + j*ncp), lower((i+1) + j*ncp),
5834 lower(i + (j+1)*ncp),
5835 lower((i+1) + (j+1)*ncp)});
5836 uv = std::max({upper(i + j*ncp), upper((i+1) + j*ncp),
5837 upper(i + (j+1)*ncp),
5838 upper((i+1) + (j+1)*ncp)});
5842 lv = std::max({lower(i + j*ncp + k*ncp*ncp),
5843 lower((i+1) + j*ncp + k*ncp*ncp),
5844 lower(i + (j+1)*ncp + k*ncp*ncp),
5845 lower((i+1) + (j+1)*ncp + k*ncp*ncp),
5846 lower(i + j*ncp + (k+1)*ncp*ncp),
5847 lower((i+1) + j*ncp + (k+1)*ncp*ncp),
5848 lower(i + (j+1)*ncp + (k+1)*ncp*ncp),
5849 lower((i+1) + (j+1)*ncp + (k+1)*ncp*ncp)});
5850 uv = std::max({upper(i + j*ncp + k*ncp*ncp),
5851 upper((i+1) + j*ncp + k*ncp*ncp),
5852 upper(i + (j+1)*ncp + k*ncp*ncp),
5853 upper((i+1) + (j+1)*ncp + k*ncp*ncp),
5854 upper(i + j*ncp + (k+1)*ncp*ncp),
5855 upper((i+1) + j*ncp + (k+1)*ncp*ncp),
5856 upper(i + (j+1)*ncp + (k+1)*ncp*ncp),
5857 upper((i+1) + (j+1)*ncp + (k+1)*ncp*ncp)});
5859 IntervalNode *child_node =
new IntervalNode(lv, uv);
5860 current->node->AddChild(child_node);
5862 if (uv > max_threshold)
5864 max_lower_bound = std::max(max_lower_bound, lv);
5865 max_threshold = std::max(max_threshold, lv);
5866 if (curr_depth < max_depth)
5868 pos_range(0) = cp_ref_loc(i);
5869 pos_range(0+
dim) = cp_ref_loc(i+1);
5872 pos_range(1) = cp_ref_loc(ncp + j);
5873 pos_range(1+
dim) = cp_ref_loc(ncp + j+1);
5877 pos_range(2) = cp_ref_loc(2*ncp + k);
5878 pos_range(2+
dim) = cp_ref_loc(2*ncp + k+1);
5880 SearchInterval *child_interval =
5881 new SearchInterval(pos_range, curr_depth + 1,
5883 pq.push(child_interval);
5898 max_upper_bound = initial_node->GetChildMaxUpper();
5899 initial_node->DeleteChildren();
5900 delete initial_node;
5901 max_threshold = std::max(max_threshold, max_upper_bound);
5903 return std::make_pair(max_lower_bound, max_upper_bound);
5907 const int vdim,
const PLBound &plb,
const int max_depth,
5910 real_t global_min_lower = std::numeric_limits<real_t>::max();
5911 real_t global_min_upper = std::numeric_limits<real_t>::max();
5913 for (
int i = 0; i <
fes->
GetNE(); i++)
5915 std::pair<real_t, real_t> min_pair =
5918 global_min_upper = std::min(global_min_upper, min_pair.second);
5920 return std::make_pair(global_min_lower, global_min_upper);
5924 const int vdim,
const PLBound &plb,
const int max_depth,
5927 real_t global_max_lower = std::numeric_limits<real_t>::lowest();
5928 real_t global_max_upper = std::numeric_limits<real_t>::lowest();
5930 for (
int i = 0; i <
fes->
GetNE(); i++)
5932 std::pair<real_t, real_t> max_pair =
5935 global_max_lower = std::max(global_max_lower, max_pair.first);
5937 return std::make_pair(global_max_lower, global_max_upper);
T Max() const
Find the maximal element in the array, using the comparison operator < for class T.
const T * HostRead() const
Shortcut for mfem::Read(a.GetMemory(), a.Size(), false).
void SetSize(int nsize)
Change the logical size of the array, keep existing entries.
int Size() const
Return the logical size of the array.
int Append(const T &el)
Append element 'el' to array, resize if necessary.
@ GaussLegendre
Open type.
@ Positive
Bernstein polynomials.
Conjugate gradient method.
Base class Coefficients that optionally depend on space and time. These are used by the BilinearFormI...
virtual real_t Eval(ElementTransformation &T, const IntegrationPoint &ip)=0
Evaluate the coefficient in the element described by T at the point ip.
Piecewise-(bi)cubic continuous finite elements.
Delta function coefficient optionally multiplied by a weight coefficient and a scaled time dependent ...
Coefficient * Weight()
See SetWeight() for description of the weight Coefficient.
real_t Scale()
Return the scale factor times the optional time dependent function. Returns with when not set by th...
real_t Tol()
Return the tolerance used to identify the mesh vertices.
Data type dense matrix using column-major storage.
void Mult(const real_t *x, real_t *y) const
Matrix vector multiplication.
void TestInversion()
Invert and print the numerical conditioning of the inversion.
void MultTranspose(const real_t *x, real_t *y) const
Multiply a vector with the transpose matrix.
void Transpose()
(*this) = (*this)^t
void GetColumnReference(int c, Vector &col)
real_t * Data() const
Returns the matrix data array. Warning: this method casts away constness.
void AddMult(const Vector &x, Vector &y, const real_t a=1.0) const override
y += a * A.x
void SetSize(int s)
Change the size of the DenseMatrix to s x s.
void GetRowl2(Vector &l) const
Returns the l2norm of the rows of the DenseMatrix.
void AddMatrix(DenseMatrix &A, int ro, int co)
Perform (ro+i,co+j)+=A(i,j) for 0<=i.
void Norm2(real_t *v) const
Take the 2-norm of the columns of A and store in v.
static MemoryType GetDeviceMemoryType()
Get the current Device MemoryType. This is the MemoryType used by most MFEM classes when allocating m...
Class for domain integration .
Class used for extruding a scalar coefficient.
real_t Eval(ElementTransformation &T, const IntegrationPoint &ip) override
Evaluate the coefficient in the element described by T at the point ip.
Collection of finite elements from the same family in multiple dimensions. This class is used to matc...
virtual const int * DofOrderForOrientation(Geometry::Type GeomType, int Or) const =0
Returns an array, say p, that maps a local permuted index i to a local base index: base_i = p[i].
static FiniteElementCollection * New(const char *name)
Factory method: return a newly allocated FiniteElementCollection according to the given name.
virtual int GetContType() const =0
virtual FiniteElementCollection * Clone(int p) const
Instantiate a new collection of the same type with a different order.
virtual const char * Name() const
@ CONTINUOUS
Field is continuous across element interfaces.
Class FiniteElementSpace - responsible for providing FEM view of the mesh, mainly managing the set of...
void Save(std::ostream &out) const
Save finite element space to output stream out.
void GetVDofs(int vd, Array< int > &dofs, int ndofs=-1) const
Returns the indices of all of the VDofs for the specified dimension 'vd'.
int GetNVDofs() const
Number of all scalar vertex dofs.
void DofsToVDofs(Array< int > &dofs, int ndofs=-1) const
Compute the full set of vdofs corresponding to each entry in dofs.
void GetEdgeInteriorDofs(int i, Array< int > &dofs) const
Returns the indices of the degrees of freedom for the interior of the specified edge.
const FiniteElement * GetBE(int i) const
Returns pointer to the FiniteElement in the FiniteElementCollection associated with i'th boundary fac...
virtual int GetTrueVSize() const
Return the number of vector true (conforming) dofs.
DofTransformation * GetElementDofs(int elem, Array< int > &dofs) const
Returns indices of degrees of freedom of element 'elem'. The returned indices are offsets into an ldo...
ElementTransformation * GetElementTransformation(int i) const
void GetEdgeVDofs(int i, Array< int > &vdofs) const
Returns the indices of the degrees of freedom for the specified edge, including the DOFs for the vert...
virtual const SparseMatrix * GetRestrictionMatrix() const
The returned SparseMatrix is owned by the FiniteElementSpace.
virtual int GetFaceDofs(int face, Array< int > &dofs, int variant=0) const
Returns the indices of the degrees of freedom for the specified face, including the DOFs for the edge...
static void AdjustVDofs(Array< int > &vdofs)
Remove the orientation information encoded into an array of dofs Some basis function types have a rel...
bool Nonconforming() const
void GetVertexVDofs(int i, Array< int > &vdofs) const
Returns the indices of the degrees of freedom for the specified vertices.
int GetNEDofs() const
Number of all scalar edge-interior dofs.
int GetAttribute(int i) const
int GetNDofs() const
Returns number of degrees of freedom. This is the number of Local Degrees of Freedom.
int GetNBE() const
Returns number of boundary elements in the mesh.
const NURBSExtension * GetNURBSext() const
virtual const Operator * GetProlongationMatrix() const
const QuadratureInterpolator * GetQuadratureInterpolator(const IntegrationRule &ir) const
Return a QuadratureInterpolator that interpolates E-vectors to quadrature point values and/or derivat...
int GetBdrAttribute(int i) const
int GetLocalDofForDof(int i) const
Return the dof index within the element from GetElementForDof() for ldof index i.
int GetElementForDof(int i) const
Return the index of the first element that contains ldof index i.
const FiniteElement * GetTypicalBE() const
Return a "typical" boundary element.
int GetNF() const
Returns number of faces (i.e. co-dimension 1 entities) in the mesh.
FiniteElementCollection * Load(Mesh *m, std::istream &input)
Read a FiniteElementSpace from a stream. The returned FiniteElementCollection is owned by the caller.
DofTransformation * GetElementVDofs(int i, Array< int > &vdofs) const
Returns indices of degrees of freedom for the i'th element. The returned indices are offsets into an ...
virtual const FiniteElement * GetFE(int i) const
Returns pointer to the FiniteElement in the FiniteElementCollection associated with i'th element in t...
Ordering::Type GetOrdering() const
Return the ordering method.
ElementTransformation * GetBdrElementTransformation(int i) const
Returns ElementTransformation for the i-th boundary element.
bool LastUpdatePRef() const
Return a flag indicating whether the last update was for p-refinement.
int GetNE() const
Returns number of elements in the mesh.
const ElementRestrictionOperator * GetElementRestriction(ElementDofOrdering e_ordering) const
Return an Operator that converts L-vectors to E-vectors.
const FiniteElement * GetEdgeElement(int i, int variant=0) const
Returns pointer to the FiniteElement in the FiniteElementCollection associated with i'th edge in the ...
int GetEdgeDofs(int edge, Array< int > &dofs, int variant=0) const
Returns the indices of the degrees of freedom for the specified edge, including the DOFs for the vert...
void GetFaceVDofs(int i, Array< int > &vdofs) const
Returns the indices of the degrees of freedom for the specified face, including the DOFs for the edge...
void GetElementVertices(int i, Array< int > &vertices) const
Returns the vertices of element i.
const FiniteElement * GetTypicalTraceElement() const
Return a "typical" trace element.
int GetNFDofs() const
Number of all scalar face-interior dofs.
int GetElementOrder(int i) const
Returns the order of the i'th finite element.
const FiniteElement * GetFaceElement(int i) const
Returns pointer to the FiniteElement in the FiniteElementCollection associated with i'th face in the ...
std::shared_ptr< const PRefinementTransferOperator > GetPrefUpdateOperator()
const SparseMatrix * GetConformingProlongation() const
const FiniteElementCollection * FEColl() const
Mesh * GetMesh() const
Returns the mesh.
int GetNV() const
Returns number of vertices in the mesh.
int GetVSize() const
Return the number of vector dofs, i.e. GetNDofs() x GetVDim().
DofTransformation * GetBdrElementDofs(int bel, Array< int > &dofs) const
Returns indices of degrees of freedom for boundary element 'bel'. The returned indices are offsets in...
int GetVDim() const
Returns the vector dimension of the finite element space.
const FiniteElement * GetTypicalFE() const
Return GetFE(0) if the local mesh is not empty; otherwise return a typical FE based on the Geometry t...
static int DecodeDof(int dof)
Helper to return the DOF associated with a sign encoded DOF.
virtual int GetMaxElementOrder() const
Return the maximum polynomial order over all elements.
DofTransformation * GetBdrElementVDofs(int i, Array< int > &vdofs) const
Returns indices of degrees of freedom for i'th boundary element. The returned indices are offsets int...
virtual void GetEssentialVDofs(const Array< int > &bdr_attr_is_ess, Array< int > &ess_vdofs, int component=-1) const
Mark degrees of freedom associated with boundary elements with the specified boundary attributes (mar...
int DofToVDof(int dof, int vd, int ndofs=-1) const
Compute a single vdof corresponding to the index dof and the vector index vd.
const Operator * GetUpdateOperator()
Get the GridFunction update operator.
Abstract class for all finite elements.
virtual void CalcVShape(const IntegrationPoint &ip, DenseMatrix &shape) const
Evaluate the values of all shape functions of a vector finite element in reference space at the given...
int GetRangeDim() const
Returns the vector dimension for vector-valued finite elements, which is also the dimension of the in...
int GetOrder() const
Returns the order of the finite element. In the case of anisotropic orders, returns the maximum order...
int GetDim() const
Returns the reference space dimension for the finite element.
virtual int GetPhysRangeDim(int) const
Returns the vector dimension, in physical space, for vector-valued finite elements,...
void CalcPhysHessian(ElementTransformation &Trans, DenseMatrix &Hessian) const
Evaluate the Hessian of all shape functions of a scalar finite element in physical space at the given...
virtual void ProjectDelta(int vertex, Vector &dofs) const
Project a delta function centered on the given vertex in the local finite dimensional space represent...
int GetMapType() const
Returns the FiniteElement::MapType of the element describing how reference functions are mapped to ph...
int GetRangeType() const
Returns the FiniteElement::RangeType of the element, one of {SCALAR, VECTOR}.
const IntegrationRule & GetNodes() const
Get a const reference to the nodes of the element.
virtual void CalcDShape(const IntegrationPoint &ip, DenseMatrix &dshape) const =0
Evaluate the gradients of all shape functions of a scalar finite element in reference space at the gi...
Geometry::Type GetGeomType() const
Returns the Geometry::Type of the reference element.
virtual void CalcDivShape(const IntegrationPoint &ip, Vector &divshape) const
Evaluate the divergence of all shape functions of a vector finite element in reference space at the g...
virtual void Project(Coefficient &coeff, ElementTransformation &Trans, Vector &dofs) const
Given a coefficient and a transformation, compute its projection (approximation) in the local finite ...
void CalcPhysLaplacian(ElementTransformation &Trans, Vector &Laplacian) const
Evaluate the Laplacian of all shape functions of a scalar finite element in physical space at the giv...
void CalcPhysVShape(ElementTransformation &Trans, DenseMatrix &shape) const
Equivalent to the CalcVShape() method with the same arguments.
virtual void CalcShape(const IntegrationPoint &ip, Vector &shape) const =0
Evaluate the values of all shape functions of a scalar finite element in reference space at the given...
virtual void CalcPhysCurlShape(ElementTransformation &Trans, DenseMatrix &curl_shape) const
Evaluate the curl of all shape functions of a vector finite element in physical space at the point de...
int GetDof() const
Returns the number of degrees of freedom in the finite element.
void CalcPhysShape(ElementTransformation &Trans, Vector &shape) const
Evaluate the values of all shape functions of a scalar finite element in physical space at the point ...
Gauss-Seidel smoother of a sparse matrix.
RefinedGeometry * Refine(Geometry::Type Geom, int Times, int ETimes=1)
const IntegrationRule * GetVertices(int GeomType) const
Return an IntegrationRule consisting of all vertices of the given Geometry::Type, GeomType.
int NumBdr(int GeomType) const
Return the number of boundary "faces" of a given Geometry::Type.
Coefficient defined by a GridFunction. This coefficient is mesh dependent.
Class for grid function - Vector with associated FE space.
void GetLaplacians(int i, const IntegrationRule &ir, Vector &laps, int vdim=1) const
void AccumulateAndCountBdrTangentValues(VectorCoefficient &vcoeff, const Array< int > &bdr_attr, Array< int > &values_counter)
void ProjectVectorFieldOn(GridFunction &vec_field, int comp=0)
virtual void CountElementsPerVDof(Array< int > &elem_per_vdof) const
For each vdof, counts how many elements contain the vdof, as containment is determined by FiniteEleme...
virtual real_t GetValue(int i, const IntegrationPoint &ip, int vdim=1) const
void SaveVTK(std::ostream &out, const std::string &field_name, int ref)
Write the GridFunction in VTK format. Note that Mesh::PrintVTK must be called first....
virtual real_t ComputeDGFaceJumpError(Coefficient *exsol, Coefficient *ell_coeff, class JumpScaling jump_scaling, const IntegrationRule *irs[]=NULL) const
Returns the Face Jumps error for L2 elements.
void GetValues(int i, const IntegrationRule &ir, Vector &vals, int vdim=1) const
virtual real_t ComputeHCurlError(VectorCoefficient *exsol, VectorCoefficient *excurl, const IntegrationRule *irs[]=NULL) const
Returns the error measured in H(curl)-norm for ND elements.
void UpdatePRef()
P-refinement version of Update().
virtual real_t ComputeH1Error(Coefficient *exsol, VectorCoefficient *exgrad, Coefficient *ell_coef, real_t Nu, int norm_type) const
void GetGradients(ElementTransformation &tr, const IntegrationRule &ir, DenseMatrix &grad) const
Extension of GetGradient(...) for a collection of IntegrationPoints.
virtual void ProjectCoefficientGlobalL2(Coefficient &coeff, real_t rtol=1e-12, int iter=1000)
Project coeff Coefficient to this GridFunction. The projection is a global L2 projection....
void AccumulateAndCountBdrValues(Coefficient *coeff[], VectorCoefficient *vcoeff, const Array< int > &attr, Array< int > &values_counter)
void GetDerivative(int comp, int der_comp, GridFunction &der) const
Compute a certain derivative of a function's component. Derivatives of the function are computed at t...
void GetVectorGradient(ElementTransformation &tr, DenseMatrix &grad) const
Compute the vector gradient with respect to the physical element variable.
virtual real_t ComputeMaxError(Coefficient &exsol, const IntegrationRule *irs[]=NULL) const
Returns Max|u_ex - u_h| error for H1 or L2 elements.
virtual void Update()
Transform by the Space UpdateMatrix (e.g., on Mesh change).
virtual PLBound GetBounds(Vector &lower, Vector &upper, const int ref_factor=1, const int vdim=-1) const
virtual void MakeRef(FiniteElementSpace *f, real_t *v)
Make the GridFunction reference external data on a new FiniteElementSpace.
void ImposeBounds(int i, const Vector &weights, const Vector &lo_, const Vector &hi_)
void SetTrueVector()
Shortcut for calling GetTrueDofs() with GetTrueVector() as argument.
virtual void Save(std::ostream &out) const
Save the GridFunction to an output stream.
virtual real_t ComputeL2Error(Coefficient *exsol[], const IntegrationRule *irs[]=NULL, const Array< int > *elems=NULL) const
Returns ||exsol - u_h||_L2 for scalar or vector H1 or L2 elements.
void MakeTRef(FiniteElementSpace *f, real_t *tv)
Associate a new FiniteElementSpace and new true-dof data with the GridFunction.
void GetVectorFieldValues(int i, const IntegrationRule &ir, DenseMatrix &vals, DenseMatrix &tr, int comp=0) const
virtual void ProjectBdrCoefficientTangent(VectorCoefficient &vcoeff, const Array< int > &bdr_attr)
Project the tangential components of the given VectorCoefficient on the boundary.
PLBound GetElementBounds(Vector &lower, Vector &upper, const int ref_factor=1, const int vdim=-1) const
void GetElementAverages(GridFunction &avgs) const
virtual real_t ComputeElementGradError(int ielem, VectorCoefficient *exgrad, const IntegrationRule *irs[]=NULL) const
Returns ||grad u_ex - grad u_h||_L2 in element ielem for H1 or L2 elements.
void MakeOwner(FiniteElementCollection *fec_)
Make the GridFunction the owner of fec_owned and fes.
void ProjectTraceCoefficientNormal(VectorCoefficient &vcoeff)
Project a VectorCoefficient on a GridFunction defined on an RT trace space.
void SaveSTL(std::ostream &out, int TimesToRefine=1)
Write the GridFunction in STL format. Note that the mesh dimension must be 2 and that quad elements w...
virtual void ComputeElementLpErrors(const real_t p, Coefficient &exsol, Vector &error, Coefficient *weight=NULL, const IntegrationRule *irs[]=NULL) const
Returns ||u_ex - u_h||_Lp elementwise for H1 or L2 elements.
virtual void SetFromTrueDofs(const Vector &tv)
Set the GridFunction from the given true-dof vector.
virtual void GetElementDofValues(int el, Vector &dof_vals) const
virtual void ProjectDiscCoefficient(std::variant< Coefficient *, VectorCoefficient * > coeff, Array< int > &dof_attr)
Project a discontinuous (vector) coefficient as a grid function on a continuous finite element space....
virtual real_t ComputeLpError(const real_t p, Coefficient &exsol, Coefficient *weight=NULL, const IntegrationRule *irs[]=NULL, const Array< int > *elems=NULL) const
Returns ||u_ex - u_h||_Lp for H1 or L2 elements.
FiniteElementSpace * FESpace()
void SaveSTLTri(std::ostream &out, real_t p1[], real_t p2[], real_t p3[])
void AccumulateAndCountTraceValues(Coefficient *coeff[], VectorCoefficient *vcoeff, Array< int > &values_counter)
std::pair< real_t, real_t > EstimateFunctionMinimum(const int elem, const PLBound &plb, const int vdim, const int max_depth, const real_t tol, real_t &min_threshold) const
Estimate the minimum value of the GridFunction in element elem if it is below a certain min_threshold...
void ComputeMeans(AvgType type, const Array< int > &zones_per_vdof)
int GetFaceVectorValues(int i, int side, const IntegrationRule &ir, DenseMatrix &vals, DenseMatrix &tr) const
std::pair< real_t, real_t > EstimateFunctionMaximum(const int elem, const PLBound &plb, const int vdim, const int max_depth, const real_t tol, real_t &max_threshold) const
Estimate the maximum value of the GridFunction in element elem if it is above a certain max_threshold...
void ProjectTraceCoefficient(Coefficient *coeff[])
Project a Coefficient on a GridFunction defined on H1 trace space.
void GetValuesFrom(const GridFunction &orig_func)
void SaveVTKHDF(const std::string &fname, const std::string &name="u", bool high_order=true, int ref=-1)
Save the GridFunction in VTKHDF format.
void LegacyNCReorder()
Loading helper.
void ProjectDeltaCoefficient(DeltaCoefficient &delta_coeff, real_t &integral)
virtual void ComputeFlux(BilinearFormIntegrator &blfi, GridFunction &flux, bool wcoef=true, int subdomain=-1)
virtual void ProjectCoefficientElementL2(Coefficient &coeff)
Project coeff Coefficient to this GridFunction. The projection is an element local L2 projection,...
FiniteElementSpace * fes
FE space on which the grid function lives. Owned if fec_owned is not NULL.
virtual real_t ComputeCurlError(VectorCoefficient *excurl, const IntegrationRule *irs[]=NULL) const
Returns ||curl u_ex - curl u_h||_L2 for ND elements.
void GetBdrValuesFrom(const GridFunction &orig_func)
virtual real_t ComputeHDivError(VectorCoefficient *exsol, Coefficient *exdiv, const IntegrationRule *irs[]=NULL) const
Returns the error measured in H(div)-norm for RT elements.
int VectorDim() const
Shortcut for calling FiniteElementSpace::GetVectorDim() on the underlying fes.
virtual real_t ComputeW11Error(Coefficient *exsol, VectorCoefficient *exgrad, int norm_type, const Array< int > *elems=NULL, const IntegrationRule *irs[]=NULL) const
Returns norm (or portions thereof) for H1 or L2 elements.
void AccumulateAndCountTraceTangentValues(VectorCoefficient &vcoeff, Array< int > &values_counter)
std::unique_ptr< GridFunction > ProlongateToMaxOrder() const
Return a GridFunction with the values of this, prolongated to the maximum order of all elements in th...
int GetFaceValues(int i, int side, const IntegrationRule &ir, Vector &vals, DenseMatrix &tr, int vdim=1) const
FiniteElementCollection * fec_owned
Used when the grid function is read from a file. It can also be set explicitly, see MakeOwner().
int CurlDim() const
Shortcut for calling FiniteElementSpace::GetCurlDim() on the underlying fes.
void ProjectTraceCoefficientTangent(VectorCoefficient &vcoeff)
Project a VectorCoefficient on a GridFunction defined on an ND trace space.
void SumFluxAndCount(BilinearFormIntegrator &blfi, GridFunction &flux, Array< int > &counts, bool wcoef, int subdomain)
GridFunction & operator=(const GridFunction &rhs)
Copy assignment. Only the data of the base class Vector is copied.
virtual real_t ComputeDivError(Coefficient *exdiv, const IntegrationRule *irs[]=NULL) const
Returns ||div u_ex - div u_h||_L2 for RT elements.
void ProjectBdrCoefficientNormal(Coefficient *coeff, VectorCoefficient *vcoeff, const Array< int > &attr)
virtual void ProjectCoefficient(Coefficient &coeff, ProjectType type=ProjectType::DEFAULT)
Project coeff Coefficient to this GridFunction. The projection computation depends on the choice of t...
void GetElementBoundsAtControlPoints(const int elem, const PLBound &plb, Vector &lower, Vector &upper, const int vdim=-1) const
void GetTrueDofs(Vector &tv) const
Extract the true-dofs from the GridFunction.
void AccumulateAndCountDerivativeValues(int comp, int der_comp, GridFunction &der, Array< int > &zones_per_dof) const
Used for the serial and parallel implementations of the GetDerivative() method; see its documentation...
void ProjectCoefficientElementL2_(Coefficient &coeff, Vector &sol, Vector &Va)
virtual real_t ComputeGradError(VectorCoefficient *exgrad, const IntegrationRule *irs[]=NULL) const
Returns ||grad u_ex - grad u_h||_L2 for H1 or L2 elements.
void GetNodalValues(int i, Array< real_t > &nval, int vdim=1) const
Returns the values at the vertices of element i for the 1-based dimension vdim.
virtual void GetVectorValue(int i, const IntegrationPoint &ip, Vector &val) const
void RestrictConforming()
real_t GetDivergence(ElementTransformation &tr) const
void AccumulateAndCountZones(Coefficient &coeff, AvgType type, Array< int > &zones_per_vdof)
Accumulates (depending on type) the values of coeff at all shared vdofs and counts in how many zones ...
void GetCurl(ElementTransformation &tr, Vector &curl) const
void GetGradient(ElementTransformation &tr, Vector &grad) const
Gradient of a scalar function at a quadrature point.
void GetVectorGradientHat(ElementTransformation &T, DenseMatrix &gh) const
Compute the vector gradient with respect to the reference element variable.
virtual void SetSpace(FiniteElementSpace *f)
Associate a new FiniteElementSpace with the GridFunction.
void GetHessians(int i, const IntegrationRule &ir, DenseMatrix &hess, int vdim=1) const
void GetVectorValues(int i, const IntegrationRule &ir, DenseMatrix &vals, DenseMatrix &tr) const
void ProjectGridFunction(const GridFunction &src)
Project the src GridFunction to this GridFunction, both of which must be on the same mesh.
void GetVectorFieldNodalValues(Vector &val, int comp) const
void ProjectBdrCoefficient(Coefficient &coeff, const Array< int > &attr)
Project a Coefficient on the GridFunction, modifying only DOFs on the boundary associated with the bo...
void ReorderByNodes()
For a vector grid function, makes sure that the ordering is byNODES.
Arbitrary order H1-conforming (continuous) finite elements.
Arbitrary order H1 elements in 3D on a cube.
Arbitrary order H1 elements in 2D on a square.
Arbitrary order H1 elements in 1D.
Class for integration point with weight.
void Get(real_t *p, const int dim) const
void Set1w(const real_t x1, const real_t w)
void Set(const real_t x1, const real_t x2, const real_t x3, const real_t w)
Class for an integration rule - an Array of IntegrationPoint.
int GetNPoints() const
Returns the number of the points in the integration rule.
IntegrationPoint & IntPoint(int i)
Returns a reference to the i-th integration point.
const IntegrationRule & Get(int GeomType, int Order)
Returns an integration rule for given GeomType and Order.
void SetRelTol(real_t rtol)
virtual void SetPrintLevel(int print_lvl)
Legacy method to set the level of verbosity of the solver output.
void SetMaxIter(int max_it)
void SetAbsTol(real_t atol)
real_t Eval(real_t h, int p) const
Arbitrary order "L2-conforming" discontinuous finite elements.
const FiniteElement * FiniteElementForGeometry(Geometry::Type GeomType) const override
Arbitrary order L2 elements in 3D on a cube.
Arbitrary order L2 elements in 2D on a square.
Arbitrary order L2 elements in 1D on a segment.
bool Factor(int m, real_t TOL=0.0) override
Compute the LU factorization of the current matrix.
void Solve(int m, int n, real_t *X) const override
Piecewise-(bi/tri)linear continuous finite elements.
void AssembleElementMatrix(const FiniteElement &el, ElementTransformation &Trans, DenseMatrix &elmat) override
void AssembleElementMatrix2(const FiniteElement &trial_fe, const FiniteElement &test_fe, ElementTransformation &Trans, DenseMatrix &elmat) override
int GetNEdges() const
Return the number of edges.
void GetBdrElementFace(int i, int *f, int *o) const
virtual FaceElementTransformations * GetFaceElementTransformations(int FaceNo, int mask=31)
NURBSExtension * NURBSext
Optional NURBS mesh extension.
int GetNumFaces() const
Return the number of faces (3D), edges (2D) or vertices (1D).
Geometry::Type GetElementGeometry(int i) const
void GetElementVertices(int i, Array< int > &v) const
Returns the indices of the vertices of element i.
bool Nonconforming() const
ElementTransformation * GetFaceTransformation(int FaceNo)
Returns a pointer to the transformation defining the given face element.
int GetNE() const
Returns number of elements.
int Dimension() const
Dimension of the reference space used within the elements.
ElementTransformation * GetTypicalElementTransformation()
If the local mesh is not empty return GetElementTransformation(0); otherwise, return the identity tra...
real_t GetElementSize(int i, int type=0)
Get the size of the i-th element relative to the perfect reference element.
void GetElementTransformation(int i, IsoparametricTransformation *ElTr) const
Builds the transformation defining the i-th element in ElTr. ElTr must be allocated in advance and wi...
void GetFaceElements(int Face, int *Elem1, int *Elem2) const
Return the indices of the elements sharing face Face.
bool FaceIsInterior(int FaceNo) const
Return true if the given face is interior.
int SpaceDimension() const
Dimension of the physical space containing the mesh.
const GeometricFactors * GetGeometricFactors(const IntegrationRule &ir, const int flags, MemoryType d_mt=MemoryType::DEFAULT)
Return the mesh geometric factors corresponding to the given integration rule.
FaceElementTransformations * GetBdrFaceTransformations(int BdrElemNo)
Builds the transformation defining the given boundary face.
int GetNV() const
Returns number of vertices. Vertices are only at the corners of elements, where you would expect them...
void GetEdgeVertices(int i, Array< int > &vert) const
Returns the indices of the vertices of edge i.
static IntegrationPoint TransformBdrElementToFace(Geometry::Type geom, int o, const IntegrationPoint &ip)
For the vertex (1D), edge (2D), or face (3D) of a boundary element with the orientation o,...
void GetEdgeTransformation(int i, IsoparametricTransformation *EdTr) const
Builds the transformation defining the i-th edge element in EdTr. EdTr must be allocated in advance a...
NCMesh * ncmesh
Optional nonconforming mesh extension.
int GetNumGeometries(int dim) const
Return the number of geometries of the given dimension present in the mesh.
Geometry::Type GetElementBaseGeometry(int i) const
Array< int > attributes
A list of all unique element attributes used by the Mesh.
const real_t * GetVertex(int i) const
Return pointer to vertex i's coordinates.
A class for non-conforming AMR. The class is not used directly by the user, rather it is an extension...
bool IsLegacyLoaded() const
I/O: Return true if the mesh was loaded from the legacy v1.1 format.
virtual void GetBoundaryClosure(const Array< int > &bdr_attr_is_ess, Array< int > &bdr_vertices, Array< int > &bdr_edges, Array< int > &bdr_faces)
Get a list of vertices (2D/3D), edges (3D) and faces (3D) that coincide with boundary elements with t...
void LegacyToNewVertexOrdering(Array< int > &order) const
I/O: Return a map from old (v1.1) vertex indices to new vertex indices.
void PrintSolution(const GridFunction &sol, std::ostream &os) const
Write a GridFunction sol patch-by-patch to stream os.
void MergeGridFunctions(GridFunction *gf_array[], int num_pieces, GridFunction &merged)
Set the DOFs of merged to values from active elements in num_pieces of Gridfunctions gf_array.
void LoadSolution(std::istream &input, GridFunction &sol) const
Read a GridFunction sol from stream input, written patch-by-patch, e.g. with PrintSolution().
int Height() const
Get the height (size of output) of the Operator. Synonym with NumRows().
virtual void Mult(const Vector &x, Vector &y) const =0
Operator application: y=A(x).
int Width() const
Get the width (size of input) of the Operator. Synonym with NumCols().
const Vector & GetControlPoints() const
Get 1D control point locations (lexicographic order) in [0,1].
void GetNDBounds(const int rdim, const Vector &coeff, Vector &intmin, Vector &intmax) const
Compute piecewise linear bounds for the lexicographically-ordered nodal coefficients in coeff in 1D/2...
int GetNControlPoints() const
Get number of control points used to compute the bounds.
Matrix-free transfer operator between finite element spaces on the same mesh.
void Mult(const Vector &x, Vector &y) const override
Interpolation or prolongation of a vector x corresponding to the coarse space to the vector y corresp...
Abstract parallel finite element space.
static void CalcLegendre(const int p, const real_t x, real_t *u)
Piecewise-(bi)quadratic continuous finite elements.
A class that performs interpolation from an E-vector to quadrature point values and/or derivatives (Q...
void SetOutputLayout(QVectorLayout layout) const
Set the desired output Q-vector layout. The default value is QVectorLayout::byNODES.
void DisableTensorProducts(bool disable=true) const
Disable the use of tensor product evaluations, for tensor-product elements, e.g. quads and hexes....
void PhysDerivatives(const Vector &e_vec, Vector &q_der) const
Interpolate the derivatives in physical space of the E-vector e_vec at quadrature points.
void Mult(const Vector &xt, Vector &x) const override
void SetBounds(const Vector &lo_, const Vector &hi_)
void SetLinearConstraint(const Vector &w_, real_t a_)
void Mult(const Vector &x, Vector &y) const override
Matrix vector multiplication.
const Array< int > & GetDofMap() const
Get an Array<int> that maps lexicographically ordered indices to the indices of the respective nodes/...
Low-level class for writing VTKHDF data (for use in ParaView).
void SaveGridFunction(const GridFunction &gf, const std::string &name)
Save the grid function with the given name, appending as a new time step.
void SaveMesh(const Mesh &mesh, bool high_order=true, int ref=-1)
Save the mesh, appending as a new time step.
Base class for vector Coefficients that optionally depend on time and space.
int GetVDim()
Returns dimension of the vector.
virtual void Eval(Vector &V, ElementTransformation &T, const IntegrationPoint &ip)=0
Evaluate the vector coefficient in the element described by T at the point ip, storing the result in ...
Scalar coefficient defined as component of a vector coefficient.
void SetComponent(int c)
Set the component.
Class used for extruding a vector coefficient.
void Eval(Vector &v, ElementTransformation &T, const IntegrationPoint &ip) override
Evaluate the vector coefficient in the element described by T at the point ip, storing the result in ...
for VectorFiniteElements (Nedelec, Raviart-Thomas)
A general vector function coefficient.
Vector coefficient defined by a vector GridFunction.
void Print(std::ostream &out=mfem::out, int width=8) const
Prints vector to stream out.
void SetDataAndSize(real_t *d, int s)
Set the Vector data and size.
real_t Norml1() const
Returns the l_1 norm of the vector.
void SetSubVector(const Array< int > &dofs, const real_t value)
Set the entries listed in dofs to the given value.
void AddElementVector(const Array< int > &dofs, const Vector &elemvect)
Add elements of the elemvect Vector to the entries listed in dofs. Negative dof values cause the -dof...
void Swap(Vector &other)
Swap the contents of two Vectors.
real_t Norml2() const
Returns the l2 norm of the vector.
void Load(std::istream **in, int np, int *dim)
Reads a vector from multiple files.
void NewMemoryAndSize(const Memory< real_t > &mem, int s, bool own_mem)
Reset the Vector to use the given external Memory mem and size s.
real_t Max() const
Returns the maximal element of the vector.
virtual bool UseDevice() const
Return the device flag of the Memory object used by the Vector.
int Size() const
Returns the size of the vector.
virtual void UseDevice(bool use_dev) const
Enable execution of Vector operations using the mfem::Device.
real_t Sum() const
Return the sum of the vector entries.
void SetSize(int s)
Resize the vector to size s.
virtual real_t * HostWrite()
Shortcut for mfem::Write(vec.GetMemory(), vec.Size(), false).
void NewDataAndSize(real_t *d, int s)
Set the Vector data and size, deleting the old data, if owned.
real_t * GetData() const
Return a pointer to the beginning of the Vector data.
Vector & operator=(const real_t *v)
Copy Size() entries from v.
virtual real_t * HostReadWrite()
Shortcut for mfem::ReadWrite(vec.GetMemory(), vec.Size(), false).
real_t Min() const
Returns the minimal element of the vector.
void GetSubVector(const Array< int > &dofs, Vector &elemvect) const
Extract entries listed in dofs to the output Vector elemvect.
Vector & Add(const real_t a, const Vector &Va)
(*this) += a * Va
void MakeRef(Vector &base, int offset, int size)
Reset the Vector to be a reference to a sub-vector of base.
void Save(const GridFunction &grid_function, const std::string &variable_name, const data_type type)
real_t weight(const Vector &x)
std::ostream & operator<<(std::ostream &os, SparseMatrix const &mat)
ProjectType
This enumerated type describes the main projection types used by GridFunction::ProjectCoefficient():
void CalcOrtho(const DenseMatrix &J, Vector &n)
void TensorProductLegendre(int dim, int order, const Vector &x_in, const Vector &xmax, const Vector &xmin, Vector &poly, real_t angle, const Vector *midpoint)
Defines the global tensor product polynomial space used by NewZZErorrEstimator.
GridFunction * Extrude1DGridFunction(Mesh *mesh, Mesh *mesh2d, GridFunction *sol, const int ny)
Extrude a 1D GridFunction, after extruding the mesh with Extrude1D()
real_t u(const Vector &xvec)
void Mult(const Table &A, const Table &B, Table &C)
C = A * B (as boolean matrices)
GeometryRefiner GlobGeometryRefiner
void AddMultVVt(const Vector &v, DenseMatrix &VVt)
VVt += v v^t.
OutStream out(std::cout)
Global stream used by the library for standard output. Initially it uses the same std::streambuf as s...
real_t Distance(const real_t *x, const real_t *y, const int n)
void CalcInverse(const DenseMatrix &a, DenseMatrix &inva)
void AddMult_a_VVt(const real_t a, const Vector &v, DenseMatrix &VVt)
VVt += a * v v^t.
real_t ZZErrorEstimator(BilinearFormIntegrator &blfi, GridFunction &u, GridFunction &flux, Vector &error_estimates, Array< int > *aniso_flags, int with_subdomains, bool with_coeff)
bool IsIdentityProlongation(const Operator *P)
real_t LSZZErrorEstimator(BilinearFormIntegrator &blfi, GridFunction &u, Vector &error_estimates, bool subdomain_reconstruction, bool with_coeff, real_t tichonov_coeff)
A `‘true’' ZZ error estimator that uses face-based patches for flux reconstruction.
void BoundingBox(const Array< int > &patch, FiniteElementSpace *ufes, int order, Vector &xmin, Vector &xmax, real_t &angle, Vector &midpoint, int iface)
Defines the bounding box for the face patches used by NewZZErorrEstimator.
void MultVVt(const Vector &v, DenseMatrix &vvt)
Make a matrix from a vector V.Vt.
bool LinearSolve(DenseMatrix &A, real_t *X, real_t TOL)
Solves the dense linear system, A * X = B for X
OutStream err(std::cerr)
Global stream used by the library for standard error output. Initially it uses the same std::streambu...
void AddMult_a_AAt(real_t a, const DenseMatrix &A, DenseMatrix &AAt)
AAt += a * A * A^t.
void filter_dos(std::string &line)
Check for, and remove, a trailing '\r' from and std::string.
bool UsesTensorBasis(const FiniteElementSpace &fes)
Return true if the mesh contains only one topology and the elements are tensor elements.
void MultAAt(const DenseMatrix &a, DenseMatrix &aat)
Calculate the matrix A.At.
real_t ComputeElementLpDistance(real_t p, int i, GridFunction &gf1, GridFunction &gf2)
Compute the Lp distance between two grid functions on the given element.
QVectorLayout
Type describing possible layouts for Q-vectors.
ComplexDenseMatrix * MultAtB(const ComplexDenseMatrix &A, const ComplexDenseMatrix &B)
Multiply the complex conjugate transpose of a matrix A with a matrix B. A^H*B.
MemoryType
Memory types supported by MFEM.
ElementDofOrdering
Constants describing the possible orderings of the DOFs in one element.
@ NATIVE
Native ordering as defined by the FiniteElement.
std::function< real_t(const Vector &)> f(real_t mass_coeff)
void skip_comment_lines(std::istream &is, const char comment_char)
Check if the stream starts with comment_char. If so skip it.
constexpr real_t infinity()
Define a shortcut for std::numeric_limits<double>::infinity()
IntegrationRules IntRules(0, Quadrature1D::GaussLegendre)
A global object with all integration rules (defined in intrules.cpp)
real_t p(const Vector &x, real_t t)
real_t sol(const Vector &x)
void Project(GridFunction &gf, CoefficientType &coef, int proj_type)
MFEM_HOST_DEVICE real_t norm(const Complex &z)
Helper struct to convert a C++ type to an MPI type.
void pts(int iphi, int t, real_t x[])