15 #include "../config/config.hpp"
16 #include "../linalg/sparsemat.hpp"
17 #include "../mesh/mesh.hpp"
41 static inline int Map(
int ndofs,
int vdim,
int dof,
int vd);
47 template <>
inline int
48 Ordering::Map<Ordering::byNODES>(
int ndofs,
int vdim,
int dof,
int vd)
50 MFEM_ASSERT(dof < ndofs && -1-dof < ndofs && 0 <= vd && vd < vdim,
"");
51 return (dof >= 0) ? dof+ndofs*vd : dof-ndofs*vd;
54 template <>
inline int
55 Ordering::Map<Ordering::byVDIM>(
int ndofs,
int vdim,
int dof,
int vd)
57 MFEM_ASSERT(dof < ndofs && -1-dof < ndofs && 0 <= vd && vd < vdim,
"");
58 return (dof >= 0) ? vd+vdim*dof : -1-(vd+vdim*(-1-dof));
119 {
return (dof >= 0) ? (sign = 1, dof) : (sign = -1, (-1 - dof)); }
146 Table *old_elem_dof,
int old_ndofs);
159 const Table &coarse_elem_dof,
409 int component = -1)
const;
490 virtual void Update(
bool want_transform =
true);
519 void Save(std::ostream &
out)
const;
567 void Save(std::ostream &
out)
const;
Abstract class for Finite Elements.
Ordering::Type GetOrdering() const
Return the ordering method.
int GetVSize() const
Return the number of vector dofs, i.e. GetNDofs() x GetVDim().
void GetVertexVDofs(int i, Array< int > &vdofs) const
int GetAttribute(int i) const
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.
int GetBdrAttribute(int i) const
Return the attribute of boundary element i.
const Table & GetBdrElementToDofTable() const
void GetElementInteriorVDofs(int i, Array< int > &vdofs) const
int DofToVDof(int dof, int vd, int ndofs=-1) const
void GetLocalRefinementMatrices(DenseTensor &localP) const
const SparseMatrix * GetConformingProlongation() const
virtual void Update(bool want_transform=true)
static int Map(int ndofs, int vdim, int dof, int vd)
void GetElementVertices(int i, Array< int > &vertices) const
Returns the vertices of element i.
void BuildElementToDofTable() const
const IntegrationRule & GetElementIntRule(int idx) const
Get the IntegrationRule associated with mesh element idx.
SparseMatrix * RefinementMatrix(int old_ndofs, const Table *old_elem_dof)
int GetNBE() const
Returns number of boundary elements.
SparseMatrix * DerefinementMatrix(int old_ndofs, const Table *old_elem_dof)
Calculate GridFunction restriction matrix after mesh derefinement.
void GetElementVDofs(int i, Array< int > &vdofs) const
Returns indexes of degrees of freedom in array dofs for i'th element.
static int DecodeDof(int dof, double &sign)
Helper to remove encoded sign from a DOF.
int GetSize() const
Return the total number of quadrature points.
Pointer to an Operator of a specified type.
int VDofToDof(int vdof) const
int GetFaceOrder(int i) const
Returns the order of the i'th face finite element.
virtual void GetEssentialVDofs(const Array< int > &bdr_attr_is_ess, Array< int > &ess_vdofs, int component=-1) const
Data type dense matrix using column-major storage.
int vdim
Vector dimension (number of unknowns per degree of freedom).
void GetEntityDofs(int entity, int index, Array< int > &dofs) const
Helper to get vertex, edge or face DOFs (entity=0,1,2 resp.).
int GetNumElementInteriorDofs(int i) const
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
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.
int GetBdrElementType(int i) const
Returns the type of boundary element i.
void RebuildElementToDofTable()
int GetNV() const
Returns number of vertices in the mesh.
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...
const IntegrationRule * int_rule[Geometry::NumGeom]
const FiniteElementCollection * fec
Associated FE collection (not owned).
OperatorHandle Th
Transformation to apply to GridFunctions after space Update().
NURBSExtension * GetNURBSext()
int GetConformingVSize() const
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
ElementTransformation * GetBdrElementTransformation(int i)
Returns the transformation defining the i-th boundary element.
void ConvertFromConformingVDofs(const Array< int > &cdofs, Array< int > &dofs)
int GetNumFaces() const
Return the number of faces (3D), edges (2D) or vertices (1D).
const SparseMatrix * GetConformingRestriction() const
int GetNE() const
Returns number of elements in the mesh.
void GetVertexDofs(int i, Array< int > &dofs) const
bool Nonconforming() const
const FiniteElement * GetEdgeElement(int i) const
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.
Mesh * GetMesh() const
Returns the mesh.
SparseMatrix * cR
Conforming restriction matrix such that cR.cP=I.
SparseMatrix * D2Const_GlobalRestrictionMatrix(FiniteElementSpace *cfes)
SparseMatrix * D2C_GlobalRestrictionMatrix(FiniteElementSpace *cfes)
virtual const Operator * GetProlongationMatrix() const
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()
int GetElementForDof(int i) const
virtual ~RefinementOperator()
ElementTransformation * GetBdrElementTransformation(int i) const
Returns ElementTransformation for the i-th boundary element.
static void AddDependencies(SparseMatrix &deps, Array< int > &master_dofs, Array< int > &slave_dofs, DenseMatrix &I)
void GetElementTransformation(int i, IsoparametricTransformation *ElTr)
Returns the transformation defining the i-th element in the user-defined variable ElTr...
Array< int > dof_ldof_array
int GetElementType(int i) const
Returns the type of element i.
virtual int GetTrueVSize() const
Return the number of vector true (conforming) dofs.
int GetVDim() const
Returns vector dimension.
int GetNF() const
Returns number of faces (i.e. co-dimension 1 entities) in the mesh.
void GetEdgeDofs(int i, Array< int > &dofs) const
Operator * Ptr() const
Access the underlying Operator pointer.
int GetBdrElementType(int i) const
Returns the type of boundary element i.
void GetTransferOperator(const FiniteElementSpace &coarse_fes, OperatorHandle &T) const
Construct and return an Operator that can be used to transfer GridFunction data from coarse_fes...
void GetElementInteriorDofs(int i, Array< int > &dofs) const
static void DofsToVDofs(int ndofs, int vdim, Array< int > &dofs)
ElementTransformation * GetElementTransformation(int i) const
Returns ElementTransformation for the i-th element.
Type
Enumeration defining IDs for some classes derived from Operator.
RefinementOperator(const FiniteElementSpace *fespace, Table *old_elem_dof, int old_ndofs)
const NURBSExtension * GetNURBSext() const
Class FiniteElementSpace - responsible for providing FEM view of the mesh, mainly managing the set of...
int GetLocalDofForDof(int i) const
virtual ~FiniteElementSpace()
SparseMatrix * H2L_GlobalRestrictionMatrix(FiniteElementSpace *lfes)
virtual ~QuadratureSpace()
void GetUpdateOperator(OperatorHandle &T)
Return the update operator in the given OperatorHandle, T.
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
void MakeVDimMatrix(SparseMatrix &mat) const
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
int GetElementBaseGeometry(int i=0) const
int GetElementType(int i) const
Returns the type of element i.
FiniteElementSpace(Mesh *mesh, const FiniteElementCollection *fec, int vdim=1, int ordering=Ordering::byNODES)
bool Nonconforming() const
virtual void GetBdrElementDofs(int i, Array< int > &dofs) const
Returns indexes of degrees of freedom for i'th boundary element.
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)
void SetOperatorOwner(bool own=true)
Set the ownership flag for the held Operator.
Mesh * mesh
The mesh that FE space lives on (not owned).
void GetElementTransformation(int i, IsoparametricTransformation *ElTr)
void ReorderElementToDofTable()
Reorder the scalar DOFs based on the element ordering.
GridFunction interpolation operator applicable after mesh refinement.
int GetNConformingDofs() const
void GetEdgeInteriorDofs(int i, Array< int > &dofs) const
const FiniteElement * GetFE(int i) const
Returns pointer to the FiniteElement associated with i'th element.
const Operator * GetUpdateOperator()
Get the GridFunction update operator.
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().
void SetUpdateOperatorOwner(bool own)
Set the ownership of the update operator: if set to false, the Operator returned by GetUpdateOperator...
void GetFaceVDofs(int i, Array< int > &vdofs) const
Returns indexes of degrees of freedom for i'th face element (2D and 3D).
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)
const FiniteElementCollection * FEColl() const
virtual void UpdatesFinished()
Free the GridFunction update operator (if any), to save memory.
const Table & GetElementToDofTable() const
void SetUpdateOperatorType(Operator::Type tid)
Specify the Operator::Type to be used by the update operators.
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)
Class representing the storage layout of a QuadratureFunction.
const FiniteElement * GetBE(int i) const
Returns pointer to the FiniteElement for the i'th boundary element.
NURBSExtension * NURBSext
void GetBdrElementVDofs(int i, Array< int > &vdofs) const
Returns indexes of degrees of freedom for i'th boundary element.
virtual int DofForGeometry(int GeomType) const =0
OutStream out(std::cout)
Global stream used by the library for standard output. Initially it uses the same std::streambuf as s...
virtual const SparseMatrix * GetRestrictionMatrix() const
long GetSequence() const
Return update counter (see Mesh::sequence)
Rank 3 tensor (array of matrices)
void Save(std::ostream &out) const
int GetAttribute(int i) const
Return the attribute of element i.
Class representing a function through its values (scalar or vector) at quadrature points...
void GetElementVertices(int i, Array< int > &v) const
Returns the indices of the vertices of element i.
static void AdjustVDofs(Array< int > &vdofs)
void SetType(Operator::Type tid)
Invoke Clear() and set a new type id.
void DofsToVDofs(Array< int > &dofs, int ndofs=-1) const
FiniteElementSpace(Mesh *mesh, NURBSExtension *ext, const FiniteElementCollection *fec, int vdim=1, int ordering=Ordering::byNODES)
Construct a NURBS FE space based on the given NURBSExtension, ext.