14 #include "../general/text.hpp"
15 #include "../mesh/mesh_headers.hpp"
27 template <>
void Ordering::
28 DofsToVDofs<Ordering::byNODES>(
int ndofs,
int vdim,
Array<int> &dofs)
31 int size = dofs.Size();
32 dofs.SetSize(size*vdim);
33 for (
int vd = 1; vd < vdim; vd++)
35 for (
int i = 0; i < size; i++)
37 dofs[i+size*vd] = Map<byNODES>(ndofs, vdim, dofs[i], vd);
42 template <>
void Ordering::
43 DofsToVDofs<Ordering::byVDIM>(
int ndofs,
int vdim,
Array<int> &dofs)
46 int size = dofs.Size();
47 dofs.SetSize(size*vdim);
48 for (
int vd = vdim-1; vd >= 0; vd--)
50 for (
int i = 0; i < size; i++)
52 dofs[i+size*vd] = Map<byVDIM>(ndofs, vdim, dofs[i], vd);
58 FiniteElementSpace::FiniteElementSpace()
59 : mesh(NULL), fec(NULL), vdim(0), ordering(
Ordering::byNODES),
60 ndofs(0), nvdofs(0), nedofs(0), nfdofs(0), nbdofs(0),
61 fdofs(NULL), bdofs(NULL),
62 elem_dof(NULL), bdrElem_dof(NULL),
63 NURBSext(NULL), own_ext(false),
64 cP(NULL), cR(NULL), cP_is_set(false),
73 mesh = mesh ? mesh : orig.
mesh;
74 fec = fec ? fec : orig.
fec;
108 if (
vdim == 1) {
return; }
109 if (ndofs < 0) { ndofs = this->
ndofs; }
113 Ordering::DofsToVDofs<Ordering::byNODES>(
ndofs,
vdim, dofs);
117 Ordering::DofsToVDofs<Ordering::byVDIM>(
ndofs,
vdim, dofs);
123 if (
vdim == 1) {
return; }
124 if (ndofs < 0) { ndofs = this->
ndofs; }
128 for (
int i = 0; i < dofs.
Size(); i++)
130 dofs[i] = Ordering::Map<Ordering::byNODES>(
ndofs,
vdim, dofs[i], vd);
135 for (
int i = 0; i < dofs.
Size(); i++)
137 dofs[i] = Ordering::Map<Ordering::byVDIM>(
ndofs,
vdim, dofs[i], vd);
144 if (
vdim == 1) {
return dof; }
145 if (ndofs < 0) { ndofs = this->
ndofs; }
149 return Ordering::Map<Ordering::byNODES>(
ndofs,
vdim, dof, vd);
153 return Ordering::Map<Ordering::byVDIM>(
ndofs,
vdim, dof, vd);
160 int n = vdofs.
Size(), *vdof = vdofs;
161 for (
int i = 0; i < n; i++)
164 if ((j = vdof[i]) < 0)
220 for (
int i = 0; i <
mesh ->
GetNE(); i++)
223 el_dof -> AddColumnsInRow (i, dofs.
Size());
226 for (
int i = 0; i <
mesh ->
GetNE(); i++)
229 el_dof -> AddConnections (i, (
int *)dofs, dofs.
Size());
231 el_dof -> ShiftUpI();
249 for (
int k = 0, dof_counter = 0; k < nnz; k++)
251 const int sdof = J[k];
252 const int dof = (sdof < 0) ? -1-sdof : sdof;
253 int new_dof = dof_marker[dof];
256 dof_marker[dof] = new_dof = dof_counter++;
258 J[k] = (sdof < 0) ? -1-new_dof : new_dof;
271 for (
int i = 0; i <
mesh ->
GetNE(); i++)
273 const int *dofs =
elem_dof -> GetRow(i);
274 const int n =
elem_dof -> RowSize(i);
275 for (
int j = 0; j < n; j++)
288 for (
int i = 0; i < dofs.
Size(); i++)
291 if (k < 0) { k = -1 - k; }
305 for (
int i = 0; i <
GetNBE(); i++)
313 mark_dofs(vdofs, ess_vdofs);
318 for (
int d = 0; d < dofs.
Size(); d++)
319 { dofs[d] =
DofToVDof(dofs[d], component); }
320 mark_dofs(dofs, ess_vdofs);
332 for (
int i = 0; i < bdr_verts.
Size(); i++)
337 mark_dofs(vdofs, ess_vdofs);
342 for (
int d = 0; d < dofs.
Size(); d++)
343 { dofs[d] =
DofToVDof(dofs[d], component); }
344 mark_dofs(dofs, ess_vdofs);
347 for (
int i = 0; i < bdr_edges.
Size(); i++)
352 mark_dofs(vdofs, ess_vdofs);
357 for (
int d = 0; d < dofs.
Size(); d++)
358 { dofs[d] =
DofToVDof(dofs[d], component); }
359 mark_dofs(dofs, ess_vdofs);
388 for (
int i = 0; i < marker.
Size(); i++)
390 if (marker[i]) { num_marked++; }
394 for (
int i = 0; i < marker.
Size(); i++)
396 if (marker[i]) { list.
Append(i); }
406 for (
int i = 0; i < list.
Size(); i++)
408 marker[list[i]] = mark_val;
417 else { dofs.
Copy(cdofs); }
425 else { cdofs.
Copy(dofs); }
443 if (d_vdofs.
Size() != c_vdofs.
Size())
445 mfem_error (
"FiniteElementSpace::D2C_GlobalRestrictionMatrix (...)");
449 for (j = 0; j < d_vdofs.
Size(); j++)
451 R -> Set (c_vdofs[j], d_vdofs[j], 1.0);
475 if (c_dofs.
Size() != 1)
477 "D2Const_GlobalRestrictionMatrix (...)");
480 for (j = 0; j < d_dofs.
Size(); j++)
482 R -> Set (c_dofs[0], d_dofs[j], 1.0);
510 h_fe->
Project(*l_fe, T, loc_restr);
512 for (
int i = 0; i <
mesh ->
GetNE(); i++)
517 R -> SetSubMatrix (l_dofs, h_dofs, loc_restr, 1);
529 for (
int i = 0; i < slave_dofs.
Size(); i++)
531 int sdof = slave_dofs[i];
534 for (
int j = 0; j < master_dofs.
Size(); j++)
536 double coef = I(i, j);
537 if (std::abs(coef) > 1e-12)
539 int mdof = master_dofs[j];
540 if (mdof != sdof && mdof != (-1-sdof))
542 deps.
Add(sdof, mdof, coef);
557 for (
int i = 0; i < ndep; i++)
559 if (!finalized[dep[i]]) {
return false; }
579 MFEM_VERIFY(dynamic_cast<const ParFiniteElementSpace*>(
this) == NULL,
580 "This method should not be used with a ParFiniteElementSpace!");
592 for (
int entity = 1; entity <= 2; entity++)
596 if (!list.
masters.size()) {
continue; }
604 if (!fe) {
continue; }
610 for (
unsigned mi = 0; mi < list.
masters.size(); mi++)
614 if (!master_dofs.
Size()) {
continue; }
620 if (!slave_dofs.
Size()) {
continue; }
636 for (
int i = 0; i <
ndofs; i++)
638 if (!deps.
RowSize(i)) { n_true_dofs++; }
642 if (n_true_dofs == ndofs)
651 int *cR_I =
new int[n_true_dofs+1];
652 double *cR_A =
new double[n_true_dofs];
653 cR_J =
new int[n_true_dofs];
654 for (
int i = 0; i < n_true_dofs; i++)
659 cR_I[n_true_dofs] = n_true_dofs;
670 for (
int i = 0, true_dof = 0; i <
ndofs; i++)
675 cP->
Add(i, true_dof++, 1.0);
688 int n_finalized = n_true_dofs;
694 for (
int dof = 0; dof <
ndofs; dof++)
702 for (
int j = 0; j < n_dep; j++)
709 finalized[dof] =
true;
719 if (n_finalized != ndofs)
721 MFEM_ABORT(
"Error creating cP matrix.");
735 if (
vdim == 1) {
return; }
737 int height = mat.
Height();
738 int width = mat.
Width();
744 for (
int i = 0; i < height; i++)
746 mat.
GetRow(i, dofs, srow);
747 for (
int vd = 0; vd <
vdim; vd++)
782 const int coarse_ndofs,
const Table &coarse_elem_dof,
790 const int coarse_ldof = localP.
SizeJ();
791 const int fine_ldof = localP.
SizeI();
808 for (
int vd = 0; vd <
vdim; vd++)
810 coarse_dofs.Copy(coarse_vdofs);
813 for (
int i = 0; i < fine_ldof; i++)
816 int m = (r >= 0) ? r : (-1 - r);
821 P->
SetRow(r, coarse_vdofs, row);
828 MFEM_ASSERT(mark.
Sum() == P->
Height(),
"Not all rows of P set.");
846 localP.
SetSize(ldof, ldof, nmat);
847 for (
int i = 0; i < nmat; i++)
856 const Table* old_elem_dof)
858 MFEM_VERIFY(
ndofs >= old_ndofs,
"Previous space is not coarser.");
869 , old_elem_dof(old_elem_dof)
871 MFEM_VERIFY(fespace->
GetNDofs() >= old_ndofs,
872 "Previous space is not coarser.");
874 width = old_ndofs * fespace->
GetVDim();
882 :
Operator(fespace->GetVSize(), coarse_fes->GetVSize()),
883 fespace(fespace), old_elem_dof(NULL)
907 int old_ndofs = width /
vdim;
909 for (
int k = 0; k < mesh->
GetNE(); k++)
917 for (
int vd = 0; vd <
vdim; vd++)
919 old_dofs.
Copy(old_vdofs);
922 for (
int i = 0; i < dofs.
Size(); i++)
931 for (
int j = 0; j < old_vdofs.
Size(); j++)
934 value += x[o] * lP(i, j) * osign;
936 y[r] = value * rsign;
980 Vector pt(&ipt.
x, dim), shape(ldof);
983 localR.
SetSize(ldof, ldof, nmat);
984 for (
int i = 0; i < nmat; i++)
994 for (
int j = 0; j < nodes.
Size(); j++)
1001 MFEM_ASSERT(dynamic_cast<const NodalFiniteElement*>(fe),
1002 "only nodal FEs are implemented");
1012 const Table* old_elem_dof)
1014 MFEM_VERIFY(
Nonconforming(),
"Not implemented for conforming meshes.");
1015 MFEM_VERIFY(old_ndofs,
"Missing previous (finer) space.");
1016 MFEM_VERIFY(
ndofs <= old_ndofs,
"Previous space is not finer.");
1032 for (
int k = 0; k < dtrans.
embeddings.Size(); k++)
1038 old_elem_dof->
GetRow(k, old_dofs);
1040 for (
int vd = 0; vd <
vdim; vd++)
1042 old_dofs.
Copy(old_vdofs);
1045 for (
int i = 0; i < lR.
Height(); i++)
1047 if (lR(i, 0) ==
infinity()) {
continue; }
1050 int m = (r >= 0) ? r : (-1 - r);
1055 R->
SetRow(r, old_vdofs, row);
1062 MFEM_ASSERT(mark.Sum() == R->
Height(),
"Not all rows of R set.");
1084 for (
int i = 0; i < nmat; i++)
1111 mfem_error(
"FiniteElementSpace::FiniteElementSpace :\n"
1112 " NURBS FE space requires NURBS mesh.");
1115 if (NURBSext == NULL)
1131 this->NURBSext = NULL;
1142 mfem_error(
"FiniteElementSpace::StealNURBSext");
1168 MFEM_ASSERT(!
NURBSext,
"internal error");
1242 int k, j, nv, ne, nf, nb, nfd, nd;
1263 for (k = 0; k < F.
Size(); k++)
1269 nd = V.
Size() * nv + E.
Size() * ne + nfd + nb;
1273 for (k = 0; k < V.
Size(); k++)
1275 for (j = 0; j < nv; j++)
1277 dofs[k*nv+j] = V[k]*nv+j;
1285 for (k = 0; k < E.
Size(); k++)
1288 for (j = 0; j < ne; j++)
1292 dofs[nv+k*ne+j] = -1 - (
nvdofs+E[k]*ne+(-1-ind[j]) );
1296 dofs[nv+k*ne+j] =
nvdofs+E[k]*ne+ind[j];
1301 ne = nv + ne * E.
Size();
1305 for (k = 0; k < F.
Size(); k++)
1310 for (j = 0; j < nf; j++)
1327 for (j = 0; j < nb; j++)
1357 int k, j, nv, ne, nf, nd, iF, oF;
1371 nd = V.
Size() * nv + E.
Size() * ne;
1382 for (k = 0; k < V.
Size(); k++)
1384 for (j = 0; j < nv; j++)
1386 dofs[k*nv+j] = V[k]*nv+j;
1394 for (k = 0; k < E.
Size(); k++)
1397 for (j = 0; j < ne; j++)
1401 dofs[nv+k*ne+j] = -1 - (
nvdofs+E[k]*ne+(-1-ind[j]) );
1405 dofs[nv+k*ne+j] =
nvdofs+E[k]*ne+ind[j];
1413 ne = nv + ne * E.
Size();
1416 for (j = 0; j < nf; j++)
1449 nd = V.
Size() * nv + E.
Size() * ne + nf;
1453 for (k = 0; k < V.
Size(); k++)
1455 for (j = 0; j < nv; j++)
1457 dofs[k*nv+j] = V[k]*nv+j;
1464 for (k = 0; k < E.
Size(); k++)
1467 for (j = 0; j < ne; j++)
1471 dofs[nv+k*ne+j] = -1 - (
nvdofs+E[k]*ne+(-1-ind[j]) );
1475 dofs[nv+k*ne+j] =
nvdofs+E[k]*ne+ind[j];
1480 ne = nv + ne * E.
Size();
1504 for (k = 0; k < 2; k++)
1506 for (j = 0; j < nv; j++)
1508 dofs[k*nv+j] = V[k]*nv+j;
1513 for (j = 0, k =
nvdofs+i*ne; j < ne; j++, k++)
1525 for (j = 0; j < nv; j++)
1535 nb =
fec -> DofForGeometry (
mesh -> GetElementBaseGeometry (i));
1538 for (j = 0; j < nb; j++)
1550 for (j = 0, k =
nvdofs+i*ne; j < ne; j++, k++)
1626 int i,
int geom_type)
const
1700 if (RP_case == 0) {
return; }
1713 cR, T.
Ptr(), coarse_P,
false, owner,
false));
1727 MFEM_ABORT(
"Error in update sequence. Space needs to be updated after "
1728 "each mesh modification.");
1738 Table* old_elem_dof = NULL;
1765 old_elem_dof = NULL;
1783 false,
false,
true));
1792 delete old_elem_dof;
1798 int fes_format = 90;
1799 bool nurbs_unit_weights =
false;
1810 MFEM_VERIFY(nurbs_fec,
"invalid FE collection");
1812 const double eps = 5e-14;
1822 out << (fes_format == 90 ?
1823 "FiniteElementSpace\n" :
"MFEM FiniteElementSpace v1.0\n")
1824 <<
"FiniteElementCollection: " <<
fec->
Name() <<
'\n'
1825 <<
"VDim: " <<
vdim <<
'\n'
1826 <<
"Ordering: " <<
ordering <<
'\n';
1828 if (fes_format == 100)
1842 out <<
"NURBS_orders\n";
1847 if (!nurbs_unit_weights)
1849 out <<
"NURBS_weights\n";
1853 out <<
"End: MFEM FiniteElementSpace v1.0\n";
1860 int fes_format = 0, ord;
1866 getline(input, buff);
1868 if (buff ==
"FiniteElementSpace") { fes_format = 90; }
1869 else if (buff ==
"MFEM FiniteElementSpace v1.0") { fes_format = 100; }
1870 else { MFEM_ABORT(
"input stream is not a FiniteElementSpace!"); }
1871 getline(input, buff,
' ');
1873 getline(input, buff);
1876 getline(input, buff,
' ');
1878 getline(input, buff,
' ');
1883 if (fes_format == 90)
1887 MFEM_VERIFY(m->
NURBSext,
"NURBS FE collection requires a NURBS mesh!");
1888 const int order = nurbs_fec->
GetOrder();
1896 else if (fes_format == 100)
1901 MFEM_VERIFY(input.good(),
"error reading FiniteElementSpace v1.0");
1902 getline(input, buff);
1904 if (buff ==
"NURBS_order" || buff ==
"NURBS_orders")
1906 MFEM_VERIFY(nurbs_fec,
1907 buff <<
": NURBS FE collection is required!");
1908 MFEM_VERIFY(m->
NURBSext, buff <<
": NURBS mesh is required!");
1909 MFEM_VERIFY(!NURBSext, buff <<
": order redefinition!");
1910 if (buff ==
"NURBS_order")
1923 else if (buff ==
"NURBS_weights")
1925 MFEM_VERIFY(NURBSext,
"NURBS_weights: NURBS_orders have to be "
1926 "specified before NURBS_weights!");
1929 else if (buff ==
"element_orders")
1931 MFEM_VERIFY(!nurbs_fec,
"section element_orders cannot be used "
1932 "with a NURBS FE collection");
1933 MFEM_ABORT(
"element_orders: not implemented yet!");
1935 else if (buff ==
"End: MFEM FiniteElementSpace v1.0")
1941 MFEM_ABORT(
"unknown section: " << buff);
1957 element_offsets =
new int[num_elem + 1];
1962 for (
int i = 0; i < num_elem; i++)
1964 element_offsets[i] = offset;
1966 if (int_rule[geom] == NULL)
1972 element_offsets[num_elem] = size = offset;
1978 const char *msg =
"invalid input stream";
1981 in >> ident; MFEM_VERIFY(ident ==
"QuadratureSpace", msg);
1982 in >> ident; MFEM_VERIFY(ident ==
"Type:", msg);
1984 if (ident ==
"default_quadrature")
1986 in >> ident; MFEM_VERIFY(ident ==
"Order:", msg);
1991 MFEM_ABORT(
"unknown QuadratureSpace type: " << ident);
2000 out <<
"QuadratureSpace\n"
2001 <<
"Type: default_quadrature\n"
2002 <<
"Order: " <<
order <<
'\n';
int GetNPoints() const
Returns the number of the points in the integration rule.
Abstract class for 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.
void Set(const double *p, const int dim)
int Size() const
Logical size of the array.
void GetFaceEdges(int i, Array< int > &, Array< int > &) const
int RowSize(const int i) const
Returns the number of elements in row i.
int GetVSize() const
Return the number of vector dofs, i.e. GetNDofs() x GetVDim().
void GetVertexVDofs(int i, Array< int > &vdofs) const
void Get(double *p, const int dim) 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:
int GetNDofs() const
Returns number of degrees of freedom.
int ndofs
Number of degrees of freedom. Number of unknowns is ndofs * vdim.
Class for an integration rule - an Array of IntegrationPoint.
void GetElementInteriorVDofs(int i, Array< int > &vdofs) const
void GetLocalRefinementMatrices(DenseTensor &localP) 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
const CoarseFineTransformations & GetDerefinementTransforms()
virtual void Update(bool want_transform=true)
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.
void BuildElementToDofTable() const
virtual void Project(Coefficient &coeff, ElementTransformation &Trans, Vector &dofs) const
virtual void Finalize(int skip_zeros=1)
Finalize the matrix initialization, switching the storage format from LIL to CSR. ...
void InvertLinearTrans(IsoparametricTransformation &trans, const DenseMatrix &invdfdx, const IntegrationPoint &pt, Vector &x)
SparseMatrix * RefinementMatrix(int old_ndofs, const Table *old_elem_dof)
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.
static int DecodeDof(int dof, double &sign)
Helper to remove encoded sign from a DOF.
int * GetRowColumns(const int row)
Return a pointer to the column indices in a row.
void BooleanMult(const Array< int > &x, Array< int > &y) const
y = A * x, but treat all elements 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().
void GetElementFaces(int i, Array< int > &, Array< int > &) const
Return the indices and the orientations of all faces of element i.
Pointer to an Operator of a specified type.
Operator::Type Type() const
Get the currently set operator type id.
void Copy(Array ©) const
Create a copy of the current array.
int GetFaceOrder(int i) const
Returns the order of the i'th face finite element.
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
void GetFaceVertices(int i, Array< int > &vert) const
Returns the indices of the vertices of face i.
Piecewise-(bi)linear continuous finite elements.
Data type dense matrix using column-major storage.
int vdim
Vector dimension (number of unknowns per degree of freedom).
int Size() const
Returns the size of the vector.
void GetRow(int i, Array< int > &row) const
Return row i in array row (the Table must be finalized)
void GetEntityDofs(int entity, int index, Array< int > &dofs) const
Helper to get vertex, edge or face DOFs (entity=0,1,2 resp.).
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:
const FiniteElement * GetTraceElement(int i, int geom_type) const
Return the trace element from element 'i' to the given 'geom_type'.
int GetBdrAttribute(int i) const
void SetSize(int i, int j, int k)
virtual void GetEssentialTrueDofs(const Array< int > &bdr_attr_is_ess, Array< int > &ess_tdof_list, int component=-1)
int GetNE() const
Returns number of elements.
void OrientedPointMatrix(DenseMatrix &oriented_matrix) const
Return the point matrix oriented according to the master and slave edges.
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...
void RebuildElementToDofTable()
const FiniteElement * GetFaceElement(int i) const
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.
FiniteElementCollection * Load(Mesh *m, std::istream &input)
Read a FiniteElementSpace from a stream. The returned FiniteElementCollection is owned by the caller...
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.
const FiniteElementCollection * fec
Associated FE collection (not owned).
OperatorHandle Th
Transformation to apply to GridFunctions after space Update().
int Size_of_connections() const
void skip_comment_lines(std::istream &is, const char comment_char)
void DeleteAll()
Delete whole array.
void BooleanMultTranspose(const Array< int > &x, Array< int > &y) const
y = At * x, but treat all elements as booleans (zero=false, nonzero=true).
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 void GetFaceDofs(int i, Array< int > &dofs) const
void ConvertFromConformingVDofs(const Array< int > &cdofs, Array< int > &dofs)
const SparseMatrix * GetConformingRestriction() const
ID for class SparseMatrix.
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
General product operator: x -> (A*B)(x) = A(B(x)).
ID for the base class Operator, i.e. any type.
const FiniteElement * GetEdgeElement(int i) const
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).
int GetNBE() const
Returns number of boundary elements in the mesh.
int Height() const
Get the height (size of output) of the Operator. Synonym with NumRows().
int Append(const T &el)
Append element to array, resize if necessary.
Mesh * GetMesh() const
Returns the mesh.
void mfem_error(const char *msg)
Function called when an error is encountered. Used by the macros MFEM_ABORT, MFEM_ASSERT, MFEM_VERIFY.
std::vector< Master > masters
SparseMatrix * cR
Conforming restriction matrix such that cR.cP=I.
void GetRow(int r, Vector &row) const
SparseMatrix * D2Const_GlobalRestrictionMatrix(FiniteElementSpace *cfes)
SparseMatrix * D2C_GlobalRestrictionMatrix(FiniteElementSpace *cfes)
virtual void CalcShape(const IntegrationPoint &ip, Vector &shape) const =0
Evaluate the values of all shape functions of a scalar finite element in reference space at the given...
virtual void GetElementDofs(int i, Array< int > &dofs) const
Returns indexes of degrees of freedom in array dofs for i'th element.
void BuildConformingInterpolation() const
Calculate the cP and cR matrices for a nonconforming mesh.
NURBSExtension * StealNURBSext()
const IntegrationRule & GetNodes() const
void Reserve(int capacity)
Ensures that the allocated size is at least the given size.
virtual ~RefinementOperator()
static void AddDependencies(SparseMatrix &deps, Array< int > &master_dofs, Array< int > &slave_dofs, DenseMatrix &I)
Array< int > dof_ldof_array
virtual const FiniteElement * FiniteElementForGeometry(int GeomType) const
const Array< int > & GetOrders() const
Read-only access to the orders of all knot vectors.
void SetRow(int r, const Vector &row)
int GetVDim() const
Returns vector dimension.
virtual void GetBoundaryClosure(const Array< int > &bdr_attr_is_ess, Array< int > &bdr_vertices, Array< int > &bdr_edges)
void GetEdgeDofs(int i, Array< int > &dofs) const
Operator * Ptr() const
Access the underlying Operator pointer.
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 Threshold(double eps)
Replace small entries, abs(a_ij) <= eps, with zero.
void CalcInverse(const DenseMatrix &a, DenseMatrix &inva)
void GetElementInteriorDofs(int i, Array< int > &dofs) const
int GetGeomType() const
Returns the Geometry::Type of the reference element.
int GetOrder() const
If all orders are identical, return that number. Otherwise, return NURBSFECollection::VariableOrder.
void Set3(const double x1, const double x2, const double x3)
void GetBdrElementFace(int i, int *, int *) const
Return the index and the orientation of the face of bdr element i. (3D)
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 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...
std::vector< Slave > slaves
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.
SparseMatrix * H2L_GlobalRestrictionMatrix(FiniteElementSpace *lfes)
void SetSize(int nsize)
Change logical size of the array, keep existing entries.
int GetOrder(int i) const
Returns the order of the i'th finite element.
void Save(std::ostream &out) const
Write the QuadratureSpace to the stream out.
void Clear()
Clear the OperatorHandle, deleting the held Operator (if owned), while leaving the type id unchanged...
void GetLocalDerefinementMatrices(DenseTensor &localR) const
Table * GetElementDofTable()
void MakeVDimMatrix(SparseMatrix &mat) const
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
const CoarseFineTransformations & GetRefinementTransforms()
Operation GetLastOperation() const
Return type of last modification of the mesh.
int GetElementBaseGeometry(int i=0) const
virtual int * DofOrderForOrientation(int GeomType, int Or) const =0
static FiniteElementCollection * New(const char *name)
Factory method: return a newly allocated FiniteElementCollection according to the given name...
virtual const FiniteElement * TraceFiniteElementForGeometry(int GeomType) const
bool Nonconforming() const
virtual void GetBdrElementDofs(int i, Array< int > &dofs) const
Returns indexes of degrees of freedom for i'th boundary element.
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...
void ConvertToConformingVDofs(const Array< int > &dofs, Array< int > &cdofs)
virtual const char * Name() const
Class for integration point with weight.
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.
double Max() const
Returns the maximal element of the vector.
int GetNConformingDofs() const
void GetEdgeInteriorDofs(int i, Array< int > &dofs) const
General triple product operator x -> A*B*C*x, with ownership of the factors.
const FiniteElement * GetFE(int i) const
Returns pointer to the FiniteElement associated with i'th element.
double infinity()
Define a shortcut for std::numeric_limits<double>::infinity()
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.
void GetFaceVDofs(int i, Array< int > &vdofs) const
Returns indexes of degrees of freedom for i'th face element (2D and 3D).
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)
int GetNEdges() const
Return the number of edges.
void filter_dos(std::string &line)
void MakeRef(T *, int)
Make this Array a reference to a pointer.
int GetNFaces() const
Return the number of faces in a 3D mesh.
int HasFaceDofs(int GeomType) const
void Mult(const double *x, double *y) const
Matrix vector multiplication.
int GetFaceBaseGeometry(int i) const
const Table & GetElementToDofTable() const
static bool CheckPoint(int GeomType, const IntegrationPoint &ip)
Check if the given point is inside the given reference 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 * RefinementMatrix_main(const int coarse_ndofs, const Table &coarse_elem_dof, const DenseTensor &localP) const
static bool DofFinalizable(int dof, const Array< bool > &finalized, const SparseMatrix &deps)
const FiniteElement * GetBE(int i) const
Returns pointer to the FiniteElement for the i'th boundary element.
NURBSExtension * NURBSext
virtual int DofForGeometry(int GeomType) const =0
void GetBdrElementVDofs(int i, Array< int > &vdofs) const
Returns indexes of degrees of freedom for i'th boundary element.
OutStream out(std::cout)
Global stream used by the library for standard output. Initially it uses the same std::streambuf as s...
void Swap(SparseMatrix &other)
BiLinear2DFiniteElement QuadrilateralFE
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
Linear1DFiniteElement SegmentFE
void GetBdrElementVertices(int i, Array< int > &v) const
Returns the indices of the vertices of boundary element i.
void GetElementVertices(int i, Array< int > &v) const
Returns the indices of the vertices of element i.
int GetBdrElementBaseGeometry(int i=0) const
static void AdjustVDofs(Array< int > &vdofs)
void SetType(Operator::Type tid)
Invoke Clear() and set a new type id.
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.
int matrix
index into CoarseFineTransformations::point_matrices
virtual const FiniteElement * FiniteElementForGeometry(int GeomType) const =0
void DofsToVDofs(Array< int > &dofs, int ndofs=-1) const