49 istream::int_type next_char = input.peek();
55 if (buff ==
"NURBS_patches")
58 "NURBS_patches requires NURBS FE space");
63 MFEM_ABORT(
"unknown section: " << buff);
104 int g_nddofs = g_ndofs - (g_nvdofs + g_nedofs + g_nfdofs);
106 vi = ei = fi = di = 0;
107 for (
int i = 0; i < num_pieces; i++)
114 int l_nddofs = l_ndofs - (l_nvdofs + l_nedofs + l_nfdofs);
119 for (
int d = 0; d < vdim; d++)
121 memcpy(g_data+vi, l_data, l_nvdofs*
sizeof(
real_t));
124 memcpy(g_data+ei, l_data, l_nedofs*
sizeof(
real_t));
127 memcpy(g_data+fi, l_data, l_nfdofs*
sizeof(
real_t));
130 memcpy(g_data+di, l_data, l_nddofs*
sizeof(
real_t));
137 memcpy(g_data+vdim*vi, l_data, l_nvdofs*
sizeof(
real_t)*vdim);
138 l_data += vdim*l_nvdofs;
139 g_data += vdim*g_nvdofs;
140 memcpy(g_data+vdim*ei, l_data, l_nedofs*
sizeof(
real_t)*vdim);
141 l_data += vdim*l_nedofs;
142 g_data += vdim*g_nedofs;
143 memcpy(g_data+vdim*fi, l_data, l_nfdofs*
sizeof(
real_t)*vdim);
144 l_data += vdim*l_nfdofs;
145 g_data += vdim*g_nfdofs;
146 memcpy(g_data+vdim*di, l_data, l_nddofs*
sizeof(
real_t)*vdim);
147 l_data += vdim*l_nddofs;
148 g_data += vdim*g_nddofs;
192 old_data.
Swap(*
this);
195 T->
Mult(old_data, *
this);
208 const std::shared_ptr<const PRefinementTransferOperator> Tp =
213 old_data.
Swap(*
this);
214 MFEM_VERIFY(Tp->Width() == old_data.
Size(),
215 "Wrong size of PRefinementTransferOperator in UpdatePRef");
218 Tp->Mult(old_data, *
this);
222 MFEM_ABORT(
"Transfer operator undefined in GridFunction::UpdatePRef");
244 MFEM_ASSERT(v.
Size() >= v_offset +
f->GetVSize(),
"");
276 MFEM_ASSERT(tv.
Size() >= tv_offset +
f->GetTrueVSize(),
"");
295 int nfe = ufes->
GetNE();
304 for (
int i = 0; i < nfe; i++)
306 if (subdomain >= 0 && ufes->
GetAttribute(i) != subdomain)
314 u.GetSubVector(udofs, ul);
319 *ffes->
GetFE(i), fl, wcoef);
325 for (
int j = 0; j < fdofs.
Size(); j++)
341 for (
int i = 0; i < count.
Size(); i++)
343 if (count[i] != 0) { flux(i) /= count[i]; }
406 int dof = FElem->
GetDof();
419 for (
int k = 0; k < n; k++)
422 nval[k] = shape * (&loc_data[dof * vdim]);
428 for (
int k = 0; k < n; k++)
432 nval[k] = shape * (&loc_data[dof * vdim]);
440 for (
int k = 0; k < n; k++)
444 nval[k] = loc_data * (&vshape(0,vdim));
471 return (DofVal * LocVec);
478 int dof = FElem->
GetDof();
500 for (
int k = 0; k < vdim; k++)
502 val(k) = shape * (&loc_data[dof * k]);
527 int dof = FElem->
GetDof();
528 Vector DofVal(dof), loc_data(dof);
533 for (
int k = 0; k < n; k++)
536 vals(k) = DofVal * loc_data;
542 for (
int k = 0; k < n; k++)
546 vals(k) = DofVal * loc_data;
575 "invalid FE map type");
577 int dof = FElem->
GetDof();
578 Vector DofLap(dof), loc_data(dof);
580 for (
int k = 0; k < n; k++)
585 laps(k) = DofLap * loc_data;
618 "invalid FE map type");
620 int dof = FElem->
GetDof();
628 for (
int k = 0; k < n; k++)
634 for (
int j = 0; j <
size; j++)
636 for (
int d = 0; d < dof; d++)
638 hess(k,j) += DofHes(d,j) * loc_data[d];
718 int comp,
Vector *tr)
const
744 MFEM_ABORT(
"GridFunction::GetValue: Field continuity type \""
746 <<
"on mesh edges.");
759 MFEM_ABORT(
"GridFunction::GetValue: Field continuity type \""
761 <<
"on mesh faces.");
780 MFEM_ASSERT(FET !=
nullptr,
781 "FaceElementTransformation must be valid for a boundary element");
810 MFEM_ABORT(
"GridFunction::GetValue: Unsupported element type \""
828 return (DofVal * LocVec);
843 for (
int j = 0; j < nip; j++)
880 MFEM_ABORT(
"GridFunction::GetVectorValue: Field continuity type \""
882 <<
"on mesh edges.");
895 MFEM_ABORT(
"GridFunction::GetVectorValue: Field continuity type \""
897 <<
"on mesh faces.");
916 MFEM_ASSERT(FET !=
nullptr,
917 "FaceElementTransformation must be valid for a boundary element");
937 MFEM_ASSERT(FET !=
nullptr,
938 "FaceElementTransformation must be valid for a boundary element");
948 MFEM_ABORT(
"GridFunction::GetVectorValue: Unsupported element type \""
950 if (val.
Size() > 0) { val = NAN; }
972 for (
int k = 0; k < vdim; k++)
974 val(k) = shape * (&loc_data[dof * k]);
999 int dof = FElem->
GetDof();
1015 for (
int j = 0; j < nip; j++)
1021 for (
int k = 0; k < vdim; k++)
1023 vals(k,j) = shape * (&loc_data[dof * k]);
1030 int vdim = std::max(spaceDim, FElem->
GetRangeDim());
1036 for (
int j = 0; j < nip; j++)
1077 MFEM_ASSERT(Transf !=
nullptr,
"FaceElementTransformation cannot be null!");
1084 MFEM_ASSERT(Transf !=
nullptr,
"FaceElementTransformation cannot be null!");
1098 Vector shape, loc_values, orig_loc_values;
1099 int i, j, d, ne, dof, odof, vdim;
1104 for (i = 0; i < ne; i++)
1113 odof = orig_fe->
GetDof();
1114 loc_values.
SetSize(dof * vdim);
1117 for (j = 0; j < dof; j++)
1121 for (d = 0; d < vdim; d++)
1123 loc_values(d*dof+j) = shape * (&orig_loc_values[d * odof]);
1137 Vector shape, loc_values, loc_values_t, orig_loc_values, orig_loc_values_t;
1138 int i, j, d, nbe, dof, odof, vdim;
1142 for (i = 0; i < nbe; i++)
1150 odof = orig_fe->
GetDof();
1151 loc_values.
SetSize(dof * vdim);
1154 for (j = 0; j < dof; j++)
1158 for (d = 0; d < vdim; d++)
1160 loc_values(d*dof+j) = shape * (&orig_loc_values[d * odof]);
1178 const int dof = fe->
GetDof();
1180 const int vdim = std::max(sdim, fe->
GetRangeDim());
1186 Vector loc_data, val(vdim);
1189 for (
int k = 0; k < n; k++)
1195 for (
int d = 0; d < vdim; d++)
1215 for (j = 0; j < ndofs; j++)
1216 for (i = 0; i < vdim; i++)
1218 temp[j+i*ndofs] =
data[k++];
1221 for (i = 0; i <
size; i++)
1249 val(vertices[k]) += vals(k, comp);
1250 overlap[vertices[k]]++;
1254 for (i = 0; i < overlap.
Size(); i++)
1256 val(i) /= overlap[i];
1271 for (
int i = 0; i < new_fes->
GetNE(); i++)
1277 const int dof = fe->
GetDof();
1278 for (
int d = 0; d < vals.
Width(); d++)
1280 for (
int k = 0; k < dof; k++)
1284 vec_field(ind) += s * vals(k, d);
1290 for (
int i = 0; i < overlap.
Size(); i++)
1292 vec_field(i) /= overlap[i];
1305 Vector pt_grad, loc_func;
1306 int i, j, k,
dim, dof, der_dof, ind;
1313 for (i = 0; i < der_fes->
GetNE(); i++)
1322 der_dof = der_fe->
GetDof();
1328 for (j = 0; j < dof; j++)
1329 loc_func(j) = ( (ind=vdofs[comp*dof+j]) >= 0 ) ?
1331 for (k = 0; k < der_dof; k++)
1339 for (j = 0; j <
dim; j++)
1341 a += inv_jac(j, der_comp) * pt_grad(j);
1343 der(der_dofs[k]) +=
a;
1344 zones_per_dof[der_dofs[k]]++;
1355 for (
int i = 0; i < overlap.
Size(); i++)
1357 der(i) /= overlap[i];
1374 MultAtB(loc_data_mat, dshape, gh);
1384 const int ND = fe.
GetDof();
1411 Vector f_e(vdim*ND*NE, my_d_mt);
1412 elem_restr->
Mult(*
this, f_e);
1433 "invalid FE map type");
1438 for (
int i = 0; i < Jinv.
Width(); i++)
1440 for (
int j = 0; j < Jinv.
Height(); j++)
1442 div_v += grad_hat(i, j) * Jinv(j, i);
1456 return (loc_data * divshape) / T.
Weight();
1498 MFEM_ABORT(
"GridFunction::GetDivergence: Unsupported element type \""
1517 "invalid FE map type");
1523 Mult(grad_hat, Jinv, grad);
1528 curl(0) = grad(2,1) - grad(1,2);
1529 curl(1) = grad(0,2) - grad(2,0);
1530 curl(2) = grad(1,0) - grad(0,1);
1532 else if (grad.
Height() == 2)
1535 curl(0) = grad(1,0) - grad(0,1);
1589 MFEM_ABORT(
"GridFunction::GetCurl: Unsupported element type \""
1603 "invalid FE map type");
1604 MFEM_ASSERT(
fes->
GetVDim() == 1,
"Defined for scalar functions.");
1654 MFEM_ABORT(
"GridFunction::GetGradient: Unsupported element type \""
1664 int elNo = tr.ElementNo;
1677 tr.SetIntPoint(&ip);
1697 Mult(grad_hat, Jinv, grad);
1736 MFEM_ABORT(
"GridFunction::GetVectorGradient: "
1737 "Unsupported element type \"" << T.
ElementType <<
"\"");
1747 Vector loc_avgs, loc_this;
1753 for (
int i = 0; i <
fes->
GetNE(); i++)
1762 loc_mass.
Mult(loc_this, loc_avgs);
1766 loc_mass.
Mult(loc_this, loc_avgs);
1769 for (
int i = 0; i < avgs.
Size(); i++)
1771 avgs(i) /= int_psi(i);
1790 if (!mesh->
GetNE()) {
return; }
1801 MFEM_VERIFY(vdim == src.
fes->
GetVDim(),
"incompatible vector dimensions!");
1807 for (
int i = 0; i < mesh->
GetNE(); i++)
1821 for (
int vd = 0; vd < vdim; vd++)
1843 MFEM_ASSERT(weights.
Size() ==
size,
"Different # of weights and dofs.");
1844 MFEM_ASSERT(lo_.
Size() ==
size,
"Different # of lower bounds and dofs.");
1845 MFEM_ASSERT(hi_.
Size() ==
size,
"Different # of upper bounds and dofs.");
1856 slbqp.
Mult(vals, new_vals);
1876 if (max_val <= min_)
1884 if (min_ <= min_val && max_val <= max_)
1890 minv = (min_ > min_val) ? min_ : min_val;
1891 maxv = (max_ < max_val) ? max_ : max_val;
1904 R->
Mult(*
this, tmp);
1905 P->
Mult(tmp, *
this);
1918 for (
int i = 0; i <
fes->
GetNE(); i++)
1922 for (
int j = 0; j < vertices.
Size(); j++)
1924 nval(vertices[j]) += values[j];
1925 overlap[vertices[j]]++;
1928 for (
int i = 0; i < overlap.
Size(); i++)
1930 nval(i) /= overlap[i];
1941 for (
int i = 0; i <
fes->
GetNE(); i++)
1945 for (
int j = 0; j < vdofs.
Size(); j++)
1947 elem_per_vdof[vdofs[j]]++;
1966 for (
int i = 0; i <
fes->
GetNE(); i++)
1974 for (
int j = 0; j < vdofs.
Size(); j++)
1978 MFEM_VERIFY(vals[j] != 0.0,
1979 "Coefficient has zeros, harmonic avg is undefined!");
1980 (*this)(vdofs[j]) += 1.0 / vals[j];
1984 (*this)(vdofs[j]) += vals[j];
1986 else { MFEM_ABORT(
"Not implemented"); }
1988 zones_per_vdof[vdofs[j]]++;
2007 for (
int i = 0; i <
fes->
GetNE(); i++)
2015 for (
int j = 0; j < vdofs.
Size(); j++)
2032 MFEM_VERIFY(vals[j] != 0.0,
2033 "Coefficient has zeros, harmonic avg is undefined!");
2034 (*this)(ldof) += isign / vals[j];
2038 (*this)(ldof) += isign*vals[j];
2041 else { MFEM_ABORT(
"Not implemented"); }
2043 zones_per_vdof[ldof]++;
2066 const int fdof = fe->
GetDof();
2071 for (
int j = 0; j < fdof; j++)
2075 if (vcoeff) { vcoeff->
Eval(vc, *transf, ip); }
2076 for (
int d = 0; d < vdim; d++)
2078 if (!vcoeff && !coeff[d]) {
continue; }
2080 real_t val = vcoeff ? vc(d) : coeff[d]->
Eval(*transf, ip);
2081 int ind = vdofs[fdof*d+j];
2084 val = -val, ind = -1-ind;
2086 if (++values_counter[ind] == 1)
2092 (*this)(ind) += val;
2113 Array<int> bdr_edges, bdr_vertices, bdr_faces;
2121 for (
int d = 0; d < vdim; d++)
2123 if (!coeff[d]) {
continue; }
2125 fe.Project(*coeff[d], transf, vals);
2126 for (
int k = 0; k < vals.
Size(); k++)
2128 const int ind = vdofs[d*vals.
Size()+k];
2129 if (++values_counter[ind] == 1)
2131 (*this)(ind) = vals(k);
2135 (*this)(ind) += vals(k);
2142 vals.
SetSize(vdim*fe.GetDof());
2143 fe.Project(*vcoeff, transf, vals);
2144 for (
int k = 0; k < vals.
Size(); k++)
2146 const int ind = vdofs[k];
2147 if (++values_counter[ind] == 1)
2149 (*this)(ind) = vals(k);
2153 (*this)(ind) += vals(k);
2159 for (
auto edge : bdr_edges)
2162 if (vdofs.
Size() == 0) {
continue; }
2166 mark_dofs(*transf, *fe);
2169 for (
auto face : bdr_faces)
2172 if (vdofs.
Size() == 0) {
continue; }
2176 mark_dofs(*transf, *fe);
2184 for (
int i = 0; i < dofs.
Size(); i++)
2188 if (k < 0) { k = -1 - k; val = -val; }
2189 if (++values_counter[k] == 1)
2225 fe->
Project(vcoeff, *T, lvec);
2227 accumulate_dofs(dofs, lvec, *
this, values_counter);
2235 Array<int> bdr_edges, bdr_vertices, bdr_faces;
2238 for (
auto edge : bdr_edges)
2241 if (dofs.
Size() == 0) {
continue; }
2246 fe->
Project(vcoeff, *T, lvec);
2247 accumulate_dofs(dofs, lvec, *
this, values_counter);
2250 for (
auto face : bdr_faces)
2253 if (dofs.
Size() == 0) {
continue; }
2258 fe->
Project(vcoeff, *T, lvec);
2259 accumulate_dofs(dofs, lvec, *
this, values_counter);
2269 for (
int i = 0; i <
size; i++)
2271 const int nz = zones_per_vdof[i];
2272 if (nz) { (*this)(i) /= nz; }
2277 for (
int i = 0; i <
size; i++)
2279 const int nz = zones_per_vdof[i];
2280 if (nz) { (*this)(i) = nz/(*
this)(i); }
2285 MFEM_ABORT(
"invalid AvgType");
2307 for (
int i = 0; i < mesh->
GetNV(); i++)
2311 if (dist < min_dist)
2321 if (min_dist >= delta_coeff.
Tol())
2330 Vector vals, loc_mass_vals;
2333 for (
int i = 0; i < mesh->
GetNE(); i++)
2336 for (
int j = 0; j < vertices.
Size(); j++)
2337 if (vertices[j] == v_idx)
2348 loc_mass.
Mult(vals, loc_mass_vals);
2349 integral += loc_mass_vals.
Sum();
2360 if (delta_c == NULL)
2367 for (
int i = 0; i <
fes->
GetNE(); i++)
2409 (*this) *= (delta_c->
Scale() / integral);
2420 for (
int i = 0; i < dofs.
Size(); i++)
2433 (*this)(vdof) = coeff.
Eval(*T, ip);
2492 for (
int i = 0; i < dofs.
Size(); i++)
2504 vcoeff.
Eval(val, *T, ip);
2508 (*this)(vdof) = val(vd);
2537 int i, j, fdof, d, ind, vdim;
2552 for (j = 0; j < fdof; j++)
2556 for (d = 0; d < vdim; d++)
2558 if (!coeff[d]) {
continue; }
2560 val = coeff[d]->
Eval(*transf, ip);
2561 if ( (ind = vdofs[fdof*d+j]) < 0 )
2563 val = -val, ind = -1-ind;
2583 for (
int i = 0; i <
fes->
GetNE(); i++)
2592 for (
int j = 0; j < vdofs.
Size(); j++)
2594 if (attr > dof_attr[vdofs[j]])
2596 (*this)(vdofs[j]) = vals[j];
2597 dof_attr[vdofs[j]] = attr;
2639 for (
int i = 0; i < values_counter.
Size(); i++)
2641 MFEM_ASSERT(
bool(values_counter[i]) ==
bool(ess_vdofs_marker[i]),
2657 ess_vdofs_marker = 0;
2661 if (!coeff[i]) {
continue; }
2663 for (
int j = 0; j<
Size(); j++)
2665 ess_vdofs_marker[j] = bool(ess_vdofs_marker[j]) ||
2666 bool(component_dof_marker[j]);
2669 for (
int i = 0; i < values_counter.
Size(); i++)
2671 MFEM_ASSERT(
bool(values_counter[i]) ==
bool(ess_vdofs_marker[i]),
2707 vcoeff.
Eval(vc, *T, ip);
2710 lvec.
Add(ip.
weight * (vc * nor), shape);
2739 vcoeff.
Eval(vc, *T, ip);
2741 lvec(j) = (vc * nor);
2759 for (
int i = 0; i < values_counter.
Size(); i++)
2761 MFEM_ASSERT(
bool(values_counter[i]) ==
bool(ess_vdofs_marker[i]),
2776 int fdof, d, i, intorder, j, k;
2780 if (elems != NULL && (*elems)[i] == 0) {
continue; }
2805 for (k = 0; k < fdof; k++)
2806 if (vdofs[fdof*d+k] >= 0)
2808 a += (*this)(vdofs[fdof*d+k]) * shape(k);
2812 a -= (*this)(-1-vdofs[fdof*d+k]) * shape(k);
2814 a -= exsol[d]->
Eval(*transf, ip);
2819 error += fabs(elem_error);
2835 for (
int i = 0; i <
fes->
GetNE(); i++)
2837 if (elems != NULL && (*elems)[i] == 0) {
continue; }
2839 int intorder = 2*fe->
GetOrder() + 3;
2852 exsol.
Eval(exact_vals, *T, *ir);
2855 vals.
Norm2(loc_errs);
2860 elem_error += ip.
weight * T->
Weight() * (loc_errs(j) * loc_errs(j));
2863 error += fabs(elem_error);
2899 exgrad->
Eval(vec,*Tr,ip);
2903 return sqrt(fabs(error));
2918 for (
int i = 0; i <
fes->
GetNE(); i++)
2939 exgrad->
Eval(vec,*Tr,ip);
2944 error += fabs(elem_error);
2961 for (
int i = 0; i <
fes->
GetNE(); i++)
2982 excurl->
Eval(vec,*Tr,ip);
2984 elem_error += ip.
weight * Tr->
Weight() * ( vec * vec );
2987 error += fabs(elem_error);
3002 for (
int i = 0; i <
fes->
GetNE(); i++)
3026 error += fabs(elem_error);
3037 int fdof, intorder, k;
3042 Vector shape, el_dofs, err_val, ell_coeff_val;
3064 intorder = 2 * intorder;
3078 transf = face_elem_transf->
Elem1;
3084 for (k = 0; k < fdof; k++)
3087 el_dofs(k) = (*this)(vdofs[k]);
3091 el_dofs(k) = - (*this)(-1-vdofs[k]);
3098 ell_coeff_val(j) = ell_coeff->
Eval(*transf, eip);
3099 err_val(j) = exsol->
Eval(*transf, eip) - (shape * el_dofs);
3105 transf = face_elem_transf->
Elem2;
3111 for (k = 0; k < fdof; k++)
3114 el_dofs(k) = (*this)(vdofs[k]);
3118 el_dofs(k) = - (*this)(-1-vdofs[k]);
3125 ell_coeff_val(j) += ell_coeff->
Eval(*transf, eip);
3126 ell_coeff_val(j) *= 0.5;
3127 err_val(j) -= (exsol->
Eval(*transf, eip) - (shape * el_dofs));
3132 transf = face_elem_transf;
3138 face_error += (ip.
weight * nu * ell_coeff_val(j) *
3140 err_val(j) * err_val(j));
3143 error += fabs(face_error);
3161 int norm_type)
const
3172 return sqrt(error1 * error1 + error2 * error2);
3181 return sqrt(L2error*L2error + GradError*GradError);
3190 return sqrt(L2error*L2error + DivError*DivError);
3199 return sqrt(L2error*L2error + CurlError*CurlError);
3210 int fdof, d, i, intorder, j, k;
3237 for (k = 0; k < fdof; k++)
3238 if (vdofs[fdof*d+k] >= 0)
3240 a += (*this)(vdofs[fdof*d+k]) * shape(k);
3244 a -= (*this)(-1-vdofs[fdof*d+k]) * shape(k);
3246 a -= exsol[d]->
Eval(*transf, ip);
3263 int i, fdof,
dim, intorder, j, k;
3267 Vector e_grad, a_grad, shape, el_dofs, err_val, ell_coeff_val;
3279 for (i = 0; i < mesh->
GetNE(); i++)
3281 if (elems != NULL && (*elems)[i] == 0) {
continue; }
3299 for (k = 0; k < fdof; k++)
3302 el_dofs(k) = (*this)(vdofs[k]);
3306 el_dofs(k) = -(*this)(-1-vdofs[k]);
3313 a = (el_dofs * shape) - (exsol->
Eval(*transf, ip));
3316 error += fabs(elem_error);
3320 for (i = 0; i < mesh->
GetNE(); i++)
3322 if (elems != NULL && (*elems)[i] == 0) {
continue; }
3341 for (k = 0; k < fdof; k++)
3344 el_dofs(k) = (*this)(vdofs[k]);
3348 el_dofs(k) = -(*this)(-1-vdofs[k]);
3355 exgrad->
Eval(e_grad, *transf, ip);
3357 Mult(dshape, Jinv, dshapet);
3362 error += fabs(elem_error);
3378 for (
int i = 0; i <
fes->
GetNE(); i++)
3380 if (elems != NULL && (*elems)[i] == 0) {
continue; }
3389 int intorder = 2*fe->
GetOrder() + 3;
3399 real_t diff = fabs(vals(j) - exsol.
Eval(*T, ip));
3402 diff = pow(diff,
p);
3405 diff *= weight->Eval(*T, ip);
3413 diff *= weight->Eval(*T, ip);
3415 error = std::max(error, diff);
3421 error += fabs(elem_error);
3427 error = pow(error, 1./
p);
3439 "Incorrect size for result vector");
3446 for (
int i = 0; i <
fes->
GetNE(); i++)
3456 int intorder = 2*fe->
GetOrder() + 3;
3465 real_t diff = fabs(vals(j) - exsol.
Eval(*T, ip));
3468 diff = pow(diff,
p);
3471 diff *= weight->Eval(*T, ip);
3479 diff *= weight->Eval(*T, ip);
3481 error[i] = std::max(error[i], diff);
3487 error[i] = pow(fabs(error[i]), 1./
p);
3503 for (
int i = 0; i <
fes->
GetNE(); i++)
3513 int intorder = 2*fe->
GetOrder() + 3;
3519 exsol.
Eval(exact_vals, *T, *ir);
3526 vals.
Norm2(loc_errs);
3530 v_weight->
Eval(exact_vals, *T, *ir);
3533 for (
int j = 0; j < vals.
Width(); j++)
3536 for (
int d = 0; d < vals.
Height(); d++)
3538 errj += vals(d,j)*exact_vals(d,j);
3540 loc_errs(j) = fabs(errj);
3547 real_t errj = loc_errs(j);
3550 errj = pow(errj,
p);
3553 errj *= weight->Eval(*T, ip);
3561 errj *= weight->Eval(*T, ip);
3563 error = std::max(error, errj);
3569 error += fabs(elem_error);
3575 error = pow(error, 1./
p);
3589 "Incorrect size for result vector");
3597 for (
int i = 0; i <
fes->
GetNE(); i++)
3607 int intorder = 2*fe->
GetOrder() + 3;
3612 exsol.
Eval(exact_vals, *T, *ir);
3619 vals.
Norm2(loc_errs);
3623 v_weight->
Eval(exact_vals, *T, *ir);
3626 for (
int j = 0; j < vals.
Width(); j++)
3629 for (
int d = 0; d < vals.
Height(); d++)
3631 errj += vals(d,j)*exact_vals(d,j);
3633 loc_errs(j) = fabs(errj);
3640 real_t errj = loc_errs(j);
3643 errj = pow(errj,
p);
3646 errj *= weight->Eval(*T, ip);
3654 errj *= weight->Eval(*T, ip);
3656 error[i] = std::max(error[i], errj);
3662 error[i] = pow(fabs(error[i]), 1./
p);
3688 os <<
"NURBS_patches\n";
3707 ofstream ofs(fname);
3708 ofs.precision(precision);
3712#ifdef MFEM_USE_ADIOS2
3714 const std::string& variable_name,
3717 os.
Save(*
this, variable_name, type);
3733 os <<
"SCALARS " << field_name <<
" double 1\n"
3734 <<
"LOOKUP_TABLE default\n";
3735 for (
int i = 0; i < mesh->
GetNE(); i++)
3742 for (
int j = 0; j < val.
Size(); j++)
3744 os << val(j) <<
'\n';
3748 else if ( (vec_dim == 2 || vec_dim == 3) && mesh->
SpaceDimension() > 1)
3751 os <<
"VECTORS " << field_name <<
" double\n";
3752 for (
int i = 0; i < mesh->
GetNE(); i++)
3761 for (
int j = 0; j < vval.
Width(); j++)
3763 os << vval(0, j) <<
' ' << vval(1, j) <<
' ';
3779 for (
int vd = 0; vd < vec_dim; vd++)
3781 os <<
"SCALARS " << field_name << vd <<
" double 1\n"
3782 <<
"LOOKUP_TABLE default\n";
3783 for (
int i = 0; i < mesh->
GetNE(); i++)
3790 for (
int j = 0; j < val.
Size(); j++)
3792 os << val(j) <<
'\n';
3803 bool high_order,
int ref)
3809#ifdef MFEM_PARALLEL_HDF5
3810 VTKHDF vtkhdf(fname, pfes->GetComm());
3815 MFEM_ABORT(
"Requires HDF5 library with parallel support enabled");
3829 real_t v1[3] = { p2[0] - p1[0], p2[1] - p1[1], p2[2] - p1[2] };
3830 real_t v2[3] = { p3[0] - p1[0], p3[1] - p1[1], p3[2] - p1[2] };
3831 real_t n[] = { v1[1] * v2[2] - v1[2] * v2[1],
3832 v1[2] * v2[0] - v1[0] * v2[2],
3833 v1[0] * v2[1] - v1[1] * v2[0]
3835 real_t rl = 1.0 / sqrt(n[0] * n[0] + n[1] * n[1] + n[2] * n[2]);
3836 n[0] *= rl; n[1] *= rl; n[2] *= rl;
3838 os <<
" facet normal " << n[0] <<
' ' << n[1] <<
' ' << n[2]
3840 <<
"\n vertex " << p1[0] <<
' ' << p1[1] <<
' ' << p1[2]
3841 <<
"\n vertex " << p2[0] <<
' ' << p2[1] <<
' ' << p2[2]
3842 <<
"\n vertex " << p3[0] <<
' ' << p3[1] <<
' ' << p3[2]
3843 <<
"\n endloop\n endfacet\n";
3861 os <<
"solid GridFunction\n";
3863 bbox[0][0] = bbox[0][1] = bbox[1][0] = bbox[1][1] =
3864 bbox[2][0] = bbox[2][1] = 0.0;
3865 for (i = 0; i < mesh->
GetNE(); i++)
3872 for (k = 0; k < RG.
Size()/n; k++)
3874 for (j = 0; j < n; j++)
3877 pts[j][0] = pointmat(0,l);
3878 pts[j][1] = pointmat(1,l);
3879 pts[j][2] = values(l);
3895 bbox[0][0] = pointmat(0,0);
3896 bbox[0][1] = pointmat(0,0);
3897 bbox[1][0] = pointmat(1,0);
3898 bbox[1][1] = pointmat(1,0);
3899 bbox[2][0] = values(0);
3900 bbox[2][1] = values(0);
3903 for (j = 0; j < values.
Size(); j++)
3905 if (bbox[0][0] > pointmat(0,j))
3907 bbox[0][0] = pointmat(0,j);
3909 if (bbox[0][1] < pointmat(0,j))
3911 bbox[0][1] = pointmat(0,j);
3913 if (bbox[1][0] > pointmat(1,j))
3915 bbox[1][0] = pointmat(1,j);
3917 if (bbox[1][1] < pointmat(1,j))
3919 bbox[1][1] = pointmat(1,j);
3921 if (bbox[2][0] > values(j))
3923 bbox[2][0] = values(j);
3925 if (bbox[2][1] < values(j))
3927 bbox[2][1] = values(j);
3932 mfem::out <<
"[xmin,xmax] = [" << bbox[0][0] <<
',' << bbox[0][1] <<
"]\n"
3933 <<
"[ymin,ymax] = [" << bbox[1][0] <<
',' << bbox[1][1] <<
"]\n"
3934 <<
"[zmin,zmax] = [" << bbox[2][0] <<
',' << bbox[2][1] <<
']'
3937 os <<
"endsolid GridFunction" << endl;
3954 MFEM_ASSERT(new_vertex.
Size() == mesh->
GetNV(),
"");
3958 for (
int i = 0; i < new_vertex.
Size(); i++)
3960 old_vertex[new_vertex[i]] = i;
3967 for (
int i = 0; i < mesh->
GetNV(); i++)
3972 for (
int j = 0; j < new_vdofs.
Size(); j++)
3974 tmp(new_vdofs[j]) = (*this)(old_vdofs[j]);
3980 for (
int i = 0; i < mesh->
GetNEdges(); i++)
3983 if (old_vertex[ev[0]] > old_vertex[ev[1]])
3988 for (
int k = 0; k < dofs.
Size(); k++)
3990 int new_dof = dofs[k];
3991 int old_dof = dofs[(ind[k] < 0) ? -1-ind[k] : ind[k]];
3998 real_t sign = (ind[k] < 0) ? -1.0 : 1.0;
3999 tmp(new_vdof) = sign * (*this)(old_vdof);
4026 P.
Mult(*
this, *xMax);
4029 return std::unique_ptr<GridFunction>(xMax);
4036 int with_subdomains,
4045 int nfe = ufes->
GetNE();
4049 Vector ul, fl, fla, d_xyz;
4059 if (with_subdomains)
4064 real_t total_error = 0.0;
4065 for (
int s = 1; s <= nsd; s++)
4068 u.ComputeFlux(blfi, flux, with_coeff, (with_subdomains ? s : -1));
4070 for (
int i = 0; i < nfe; i++)
4072 if (with_subdomains && ufes->
GetAttribute(i) != s) {
continue; }
4077 u.GetSubVector(udofs, ul);
4084 *ffes->
GetFE(i), fl, with_coeff);
4089 (aniso_flags ? &d_xyz : NULL));
4091 error_estimates(i) = std::sqrt(eng);
4097 for (
int k = 0; k <
dim; k++)
4104 for (
int k = 0; k <
dim; k++)
4106 if (d_xyz[k] / sum > thresh) { flag |= (1 << k); }
4109 (*aniso_flags)[i] = flag;
4117 auto process_local_error = total_error;
4118 MPI_Allreduce(&process_local_error, &total_error, 1,
4120 MPI_SUM, pfes->GetComm());
4123 return std::sqrt(total_error);
4135 MFEM_VERIFY(
dim >= 1,
"dim must be positive");
4136 MFEM_VERIFY(
dim <= 3,
"dim cannot be greater than 3");
4137 MFEM_VERIFY(order >= 0,
"order cannot be negative");
4139 bool rotate = (angle != 0.0) || (midpoint->
Norml2() != 0.0);
4148 x[0] = tmp[0]*cos(-angle) - tmp[1]*sin(-angle);
4149 x[1] = tmp[0]*sin(-angle) + tmp[1]*cos(-angle);
4158 real_t x1 = (x(0) - xmin(0))/(xmax(0)-xmin(0)), x2, x3;
4159 Vector poly_x(order+1), poly_y(order+1), poly_z(order+1);
4163 x2 = (x(1)-xmin(1))/(xmax(1)-xmin(1));
4168 x3 = (x(2)-xmin(2))/(xmax(2)-xmin(2));
4172 int basis_dimension =
static_cast<int>(pow(order+1,
dim));
4173 poly.
SetSize(basis_dimension);
4178 for (
int i = 0; i <= order; i++)
4180 poly(i) = poly_x(i);
4186 for (
int j = 0; j <= order; j++)
4188 for (
int i = 0; i <= order; i++)
4190 int cnt = i + (order+1) * j;
4191 poly(cnt) = poly_x(i) * poly_y(j);
4198 for (
int k = 0; k <= order; k++)
4200 for (
int j = 0; j <= order; j++)
4202 for (
int i = 0; i <= order; i++)
4204 int cnt = i + (order+1) * j + (order+1) * (order+1) * k;
4205 poly(cnt) = poly_x(i) * poly_y(j) * poly_z(k);
4213 MFEM_ABORT(
"TensorProductLegendre: invalid value of dim");
4229 int num_elems = patch.
Size();
4239 if (
rotate && iface >= 0)
4245 physical_diff = 0.0;
4248 for (
int i = 0; i < 2; i++)
4251 Tr.
Transform(reference_pt, physical_pt);
4252 midpoint += physical_pt;
4253 physical_pt *= pow(-1.0,i);
4254 physical_diff += physical_pt;
4257 angle = atan2(physical_diff(1),physical_diff(0));
4260 for (
int i = 0; i < num_elems; i++)
4262 int ielem = patch[i];
4273 transip -= midpoint;
4276 transip[0] = tmp[0]*cos(-angle) - tmp[1]*sin(-angle);
4277 transip[1] = tmp[0]*sin(-angle) + tmp[1]*cos(-angle);
4279 for (
int d = 0; d <
dim; d++) { xmax(d) = max(xmax(d), transip(d)); }
4280 for (
int d = 0; d <
dim; d++) { xmin(d) = min(xmin(d), transip(d)); }
4288 bool subdomain_reconstruction,
4292 MFEM_VERIFY(tichonov_coeff >= 0.0,
"tichonov_coeff cannot be negative");
4300 int nfe = ufes->
GetNE();
4301 int nfaces = ufes->
GetNF();
4308 error_estimates = 0.0;
4319 if (subdomain_reconstruction)
4324 real_t total_error = 0.0;
4325 for (
int iface = 0; iface < nfaces; iface++)
4332 patch[0] = el1; patch[1] = el2;
4335 if (el1 == -1 || el2 == -1)
4346 if (el1_attr != el2_attr) {
continue; }
4355 int num_basis_functions =
static_cast<int>(pow(patch_order+1,
dim));
4356 int flux_order = 2*patch_order + 1;
4365 xmin, xmax, angle, midpoint, iface);
4370 for (
int i = 0; i < patch.
Size(); i++)
4372 int ielem = patch[i];
4378 u.GetSubVector(udofs, ul);
4381 const auto *dummy = ufes->
GetFE(ielem);
4383 *dummy, fl, with_coeff, ir);
4387 for (
int k = 0; k < num_integration_pts; k++)
4399 for (
int l = 0; l < num_basis_functions; l++)
4402 for (
int n = 0; n < sdim; n++)
4404 b[l + n * num_basis_functions] +=
p(l) * fl(k + n * num_integration_pts);
4416 for (
int i = 0; i < num_basis_functions; i++)
4418 A(i,i) += tichonov_coeff;
4425 if (!lu.
Factor(num_basis_functions,TOL))
4428 mfem::out <<
"LSZZErrorEstimator: Matrix A is singular.\t"
4429 <<
"Consider increasing tichonov_coeff." << endl;
4430 for (
int i = 0; i < num_basis_functions; i++)
4434 lu.
Factor(num_basis_functions,TOL);
4436 lu.
Solve(num_basis_functions, sdim,
b);
4444 for (
int i = 0; i < num_basis_functions; i++)
4446 for (
int j = 0; j < sdim; j++)
4448 f(j) +=
b[i + j * num_basis_functions] *
p(i);
4455 real_t element_error = 0.0;
4456 real_t patch_error = 0.0;
4457 for (
int i = 0; i < patch.
Size(); i++)
4459 int ielem = patch[i];
4460 element_error =
u.ComputeElementGradError(ielem, &global_poly);
4461 element_error *= element_error;
4462 patch_error += element_error;
4463 error_estimates(ielem) += element_error;
4467 total_error += patch_error;
4475 for (
int ielem = 0; ielem < nfe; ielem++)
4477 if (counters[ielem] == 0)
4479 error_estimates(ielem) =
infinity();
4483 error_estimates(ielem) /= counters[ielem]/2.0;
4484 error_estimates(ielem) = sqrt(error_estimates(ielem));
4487 return std::sqrt(total_error/
dim);
4508 for (
int j = 0; j < nip; j++)
4520 errj = pow(errj,
p);
4545 return sol_in.
Eval(*T_in, ip);
4556 string cname = name;
4557 if (cname ==
"Linear")
4561 else if (cname ==
"Quadratic")
4565 else if (cname ==
"Cubic")
4569 else if (!strncmp(name,
"H1_", 3))
4573 else if (!strncmp(name,
"H1Pos_", 6))
4578 else if (!strncmp(name,
"L2_T", 4))
4582 else if (!strncmp(name,
"L2_", 3))
4586 else if (!strncmp(name,
"L2Int_", 6))
4593 mfem::err <<
"Extrude1DGridFunction : unknown FE collection : "
4613 const int vdim)
const
4621 MFEM_VERIFY(tbe != NULL,
"TensorBasis FiniteElement expected.");
4627 int ndofs = dof_idx.
Size();
4630 lower.
SetSize(n_c_pts*(vdim > 0 ? 1 : fes_dim));
4631 upper.
SetSize(n_c_pts*(vdim > 0 ? 1 : fes_dim));
4633 for (
int d = 0; d < fes_dim; d++)
4635 if (vdim > 0 && d != vdim-1) {
continue; }
4636 const int d_off = vdim > 0 ? 0 : d;
4638 Vector lowerT(lower, d_off*n_c_pts, n_c_pts);
4639 Vector upperT(upper, d_off*n_c_pts, n_c_pts);
4643 if (dof_map.
Size() == 0)
4650 for (
int j = 0; j < ndofs; j++)
4652 nodal_data(j) = loc_data(dof_map[j]);
4655 plb.
GetNDBounds(rdim, nodal_data, lowerT, upperT);
4661 const int vdim)
const
4669 lower.
SetSize((vdim > 0 ? 1 :fes_dim));
4670 upper.
SetSize((vdim > 0 ? 1 :fes_dim));
4671 for (
int d = 0; d < fes_dim; d++)
4673 if (vdim > 0 && d != vdim-1) {
continue; }
4674 const int d_off = vdim > 0 ? 0 : d;
4675 Vector lowerT(lowerC, d_off*n_c_pts, n_c_pts);
4676 Vector upperT(upperC, d_off*n_c_pts, n_c_pts);
4677 lower(d_off) = lowerT.
Min();
4678 upper(d_off) = upperT.
Max();
4684 const int vdim)
const
4688 lower.
SetSize(nel*(vdim > 0 ? 1 :fes_dim));
4689 upper.
SetSize(nel*(vdim > 0 ? 1 :fes_dim));
4690 for (
int e = 0; e < nel; e++)
4694 for (
int d = 0; d < fes_dim ; d++)
4696 if (vdim > 0 && d != vdim-1) {
continue; }
4697 const int d_off = vdim > 0 ? 0 : d;
4698 lower(e + d_off*nel) = lt(d_off);
4699 upper(e + d_off*nel) = ut(d_off);
4706 const int ref_factor,
4707 const int vdim)
const
4716 const int ref_factor,
const int vdim)
const
4725 lower.
SetSize(vdim > 0 ? 1 : fes_dim);
4726 upper.
SetSize(vdim > 0 ? 1 : fes_dim);
4727 for (
int d = 0; d < fes_dim; d++)
4729 if (vdim > 0 && d != vdim-1) {
continue; }
4730 const int d_off = vdim > 0 ? 0 : d;
4731 Vector lelt(lel, d_off*nel, nel);
4732 Vector uelt(uel, d_off*nel, nel);
4733 lower(d_off) = lelt.
Min();
4734 upper(d_off) = uelt.
Max();
T Max() const
Find the maximal element in the array, using the comparison operator < for class T.
void SetSize(int nsize)
Change the logical size of the array, keep existing entries.
int Size() const
Return the logical size of the array.
@ GaussLegendre
Open type.
Conjugate gradient method.
void Mult(const Vector &b, Vector &x) const override
Iterative solution of the linear system using the Conjugate Gradient method.
void SetOperator(const Operator &op) override
Set/update the solver for the given operator.
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 MultTranspose(const real_t *x, real_t *y) const
Multiply a vector with the transpose matrix.
void GetColumnReference(int c, Vector &col)
real_t * Data() const
Returns the matrix data array. Warning: this method casts away constness.
void SetSize(int s)
Change the size of the DenseMatrix to s x s.
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 scalar GridFunctions.
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.
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.
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.
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.
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...
int GetCurlDim() const
Returns the dimension of the curl for vector-valued finite elements.
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 ...
Data type for Gauss-Seidel smoother of 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 ComputeMeans(AvgType type, Array< int > &zones_per_vdof)
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.
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. Only boundary attri...
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 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 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[])
virtual void ProjectCoefficient(Coefficient &coeff)
Project coeff Coefficient to this GridFunction. The projection computation depends on the choice of t...
int GetFaceVectorValues(int i, int side, const IntegrationRule &ir, DenseMatrix &vals, DenseMatrix &tr) const
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)
void ProjectDiscCoefficient(VectorCoefficient &coeff, Array< int > &dof_attr)
virtual void ComputeFlux(BilinearFormIntegrator &blfi, GridFunction &flux, bool wcoef=true, int subdomain=-1)
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.
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 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 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...
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 ProjectBdrCoefficientNormal(VectorCoefficient &vcoeff, const Array< int > &bdr_attr)
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.
Class for integration point with weight.
void Set1w(const real_t x1, 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 SetPreconditioner(Solver &pr)
This should be called before SetOperator.
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.
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
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().
void GetNDBounds(const int rdim, const Vector &coeff, Vector &intmin, Vector &intmax) const
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 ...
for VectorFiniteElements (Nedelec, Raviart-Thomas)
A general vector function coefficient.
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)
std::ostream & operator<<(std::ostream &os, SparseMatrix const &mat)
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.
real_t infinity()
Define a shortcut for std::numeric_limits<double>::infinity()
GridFunction * Extrude1DGridFunction(Mesh *mesh, Mesh *mesh2d, GridFunction *sol, const int ny)
Extrude a scalar 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)
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.
OutStream err(std::cerr)
Global stream used by the library for standard error output. Initially it uses the same std::streambu...
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.
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.
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)
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[])