33 ndofs(0), nvdofs(0), nedofs(0), nfdofs(0), nbdofs(0),
35 elem_dof(NULL), elem_fos(NULL), bdr_elem_dof(NULL), bdr_elem_fos(NULL),
37 NURBSext(NULL), own_ext(false),
40 sequence(0), mesh_sequence(0), orders_changed(false), relaxed_hp(false)
47 mesh_ = mesh_ ? mesh_ : orig.
mesh;
48 fec_ = fec_ ? fec_ : orig.
fec;
72 int vdim,
int ordering)
77 int vdim,
int ordering)
83 MFEM_VERIFY(
cP == NULL,
"");
84 MFEM_VERIFY(
cR == NULL,
"");
94 for (
int i=0; i<n; ++i)
98 perm_mat->
Set(i, j, s);
110 else if (perm != NULL)
121 else if (perm != NULL)
123 cR.reset(perm_mat_tr);
135 "Attempting to set serial prolongation operator for "
136 "parallel finite element space.");
154 "Attempting to set serial restriction operator for "
155 "parallel finite element space.");
171 "Space has not been Updated() after a Mesh change.");
172 MFEM_VERIFY(i >= 0 && i <
GetNE(),
"Invalid element index");
173 MFEM_VERIFY(
p >= 0 &&
p <=
MaxVarOrder,
"Order out of range");
196 "Space has not been Updated() after a Mesh change.");
197 MFEM_VERIFY(i >= 0 && i <
GetNE(),
"Invalid element index");
212 if (ndofs_ < 0) { ndofs_ = this->
ndofs; }
216 for (
int i = 0; i < dofs.
Size(); i++)
218 dofs[i] = Ordering::Map<Ordering::byNODES>(ndofs_,
vdim, i, vd);
223 for (
int i = 0; i < dofs.
Size(); i++)
225 dofs[i] = Ordering::Map<Ordering::byVDIM>(ndofs_,
vdim, i, vd);
232 if (
vdim == 1) {
return; }
233 if (ndofs_ < 0) { ndofs_ = this->
ndofs; }
237 Ordering::DofsToVDofs<Ordering::byNODES>(ndofs_,
vdim, dofs);
241 Ordering::DofsToVDofs<Ordering::byVDIM>(ndofs_,
vdim, dofs);
247 if (
vdim == 1) {
return; }
248 if (ndofs_ < 0) { ndofs_ = this->
ndofs; }
252 for (
int i = 0; i < dofs.
Size(); i++)
254 dofs[i] = Ordering::Map<Ordering::byNODES>(ndofs_,
vdim, dofs[i], vd);
259 for (
int i = 0; i < dofs.
Size(); i++)
261 dofs[i] = Ordering::Map<Ordering::byVDIM>(ndofs_,
vdim, dofs[i], vd);
268 if (
vdim == 1) {
return dof; }
269 if (ndofs_ < 0) { ndofs_ = this->
ndofs; }
273 return Ordering::Map<Ordering::byNODES>(ndofs_,
vdim, dof, vd);
277 return Ordering::Map<Ordering::byVDIM>(ndofs_,
vdim, dof, vd);
284 int n = vdofs.
Size(), *vdof = vdofs;
285 for (
int i = 0; i < n; i++)
288 if ((j = vdof[i]) < 0)
384 if (el_fos) { el_fos->
MakeJ(); }
423 if (bel_fos) { bel_fos->
MakeJ(); }
436 if (bel_fos) { bel_fos->
ShiftUpI(); }
452 for (
int i = 0; i < fc_dof->
Size(); i++)
458 for (
int i = 0; i < fc_dof->
Size(); i++)
483 for (
int k = 0, dof_counter = 0; k < nnz; k++)
485 const int sdof = J[k];
486 const int dof = (sdof < 0) ? -1-sdof : sdof;
487 int new_dof = dof_marker[dof];
490 dof_marker[dof] = new_dof = dof_counter++;
492 J[k] = (sdof < 0) ? -1-new_dof : new_dof;
505 for (
int i = 0; i <
mesh ->
GetNE(); i++)
507 const int *dofs =
elem_dof -> GetRow(i);
508 const int n =
elem_dof -> RowSize(i);
509 for (
int j = 0; j < n; j++)
534 for (
int j = 0; j < n; j++)
550 mark_array[d >= 0 ? d : -1 - d] = -1;
561 for (
int i = 0; i <
GetNBE(); i++)
573 for (
auto &d : dofs) { d =
DofToVDof(d, component); }
586 for (
auto v : bdr_verts)
595 for (
auto &d : dofs) { d =
DofToVDof(d, component); }
599 for (
auto e : bdr_edges)
608 for (
auto &d : dofs) { d =
DofToVDof(d, component); }
612 for (
auto f : bdr_faces)
621 for (
auto &d : dofs) { d =
DofToVDof(d, component); }
648 std::string error_msg =
"failed dof: ";
649 auto ess_tdofs_ = ess_tdofs.
HostRead();
650 auto ess_tdofs2_ = ess_tdofs2.
HostRead();
651 for (
int i = 0; i < ess_tdofs2.
Size(); ++i)
653 if (
bool(ess_tdofs_[i]) !=
bool(ess_tdofs2_[i]))
655 error_msg += std::to_string(i) +=
"(R ";
656 error_msg += std::to_string(
bool(ess_tdofs_[i])) +=
" P^T ";
657 error_msg += std::to_string(
bool(ess_tdofs2_[i])) +=
") ";
664 MFEM_ASSERT(R->
Width() == ess_vdofs.
Size(),
"!");
665 MFEM_VERIFY(counter == 0,
"internal MFEM error: counter = " << counter
666 <<
' ' << error_msg);
696 for (
int i = 0; i < ext_face_marker.
Size(); i++)
698 if (ext_face_marker[i])
709 for (
auto &d : dofs) { d =
DofToVDof(d, component); }
735 std::string error_msg =
"failed dof: ";
736 auto ext_tdofs_ = ext_tdofs.
HostRead();
737 auto ext_tdofs2_ = ext_tdofs2.
HostRead();
738 for (
int i = 0; i < ext_tdofs2.
Size(); ++i)
740 if (
bool(ext_tdofs_[i]) !=
bool(ext_tdofs2_[i]))
742 error_msg += std::to_string(i) +=
"(R ";
743 error_msg += std::to_string(
bool(ext_tdofs_[i])) +=
" P^T ";
744 error_msg += std::to_string(
bool(ext_tdofs2_[i])) +=
") ";
751 MFEM_ASSERT(R->
Width() == ext_vdofs.
Size(),
"!");
752 MFEM_VERIFY(counter == 0,
"internal MFEM error: counter = " << counter
753 <<
' ' << error_msg);
765 for (
int i = 0; i < marker.
Size(); i++)
767 if (marker[i]) { num_marked++; }
771 list.Reserve(num_marked);
772 for (
int i = 0; i < marker.
Size(); i++)
774 if (marker[i]) { list.Append(i); }
786 for (
int i = 0; i < list.Size(); i++)
788 marker[list[i]] = mark_val;
796 if (
cP) {
cP->BooleanMultTranspose(dofs, cdofs); }
797 else { dofs.
Copy(cdofs); }
804 if (
cR) {
cR->BooleanMultTranspose(cdofs, dofs); }
805 else { cdofs.
Copy(dofs); }
823 if (d_vdofs.
Size() != c_vdofs.
Size())
825 mfem_error (
"FiniteElementSpace::D2C_GlobalRestrictionMatrix (...)");
829 for (j = 0; j < d_vdofs.
Size(); j++)
831 R -> Set (c_vdofs[j], d_vdofs[j], 1.0);
855 if (c_dofs.
Size() != 1)
857 "D2Const_GlobalRestrictionMatrix (...)");
860 for (j = 0; j < d_dofs.
Size(); j++)
862 R -> Set (c_dofs[0], d_dofs[j], 1.0);
886 for (
int i = 0; i <
mesh ->
GetNE(); i++)
893 if (geom != cached_geom)
895 h_fe =
this ->
GetFE (i);
896 l_fe = lfes ->
GetFE (i);
898 h_fe->
Project(*l_fe, T, loc_restr);
902 for (
int vd = 0; vd < lvdim; vd++)
904 l_dofs.
Copy(l_vdofs);
907 h_dofs.
Copy(h_vdofs);
910 R -> SetSubMatrix (l_vdofs, h_vdofs, loc_restr, 1);
923 for (
int i = skipfirst; i < slave_dofs.
Size(); i++)
925 const int sdof = slave_dofs[i];
928 for (
int j = 0; j < master_dofs.
Size(); j++)
930 const real_t coef = I(i, j);
931 if (std::abs(coef) > 1e-12)
933 const int mdof = master_dofs[j];
934 if (mdof != sdof && mdof != (-1-sdof))
936 deps.
Add(sdof, mdof, coef);
959 MFEM_ASSERT(V.
Size() == E.
Size(),
"");
966 for (
int i = 0; i < E.
Size(); i++)
968 int a = i,
b = (i+1) % V.
Size();
969 if (V[
a] > V[
b]) { std::swap(
a,
b); }
976 for (
int j = 0; j < 2; j++)
978 edge_pm(j, 0) = (*pm)(j,
a);
979 edge_pm(j, 1) = (*pm)(j,
b);
980 mid[j] = 0.5*((*pm)(j,
a) + (*pm)(j,
b));
985 if (mid[0] > eps && mid[0] < 1-eps &&
986 mid[1] > eps && mid[1] < 1-eps)
1005 for (
int i = 0; i < ndep; i++)
1007 if (!finalized[dep[i]]) {
return false; }
1034 if (!dofs.
Size()) {
return 0; }
1039 for (
int i = 0; i < nv; i++)
1042 dofs[nv+i] = edof[nv+i];
1046 for (
int i = 0; i < ne; i++)
1048 dofs[face_vert*nv + i] = edof[2*nv + i];
1111 MFEM_ASSERT(ent_dofs.
Size() >= num_ent+1,
"");
1115 for (
int i = 0; i < num_ent; i++)
1117 if (ent_dofs.
RowSize(i) <= 1) {
continue; }
1122 if (geom != last_geom)
1130 const auto *master_fe =
fec->
GetFE(geom,
p);
1131 if (!master_fe) {
break; }
1134 for (
int variant = 1; ; variant++)
1136 const int q =
GetEntityDofs(entity, i, slave_dofs, geom, variant);
1137 if (q < 0) {
break; }
1139 const auto *slave_fe =
fec->
GetFE(geom, q);
1152 "This method should not be used with a ParFiniteElementSpace!");
1167 Array<int> master_dofs, slave_dofs, highest_dofs;
1186 for (
int entity = 2; entity >= 1; entity--)
1189 if (!list.masters.Size()) {
continue; }
1198 if (!master_dofs.
Size()) {
continue; }
1201 if (!master_fe) {
continue; }
1203 switch (master_geom)
1208 default: MFEM_ABORT(
"unsupported geometry");
1211 for (
int si = master.slaves_begin; si < master.slaves_end; si++)
1216 if (!slave_dofs.
Size()) {
break; }
1235 const auto *pm = list.point_matrices[master_geom][slave.
matrix];
1237 slave_dofs, slave.
index, pm);
1248 const int q =
GetEntityDofs(entity, master.index, highest_dofs,
1249 master_geom, nvar-1);
1250 const auto *highest_fe =
fec->
GetFE(master_geom, q);
1267 int n_true_dofs = 0;
1268 for (
int i = 0; i <
ndofs; i++)
1270 if (!deps.
RowSize(i)) { n_true_dofs++; }
1274 if (n_true_dofs ==
ndofs)
1292 for (
int i = 0; i < n_true_dofs; i++)
1297 cR_I[n_true_dofs] = n_true_dofs;
1321 for (
int i = 0, true_dof = 0; i <
ndofs; i++)
1325 cP->
Add(i, true_dof, 1.0);
1327 finalized[i] =
true;
1333 inv_deps.
GetRow(i, cols, srow);
1334 cR_hp->AddRow(true_dof, cols, srow);
1338 cR_hp->Add(true_dof, i, 1.0);
1354 int n_finalized = n_true_dofs;
1358 for (
int dof = 0; dof <
ndofs; dof++)
1364 int n_dep = deps.
RowSize(dof);
1366 for (
int j = 0; j < n_dep; j++)
1368 cP->GetRow(dep_col[j], cols, srow);
1369 srow *= dep_coef[j];
1370 cP->AddRow(dof, cols, srow);
1373 finalized[dof] =
true;
1383 MFEM_VERIFY(n_finalized ==
ndofs,
1384 "Error creating cP matrix: n_finalized = "
1385 << n_finalized <<
", ndofs = " <<
ndofs);
1400 if (
vdim == 1) {
return; }
1402 int height = mat.
Height();
1403 int width = mat.
Width();
1409 for (
int i = 0; i < height; i++)
1411 mat.
GetRow(i, dofs, srow);
1412 for (
int vd = 0; vd <
vdim; vd++)
1519 key_face key = std::make_tuple(is_dg_space, f_ordering, type, m);
1520 auto itr =
L2F.find(key);
1521 if (itr !=
L2F.end())
1560 for (
int i = 0; i <
E2Q_array.Size(); i++)
1563 if (qi->
IntRule == &ir) {
return qi; }
1579 for (
int i = 0; i <
E2Q_array.Size(); i++)
1582 if (qi->
qspace == &qs) {
return qi; }
1604 if (qi->
IntRule == &ir) {
return qi; }
1617 if (qi->
IntRule == &ir) {
return qi; }
1628 const int coarse_ndofs,
const Table &coarse_elem_dof,
1641 if (elem_geoms.
Size() == 1)
1643 const int coarse_ldof = localP[elem_geoms[0]].
SizeJ();
1661 const int fine_ldof = localP[geom].
SizeI();
1666 for (
int vd = 0; vd <
vdim; vd++)
1668 coarse_dofs.
Copy(coarse_vdofs);
1671 for (
int i = 0; i < fine_ldof; i++)
1674 int m = (r >= 0) ? r : (-1 - r);
1679 P->
SetRow(r, coarse_vdofs, row);
1686 MFEM_ASSERT(mark.
Sum() == P->
Height(),
"Not all rows of P set.");
1692 const int coarse_ndofs,
const Table &coarse_elem_dof)
const
1716 const int ldof = fe->
GetDof();
1722 const int fine_ldof = lP.
Height();
1727 for (
int vd = 0; vd <
vdim; vd++)
1729 coarse_dofs.
Copy(coarse_vdofs);
1732 for (
int i = 0; i < fine_ldof; i++)
1735 int m = (r >= 0) ? r : (-1 - r);
1740 P->
SetRow(r, coarse_vdofs, row);
1747 MFEM_VERIFY(mark.
Sum() == P->
Height(),
"Not all rows of P set.");
1760 int nmat = pmats.
SizeK();
1767 localP.
SetSize(ldof, ldof, nmat);
1768 for (
int i = 0; i < nmat; i++)
1776 const Table* old_elem_dof,
1777 const Table* old_elem_fos)
1779 MFEM_VERIFY(
GetNE() >= old_elem_dof->
Size(),
1780 "Previous mesh is not coarser.");
1786 for (
int i = 0; i < elem_geoms.
Size(); i++)
1803 old_elem_dof(old_elem_dof),
1804 old_elem_fos(old_elem_fos)
1806 MFEM_VERIFY(fespace->
GetNE() >= old_elem_dof->
Size(),
1807 "Previous mesh is not coarser.");
1816 for (
int i = 0; i < elem_geoms.
Size(); i++)
1822 ConstructDoFTransArray();
1828 fespace(fespace), old_elem_dof(NULL), old_elem_fos(NULL)
1834 for (
int i = 0; i < elem_geoms.
Size(); i++)
1837 localP[elem_geoms[i]]);
1850 ConstructDoFTransArray();
1855 delete old_elem_dof;
1856 delete old_elem_fos;
1857 for (
int i=0; i<old_DoFTransArray.Size(); i++)
1859 delete old_DoFTransArray[i];
1863void FiniteElementSpace::RefinementOperator::ConstructDoFTransArray()
1866 for (
int i=0; i<old_DoFTransArray.Size(); i++)
1868 old_DoFTransArray[i] = NULL;
1882 const FiniteElement *nd_tet =
1887 new ND_TetDofTransformation(nd_tet->GetOrder());
1890 const FiniteElement *nd_pri =
1895 new ND_WedgeDofTransformation(nd_pri->GetOrder());
1898 const FiniteElement *nd_pyr =
1903 new ND_PyramidDofTransformation(nd_pyr->GetOrder());
1911 Mesh* mesh_ref = fespace->GetMesh();
1915 Array<int> dofs, vdofs, old_dofs, old_vdofs, old_Fo;
1917 int rvdim = fespace->GetVDim();
1918 int old_ndofs = width / rvdim;
1926 for (
int k = 0; k < mesh_ref->
GetNE(); k++)
1930 if (fespace->IsVariableOrder())
1934 const int ldof = fe->
GetDof();
1940 const DenseMatrix &lP = (fespace->IsVariableOrder()) ? eP : localP[geom](
1945 fespace->GetElementDofs(k, dofs, doftrans);
1946 old_elem_dof->GetRow(emb.
parent, old_dofs);
1950 for (
int vd = 0; vd < rvdim; vd++)
1953 fespace->DofsToVDofs(vd, vdofs);
1954 old_dofs.
Copy(old_vdofs);
1955 fespace->DofsToVDofs(vd, old_vdofs, old_ndofs);
1958 lP.
Mult(subX, subY);
1964 old_elem_fos->GetRow(emb.
parent, old_Fo);
1965 old_DoFTrans.SetDofTransformation(*old_DoFTransArray[geom]);
1966 old_DoFTrans.SetFaceOrientations(old_Fo);
1969 for (
int vd = 0; vd < rvdim; vd++)
1972 fespace->DofsToVDofs(vd, vdofs);
1973 old_dofs.
Copy(old_vdofs);
1974 fespace->DofsToVDofs(vd, old_vdofs, old_ndofs);
1977 old_DoFTrans.InvTransformPrimal(subX);
1978 lP.
Mult(subX, subY);
1982 doftrans.
SetVDim(rvdim, fespace->GetOrdering());
1992 Mesh* mesh_ref = fespace->GetMesh();
1999 Array<int> f_dofs, c_dofs, f_vdofs, c_vdofs, old_Fo;
2001 int rvdim = fespace->GetVDim();
2002 int old_ndofs = width / rvdim;
2004 Vector subY, subX, subYt;
2011 for (
int k = 0; k < mesh_ref->
GetNE(); k++)
2016 if (fespace->IsVariableOrder())
2018 fe = fespace->GetFE(k);
2020 const int ldof = fe->
GetDof();
2027 const DenseMatrix &lP = (fespace->IsVariableOrder()) ? eP : localP[geom](
2030 fespace->GetElementDofs(k, f_dofs, doftrans);
2031 old_elem_dof->GetRow(emb.
parent, c_dofs);
2037 for (
int vd = 0; vd < rvdim; vd++)
2039 f_dofs.
Copy(f_vdofs);
2040 fespace->DofsToVDofs(vd, f_vdofs);
2041 c_dofs.
Copy(c_vdofs);
2042 fespace->DofsToVDofs(vd, c_vdofs, old_ndofs);
2045 for (
int p = 0;
p < f_dofs.
Size(); ++
p)
2060 old_elem_fos->GetRow(emb.
parent, old_Fo);
2061 old_DoFTrans.SetDofTransformation(*old_DoFTransArray[geom]);
2062 old_DoFTrans.SetFaceOrientations(old_Fo);
2065 for (
int vd = 0; vd < rvdim; vd++)
2067 f_dofs.
Copy(f_vdofs);
2068 fespace->DofsToVDofs(vd, f_vdofs);
2069 c_dofs.
Copy(c_vdofs);
2070 fespace->DofsToVDofs(vd, c_vdofs, old_ndofs);
2074 for (
int p = 0;
p < f_dofs.
Size(); ++
p)
2082 old_DoFTrans.TransformDual(subYt);
2085 doftrans.
SetVDim(rvdim, fespace->GetOrdering());
2088 for (
int p = 0;
p < f_dofs.
Size(); ++
p)
2106 : geom(g), num_children(n), children(c) { }
2108 bool operator<(
const RefType &other)
const
2110 if (geom < other.geom) {
return true; }
2111 if (geom > other.geom) {
return false; }
2112 if (num_children < other.num_children) {
return true; }
2113 if (num_children > other.num_children) {
return false; }
2114 for (
int i = 0; i < num_children; i++)
2116 if (children[i].one < other.children[i].one) {
return true; }
2117 if (children[i].one > other.children[i].one) {
return false; }
2123void GetCoarseToFineMap(
const CoarseFineTransformations &cft,
2125 Table &coarse_to_fine,
2126 Array<int> &coarse_to_ref_type,
2127 Table &ref_type_to_matrix,
2128 Array<Geometry::Type> &ref_type_to_geom)
2130 const int fine_ne = cft.embeddings.Size();
2132 for (
int i = 0; i < fine_ne; i++)
2134 coarse_ne = std::max(coarse_ne, cft.embeddings[i].parent);
2138 coarse_to_ref_type.SetSize(coarse_ne);
2139 coarse_to_fine.SetDims(coarse_ne, fine_ne);
2141 Array<int> cf_i(coarse_to_fine.GetI(), coarse_ne+1);
2142 Array<Pair<int,int> > cf_j(fine_ne);
2144 for (
int i = 0; i < fine_ne; i++)
2146 cf_i[cft.embeddings[i].parent+1]++;
2149 MFEM_ASSERT(cf_i.Last() == cf_j.Size(),
"internal error");
2150 for (
int i = 0; i < fine_ne; i++)
2152 const Embedding &e = cft.embeddings[i];
2153 cf_j[cf_i[e.parent]].one = e.matrix;
2154 cf_j[cf_i[e.parent]].two = i;
2157 std::copy_backward(cf_i.begin(), cf_i.end()-1, cf_i.end());
2159 for (
int i = 0; i < coarse_ne; i++)
2161 std::sort(&cf_j[cf_i[i]], cf_j.GetData() + cf_i[i+1]);
2163 for (
int i = 0; i < fine_ne; i++)
2165 coarse_to_fine.GetJ()[i] = cf_j[i].two;
2171 map<RefType,int> ref_type_map;
2172 for (
int i = 0; i < coarse_ne; i++)
2174 const int num_children = cf_i[i+1]-cf_i[i];
2175 MFEM_ASSERT(num_children > 0,
"");
2176 const int fine_el = cf_j[cf_i[i]].two;
2179 const RefType ref_type(geom, num_children, &cf_j[cf_i[i]]);
2180 pair<map<RefType,int>::iterator,
bool> res =
2181 ref_type_map.insert(
2182 pair<const RefType,int>(ref_type, (
int)ref_type_map.size()));
2183 coarse_to_ref_type[i] = res.first->second;
2186 ref_type_to_matrix.MakeI((
int)ref_type_map.size());
2187 ref_type_to_geom.SetSize((
int)ref_type_map.size());
2188 for (map<RefType,int>::iterator it = ref_type_map.begin();
2189 it != ref_type_map.end(); ++it)
2191 ref_type_to_matrix.AddColumnsInRow(it->second, it->first.num_children);
2192 ref_type_to_geom[it->second] = it->first.geom;
2195 ref_type_to_matrix.MakeJ();
2196 for (map<RefType,int>::iterator it = ref_type_map.begin();
2197 it != ref_type_map.end(); ++it)
2199 const RefType &rt = it->first;
2200 for (
int j = 0; j < rt.num_children; j++)
2202 ref_type_to_matrix.AddConnection(it->second, rt.children[j].one);
2205 ref_type_to_matrix.ShiftUpI();
2220 "incompatible coarse and fine FE spaces");
2228 for (
int gi = 0; gi < elem_geoms.
Size(); gi++)
2231 DenseTensor &lP = localP[geom], &lM = localM[geom];
2241 for (
int i = 0; i < pmats.
SizeK(); i++)
2251 Table ref_type_to_matrix;
2252 internal::GetCoarseToFineMap(rtrans, *f_mesh, coarse_to_fine,
2253 coarse_to_ref_type, ref_type_to_matrix,
2255 MFEM_ASSERT(coarse_to_fine.Size() == c_fes->
GetNE(),
"");
2257 const int total_ref_types = ref_type_to_geom.Size();
2259 Array<int> ref_type_to_coarse_elem_offset(total_ref_types);
2260 ref_type_to_fine_elem_offset.
SetSize(total_ref_types);
2263 for (
int i = 0; i < total_ref_types; i++)
2266 ref_type_to_coarse_elem_offset[i] = num_ref_types[g];
2267 ref_type_to_fine_elem_offset[i] = num_fine_elems[g];
2269 num_fine_elems[g] += ref_type_to_matrix.
RowSize(i);
2274 if (num_ref_types[g] == 0) {
continue; }
2275 const int fine_dofs = localP[g].
SizeI();
2276 const int coarse_dofs = localP[g].
SizeJ();
2277 localPtMP[g].
SetSize(coarse_dofs, coarse_dofs, num_ref_types[g]);
2278 localR[g].
SetSize(coarse_dofs, fine_dofs, num_fine_elems[g]);
2280 for (
int i = 0; i < total_ref_types; i++)
2283 DenseMatrix &lPtMP = localPtMP[g](ref_type_to_coarse_elem_offset[i]);
2284 int lR_offset = ref_type_to_fine_elem_offset[i];
2285 const int *mi = ref_type_to_matrix.
GetRow(i);
2286 const int nm = ref_type_to_matrix.
RowSize(i);
2288 for (
int s = 0; s < nm; s++)
2297 for (
int s = 0; s < nm; s++)
2310 delete coarse_elem_dof;
2319 const int fine_vdim = fine_fes->GetVDim();
2320 const int coarse_ndofs = height/fine_vdim;
2321 for (
int coarse_el = 0; coarse_el < coarse_to_fine.Size(); coarse_el++)
2323 coarse_elem_dof->
GetRow(coarse_el, c_vdofs);
2324 fine_fes->DofsToVDofs(c_vdofs, coarse_ndofs);
2329 const int ref_type = coarse_to_ref_type[coarse_el];
2331 const int *fine_elems = coarse_to_fine.GetRow(coarse_el);
2332 const int num_fine_elems = coarse_to_fine.RowSize(coarse_el);
2333 const int lR_offset = ref_type_to_fine_elem_offset[ref_type];
2334 for (
int s = 0; s < num_fine_elems; s++)
2336 const DenseMatrix &lR = localR[geom](lR_offset+s);
2337 fine_fes->GetElementVDofs(fine_elems[s], f_vdofs);
2356 const int nmat = pmats.
SizeK();
2357 const int ldof = fe->
GetDof();
2363 localR.
SetSize(ldof, ldof, nmat);
2364 for (
int i = 0; i < nmat; i++)
2372 const Table* old_elem_dof,
2373 const Table* old_elem_fos)
2377 MFEM_VERIFY(
Nonconforming(),
"Not implemented for conforming meshes.");
2378 MFEM_VERIFY(old_ndofs,
"Missing previous (finer) space.");
2379 MFEM_VERIFY(
ndofs <= old_ndofs,
"Previous space is not finer.");
2389 for (
int i = 0; i < elem_geoms.
Size(); i++)
2403 MFEM_ASSERT(dtrans.
embeddings.Size() == old_elem_dof->
Size(),
"");
2409 for (
int k = 0; k < dtrans.
embeddings.Size(); k++)
2418 const int ldof = fe->
GetDof();
2432 old_elem_dof->
GetRow(k, old_dofs);
2433 MFEM_VERIFY(old_dofs.
Size() == dofs.
Size(),
2434 "Parent and child must have same #dofs.");
2436 for (
int vd = 0; vd <
vdim; vd++)
2438 old_dofs.
Copy(old_vdofs);
2441 for (
int i = 0; i < lR.
Height(); i++)
2443 if (!std::isfinite(lR(i, 0))) {
continue; }
2446 int m = (r >= 0) ? r : (-1 - r);
2448 if (is_dg || !mark[m])
2451 R->
SetRow(r, old_vdofs, row);
2462 MFEM_VERIFY(num_marked == R->
Height(),
2463 "internal error: not all rows of R were set.");
2483 int nmat = pmats.
SizeK();
2490 for (
int i = 0; i < nmat; i++)
2499 int vdim_,
int ordering_)
2521 MFEM_VERIFY(mesh_->
NURBSext,
"NURBS FE space requires a NURBS mesh.");
2523 if (NURBSext_ == NULL)
2602 mfem_error(
"FiniteElementSpace::StealNURBSext");
2611 MFEM_VERIFY(
NURBSext,
"NURBSExt not defined.");
2654 *
VNURBSext[1]->GetElementDofTable(),offset1 );
2657 *
VNURBSext[1]->GetBdrElementDofTable(),offset1);
2662 int offset2 = offset1 +
VNURBSext[1]->GetNDof();
2667 *
VNURBSext[1]->GetElementDofTable(),offset1,
2668 *
VNURBSext[2]->GetElementDofTable(),offset2);
2671 *
VNURBSext[1]->GetBdrElementDofTable(),offset1,
2672 *
VNURBSext[2]->GetBdrElementDofTable(),offset2);
2706 if (
b == -1) {
continue; }
2716 for (
int i = 0; i < nv; i++)
2718 MFEM_VERIFY(fv[i] == bv[i],
2719 "non-matching face and boundary elements detected!");
2724 for (
int i = 0; i < row.
Size(); i++)
2727 face_dof_list.
Append(conn);
2736 MFEM_VERIFY(!
NURBSext,
"internal error");
2741 "Variable-order space requires a nonconforming mesh.");
2764 "Mesh was not correctly finalized.");
2778 else if (mixed_faces)
2802 MFEM_ASSERT(lastRow.
Size() == 1,
"");
2830 MFEM_ASSERT(lastRow.
Size() == 1,
"");
2884 const Table & loc_var_ent_dofs,
2889 const int osall0 = var_ent_dofs.
GetI()[entity];
2890 const int osall1 = var_ent_dofs.
GetI()[entity + 1];
2892 const int osloc0 = loc_var_ent_dofs.
GetI()[entity];
2893 const int osloc1 = loc_var_ent_dofs.
GetI()[entity + 1];
2897 for (
int i=osloc0; i<osloc1; ++i)
2899 const int order = loc_var_ent_orders[i];
2901 int na = var_ent_dofs.
GetJ()[j + 1] - var_ent_dofs.
GetJ()[j];
2902 while (var_ent_orders[j] != order && j < osall1 - 1)
2906 na = var_ent_dofs.
GetJ()[j + 1] - var_ent_dofs.
GetJ()[j];
2909 MFEM_ASSERT(var_ent_orders[j] == order,
"");
2911 const int n = loc_var_ent_dofs.
GetJ()[i + 1] - loc_var_ent_dofs.
GetJ()[i];
2913 MFEM_ASSERT(n == na &&
2914 n == var_ent_dofs.
GetJ()[j + 1] - var_ent_dofs.
GetJ()[j],
"");
2916 for (
int k=0; k<n; ++k) {
all2local[ndof_all + k] = ndof_loc + k; }
2926 const int na = var_ent_dofs.
GetJ()[j + 1] - var_ent_dofs.
GetJ()[j];
2941 for (
int i=0; i<
nvdofs; ++i)
2975 for (
int i=ndof_all; i<
ndofs; ++i)
2985 MFEM_ASSERT(bits != 0,
"invalid bit mask");
2986 for (
int order = 0; bits != 0; order++, bits >>= 1)
2988 if (bits & 1) {
return order; }
3022 edge_elem_orders = 0;
3023 face_elem_orders = 0;
3037 const int order = localVar ?
elem_order[i] : baseOrder;
3042 for (
int j = 0; j < E.
Size(); j++)
3044 edge_orders[E[j]] |= mask;
3045 edge_elem_orders[E[j]] |= mask;
3056 for (
int j = 0; j < F.
Size(); j++)
3058 face_orders[F[j]] |= mask;
3059 face_elem_orders[F[j]] |= mask;
3083 std::set<int> changedEdges;
3084 std::set<int> changedFaces;
3093 for (
int i = master.slaves_begin; i < master.slaves_end; i++)
3095 slave_orders |= edge_orders[edge_list.
slaves[i].index];
3098 if (slave_orders == 0)
3103 const int min_order_slaves =
MinOrder(slave_orders);
3104 if (edge_orders[master.index] == 0 ||
3105 min_order_slaves <
MinOrder(edge_orders[master.index]))
3107 edge_orders[master.index] |=
VarOrderBits(1) << min_order_slaves;
3108 changedEdges.insert(master.index);
3114 edge_orders[master.index]);
3115 for (
int i = master.slaves_begin; i < master.slaves_end; i++)
3117 if (edge_list.
slaves[i].index >= numEdges)
3123 edge_orders[edge_list.
slaves[i].index] |= min_mask;
3124 if (eo0 != edge_orders[edge_list.
slaves[i].index])
3126 changedEdges.insert(edge_list.
slaves[i].index);
3140 for (
int i = master.slaves_begin; i < master.slaves_end; i++)
3144 if (slave.
index >= 0)
3148 slave_orders |= face_orders[slave.
index];
3150 if (slave.
index >= numFaces)
3156 for (
int j = 0; j < E.
Size(); j++)
3158 slave_orders |= edge_orders[E[j]];
3164 slave_orders |= edge_orders[-1 - slave.
index];
3168 if (slave_orders == 0)
3173 const int min_order_slaves =
MinOrder(slave_orders);
3174 if (face_orders[master.index] == 0 ||
3175 min_order_slaves <
MinOrder(face_orders[master.index]))
3177 face_orders[master.index] |=
VarOrderBits(1) << min_order_slaves;
3178 changedFaces.insert(master.index);
3185 for (
int i = master.slaves_begin; i < master.slaves_end; i++)
3189 if (slave.
index >= 0 && slave.
index < numFaces)
3192 face_orders[slave.
index] |= min_mask;
3193 if (fo0 != face_orders[slave.
index])
3195 changedFaces.insert(slave.
index);
3205 for (
int j = 0; j < E.
Size(); j++)
3208 edge_orders[E[j]] |= face_orders[i];
3209 if (eo0 != edge_orders[E[j]])
3211 changedEdges.insert(E[j]);
3219 edge_orders, face_orders);
3236 for (
int i=0; i<edge_orders.
Size(); ++i)
3238 if (edge_orders[i] == 0)
3240 skip_edges[i] =
true;
3244 for (
int i=0; i<face_orders.
Size(); ++i)
3246 if (face_orders[i] == 0)
3248 skip_faces[i] =
true;
3268 int num_ent = entity_orders.
Size();
3270 int total_dofs_nonghost = 0;
3278 var_ent_order->
Reserve(num_ent);
3281 int nonGhost = num_ent;
3288 for (
int i = 0; i < num_ent; i++)
3305 for (
int order = 0; bits != 0; order++, bits >>= 1)
3312 if (i < nonGhost) { total_dofs_nonghost += dofs; }
3313 if (var_ent_order) { var_ent_order->
Append(order); }
3319 list.Append(
Connection(num_ent, total_dofs));
3323 return total_dofs_nonghost;
3327 int row,
int ndof)
const
3329 const int *beg = var_dof_table.
GetRow(row);
3330 const int *end = var_dof_table.
GetRow(row + 1);
3335 if ((beg[1] - beg[0]) == ndof) {
return beg[0]; }
3339 MFEM_ABORT(
"DOFs not found for ndof = " << ndof);
3354 if (variant >= end - beg) {
return -1; }
3375 if (variant >= end - beg) {
return -1; }
3389static const char* msg_orders_changed =
3390 "Element orders changed, you need to Update() the space first.";
3432 for (
int i = 0; i < F.
Size(); i++)
3450 for (
int i = 0; i < V.
Size(); i++)
3452 for (
int j = 0; j < nv; j++)
3454 dofs.
Append(V[i]*nv + j);
3461 for (
int i = 0; i < E.
Size(); i++)
3466 for (
int j = 0; j < ne; j++)
3475 for (
int i = 0; i < F.
Size(); i++)
3483 for (
int j = 0; j < nf; j++)
3495 for (
int j = 0; j < nb; j++)
3572 for (
int i = 0; i < V.
Size(); i++)
3574 for (
int j = 0; j < nv; j++)
3576 dofs.
Append(V[i]*nv + j);
3583 for (
int i = 0; i < E.
Size(); i++)
3588 for (
int j = 0; j < ne; j++)
3600 for (
int j = 0; j < nf; j++)
3628 int order, nf, fbase;
3636 if (variant >= end - beg) {
return -1; }
3638 fbase = beg[variant];
3639 nf = beg[variant+1] - fbase;
3645 std::stringstream msg;
3646 msg <<
"fec->GetNumDof(" << (fgeom == Geometry::SQUARE ?
"square" :
"triangle")
3647 <<
", " << order <<
") = " << fec->GetNumDof(fgeom, order) <<
" nf " << nf;
3648 msg <<
" face " << face <<
" variant " << variant << std::endl;
3654 if (variant > 0) {
return -1; }
3673 for (
int i = 0; i < V.
Size(); i++)
3675 for (
int j = 0; j < nv; j++)
3677 dofs.
Append(V[i]*nv + j);
3683 for (
int i = 0; i < E.
Size(); i++)
3688 for (
int j = 0; j < ne; j++)
3694 for (
int j = 0; j < nf; j++)
3707 int order, ne, base;
3712 if (variant >= end - beg) {
return -1; }
3714 base = beg[variant];
3715 ne = beg[variant+1] - base;
3722 if (variant > 0) {
return -1; }
3735 for (
int i = 0; i < 2; i++)
3737 for (
int j = 0; j < nv; j++)
3739 dofs.
Append(V[i]*nv + j);
3742 for (
int j = 0; j < ne; j++)
3754 for (
int j = 0; j < nv; j++)
3769 for (
int j = 0; j < nb; j++)
3799 for (
int j = 0; j < nf; j++)
3811 for (
int j = 0, k =
nvdofs+i*ne; j < ne; j++, k++)
3820 "FiniteElementSpace::GetPatchDofs needs a NURBSExtension");
3830 MFEM_ABORT(
"Empty MPI partitions are not permitted!");
3832 MFEM_ABORT(
"Invalid element id:" << i <<
"; minimum allowed:" << 0 <<
3833 ", maximum allowed:" <<
mesh->
GetNE()-1);
3851 "internal error: " <<
3866 MFEM_VERIFY(fe !=
nullptr,
"Could not determine a typical FE!");
3926 "NURBS mesh: only boundary faces are supported!");
3936 MFEM_ASSERT(
mesh->
Dimension() > 1,
"No edges with mesh dimension < 2");
3967 for (
int i = 0; i <
E2Q_array.Size(); i++)
3995 for (
int i = 0; i <
VNURBSext.Size(); i++)
4046 for (
int i = 0; i < elem_geoms.
Size(); i++)
4049 localP[elem_geoms[i]]);
4091 if (RP_case == 0) {
return; }
4104 cR.get(), T.
Ptr(), coarse_P,
false, owner,
false));
4128 Table coarse_to_fine;
4131 for (
int i = 0; i < coarse_to_fine.
Size(); i++)
4133 coarse_to_fine.
GetRow(i, tabrow);
4140 MFEM_ABORT(
"not implemented yet");
4158 MFEM_ABORT(
"Error in update sequence. Space needs to be updated after "
4159 "each mesh modification.");
4166 MFEM_ABORT(
"Updating space after both mesh change and element order "
4167 "change is not supported. Please update separately after "
4178 Table* old_elem_dof = NULL;
4179 Table* old_elem_fos = NULL;
4205 MFEM_VERIFY(!old_orders_changed,
"Interpolation for element order change "
4206 "is not implemented yet, sorry.");
4216 old_elem_fos, old_ndofs));
4219 old_elem_dof = NULL;
4220 old_elem_fos = NULL;
4245 false,
false,
true));
4254 false,
false,
true));
4264 delete old_elem_dof;
4265 delete old_elem_fos;
4282 for (
auto ref : refs)
4310 if (geoms.
Size() != 1) {
return false; }
4324 int fes_nodes_ordering)
const
4327 const int NE = m->
GetNE();
4329 if (NE == 0) { fes_node_pos.
SetSize(0);
return; }
4338 for (
int e = 0; e < NE; e++)
4341 const int mdof_cnt = dofs.
Size() /
dim;
4346 Vector mesh_shape(mdof_cnt), gf_xyz(fdof_cnt *
dim);
4347 for (
int q = 0; q < fdof_cnt; q++)
4350 for (
int d = 0; d <
dim; d++)
4353 gf_xyz(d*fdof_cnt + q) = x * mesh_shape;
4365 int fes_format = 90;
4366 bool nurbs_unit_weights =
false;
4377 MFEM_VERIFY(nurbs_fec,
"invalid FE collection");
4379 const real_t eps = 5e-14;
4390 os << (fes_format == 90 ?
4391 "FiniteElementSpace\n" :
"MFEM FiniteElementSpace v1.0\n")
4392 <<
"FiniteElementCollection: " <<
fec->
Name() <<
'\n'
4393 <<
"VDim: " <<
vdim <<
'\n'
4394 <<
"Ordering: " <<
ordering <<
'\n';
4396 if (fes_format == 100)
4410 os <<
"NURBS_orders\n";
4417 os <<
"NURBS_periodic\n";
4422 if (!nurbs_unit_weights)
4424 os <<
"NURBS_weights\n";
4428 os <<
"End: MFEM FiniteElementSpace v1.0\n";
4432std::shared_ptr<const PRefinementTransferOperator>
4435void FiniteElementSpace
4436::GetEssentialBdrEdgesFaces(
const Array<int> &bdr_attr_is_ess,
4437 std::set<int> & edges, std::set<int> & faces)
const
4440 MFEM_VERIFY(
dim == 2 ||
dim == 3,
"");
4442 for (
int i = 0; i <
GetNBE(); i++)
4454 for (
auto edge : edges_i)
4472 for (
auto e : bdr_edges)
4477 for (
auto f : bdr_faces)
4487 int fes_format = 0, ord;
4493 getline(input, buff);
4495 if (buff ==
"FiniteElementSpace") { fes_format = 90; }
4496 else if (buff ==
"MFEM FiniteElementSpace v1.0") { fes_format = 100; }
4497 else { MFEM_ABORT(
"input stream is not a FiniteElementSpace!"); }
4498 getline(input, buff,
' ');
4500 getline(input, buff);
4503 getline(input, buff,
' ');
4505 getline(input, buff,
' ');
4511 if (fes_format == 90)
4515 MFEM_VERIFY(m->
NURBSext,
"NURBS FE collection requires a NURBS mesh!");
4516 const int order = nurbs_fec->
GetOrder();
4524 else if (fes_format == 100)
4529 MFEM_VERIFY(input.good(),
"error reading FiniteElementSpace v1.0");
4530 getline(input, buff);
4532 if (buff ==
"NURBS_order" || buff ==
"NURBS_orders")
4534 MFEM_VERIFY(nurbs_fec,
4535 buff <<
": NURBS FE collection is required!");
4536 MFEM_VERIFY(m->
NURBSext, buff <<
": NURBS mesh is required!");
4537 MFEM_VERIFY(!nurbs_ext, buff <<
": order redefinition!");
4538 if (buff ==
"NURBS_order")
4551 else if (buff ==
"NURBS_periodic")
4558 else if (buff ==
"NURBS_weights")
4560 MFEM_VERIFY(nurbs_ext,
"NURBS_weights: NURBS_orders have to be "
4561 "specified before NURBS_weights!");
4564 else if (buff ==
"element_orders")
4566 MFEM_VERIFY(!nurbs_fec,
"section element_orders cannot be used "
4567 "with a NURBS FE collection");
4568 MFEM_ABORT(
"element_orders: not implemented yet!");
4570 else if (buff ==
"End: MFEM FiniteElementSpace v1.0")
4576 MFEM_ABORT(
"unknown section: " << buff);
T Max() const
Find the maximal element in the array, using the comparison operator < for class T.
void Load(std::istream &in, int fmt=0)
Read an Array from the stream in using format fmt. The format fmt can be:
const T * HostRead() const
Shortcut for mfem::Read(a.GetMemory(), a.Size(), false).
void Reserve(int capacity)
Ensures that the allocated size is at least the given size.
void SetSize(int nsize)
Change the logical size of the array, keep existing entries.
int Size() const
Return the logical size of the array.
void MakeRef(T *data_, int size_, bool own_data=false)
Make this Array a reference to a pointer.
void DeleteAll()
Delete the whole array.
int Append(const T &el)
Append element 'el' to array, resize if necessary.
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:
void Copy(Array ©) const
Create a copy of the internal array to the provided copy.
T Sum() const
Return the sum of all the array entries using the '+'' operator for class 'T'.
T * HostWrite()
Shortcut for mfem::Write(a.GetMemory(), a.Size(), false).
void Mult(const real_t *x, real_t *y) const
Matrix vector multiplication with the inverse of dense matrix.
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 SetSize(int s)
Change the size of the DenseMatrix to s x s.
void UseExternalData(real_t *d, int h, int w)
Change the data array and the size of the DenseMatrix.
void GetRow(int r, Vector &row) const
Rank 3 tensor (array of matrices)
void SetSize(int i, int j, int k, MemoryType mt_=MemoryType::PRESERVE)
Abstract base class that defines an interface for element restrictions.
Operator that converts FiniteElementSpace L-vectors to E-vectors.
Abstract data type element.
virtual void GetVertices(Array< int > &v) const =0
Get the indices defining the vertices.
virtual int GetNVertices() const =0
A class that performs interpolation from a face E-vector to quadrature point values and/or derivative...
const IntegrationRule * IntRule
Not owned.
static bool SupportsFESpace(const FiniteElementSpace &fes)
Returns true if the given finite element space is supported by FaceQuadratureInterpolator.
Base class for operators that extracts Face degrees of freedom.
Collection of finite elements from the same family in multiple dimensions. This class is used to matc...
static FiniteElementCollection * New(const char *name)
Factory method: return a newly allocated FiniteElementCollection according to the given name.
const int * GetDofOrdering(Geometry::Type geom, int p, int ori) const
Variable order version of DofOrderForOrientation().
int GetOrder() const
Return the order (polynomial degree) of the FE collection, corresponding to the order/degree returned...
virtual int GetContType() const =0
int HasFaceDofs(Geometry::Type geom, int p) const
virtual int DofForGeometry(Geometry::Type GeomType) const =0
int GetNumDof(Geometry::Type geom, int p) const
Variable order version of DofForGeometry().
virtual const FiniteElement * TraceFiniteElementForGeometry(Geometry::Type GeomType) const
const FiniteElement * GetTraceFE(Geometry::Type geom, int p) const
Variable order version of TraceFiniteElementForGeometry().
virtual const char * Name() const
const FiniteElement * GetFE(Geometry::Type geom, int p) const
Variable order version of FiniteElementForGeometry().
@ DISCONTINUOUS
Field is discontinuous across element interfaces.
virtual const FiniteElement * FiniteElementForGeometry(Geometry::Type GeomType) const =0
virtual ~DerefinementOperator()
void Mult(const Vector &x, Vector &y) const override
Operator application: y=A(x).
DerefinementOperator(const FiniteElementSpace *f_fes, const FiniteElementSpace *c_fes, BilinearFormIntegrator *mass_integ)
TODO: Implement DofTransformation support.
GridFunction interpolation operator applicable after mesh refinement.
virtual ~RefinementOperator()
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 ...
RefinementOperator(const FiniteElementSpace *fespace, Table *old_elem_dof, Table *old_elem_fos, int old_ndofs)
virtual void Mult(const Vector &x, Vector &y) const
Operator application: y=A(x).
Class FiniteElementSpace - responsible for providing FEM view of the mesh, mainly managing the set of...
std::unique_ptr< FiniteElementSpace > fesPrev
void Save(std::ostream &out) const
Save finite element space to output stream out.
void DestroyDoFTransArray()
virtual void ApplyGhostElementOrdersToEdgesAndFaces(Array< VarOrderBits > &edge_orders, Array< VarOrderBits > &face_orders) const
Helper function for ParFiniteElementSpace.
int GetEntityVDofs(int entity, int index, Array< int > &dofs, Geometry::Type master_geom=Geometry::INVALID, int variant=0) const
Helper to get vertex, edge or face VDOFs (entity=0,1,2 resp.).
void GetVDofs(int vd, Array< int > &dofs, int ndofs=-1) const
Returns the indices of all of the VDofs for the specified dimension 'vd'.
DofTransformation DoFTrans
static int EncodeDof(int entity_base, int idx)
Helper to encode a sign flip into a DOF index (for Hcurl/Hdiv shapes).
const SparseMatrix * GetConformingRestriction() const
The returned SparseMatrix is owned by the FiniteElementSpace.
void ReorderElementToDofTable()
Reorder the scalar DOFs based on the element ordering.
Array< char > var_face_orders
int GetVectorDim() const
Return the total dimension of a vector in the space.
bool IsVariableOrder() const
Returns true if the space contains elements of varying polynomial orders.
void SetRestriction(const SparseMatrix &r)
void BuildNURBSFaceToDofTable() const
Generates partial face_dof table for a NURBS space.
void BuildDofToBdrArrays() const
Initialize internal data that enables the use of the methods GetBdrElementForDof() and GetBdrLocalDof...
static void AddDependencies(SparseMatrix &deps, Array< int > &master_dofs, Array< int > &slave_dofs, DenseMatrix &I, int skipfirst=0)
const Table & GetElementToDofTable() const
Return a reference to the internal Table that stores the lists of scalar dofs, for each mesh element,...
Array< int > dof_ldof_array
Array< StatelessDofTransformation * > DoFTransArray
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.
Array< FaceQuadratureInterpolator * > E2BFQ_array
const FiniteElement * GetBE(int i) const
Returns pointer to the FiniteElement in the FiniteElementCollection associated with i'th boundary fac...
Array< FaceQuadratureInterpolator * > E2IFQ_array
friend struct DerefineMatrixOp
Array< int > face_min_nghb_order
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...
int GetNumElementInteriorDofs(int i) const
Returns the number of degrees of freedom associated with the interior of the specified element.
std::shared_ptr< PRefinementTransferOperator > PTh
virtual void GetExteriorTrueDofs(Array< int > &exterior_dofs, int component=-1) const
Get a list of all true dofs on the exterior of the mesh, exterior_dofs. For spaces with 'vdim' > 1,...
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...
NURBSExtension * NURBSext
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...
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,...
static void AdjustVDofs(Array< int > &vdofs)
Remove the orientation information encoded into an array of dofs Some basis function types have a rel...
virtual void GetExteriorVDofs(Array< int > &exterior_vdofs, int component=-1) const
Mark degrees of freedom associated with exterior faces of the mesh. For spaces with 'vdim' > 1,...
SparseMatrix * VariableOrderRefinementMatrix(const int coarse_ndofs, const Table &coarse_elem_dof) const
int GetEdgeOrder(int edge, int variant=0) const
Array< char > loc_var_face_orders
bool Nonconforming() const
void GetVertexVDofs(int i, Array< int > &vdofs) const
Returns the indices of the degrees of freedom for the specified vertices.
void GetVertexDofs(int i, Array< int > &dofs) const
Returns the indices of the degrees of freedom for the specified vertices.
void BuildFaceToDofTable() const
int GetFaceOrder(int face, int variant=0) const
Returns the polynomial degree of the i'th face finite element.
int GetNumBorderDofs(Geometry::Type geom, int order) const
FiniteElementSpace()
Default constructor: the object is invalid until initialized using the method Load().
Array< int > dof_elem_array
int FindFaceDof(int face, int ndof) const
Similar to FindEdgeDof, but used for mixed meshes too.
static int MinOrder(VarOrderBits bits)
Return the minimum order (least significant bit set) in the bit mask.
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...
MFEM_DEPRECATED void RebuildElementToDofTable()
(
int GetNDofs() const
Returns number of degrees of freedom. This is the number of Local Degrees of Freedom.
bool orders_changed
True if at least one element order changed (variable-order space only).
SparseMatrix * DerefinementMatrix(int old_ndofs, const Table *old_elem_dof, const Table *old_elem_fos)
Calculate GridFunction restriction matrix after mesh derefinement.
friend class PRefinementTransferOperator
void GetLocalRefinementMatrices(Geometry::Type geom, DenseTensor &localP) const
void GetEdgeInteriorVDofs(int i, Array< int > &vdofs) const
Returns the indices of the degrees of freedom for the interior of the specified edge.
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,...
SparseMatrix * D2C_GlobalRestrictionMatrix(FiniteElementSpace *cfes)
Generate the global restriction matrix from a discontinuous FE space to the continuous FE space of th...
virtual void GetEssentialTrueDofs(const Array< int > &bdr_attr_is_ess, Array< int > &ess_tdof_list, int component=-1) const
Get a list of essential true dofs, ess_tdof_list, corresponding to the boundary attributes marked in ...
int GetNBE() const
Returns number of boundary elements in the mesh.
virtual void UpdateMeshPointer(Mesh *new_mesh)
int GetDegenerateFaceDofs(int index, Array< int > &dofs, Geometry::Type master_geom, int variant) const
const QuadratureInterpolator * GetQuadratureInterpolator(const IntegrationRule &ir) const
Return a QuadratureInterpolator that interpolates E-vectors to quadrature point values and/or derivat...
Array< char > ghost_edge_orders
int GetBdrAttribute(int i) const
Array< int > dof_bdr_elem_array
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.).
virtual const Operator * GetRestrictionOperator() const
An abstract operator that performs the same action as GetRestrictionMatrix.
static constexpr int MaxVarOrder
virtual void CopyProlongationAndRestriction(const FiniteElementSpace &fes, const Array< int > *perm)
Copies the prolongation and restriction matrices from fes.
Array< char > var_edge_orders
std::unique_ptr< Operator > R_transpose
Operator computing the action of the transpose of the restriction.
int MakeDofTable(int ent_dim, const Array< VarOrderBits > &entity_orders, Table &entity_dofs, Array< char > *var_ent_order)
void UpdateElementOrders()
Resize the elem_order array on mesh change.
void MakeVDimMatrix(SparseMatrix &mat) const
Replicate 'mat' in the vector dimension, according to vdim ordering mode.
int GetNF() const
Returns number of faces (i.e. co-dimension 1 entities) in the mesh.
SparseMatrix * H2L_GlobalRestrictionMatrix(FiniteElementSpace *lfes)
Construct the restriction matrix from the FE space given by (*this) to the lower degree FE space give...
SparseMatrix * D2Const_GlobalRestrictionMatrix(FiniteElementSpace *cfes)
Generate the global restriction matrix from a discontinuous FE space to the piecewise constant FE spa...
const FiniteElementCollection * fec
Associated FE collection (not owned).
void GetNodePositions(const Vector &mesh_nodes, Vector &fes_node_pos, int fes_nodes_ordering=Ordering::byNODES) const
Compute the space's node positions w.r.t. given mesh positions. The function uses FiniteElement::GetN...
FiniteElementCollection * Load(Mesh *m, std::istream &input)
Read a FiniteElementSpace from a stream. The returned FiniteElementCollection is owned by the caller.
void BuildBdrElementToDofTable() const
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 ...
Array< QuadratureInterpolator * > E2Q_array
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.
NURBSExtension * StealNURBSext()
void GetPatchDofs(int patch, Array< int > &dofs) const
Returns indices of degrees of freedom for NURBS patch index patch. Cartesian ordering is used,...
void BuildDofToArrays_() const
Initialize internal data that enables the use of the methods GetElementForDof() and GetLocalDofForDof...
const Operator * GetRestrictionTransposeOperator() const
Return an operator that performs the transpose of GetRestrictionOperator.
static bool DofFinalizable(int dof, const Array< bool > &finalized, const SparseMatrix &deps)
void GetLocalDerefinementMatrices(Geometry::Type geom, DenseTensor &localR) const
void BuildConformingInterpolation() const
Calculate the cP and cR matrices for a nonconforming mesh.
int GetNE() const
Returns number of elements in the mesh.
int vdim
Vector dimension (number of unknowns per degree of freedom).
Table var_face_dofs
NOTE: also used for spaces with mixed faces.
OperatorHandle L2E_nat
The element restriction operators, see GetElementRestriction().
bool lastUpdatePRef
Flag to indicate whether the last update was for p-refinement.
int * bdofs
internal DOFs of elements if mixed/var-order; NULL otherwise
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 ...
Array< char > ghost_face_orders
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...
std::tuple< bool, ElementDofOrdering, FaceType, L2FaceValues > key_face
The face restriction operators, see GetFaceRestriction().
std::unique_ptr< SparseMatrix > cR
Conforming restriction matrix such that cR.cP=I.
void ConstructDoFTransArray()
void GetElementInteriorVDofs(int i, Array< int > &vdofs) const
Returns the indices of the degrees of freedom for the interior of the specified element.
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...
Array< char > loc_var_edge_orders
virtual void Update(bool want_transform=true)
Reflect changes in the mesh: update number of DOFs, etc. Also, calculate GridFunction transformation ...
OperatorHandle Th
Transformation to apply to GridFunctions after space Update().
SparseMatrix * RefinementMatrix(int old_ndofs, const Table *old_elem_dof, const Table *old_elem_fos)
std::uint64_t VarOrderBits
Bit-mask representing a set of orders needed by an edge/face.
SparseMatrix * RefinementMatrix_main(const int coarse_ndofs, const Table &coarse_elem_dof, const Table *coarse_elem_fos, const DenseTensor localP[]) const
int ndofs
Number of degrees of freedom. Number of unknowns is ndofs * vdim.
std::unique_ptr< SparseMatrix > cP
void AddEdgeFaceDependencies(SparseMatrix &deps, Array< int > &master_dofs, const FiniteElement *master_fe, Array< int > &slave_dofs, int slave_face, const DenseMatrix *pm) const
const FiniteElement * GetTraceElement(int i, Geometry::Type geom_type) const
Return the trace element from element 'i' to the given 'geom_type'.
const FiniteElement * GetTypicalTraceElement() const
Return a "typical" trace element.
static void MarkerToList(const Array< int > &marker, Array< int > &list)
Convert a Boolean marker array to a list containing all marked indices.
Array< NURBSExtension * > VNURBSext
int GetElementOrder(int i) const
Returns the order of the i'th finite element.
void SetVarOrderLocalDofs()
Sets all2local. See documentation of all2local for details.
Mesh * mesh
The mesh that FE space lives on (not owned).
const FiniteElement * GetFaceElement(int i) const
Returns pointer to the FiniteElement in the FiniteElementCollection associated with i'th face in the ...
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...
void CalcEdgeFaceVarOrders(Array< VarOrderBits > &edge_orders, Array< VarOrderBits > &face_orders, Array< VarOrderBits > &edge_elem_orders, Array< VarOrderBits > &face_elem_orders, Array< bool > &skip_edges, Array< bool > &skip_faces) const
virtual bool OrderPropagation(const std::set< int > &edges, const std::set< int > &faces, Array< VarOrderBits > &edge_orders, Array< VarOrderBits > &face_orders) const
Returns true if order propagation is done, for variable-order spaces.
std::shared_ptr< const PRefinementTransferOperator > GetPrefUpdateOperator()
void SetElementOrder(int i, int p)
Sets the order of the i'th finite element.
const SparseMatrix * GetHpConformingRestriction() const
The returned SparseMatrix is owned by the FiniteElementSpace.
const SparseMatrix * GetConformingProlongation() const
const FiniteElementCollection * FEColl() const
Mesh * GetMesh() const
Returns the mesh.
int GetElementOrderImpl(int i) const
Return element order: internal version of GetElementOrder without checks.
int GetNVariants(int entity, int index) const
Return number of possible DOF variants for edge/face (var. order spaces).
virtual ~FiniteElementSpace()
Array< int > dof_bdr_ldof_array
int GetVSize() const
Return the number of vector dofs, i.e. GetNDofs() x GetVDim().
const Table * GetElementToFaceOrientationTable() const
DofTransformation * GetBdrElementDofs(int bel, Array< int > &dofs) const
Returns indices of degrees of freedom for boundary element 'bel'. The returned indices are offsets in...
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' para...
int GetVDim() const
Returns the vector dimension of the finite element space.
const FaceQuadratureInterpolator * GetFaceQuadratureInterpolator(const IntegrationRule &ir, FaceType type) const
Return a FaceQuadratureInterpolator that interpolates E-vectors to quadrature point values and/or der...
bool IsDGSpace() const
Return whether or not the space is discontinuous (L2)
void GetFaceInteriorDofs(int i, Array< int > &dofs) const
Returns the indices of the degrees of freedom for the interior of the specified face.
virtual void PRefineAndUpdate(const Array< pRefinement > &refs, bool want_transfer=true)
int GetNConformingDofs() const
void SetProlongation(const SparseMatrix &p)
Array< int > edge_min_nghb_order
Minimum order among neighboring elements.
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.
void GetElementInteriorDofs(int i, Array< int > &dofs) const
Returns the indices of the degrees of freedom for the interior of the specified element.
virtual int NumGhostEdges() const
Returns the number of ghost edges (nonzero in ParFiniteElementSpace).
bool PRefinementSupported()
void Constructor(Mesh *mesh, NURBSExtension *ext, const FiniteElementCollection *fec, int vdim=1, int ordering=Ordering::byNODES)
Help function for constructors + Load().
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...
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...
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...
virtual int NumGhostFaces() const
Returns the number of ghost faces (nonzero in ParFiniteElementSpace).
int DofToVDof(int dof, int vd, int ndofs=-1) const
Compute a single vdof corresponding to the index dof and the vector index vd.
virtual const FaceRestriction * GetFaceRestriction(ElementDofOrdering f_ordering, FaceType, L2FaceValues mul=L2FaceValues::DoubleValued) const
Return an Operator that converts L-vectors to E-vectors on each face.
int GetCurlDim() const
Return the dimension of the curl of a GridFunction defined on this space.
virtual void GhostFaceOrderToEdges(const Array< VarOrderBits > &face_orders, Array< VarOrderBits > &edge_orders) const
Helper function for ParFiniteElementSpace.
int FindEdgeDof(int edge, int ndof) const
void GetPatchVDofs(int i, Array< int > &vdofs) const
Returns indices of degrees of freedom in vdofs for NURBS patch i.
void BuildElementToDofTable() const
std::unique_ptr< SparseMatrix > cR_hp
A version of the conforming restriction matrix for variable-order spaces.
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.
void VariableOrderMinimumRule(SparseMatrix &deps) const
Abstract class for all finite elements.
int GetRangeDim() const
Returns the vector dimension for vector-valued finite elements, which is also the dimension of the in...
int GetOrder() const
Returns the order of the finite element. In the case of anisotropic orders, returns the maximum order...
int GetDim() const
Returns the reference space dimension for the finite element.
virtual 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...
int GetRangeType() const
Returns the FiniteElement::RangeType of the element, one of {SCALAR, VECTOR}.
virtual void GetLocalRestriction(ElementTransformation &Trans, DenseMatrix &R) const
Return a local restriction matrix R (Dof x Dof) mapping fine dofs to coarse dofs.
const IntegrationRule & GetNodes() const
Get a const reference to the nodes of the element.
Geometry::Type GetGeomType() const
Returns the Geometry::Type of the reference element.
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...
virtual void Project(Coefficient &coeff, ElementTransformation &Trans, Vector &dofs) const
Given a coefficient and a transformation, compute its projection (approximation) in the local finite ...
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...
int GetDof() const
Returns the number of degrees of freedom in the finite element.
static const int NumVerts[NumGeom]
Arbitrary order H1-conforming (continuous) finite elements.
Class for an integration rule - an Array of IntegrationPoint.
int GetNPoints() const
Returns the number of the points in the integration rule.
Operator that converts L2 FiniteElementSpace L-vectors to E-vectors.
Operator that extracts Face degrees of freedom for L2 spaces.
Operator that extracts face degrees of freedom for L2 interface spaces.
Arbitrary order "L2-conforming" discontinuous finite elements.
Class used by MFEM to store pointers to host and/or device memory.
List of mesh geometries stored as Array<Geometry::Type>.
void GetFaceEdges(int i, Array< int > &edges, Array< int > &o) const
void GetGeometries(int dim, Array< Geometry::Type > &el_geoms) const
Return all element geometries of the given dimension present in the mesh.
Operation GetLastOperation() const
Return type of last modification of the mesh.
int GetNEdges() const
Return the number of edges.
void GetBdrElementFace(int i, int *f, int *o) const
Array< int > bdr_attributes
A list of all unique boundary attributes used by the Mesh.
NURBSExtension * NURBSext
Optional NURBS mesh extension.
virtual void GetExteriorFaceMarker(Array< int > &face_marker) const
Populate a marker array identifying exterior faces.
int GetNumFaces() const
Return the number of faces (3D), edges (2D) or vertices (1D).
void GetBdrElementVertices(int i, Array< int > &v) const
Returns the indices of the vertices of boundary element i.
Geometry::Type GetFaceGeometry(int i) const
Return the Geometry::Type associated with face i.
Geometry::Type GetElementGeometry(int i) const
Geometry::Type GetBdrElementGeometry(int i) const
void GetElementVertices(int i, Array< int > &v) const
Returns the indices of the vertices of element i.
const FiniteElementSpace * GetNodalFESpace() const
Geometry::Type GetTypicalElementGeometry() const
If the local mesh is not empty, return GetElementGeometry(0); otherwise, return a typical Geometry pr...
int GetBdrElementFaceIndex(int be_idx) const
Return the local face (codimension-1) index for the given boundary element index.
int GetNFaces() const
Return the number of faces in a 3D mesh.
const CoarseFineTransformations & GetRefinementTransforms() const
int GetNE() const
Returns number of elements.
const Element * GetFace(int i) const
Return pointer to the i'th face element object.
int Dimension() const
Dimension of the reference space used within the elements.
const Element * GetBdrElement(int i) const
Return pointer to the i'th boundary element object.
void GetBdrElementEdges(int i, Array< int > &edges, Array< int > &cor) const
Return the indices and the orientations of all edges of bdr element i.
void GetElementFaces(int i, Array< int > &faces, Array< int > &ori) const
Return the indices and the orientations of all faces of element i.
int SpaceDimension() const
Dimension of the physical space containing the mesh.
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.
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....
void GetFaceVertices(int i, Array< int > &vert) const
Returns the indices of the vertices of face i.
int GetNBE() const
Returns number of boundary elements.
NCMesh * ncmesh
Optional nonconforming mesh extension.
void GetElementEdges(int i, Array< int > &edges, Array< int > &cor) const
Return the indices and the orientations of all edges of element i.
int GetNumGeometries(int dim) const
Return the number of geometries of the given dimension present in the mesh.
Geometry::Type GetTypicalFaceGeometry() const
If the local mesh is not empty, return GetFaceGeometry(0); otherwise return a typical face geometry p...
Geometry::Type GetElementBaseGeometry(int i) const
Operator that extracts face degrees of freedom for L2 nonconforming spaces.
const NCList & GetNCList(int entity)
Return vertex/edge/face list (entity = 0/1/2, respectively).
const CoarseFineTransformations & GetDerefinementTransforms() const
const NCList & GetFaceList()
Return the current list of conforming and nonconforming faces.
Geometry::Type GetFaceGeometry(int index) const
Return face geometry type. index is the Mesh face number.
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...
const NCList & GetEdgeList()
Return the current list of conforming and nonconforming edges.
int GetNFaces() const
Return the number of (2D) faces in the NCMesh.
int GetNEdges() const
Return the number of edges in the NCMesh.
Arbitrary order H(curl)-conforming Nedelec finite elements.
NURBSExtension generally contains multiple NURBSPatch objects spanning an entire Mesh....
const Vector & GetWeights() const
Access function to the vector of weights weights.
const Array< int > & GetSlave() const
int GetNKV() const
Return the number of KnotVectors.
void LoadBE(int i, const FiniteElement *BE) const
Load boundary element i into BE.
Table * GetElementDofTable()
const Array< int > & GetMaster() const
void LoadFE(int i, const FiniteElement *FE) const
Load element i into FE.
void GetPatchDofs(const int patch, Array< int > &dofs)
Return the degrees of freedom in dofs on patch patch, in Cartesian order.
Table * GetBdrElementDofTable()
int GetNDof() const
Return the number of active DOFs.
int GetOrder() const
If all KnotVector orders are identical, return that number. Otherwise, return NURBSFECollection::Vari...
NURBSExtension * GetCurlExtension(int component)
const Array< int > & GetOrders() const
Read-only access to the orders of all KnotVectors.
NURBSExtension * GetDivExtension(int component)
void ConnectBoundaries()
Set DOF maps for periodic BC.
Arbitrary order non-uniform rational B-splines (NURBS) finite elements.
int GetOrder() const
Get the order of the NURBS collection: either a positive number, when using fixed order,...
virtual void SetOrder(int Order) const
Set the order and the name, based on the given Order: either a positive number for fixed order,...
virtual void SetDim(const int dim)
Arbitrary order H(curl) NURBS finite elements.
Arbitrary order H(div) NURBS finite elements.
Pointer to an Operator of a specified type.
OpType * As() const
Return the Operator pointer statically cast to a specified OpType. Similar to the method Get().
bool OwnsOperator() const
Return true if the OperatorHandle owns the held Operator.
void SetOperatorOwner(bool own=true)
Set the ownership flag for the held Operator.
void SetType(Operator::Type tid)
Invoke Clear() and set a new type id.
Operator * Ptr() const
Access the underlying Operator pointer.
void Clear()
Clear the OperatorHandle, deleting the held Operator (if owned), while leaving the type id unchanged.
void Reset(OpType *A, bool own_A=true)
Reset the OperatorHandle to the given OpType pointer, A.
OpType * Is() const
Return the Operator pointer dynamically cast to a specified OpType.
Operator::Type Type() const
Get the currently set operator type id.
int width
Dimension of the input / number of columns in the matrix.
int Height() const
Get the height (size of output) of the Operator. Synonym with NumRows().
int height
Dimension of the output / number of rows in the matrix.
int Width() const
Get the width (size of input) of the Operator. Synonym with NumCols().
Type
Enumeration defining IDs for some classes derived from Operator.
@ ANY_TYPE
ID for the base class Operator, i.e. any type.
@ MFEM_SPARSEMAT
ID for class SparseMatrix.
The ordering method used when the number of unknowns per mesh node (vector dimension) is bigger than ...
Abstract parallel finite element space.
Parallel version of NURBSExtension.
General product operator: x -> (A*B)(x) = A(B(x)).
A class that performs interpolation from an E-vector to quadrature point values and/or derivatives (Q...
static bool SupportsFESpace(const FiniteElementSpace &fespace)
Returns true if the given finite element space is supported by QuadratureInterpolator.
const IntegrationRule * IntRule
Not owned.
const QuadratureSpace * qspace
Not owned.
Class representing the storage layout of a QuadratureFunction.
int GetRow(const int row, Array< int > &cols, Vector &srow) const override
Extract all column indices and values from a given row.
void Add(const int i, const int j, const real_t val)
void Swap(SparseMatrix &other)
void BooleanMultTranspose(const Array< int > &x, Array< int > &y) const
y = At * x, treating all entries as booleans (zero=false, nonzero=true).
void BooleanMult(const Array< int > &x, Array< int > &y) const
y = A * x, treating all entries as booleans (zero=false, nonzero=true).
int * GetRowColumns(const int row)
Return a pointer to the column indices in a row.
int RowSize(const int i) const
Returns the number of elements in row i.
real_t * GetRowEntries(const int row)
Return a pointer to the entries in a row.
void SetRow(const int row, const Array< int > &cols, const Vector &srow)
void Finalize(int skip_zeros=1) override
Finalize the matrix initialization, switching the storage format from LIL to CSR.
void Set(const int i, const int j, const real_t val)
Table stores the connectivity of elements of TYPE I to elements of TYPE II. For example,...
void AddConnections(int r, const int *c, int nc)
void GetRow(int i, Array< int > &row) const
Return row i in array row (the Table must be finalized)
void AddConnection(int r, int c)
int Size() const
Returns the number of TYPE I elements.
int Size_of_connections() const
Returns the number of connections in the table.
void AddColumnsInRow(int r, int ncol)
void MakeFromList(int nrows, const Array< Connection > &list)
Create the table from a list of connections {(from, to)}, where 'from' is a TYPE I index and 'to' is ...
void AddAColumnInRow(int r)
The transpose of a given operator. Switches the roles of the methods Mult() and MultTranspose().
General triple product operator x -> A*B*C*x, with ownership of the factors.
void Print(std::ostream &out=mfem::out, int width=8) const
Prints vector to stream out.
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 Load(std::istream **in, int np, int *dim)
Reads a vector from multiple files.
real_t Max() const
Returns the maximal element of the vector.
void SetSize(int s)
Resize the vector to size s.
real_t * GetData() const
Return a pointer to the beginning of the Vector data.
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
int index(int i, int j, int nx, int ny)
void RemoveBasisAndRestriction(const mfem::FiniteElementSpace *fes)
Remove from ceed_basis_map and ceed_restr_map the entries associated with the given fes.
Linear1DFiniteElement SegmentFE
void mfem_error(const char *msg)
void Mult(const Table &A, const Table &B, Table &C)
C = A * B (as boolean matrices)
void DofMapHelper(int entity, const Table &var_ent_dofs, const Table &loc_var_ent_dofs, const Array< char > &var_ent_orders, const Array< char > &loc_var_ent_orders, Array< int > &all2local, int &ndof_all, int &ndof_loc)
void Transpose(const Table &A, Table &At, int ncols_A_)
Transpose a Table.
void Swap(T &a, T &b)
Swap objects of type T. The operation is performed using the most specialized swap function from the ...
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.
BiLinear2DFiniteElement QuadrilateralFE
ComplexDenseMatrix * MultAtB(const ComplexDenseMatrix &A, const ComplexDenseMatrix &B)
Multiply the complex conjugate transpose of a matrix A with a matrix B. A^H*B.
void AddMult(const DenseMatrix &b, const DenseMatrix &c, DenseMatrix &a)
Matrix matrix multiplication. A += B * C.
ElementDofOrdering GetEVectorOrdering(const FiniteElementSpace &fes)
Return LEXICOGRAPHIC if mesh contains only one topology and the elements are tensor elements,...
void MarkDofs(const Array< int > &dofs, Array< int > &mark_array)
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)
MFEM_EXPORT Linear2DFiniteElement TriangleFE
void skip_comment_lines(std::istream &is, const char comment_char)
Check if the stream starts with comment_char. If so skip it.
real_t p(const Vector &x, real_t t)
bool operator<(const Data &d1, const Data &d2)
Helper struct for defining a connectivity table, see Table::MakeFromList.
Defines the position of a fine element within a coarse element.
int parent
Coarse Element index in the coarse mesh.
Geometry::Type Geom() const
Lists all edges/faces in the nonconforming mesh.
Array< Slave > slaves
All MeshIds corresponding to slave faces.
Array< Master > masters
All MeshIds corresponding to master faces.
Nonconforming edge/face within a bigger edge/face.
unsigned matrix
index into NCList::point_matrices[geom]