14 #include "../general/text.hpp"
15 #include "../general/forall.hpp"
16 #include "../mesh/mesh_headers.hpp"
18 #include "ceed/util.hpp"
28 template <>
void Ordering::
29 DofsToVDofs<Ordering::byNODES>(
int ndofs,
int vdim,
Array<int> &dofs)
32 int size = dofs.Size();
33 dofs.SetSize(size*vdim);
34 for (
int vd = 1; vd < vdim; vd++)
36 for (
int i = 0; i < size; i++)
38 dofs[i+size*vd] = Map<byNODES>(ndofs, vdim, dofs[i], vd);
43 template <>
void Ordering::
44 DofsToVDofs<Ordering::byVDIM>(
int ndofs,
int vdim,
Array<int> &dofs)
47 int size = dofs.Size();
48 dofs.SetSize(size*vdim);
49 for (
int vd = vdim-1; vd >= 0; vd--)
51 for (
int i = 0; i < size; i++)
53 dofs[i+size*vd] = Map<byVDIM>(ndofs, vdim, dofs[i], vd);
59 FiniteElementSpace::FiniteElementSpace()
61 ndofs(0), nvdofs(0), nedofs(0), nfdofs(0), nbdofs(0), bdofs(NULL),
62 elem_dof(NULL), bdr_elem_dof(NULL), face_dof(NULL),
63 NURBSext(NULL), own_ext(false),
64 cP(NULL), cR(NULL), cR_hp(NULL), cP_is_set(false),
66 sequence(0), mesh_sequence(0), orders_changed(false), relaxed_hp(false)
73 mesh = mesh ? mesh : orig.
mesh;
74 fec = fec ? fec : orig.
fec;
99 MFEM_VERIFY(
cP == NULL,
"");
100 MFEM_VERIFY(
cR == NULL,
"");
105 int n = perm->
Size();
107 for (
int i=0; i<n; ++i)
111 perm_mat->
Set(i, j, s);
136 "Space has not been Updated() after a Mesh change.");
137 MFEM_VERIFY(i >= 0 && i <
GetNE(),
"Invalid element index");
138 MFEM_VERIFY(p >= 0 && p <=
MaxVarOrder,
"Order out of range");
163 "Space has not been Updated() after a Mesh change.");
164 MFEM_VERIFY(i >= 0 && i <
GetNE(),
"Invalid element index");
179 if (ndofs < 0) { ndofs = this->
ndofs; }
183 for (
int i = 0; i < dofs.
Size(); i++)
185 dofs[i] = Ordering::Map<Ordering::byNODES>(
ndofs,
vdim, i, vd);
190 for (
int i = 0; i < dofs.
Size(); i++)
192 dofs[i] = Ordering::Map<Ordering::byVDIM>(
ndofs,
vdim, i, vd);
199 if (
vdim == 1) {
return; }
200 if (ndofs < 0) { ndofs = this->
ndofs; }
204 Ordering::DofsToVDofs<Ordering::byNODES>(
ndofs,
vdim, dofs);
208 Ordering::DofsToVDofs<Ordering::byVDIM>(
ndofs,
vdim, dofs);
214 if (
vdim == 1) {
return; }
215 if (ndofs < 0) { ndofs = this->
ndofs; }
219 for (
int i = 0; i < dofs.
Size(); i++)
221 dofs[i] = Ordering::Map<Ordering::byNODES>(
ndofs,
vdim, dofs[i], vd);
226 for (
int i = 0; i < dofs.
Size(); i++)
228 dofs[i] = Ordering::Map<Ordering::byVDIM>(
ndofs,
vdim, dofs[i], vd);
235 if (
vdim == 1) {
return dof; }
236 if (ndofs < 0) { ndofs = this->
ndofs; }
240 return Ordering::Map<Ordering::byNODES>(
ndofs,
vdim, dof, vd);
244 return Ordering::Map<Ordering::byVDIM>(
ndofs,
vdim, dof, vd);
251 int n = vdofs.
Size(), *vdof = vdofs;
252 for (
int i = 0; i < n; i++)
255 if ((j = vdof[i]) < 0)
312 for (
int i = 0; i <
mesh ->
GetNE(); i++)
315 el_dof -> AddColumnsInRow (i, dofs.
Size());
318 for (
int i = 0; i <
mesh ->
GetNE(); i++)
321 el_dof -> AddConnections (i, (
int *)dofs, dofs.
Size());
323 el_dof -> ShiftUpI();
360 for (
int i = 0; i < fc_dof->
Size(); i++)
366 for (
int i = 0; i < fc_dof->
Size(); i++)
389 for (
int k = 0, dof_counter = 0; k < nnz; k++)
391 const int sdof = J[k];
392 const int dof = (sdof < 0) ? -1-sdof : sdof;
393 int new_dof = dof_marker[dof];
396 dof_marker[dof] = new_dof = dof_counter++;
398 J[k] = (sdof < 0) ? -1-new_dof : new_dof;
411 for (
int i = 0; i <
mesh ->
GetNE(); i++)
413 const int *dofs =
elem_dof -> GetRow(i);
414 const int n =
elem_dof -> RowSize(i);
415 for (
int j = 0; j < n; j++)
429 for (
int i = 0; i < dofs.
Size(); i++)
432 if (k < 0) { k = -1 - k; }
446 for (
int i = 0; i <
GetNBE(); i++)
454 mark_dofs(vdofs, ess_vdofs);
459 for (
int d = 0; d < dofs.
Size(); d++)
460 { dofs[d] =
DofToVDof(dofs[d], component); }
461 mark_dofs(dofs, ess_vdofs);
473 for (
int i = 0; i < bdr_verts.
Size(); i++)
478 mark_dofs(vdofs, ess_vdofs);
483 for (
int d = 0; d < dofs.
Size(); d++)
484 { dofs[d] =
DofToVDof(dofs[d], component); }
485 mark_dofs(dofs, ess_vdofs);
488 for (
int i = 0; i < bdr_edges.
Size(); i++)
493 mark_dofs(vdofs, ess_vdofs);
498 for (
int d = 0; d < dofs.
Size(); d++)
499 { dofs[d] =
DofToVDof(dofs[d], component); }
500 mark_dofs(dofs, ess_vdofs);
545 for (
int i = 0; i < marker.
Size(); i++)
547 if (marker[i]) { num_marked++; }
552 for (
int i = 0; i < marker.
Size(); i++)
554 if (marker[i]) { list.
Append(i); }
566 for (
int i = 0; i < list.
Size(); i++)
568 marker[list[i]] = mark_val;
577 else { dofs.
Copy(cdofs); }
585 else { cdofs.
Copy(dofs); }
603 if (d_vdofs.
Size() != c_vdofs.
Size())
605 mfem_error (
"FiniteElementSpace::D2C_GlobalRestrictionMatrix (...)");
609 for (j = 0; j < d_vdofs.
Size(); j++)
611 R ->
Set (c_vdofs[j], d_vdofs[j], 1.0);
635 if (c_dofs.
Size() != 1)
637 "D2Const_GlobalRestrictionMatrix (...)");
640 for (j = 0; j < d_dofs.
Size(); j++)
642 R ->
Set (c_dofs[0], d_dofs[j], 1.0);
666 for (
int i = 0; i <
mesh ->
GetNE(); i++)
673 if (geom != cached_geom)
675 h_fe =
this ->
GetFE (i);
676 l_fe = lfes ->
GetFE (i);
678 h_fe->
Project(*l_fe, T, loc_restr);
682 for (
int vd = 0; vd <
vdim; vd++)
684 l_dofs.
Copy(l_vdofs);
687 h_dofs.
Copy(h_vdofs);
690 R -> SetSubMatrix (l_vdofs, h_vdofs, loc_restr, 1);
703 for (
int i = skipfirst; i < slave_dofs.
Size(); i++)
705 int sdof = slave_dofs[i];
708 for (
int j = 0; j < master_dofs.
Size(); j++)
710 double coef = I(i, j);
711 if (std::abs(coef) > 1e-12)
713 int mdof = master_dofs[j];
714 if (mdof != sdof && mdof != (-1-sdof))
716 deps.
Add(sdof, mdof, coef);
739 mesh->GetFaceVertices(slave_face, V);
740 mesh->GetFaceEdges(slave_face, E, Eo);
741 MFEM_ASSERT(V.
Size() == E.
Size(),
"");
748 for (
int i = 0; i < E.
Size(); i++)
750 int a = i,
b = (i+1) % V.
Size();
751 if (V[a] > V[b]) { std::swap(a, b); }
758 for (
int j = 0; j < 2; j++)
760 edge_pm(j, 0) = (*pm)(j,
a);
761 edge_pm(j, 1) = (*pm)(j,
b);
762 mid[j] = 0.5*((*pm)(j,
a) + (*pm)(j,
b));
766 const double eps = 1e-14;
767 if (mid[0] > eps && mid[0] < 1-eps &&
768 mid[1] > eps && mid[1] < 1-eps)
770 int order = GetEdgeDofs(E[i], slave_dofs, 0);
773 edge_fe->GetTransferMatrix(*master_fe, edge_T, I);
775 AddDependencies(deps, master_dofs, slave_dofs, I, 0);
787 for (
int i = 0; i < ndep; i++)
789 if (!finalized[dep[i]]) {
return false; }
809 int order =
GetEdgeDofs(-1 - index, edof, variant);
816 if (!dofs.
Size()) {
return 0; }
821 for (
int i = 0; i < nv; i++)
824 dofs[nv+i] = edof[nv+i];
828 for (
int i = 0; i < ne; i++)
830 dofs[face_vert*nv + i] = edof[2*nv + i];
872 MFEM_VERIFY(dynamic_cast<const ParFiniteElementSpace*>(
this) == NULL,
873 "This method should not be used with a ParFiniteElementSpace!");
879 Array<int> master_dofs, slave_dofs, highest_dofs;
896 for (
int entity = 2; entity >= 1; entity--)
899 if (!list.
masters.Size()) {
continue; }
907 if (!master_dofs.
Size()) {
continue; }
910 if (!master_fe) {
continue; }
917 default: MFEM_ABORT(
"unsupported geometry");
925 if (!slave_dofs.
Size()) {
break; }
946 slave_dofs, slave.
index, pm);
958 master_geom, nvar-1);
959 const auto *highest_fe =
fec->
GetFE(master_geom, q);
979 MFEM_ASSERT(ent_dofs.
Size() == num_ent+1,
"");
983 for (
int i = 0; i < num_ent; i++)
985 if (ent_dofs.
RowSize(i) <= 1) {
continue; }
990 if (geom != last_geom)
998 const auto *master_fe =
fec->
GetFE(geom, p);
1001 for (
int variant = 1; ; variant++)
1003 int q =
GetEntityDofs(entity, i, slave_dofs, geom, variant);
1004 if (q < 0) {
break; }
1006 const auto *slave_fe =
fec->
GetFE(geom, q);
1019 int n_true_dofs = 0;
1020 for (
int i = 0; i <
ndofs; i++)
1022 if (!deps.
RowSize(i)) { n_true_dofs++; }
1026 if (n_true_dofs == ndofs)
1041 for (
int i = 0; i < n_true_dofs; i++)
1046 cR_I[n_true_dofs] = n_true_dofs;
1061 for (
int i = 0, true_dof = 0; i <
ndofs; i++)
1065 cP->
Add(i, true_dof, 1.0);
1067 finalized[i] =
true;
1073 inv_deps.
GetRow(i, cols, srow);
1094 int n_finalized = n_true_dofs;
1098 for (
int dof = 0; dof <
ndofs; dof++)
1104 int n_dep = deps.
RowSize(dof);
1106 for (
int j = 0; j < n_dep; j++)
1108 cP->
GetRow(dep_col[j], cols, srow);
1109 srow *= dep_coef[j];
1113 finalized[dof] =
true;
1123 MFEM_VERIFY(n_finalized == ndofs,
1124 "Error creating cP matrix: n_finalized = "
1125 << n_finalized <<
", ndofs = " << ndofs);
1142 if (
vdim == 1) {
return; }
1144 int height = mat.
Height();
1145 int width = mat.
Width();
1151 for (
int i = 0; i < height; i++)
1153 mat.
GetRow(i, dofs, srow);
1154 for (
int vd = 0; vd <
vdim; vd++)
1234 key_face key = std::make_tuple(is_dg_space, e_ordering, type, m);
1235 auto itr =
L2F.find(key);
1236 if (itr !=
L2F.end())
1259 for (
int i = 0; i <
E2Q_array.Size(); i++)
1262 if (qi->
IntRule == &ir) {
return qi; }
1273 for (
int i = 0; i <
E2Q_array.Size(); i++)
1276 if (qi->
qspace == &qs) {
return qi; }
1293 if (qi->
IntRule == &ir) {
return qi; }
1306 if (qi->
IntRule == &ir) {
return qi; }
1317 const int coarse_ndofs,
const Table &coarse_elem_dof,
1328 if (elem_geoms.
Size() == 1)
1330 const int coarse_ldof = localP[elem_geoms[0]].
SizeJ();
1348 const int fine_ldof = localP[
geom].
SizeI();
1353 for (
int vd = 0; vd <
vdim; vd++)
1355 coarse_dofs.Copy(coarse_vdofs);
1358 for (
int i = 0; i < fine_ldof; i++)
1361 int m = (r >= 0) ? r : (-1 - r);
1366 P->
SetRow(r, coarse_vdofs, row);
1373 MFEM_ASSERT(mark.
Sum() == P->
Height(),
"Not all rows of P set.");
1386 int nmat = pmats.
SizeK();
1393 localP.
SetSize(ldof, ldof, nmat);
1394 for (
int i = 0; i < nmat; i++)
1402 const Table* old_elem_dof)
1404 MFEM_VERIFY(
GetNE() >= old_elem_dof->
Size(),
1405 "Previous mesh is not coarser.");
1410 for (
int i = 0; i < elem_geoms.Size(); i++)
1421 , old_elem_dof(old_elem_dof)
1423 MFEM_VERIFY(fespace->
GetNE() >= old_elem_dof->
Size(),
1424 "Previous mesh is not coarser.");
1426 width = old_ndofs * fespace->
GetVDim();
1431 for (
int i = 0; i < elem_geoms.Size(); i++)
1439 :
Operator(fespace->GetVSize(), coarse_fes->GetVSize()),
1440 fespace(fespace), old_elem_dof(NULL)
1444 for (
int i = 0; i < elem_geoms.Size(); i++)
1447 localP[elem_geoms[i]]);
1456 delete old_elem_dof;
1468 int old_ndofs = width /
vdim;
1472 for (
int k = 0; k < mesh->
GetNE(); k++)
1483 for (
int vd = 0; vd <
vdim; vd++)
1487 old_dofs.
Copy(old_vdofs);
1490 lP.
Mult(subX, subY);
1510 int old_ndofs = width /
vdim;
1514 for (
int k = 0; k < mesh->
GetNE(); k++)
1525 for (
int vd = 0; vd <
vdim; vd++)
1527 f_dofs.
Copy(f_vdofs);
1529 c_dofs.
Copy(c_vdofs);
1534 for (
int p = 0;
p < f_dofs.
Size(); ++
p)
1546 for (
int p = 0;
p < f_dofs.
Size(); ++
p)
1561 "incompatible coarse and fine FE spaces");
1569 for (
int gi = 0; gi < elem_geoms.
Size(); gi++)
1581 emb_tr.SetIdentityTransformation(geom);
1582 for (
int i = 0; i < pmats.
SizeK(); i++)
1584 emb_tr.SetPointMat(pmats(i));
1592 Table ref_type_to_matrix;
1594 ref_type_to_matrix, ref_type_to_geom);
1595 MFEM_ASSERT(coarse_to_fine.
Size() == c_fes->
GetNE(),
"");
1597 const int total_ref_types = ref_type_to_geom.
Size();
1599 Array<int> ref_type_to_coarse_elem_offset(total_ref_types);
1600 ref_type_to_fine_elem_offset.
SetSize(total_ref_types);
1603 for (
int i = 0; i < total_ref_types; i++)
1606 ref_type_to_coarse_elem_offset[i] = num_ref_types[g];
1607 ref_type_to_fine_elem_offset[i] = num_fine_elems[g];
1609 num_fine_elems[g] += ref_type_to_matrix.
RowSize(i);
1614 if (num_ref_types[g] == 0) {
continue; }
1615 const int fine_dofs = localP[g].
SizeI();
1616 const int coarse_dofs = localP[g].
SizeJ();
1617 localPtMP[g].
SetSize(coarse_dofs, coarse_dofs, num_ref_types[g]);
1618 localR[g].
SetSize(coarse_dofs, fine_dofs, num_fine_elems[g]);
1620 for (
int i = 0; i < total_ref_types; i++)
1623 DenseMatrix &lPtMP = localPtMP[g](ref_type_to_coarse_elem_offset[i]);
1624 int lR_offset = ref_type_to_fine_elem_offset[i];
1625 const int *mi = ref_type_to_matrix.
GetRow(i);
1626 const int nm = ref_type_to_matrix.
RowSize(i);
1628 for (
int s = 0;
s < nm;
s++)
1637 for (
int s = 0;
s < nm;
s++)
1650 delete coarse_elem_dof;
1659 const int vdim = fine_fes->GetVDim();
1660 const int coarse_ndofs = height/
vdim;
1661 for (
int coarse_el = 0; coarse_el < coarse_to_fine.Size(); coarse_el++)
1663 coarse_elem_dof->GetRow(coarse_el, c_vdofs);
1664 fine_fes->DofsToVDofs(c_vdofs, coarse_ndofs);
1668 const int ref_type = coarse_to_ref_type[coarse_el];
1670 const int *fine_elems = coarse_to_fine.GetRow(coarse_el);
1671 const int num_fine_elems = coarse_to_fine.RowSize(coarse_el);
1672 const int lR_offset = ref_type_to_fine_elem_offset[ref_type];
1673 for (
int s = 0;
s < num_fine_elems;
s++)
1676 fine_fes->GetElementVDofs(fine_elems[
s], f_vdofs);
1679 AddMult(lR, loc_x_mat, loc_y_mat);
1694 const int nmat = pmats.
SizeK();
1695 const int ldof = fe->
GetDof();
1701 localR.
SetSize(ldof, ldof, nmat);
1702 for (
int i = 0; i < nmat; i++)
1710 const Table* old_elem_dof)
1712 MFEM_VERIFY(
Nonconforming(),
"Not implemented for conforming meshes.");
1713 MFEM_VERIFY(old_ndofs,
"Missing previous (finer) space.");
1714 MFEM_VERIFY(
ndofs <= old_ndofs,
"Previous space is not finer.");
1722 for (
int i = 0; i < elem_geoms.
Size(); i++)
1730 localR[elem_geoms[0]].SizeI());
1738 MFEM_ASSERT(dtrans.
embeddings.Size() == old_elem_dof->
Size(),
"");
1741 for (
int k = 0; k < dtrans.
embeddings.Size(); k++)
1748 old_elem_dof->
GetRow(k, old_dofs);
1750 for (
int vd = 0; vd <
vdim; vd++)
1752 old_dofs.
Copy(old_vdofs);
1755 for (
int i = 0; i < lR.
Height(); i++)
1757 if (!std::isfinite(lR(i, 0))) {
continue; }
1760 int m = (r >= 0) ? r : (-1 - r);
1765 R->
SetRow(r, old_vdofs, row);
1773 MFEM_VERIFY(num_marked == R->
Height(),
1774 "internal error: not all rows of R were set.");
1793 int nmat = pmats.
SizeK();
1800 for (
int i = 0; i < nmat; i++)
1829 MFEM_VERIFY(mesh->
NURBSext,
"NURBS FE space requires a NURBS mesh.");
1831 if (NURBSext == NULL)
1847 this->NURBSext = NULL;
1858 mfem_error(
"FiniteElementSpace::StealNURBSext");
1867 MFEM_VERIFY(
NURBSext,
"NURBSExt not defined.");
1911 if (b == -1) {
continue; }
1921 for (
int i = 0; i < nv; i++)
1923 MFEM_VERIFY(fv[i] == bv[i],
1924 "non-matching face and boundary elements detected!");
1929 for (
int i = 0; i < row.
Size(); i++)
1932 face_dof_list.
Append(conn);
1941 MFEM_VERIFY(!
NURBSext,
"internal error");
1946 "Variable order space requires a nonconforming mesh.");
1966 "Mesh was not correctly finalized.");
1977 else if (mixed_faces)
2062 MFEM_ASSERT(bits != 0,
"invalid bit mask");
2063 for (
int order = 0; bits != 0; order++, bits >>= 1)
2065 if (bits & 1) {
return order; }
2092 for (
int j = 0; j < E.
Size(); j++)
2094 edge_orders[E[j]] |= mask;
2100 for (
int j = 0; j < F.
Size(); j++)
2102 face_orders[F[j]] |= mask;
2130 slave_orders |= edge_orders[edge_list.
slaves[i].index];
2133 int min_order =
MinOrder(slave_orders);
2149 if (slave.
index >= 0)
2151 slave_orders |= face_orders[slave.
index];
2154 for (
int j = 0; j < E.
Size(); j++)
2156 slave_orders |= edge_orders[E[j]];
2162 slave_orders |= edge_orders[-1 - slave.
index];
2166 int min_order =
MinOrder(slave_orders);
2178 for (
int j = 0; j < E.
Size(); j++)
2180 edge_orders[E[j]] |= face_orders[i];
2202 int num_ent = entity_orders.
Size();
2211 var_ent_order->
Reserve(num_ent);
2215 for (
int i = 0; i < num_ent; i++)
2220 for (
int order = 0; bits != 0; order++, bits >>= 1)
2228 if (var_ent_order) { var_ent_order->
Append(order); }
2243 int row,
int ndof)
const
2245 const int *beg = var_dof_table.
GetRow(row);
2246 const int *end = var_dof_table.
GetRow(row + 1);
2251 if ((beg[1] - beg[0]) == ndof) {
return beg[0]; }
2255 MFEM_ABORT(
"DOFs not found for ndof = " << ndof);
2265 if (variant >= end - beg) {
return -1; }
2281 if (variant >= end - beg) {
return -1; }
2291 MFEM_ASSERT(index >= 0 && index < dof_table.
Size(),
"");
2292 return dof_table.
GetRow(index + 1) - dof_table.
GetRow(index);
2295 static const char* msg_orders_changed =
2296 "Element orders changed, you need to Update() the space first.";
2325 for (
int i = 0; i < F.
Size(); i++)
2336 for (
int i = 0; i < V.
Size(); i++)
2338 for (
int j = 0; j < nv; j++)
2340 dofs.
Append(V[i]*nv + j);
2347 for (
int i = 0; i < E.
Size(); i++)
2352 for (
int j = 0; j < ne; j++)
2361 for (
int i = 0; i < F.
Size(); i++)
2369 for (
int j = 0; j < nf; j++)
2381 for (
int j = 0; j < nb; j++)
2390 if (i < 0 || !mesh->
GetNE()) {
return NULL; }
2391 MFEM_VERIFY(i < mesh->
GetNE(),
2392 "Invalid element id " << i <<
", maximum allowed " <<
mesh->
GetNE()-1);
2409 "internal error: " <<
2455 for (
int i = 0; i < V.
Size(); i++)
2457 for (
int j = 0; j < nv; j++)
2459 dofs.
Append(V[i]*nv + j);
2466 for (
int i = 0; i < E.
Size(); i++)
2471 for (
int j = 0; j < ne; j++)
2483 for (
int j = 0; j < nf; j++)
2504 int order, nf, fbase;
2512 if (variant >= end - beg) {
return -1; }
2514 fbase = beg[variant];
2515 nf = beg[variant+1] - fbase;
2523 if (variant > 0) {
return -1; }
2542 for (
int i = 0; i < V.
Size(); i++)
2544 for (
int j = 0; j < nv; j++)
2546 dofs.
Append(V[i]*nv + j);
2552 for (
int i = 0; i < E.
Size(); i++)
2557 for (
int j = 0; j < ne; j++)
2563 for (
int j = 0; j < nf; j++)
2576 int order, ne, base;
2581 if (variant >= end - beg) {
return -1; }
2583 base = beg[variant];
2584 ne = beg[variant+1] - base;
2591 if (variant > 0) {
return -1; }
2604 for (
int i = 0; i < 2; i++)
2606 for (
int j = 0; j < nv; j++)
2608 dofs.
Append(V[i]*nv + j);
2611 for (
int j = 0; j < ne; j++)
2623 for (
int j = 0; j < nv; j++)
2638 for (
int j = 0; j < nb; j++)
2656 for (
int j = 0, k =
nvdofs+i*ne; j < ne; j++, k++)
2680 for (
int j = 0; j < nf; j++)
2742 "NURBS mesh: only boundary faces are supported!");
2752 MFEM_ASSERT(
mesh->
Dimension() > 1,
"No edges with mesh dimension < 2");
2777 for (
int i = 0; i <
E2Q_array.Size(); i++)
2814 ceed::RemoveBasisAndRestriction(
this);
2827 for (
int i = 0; i < elem_geoms.
Size(); i++)
2830 localP[elem_geoms[i]]);
2864 if (RP_case == 0) {
return; }
2877 cR, T.
Ptr(), coarse_P,
false, owner,
false));
2899 MFEM_ABORT(
"not implemented yet");
2915 MFEM_ABORT(
"Error in update sequence. Space needs to be updated after "
2916 "each mesh modification.");
2923 MFEM_ABORT(
"Updating space after both mesh change and element order "
2924 "change is not supported. Please update separately after "
2935 Table* old_elem_dof = NULL;
2959 MFEM_VERIFY(!old_orders_changed,
"Interpolation for element order change "
2960 "is not implemented yet, sorry.");
2972 old_elem_dof = NULL;
2990 false,
false,
true));
2999 delete old_elem_dof;
3010 int fes_format = 90;
3011 bool nurbs_unit_weights =
false;
3022 MFEM_VERIFY(nurbs_fec,
"invalid FE collection");
3024 const double eps = 5e-14;
3035 out << (fes_format == 90 ?
3036 "FiniteElementSpace\n" :
"MFEM FiniteElementSpace v1.0\n")
3037 <<
"FiniteElementCollection: " <<
fec->
Name() <<
'\n'
3038 <<
"VDim: " <<
vdim <<
'\n'
3039 <<
"Ordering: " <<
ordering <<
'\n';
3041 if (fes_format == 100)
3055 out <<
"NURBS_orders\n";
3062 out <<
"NURBS_periodic\n";
3067 if (!nurbs_unit_weights)
3069 out <<
"NURBS_weights\n";
3073 out <<
"End: MFEM FiniteElementSpace v1.0\n";
3080 int fes_format = 0, ord;
3086 getline(input, buff);
3088 if (buff ==
"FiniteElementSpace") { fes_format = 90; }
3089 else if (buff ==
"MFEM FiniteElementSpace v1.0") { fes_format = 100; }
3090 else { MFEM_ABORT(
"input stream is not a FiniteElementSpace!"); }
3091 getline(input, buff,
' ');
3093 getline(input, buff);
3096 getline(input, buff,
' ');
3098 getline(input, buff,
' ');
3103 if (fes_format == 90)
3107 MFEM_VERIFY(m->
NURBSext,
"NURBS FE collection requires a NURBS mesh!");
3108 const int order = nurbs_fec->
GetOrder();
3116 else if (fes_format == 100)
3121 MFEM_VERIFY(input.good(),
"error reading FiniteElementSpace v1.0");
3122 getline(input, buff);
3124 if (buff ==
"NURBS_order" || buff ==
"NURBS_orders")
3126 MFEM_VERIFY(nurbs_fec,
3127 buff <<
": NURBS FE collection is required!");
3128 MFEM_VERIFY(m->
NURBSext, buff <<
": NURBS mesh is required!");
3129 MFEM_VERIFY(!NURBSext, buff <<
": order redefinition!");
3130 if (buff ==
"NURBS_order")
3143 else if (buff ==
"NURBS_periodic")
3150 else if (buff ==
"NURBS_weights")
3152 MFEM_VERIFY(NURBSext,
"NURBS_weights: NURBS_orders have to be "
3153 "specified before NURBS_weights!");
3156 else if (buff ==
"element_orders")
3158 MFEM_VERIFY(!nurbs_fec,
"section element_orders cannot be used "
3159 "with a NURBS FE collection");
3160 MFEM_ABORT(
"element_orders: not implemented yet!");
3162 else if (buff ==
"End: MFEM FiniteElementSpace v1.0")
3168 MFEM_ABORT(
"unknown section: " << buff);
3184 element_offsets =
new int[num_elem + 1];
3189 for (
int i = 0; i < num_elem; i++)
3191 element_offsets[i] = offset;
3193 if (int_rule[geom] == NULL)
3199 element_offsets[num_elem] = size = offset;
3205 const char *msg =
"invalid input stream";
3208 in >> ident; MFEM_VERIFY(ident ==
"QuadratureSpace", msg);
3209 in >> ident; MFEM_VERIFY(ident ==
"Type:", msg);
3211 if (ident ==
"default_quadrature")
3213 in >> ident; MFEM_VERIFY(ident ==
"Order:", msg);
3218 MFEM_ABORT(
"unknown QuadratureSpace type: " << ident);
3227 out <<
"QuadratureSpace\n"
3228 <<
"Type: default_quadrature\n"
3229 <<
"Order: " <<
order <<
'\n';
int GetNPoints() const
Returns the number of the points in the integration rule.
Abstract class for all finite elements.
int GetOrder() const
Get the order of the NURBS collection: either a positive number, when using fixed order...
Arbitrary order non-uniform rational B-splines (NURBS) finite elements.
Ordering::Type GetOrdering() const
Return the ordering method.
int Size() const
Return the logical size of the array.
int RowSize(const int i) const
Returns the number of elements in row i.
void SetSubVector(const Array< int > &dofs, const double value)
Set the entries listed in dofs to the given value.
int GetVSize() const
Return the number of vector dofs, i.e. GetNDofs() x GetVDim().
void GetVertexVDofs(int i, Array< int > &vdofs) const
void Add(const int i, const int j, const double a)
OpType * As() const
Return the Operator pointer statically cast to a specified OpType. Similar to the method Get()...
const Vector & GetWeights() const
void Load(std::istream &in, int fmt=0)
Read an Array from the stream in using format fmt. The format fmt can be:
void BuildTranspose() const
Build and store internally the transpose of this matrix which will be used in the methods AddMultTran...
int GetNDofs() const
Returns number of degrees of freedom.
const FiniteElement * GetFE(Geometry::Type geom, int p) const
Variable order version of FiniteElementForGeometry().
int ndofs
Number of degrees of freedom. Number of unknowns is ndofs * vdim.
Class for an integration rule - an Array of IntegrationPoint.
int * bdofs
internal DOFs of elements if mixed/var-order; NULL otherwise
const Array< int > & GetMaster() const
void GetElementInteriorVDofs(int i, Array< int > &vdofs) const
int DofToVDof(int dof, int vd, int ndofs=-1) const
void GetBdrElementEdges(int i, Array< int > &edges, Array< int > &cor) const
Return the indices and the orientations of all edges of bdr element i.
const SparseMatrix * GetConformingProlongation() const
The returned SparseMatrix is owned by the FiniteElementSpace.
static void AddDependencies(SparseMatrix &deps, Array< int > &master_dofs, Array< int > &slave_dofs, DenseMatrix &I, int skipfirst=0)
const CoarseFineTransformations & GetDerefinementTransforms()
virtual void Update(bool want_transform=true)
Reflect changes in the mesh: update number of DOFs, etc. Also, calculate GridFunction transformation ...
bool IsVariableOrder() const
Returns true if the space contains elements of varying polynomial orders.
void LoadBE(int i, const FiniteElement *BE) const
const IntegrationRule & Get(int GeomType, int Order)
Returns an integration rule for given GeomType and Order.
void GetEdgeVertices(int i, Array< int > &vert) const
Returns the indices of the vertices of edge i.
Operator that extracts Face degrees of freedom for H1 FiniteElementSpaces.
void BuildElementToDofTable() const
void AddColumnsInRow(int r, int ncol)
int MakeDofTable(int ent_dim, const Array< int > &entity_orders, Table &entity_dofs, Array< char > *var_ent_order)
void BuildNURBSFaceToDofTable() const
Generates partial face_dof table for a NURBS space.
const FiniteElement * GetEdgeElement(int i, int variant=0) const
Returns pointer to the FiniteElement in the FiniteElementCollection associated with i'th edge in the ...
void MakeI(int nrows)
Next 7 methods are used together with the default constructor.
virtual void Project(Coefficient &coeff, ElementTransformation &Trans, Vector &dofs) const
Given a coefficient and a transformation, compute its projection (approximation) in the local finite ...
virtual void GetVertices(Array< int > &v) const =0
Returns element's vertices.
DerefinementOperator(const FiniteElementSpace *f_fes, const FiniteElementSpace *c_fes, BilinearFormIntegrator *mass_integ)
const FiniteElement * GetTraceElement(int i, Geometry::Type geom_type) const
Return the trace element from element 'i' to the given 'geom_type'.
virtual void Finalize(int skip_zeros=1)
Finalize the matrix initialization, switching the storage format from LIL to CSR. ...
void GetBdrElementFace(int i, int *f, int *o) const
Return the index and the orientation of the face of bdr element i. (3D)
int GetNumGeometries(int dim) const
Return the number of geometries of the given dimension present in the mesh.
void SetSize(int s)
Resize the vector to size s.
SparseMatrix * RefinementMatrix(int old_ndofs, const Table *old_elem_dof)
int GetNBE() const
Returns number of boundary elements.
SparseMatrix * DerefinementMatrix(int old_ndofs, const Table *old_elem_dof)
Calculate GridFunction restriction matrix after mesh derefinement.
void GetElementVDofs(int i, Array< int > &vdofs) const
Returns indexes of degrees of freedom in array dofs for i'th element.
void SetElementOrder(int i, int p)
Sets the order of the i'th finite element.
int * GetRowColumns(const int row)
Return a pointer to the column indices in a row.
static int DecodeDof(int dof)
Helpers to remove encoded sign from a DOF.
const T * HostRead() const
Shortcut for mfem::Read(a.GetMemory(), a.Size(), false).
SparseMatrix * RefinementMatrix_main(const int coarse_ndofs, const Table &coarse_elem_dof, const DenseTensor localP[]) const
void BooleanMult(const Array< int > &x, Array< int > &y) const
y = A * x, treating all entries as booleans (zero=false, nonzero=true).
Lists all edges/faces in the nonconforming mesh.
void Mult(const Table &A, const Table &B, Table &C)
C = A * B (as boolean matrices)
int Width() const
Get the width (size of input) of the Operator. Synonym with NumCols().
static int MinOrder(VarOrderBits bits)
Return the minimum order (least significant bit set) in the bit mask.
Pointer to an Operator of a specified type.
Operator::Type Type() const
Get the currently set operator type id.
virtual const FiniteElement * FiniteElementForGeometry(Geometry::Type GeomType) const =0
static constexpr int MaxVarOrder
void Copy(Array ©) const
Create a copy of the internal array to the provided copy.
virtual ~DerefinementOperator()
unsigned matrix
index into NCList::point_matrices[geom]
void GetSubVector(const Array< int > &dofs, Vector &elemvect) const
Extract entries listed in dofs to the output Vector elemvect.
int GetOrder() const
Returns the order of the finite element. In the case of anisotropic orders, returns the maximum order...
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...
void GetFaceVertices(int i, Array< int > &vert) const
Returns the indices of the vertices of face i.
Data type dense matrix using column-major storage.
int vdim
Vector dimension (number of unknowns per degree of freedom).
Geometry::Type Geom() const
void GetRow(int i, Array< int > &row) const
Return row i in array row (the Table must be finalized)
int GetNumElementInteriorDofs(int i) const
void Save(std::ostream &out, int fmt=0) const
Save the Array to the stream out using the format fmt. The format fmt can be:
int GetElementOrder(int i) const
Returns the order of the i'th finite element.
int GetBdrAttribute(int i) const
int GetBdrElementEdgeIndex(int i) const
const SparseMatrix * GetHpConformingRestriction() const
The returned SparseMatrix is owned by the FiniteElementSpace.
virtual void GetEssentialTrueDofs(const Array< int > &bdr_attr_is_ess, Array< int > &ess_tdof_list, int component=-1)
Get a list of essential true dofs, ess_tdof_list, corresponding to the boundary attributes marked in ...
int GetNE() const
Returns number of elements.
const Element * GetFace(int i) const
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...
virtual void GetLocalInterpolation(ElementTransformation &Trans, DenseMatrix &I) const
Return the local interpolation matrix I (Dof x Dof) where the fine element is the image of the base g...
T Sum()
Return the sum of all the array entries using the '+'' operator for class 'T'.
MFEM_DEPRECATED void RebuildElementToDofTable()
(
Geometry::Type GetFaceBaseGeometry(int i) const
virtual void MultTranspose(const Vector &x, Vector &y) const
Action of the transpose operator: y=A^t(x). The default behavior in class Operator is to generate an ...
const FiniteElement * GetFaceElement(int i) const
Returns pointer to the FiniteElement in the FiniteElementCollection associated with i'th face in the ...
virtual void GetTrueTransferOperator(const FiniteElementSpace &coarse_fes, OperatorHandle &T) const
Construct and return an Operator that can be used to transfer true-dof data from coarse_fes, defined on a coarse mesh, to this FE space, defined on a refined mesh.
void AddEdgeFaceDependencies(SparseMatrix &deps, Array< int > &master_dofs, const FiniteElement *master_fe, Array< int > &slave_dofs, int slave_face, const DenseMatrix *pm) const
FiniteElementCollection * Load(Mesh *m, std::istream &input)
Read a FiniteElementSpace from a stream. The returned FiniteElementCollection is owned by the caller...
virtual void GetElementDofs(int elem, Array< int > &dofs) const
Returns indices of degrees of freedom of element 'elem'.
static bool IsEnabled()
Return true if any backend other than Backend::CPU is enabled.
void AddRow(const int row, const Array< int > &cols, const Vector &srow)
double * GetRowEntries(const int row)
Return a pointer to the entries in a row.
double * GetData() const
Return a pointer to the beginning of the Vector data.
virtual void CopyProlongationAndRestriction(const FiniteElementSpace &fes, const Array< int > *perm)
Copies the prolongation and restriction matrices from fes.
const FiniteElementCollection * fec
Associated FE collection (not owned).
OperatorHandle Th
Transformation to apply to GridFunctions after space Update().
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...
Geometry::Type GetElementBaseGeometry(int i) const
int Size_of_connections() const
void GetLocalDerefinementMatrices(Geometry::Type geom, DenseTensor &localR) const
Geometry::Type GetBdrElementGeometry(int i) const
void skip_comment_lines(std::istream &is, const char comment_char)
Check if the stream starts with comment_char. If so skip it.
void DeleteAll()
Delete the whole array.
void BooleanMultTranspose(const Array< int > &x, Array< int > &y) const
y = At * x, treating all entries as booleans (zero=false, nonzero=true).
int GetOrder() const
Return the order (polynomial degree) of the FE collection, corresponding to the order/degree returned...
void AddConnections(int r, const int *c, int nc)
std::uint64_t VarOrderBits
Bit-mask representing a set of orders needed by an edge/face.
const NCList & GetFaceList()
Return the current list of conforming and nonconforming faces.
Array< int > dof_elem_array
static void MarkerToList(const Array< int > &marker, Array< int > &list)
Convert a Boolean marker array to a list containing all marked indices.
void GetFaceInteriorDofs(int i, Array< int > &dofs) const
virtual int DofForGeometry(Geometry::Type GeomType) const =0
virtual void UpdateMeshPointer(Mesh *new_mesh)
void ConvertFromConformingVDofs(const Array< int > &cdofs, Array< int > &dofs)
For a partially conforming FE space, convert a marker array (nonzero entries are true) on the conform...
const IntegrationRule * IntRule
Not owned.
const Operator * GetElementRestriction(ElementDofOrdering e_ordering) const
Return an Operator that converts L-vectors to E-vectors.
int GetNumFaces() const
Return the number of faces (3D), edges (2D) or vertices (1D).
int uni_fdof
of single face DOFs if all faces uniform; -1 otherwise
const SparseMatrix * GetConformingRestriction() const
The returned SparseMatrix is owned by the FiniteElementSpace.
Geometry::Type GetGeomType() const
Returns the Geometry::Type of the reference element.
ID for class SparseMatrix.
const Array< int > & GetSlave() const
virtual void Mult(const Vector &x, Vector &y) const
Operator application: y=A(x).
void Load(std::istream **in, int np, int *dim)
Reads a vector from multiple files.
int GetNE() const
Returns number of elements in the mesh.
void GetVertexDofs(int i, Array< int > &dofs) const
void MultTranspose(const double *x, double *y) const
Multiply a vector with the transpose matrix.
General product operator: x -> (A*B)(x) = A(B(x)).
void BuildBdrElementToDofTable() const
int HasFaceDofs(Geometry::Type geom, int p) const
ID for the base class Operator, i.e. any type.
int FindFaceDof(int face, int ndof) const
Similar to FindEdgeDof, but used for mixed meshes too.
int GetFaceOrder(int face, int variant=0) const
Returns the polynomial degree of the i'th face finite element.
double f(const Vector &xvec)
virtual int GetRow(const int row, Array< int > &cols, Vector &srow) const
Extract all column indices and values from a given row.
virtual void Mult(const Vector &x, Vector &y) const
Operator application: y=A(x).
void AddMult(const DenseMatrix &b, const DenseMatrix &c, DenseMatrix &a)
Matrix matrix multiplication. A += B * C.
int GetNBE() const
Returns number of boundary elements in the mesh.
void MakeFromList(int nrows, const Array< Connection > &list)
bool orders_changed
True if at least one element order changed (variable-order space only).
int Height() const
Get the height (size of output) of the Operator. Synonym with NumRows().
int FindEdgeDof(int edge, int ndof) const
int Append(const T &el)
Append element 'el' to array, resize if necessary.
Mesh * GetMesh() const
Returns the mesh.
Operator that extracts Face degrees of freedom on L2 FiniteElementSpaces.
void GetVDofs(int vd, Array< int > &dofs, int ndofs=-1) const
Returns the indices of all of the VDofs for the specified dimension 'vd'.
void mfem_error(const char *msg)
Function called when an error is encountered. Used by the macros MFEM_ABORT, MFEM_ASSERT, MFEM_VERIFY.
A class that performs interpolation from an E-vector to quadrature point values and/or derivatives (Q...
SparseMatrix * cR
Conforming restriction matrix such that cR.cP=I.
void GetRow(int r, Vector &row) const
const IntegrationRule * IntRule
Not owned.
SparseMatrix * D2Const_GlobalRestrictionMatrix(FiniteElementSpace *cfes)
Generate the global restriction matrix from a discontinuous FE space to the piecewise constant FE spa...
static const int NumVerts[NumGeom]
SparseMatrix * D2C_GlobalRestrictionMatrix(FiniteElementSpace *cfes)
Generate the global restriction matrix from a discontinuous FE space to the continuous FE space of th...
void GetBoundaryTrueDofs(Array< int > &boundary_dofs, int component=-1)
Get a list of all boundary true dofs, boundary_dofs. For spaces with 'vdim' > 1, the 'component' param...
T Max() const
Find the maximal element in the array, using the comparison operator < for class T.
void BuildConformingInterpolation() const
Calculate the cP and cR matrices for a nonconforming mesh.
Geometry::Type GetFaceGeometry(int i) const
NURBSExtension * StealNURBSext()
Array< DenseMatrix * > point_matrices[Geometry::NumGeom]
List of unique point matrices for each slave geometry.
void Reserve(int capacity)
Ensures that the allocated size is at least the given size.
virtual ~RefinementOperator()
virtual const FiniteElement * TraceFiniteElementForGeometry(Geometry::Type GeomType) const
void GetBdrElementAdjacentElement(int bdr_el, int &el, int &info) const
For the given boundary element, bdr_el, return its adjacent element and its info, i...
bool IsDGSpace() const
Return whether or not the space is discontinuous (L2)
Array< int > dof_ldof_array
void SetSize(int i, int j, int k, MemoryType mt_=MemoryType::PRESERVE)
const Array< int > & GetOrders() const
Read-only access to the orders of all knot vectors.
virtual void GetBdrElementDofs(int bel, Array< int > &dofs) const
Returns indices of degrees of freedom for boundary element 'bel'.
int GetVDim() const
Returns vector dimension.
int Size() const
Returns the number of TYPE I elements.
const int * GetDofOrdering(Geometry::Type geom, int p, int ori) const
Variable order version of DofOrderForOrientation().
int GetNF() const
Returns number of faces (i.e. co-dimension 1 entities) in the mesh.
static int EncodeDof(int entity_base, int idx)
Helper to encode a sign flip into a DOF index (for Hcurl/Hdiv shapes).
virtual const FaceRestriction * GetFaceRestriction(ElementDofOrdering e_ordering, FaceType, L2FaceValues mul=L2FaceValues::DoubleValued) const
Return an Operator that converts L-vectors to E-vectors on each face.
virtual void GetBoundaryClosure(const Array< int > &bdr_attr_is_ess, Array< int > &bdr_vertices, Array< int > &bdr_edges)
Array< QuadratureInterpolator * > E2Q_array
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...
A class that performs interpolation from a face E-vector to quadrature point values and/or derivative...
int GetNumBorderDofs(Geometry::Type geom, int order) const
Operator * Ptr() const
Access the underlying Operator pointer.
int GetEntityDofs(int entity, int index, Array< int > &dofs, Geometry::Type master_geom=Geometry::INVALID, int variant=0) const
Helper to get vertex, edge or face DOFs (entity=0,1,2 resp.).
OperatorHandle L2E_nat
The element restriction operators, see GetElementRestriction().
int GetNumDof(Geometry::Type geom, int p) const
Variable order version of DofForGeometry().
int slaves_end
slave faces
void GetTransferOperator(const FiniteElementSpace &coarse_fes, OperatorHandle &T) const
Construct and return an Operator that can be used to transfer GridFunction data from coarse_fes...
void GetElementInteriorDofs(int i, Array< int > &dofs) const
void GetLocalRefinementMatrices(Geometry::Type geom, DenseTensor &localP) const
int GetOrder() const
If all orders are identical, return that number. Otherwise, return NURBSFECollection::VariableOrder.
List of mesh geometries stored as Array<Geometry::Type>.
double Min() const
Returns the minimal element of the vector.
Type
Enumeration defining IDs for some classes derived from Operator.
RefinementOperator(const FiniteElementSpace *fespace, Table *old_elem_dof, int old_ndofs)
void Swap(Array< T > &, Array< T > &)
Array< int > bdr_attributes
A list of all unique boundary attributes used by the Mesh.
double p(const Vector &x, double t)
void LoadFE(int i, const FiniteElement *FE) const
void SetOrder(int Order) const
Set the order and the name, based on the given Order: either a positive number for fixed order...
Operator that converts FiniteElementSpace L-vectors to E-vectors.
void Print(std::ostream &out=mfem::out, int width=8) const
Prints vector to stream out.
Nonconforming edge/face within a bigger edge/face.
Class FiniteElementSpace - responsible for providing FEM view of the mesh, mainly managing the set of...
int GetDof() const
Returns the number of degrees of freedom in the finite element.
virtual ~FiniteElementSpace()
bool OwnsOperator() const
Return true if the OperatorHandle owns the held Operator.
Collection of finite elements from the same family in multiple dimensions. This class is used to matc...
SparseMatrix * H2L_GlobalRestrictionMatrix(FiniteElementSpace *lfes)
Construct the restriction matrix from the FE space given by (*this) to the lower degree FE space give...
void SetSize(int nsize)
Change the logical size of the array, keep existing entries.
void Set(const int i, const int j, const double a)
void Transpose(const Table &A, Table &At, int ncols_A_)
Transpose a Table.
void Save(std::ostream &out) const
Write the QuadratureSpace to the stream out.
Array< char > var_face_orders
void Clear()
Clear the OperatorHandle, deleting the held Operator (if owned), while leaving the type id unchanged...
Helper struct for defining a connectivity table, see Table::MakeFromList.
void Mult(const double *x, double *y) const
Matrix vector multiplication with the inverse of dense matrix.
Geometry::Type GetElementGeometry(int i) const
Table * GetElementDofTable()
void MakeVDimMatrix(SparseMatrix &mat) const
Replicate 'mat' in the vector dimension, according to vdim ordering mode.
Table * GetBdrElementDofTable()
The ordering method used when the number of unknowns per mesh node (vector dimension) is bigger than ...
void GetEdgeInteriorVDofs(int i, Array< int > &vdofs) const
Linear2DFiniteElement TriangleFE
int GetNVariants(int entity, int index) const
Return number of possible DOF variants for edge/face (var. order spaces).
const CoarseFineTransformations & GetRefinementTransforms()
Operation GetLastOperation() const
Return type of last modification of the mesh.
static FiniteElementCollection * New(const char *name)
Factory method: return a newly allocated FiniteElementCollection according to the given name...
T * HostWrite()
Shortcut for mfem::Write(a.GetMemory(), a.Size(), false).
bool Nonconforming() const
NURBSExtension * NURBSext
Optional NURBS mesh extension.
int GetNV() const
Returns number of vertices. Vertices are only at the corners of elements, where you would expect them...
int GetDegenerateFaceDofs(int index, Array< int > &dofs, Geometry::Type master_geom, int variant) const
void ConvertToConformingVDofs(const Array< int > &dofs, Array< int > &cdofs)
For a partially conforming FE space, convert a marker array (nonzero entries are true) on the partial...
virtual const char * Name() const
void SetOperatorOwner(bool own=true)
Set the ownership flag for the held Operator.
void GetElementEdges(int i, Array< int > &edges, Array< int > &cor) const
Return the indices and the orientations of all edges of element i.
Mesh * mesh
The mesh that FE space lives on (not owned).
void ReorderElementToDofTable()
Reorder the scalar DOFs based on the element ordering.
GridFunction interpolation operator applicable after mesh refinement.
void CalcEdgeFaceVarOrders(Array< VarOrderBits > &edge_orders, Array< VarOrderBits > &face_orders) const
double Max() const
Returns the maximal element of the vector.
const NCList & GetNCList(int entity)
Return vertex/edge/face list (entity = 0/1/2, respectively).
Array< FaceQuadratureInterpolator * > E2BFQ_array
int GetNConformingDofs() const
Table var_face_dofs
NOTE: also used for spaces with mixed faces.
void GetFaceEdges(int i, Array< int > &edges, Array< int > &o) const
void GetEdgeInteriorDofs(int i, Array< int > &dofs) const
const QuadratureInterpolator * GetQuadratureInterpolator(const IntegrationRule &ir) const
Return a QuadratureInterpolator that interpolates E-vectors to quadrature point values and/or derivat...
ElementDofOrdering
Constants describing the possible orderings of the DOFs in one element.
General triple product operator x -> A*B*C*x, with ownership of the factors.
virtual void GetLocalRestriction(ElementTransformation &Trans, DenseMatrix &R) const
Return a local restriction matrix R (Dof x Dof) mapping fine dofs to coarse dofs. ...
Array< FaceQuadratureInterpolator * > E2IFQ_array
void BuildFaceToDofTable() const
void UpdateElementOrders()
Resize the elem_order array on mesh change.
void OrientedPointMatrix(const Slave &slave, DenseMatrix &oriented_matrix) const
Return the point matrix oriented according to the master and slave edges.
virtual const FiniteElement * GetFE(int i) const
Returns pointer to the FiniteElement in the FiniteElementCollection associated with i'th element in t...
int index(int i, int j, int nx, int ny)
Array< char > var_edge_orders
int GetEdgeOrder(int edge, int variant=0) const
Lexicographic ordering for tensor-product FiniteElements.
virtual int GetNVertices() const =0
int parent
Element index in the coarse mesh.
FiniteElementSpace()
Default constructor: the object is invalid until initialized using the method Load().
QuadratureSpace(Mesh *mesh_, int order_)
Create a QuadratureSpace based on the global rules from IntRules.
void Constructor(Mesh *mesh, NURBSExtension *ext, const FiniteElementCollection *fec, int vdim=1, int ordering=Ordering::byNODES)
Help function for constructors + Load().
NCMesh * ncmesh
Optional non-conforming mesh extension.
Geometry::Type GetBdrElementBaseGeometry(int i) const
void GetFaceVDofs(int i, Array< int > &vdofs) const
Returns indexes of degrees of freedom for i'th face element (2D and 3D).
NQPT x VDIM x NE (values) / NQPT x VDIM x DIM x NE (grads)
void SetRow(const int row, const Array< int > &cols, const Vector &srow)
void GetEdgeVDofs(int i, Array< int > &vdofs) const
Returns indexes of degrees of freedom for i'th edge.
static void ListToMarker(const Array< int > &list, int marker_size, Array< int > &marker, int mark_val=-1)
Convert an array of indices (list) to a Boolean marker array where all indices in the list are marked...
int GetNEdges() const
Return the number of edges.
void filter_dos(std::string &line)
Check for, and remove, a trailing '\r' from and std::string.
MFEM_HOST_DEVICE void Set(const int height, const int width, const double alpha, const TA *Adata, TB *Bdata)
Compute B = alpha*A, where the matrices A and B are of size height x width with data Adata and Bdata...
void MakeRef(T *, int)
Make this Array a reference to a pointer.
int GetNFaces() const
Return the number of faces in a 3D mesh.
BiLinear2DFiniteElement QuadrilateralFE
void MultAtB(const DenseMatrix &A, const DenseMatrix &B, DenseMatrix &AtB)
Multiply the transpose of a matrix A with a matrix B: At*B.
void Mult(const double *x, double *y) const
Matrix vector multiplication.
std::tuple< bool, ElementDofOrdering, FaceType, L2FaceValues > key_face
The face restriction operators, see GetFaceRestriction().
const Table & GetElementToDofTable() const
Return a reference to the internal Table that stores the lists of scalar dofs, for each mesh element...
virtual void GetTransferMatrix(const FiniteElement &fe, ElementTransformation &Trans, DenseMatrix &I) const
Return interpolation matrix, I, which maps dofs from a coarse element, fe, to the fine dofs on this f...
const NCList & GetEdgeList()
Return the current list of conforming and nonconforming edges.
SparseMatrix * cR_hp
A version of the conforming restriction matrix for variable-order spaces.
static bool DofFinalizable(int dof, const Array< bool > &finalized, const SparseMatrix &deps)
Class representing the storage layout of a QuadratureFunction.
void UseExternalData(double *d, int h, int w)
Change the data array and the size of the DenseMatrix.
const FiniteElement * GetBE(int i) const
Returns pointer to the FiniteElement in the FiniteElementCollection associated with i'th boundary fac...
NURBSExtension * NURBSext
void GetBdrElementVDofs(int i, Array< int > &vdofs) const
Returns indexes of degrees of freedom for i'th boundary element.
void SetSize(int s)
Change the size of the DenseMatrix to s x s.
OutStream out(std::cout)
Global stream used by the library for standard output. Initially it uses the same std::streambuf as s...
Base class for operators that extracts Face degrees of freedom.
void Swap(SparseMatrix &other)
int GetElementOrderImpl(int i) const
Return element order: internal version of GetElementOrder without checks.
Rank 3 tensor (array of matrices)
IntegrationRules IntRules(0, Quadrature1D::GaussLegendre)
A global object with all integration rules (defined in intrules.cpp)
void Save(std::ostream &out) const
Save finite element space to output stream out.
Abstract data type element.
void BuildDofToArrays()
Initialize internal data that enables the use of the methods GetElementForDof() and GetLocalDofForDof...
Linear1DFiniteElement SegmentFE
void GetBdrElementVertices(int i, Array< int > &v) const
Returns the indices of the vertices of boundary element i.
Operator that converts L2 FiniteElementSpace L-vectors to E-vectors.
void GetElementVertices(int i, Array< int > &v) const
Returns the indices of the vertices of element i.
int FindDofs(const Table &var_dof_table, int row, int ndof) const
Search row of a DOF table for a DOF set of size 'ndof', return first DOF.
static void AdjustVDofs(Array< int > &vdofs)
void SetType(Operator::Type tid)
Invoke Clear() and set a new type id.
const Element * GetBdrElement(int i) const
Defines the position of a fine element within a coarse element.
void Reset(OpType *A, bool own_A=true)
Reset the OperatorHandle to the given OpType pointer, A.
void GetElementFaces(int i, Array< int > &faces, Array< int > &ori) const
Return the indices and the orientations of all faces of element i.
int matrix
Index into the DenseTensor corresponding to the parent Geometry::Type stored in CoarseFineTransformat...
const QuadratureSpace * qspace
Not owned.
void DofsToVDofs(Array< int > &dofs, int ndofs=-1) const
const FaceQuadratureInterpolator * GetFaceQuadratureInterpolator(const IntegrationRule &ir, FaceType type) const
Return a FaceQuadratureInterpolator that interpolates E-vectors to quadrature point values and/or der...