36 for (
int a = 0;
a < attributes.
Size();
a++)
52 Array<int> parent_vertex_ids, parent_element_ids;
54 const int ne = from_boundary ? parent.
GetNBE() : parent.
GetNE();
55 for (
int i = 0; i < ne; i++)
57 const Element *pel = from_boundary ?
65 for (
int iv = 0; iv < v.
Size(); iv++)
68 int mesh_vertex_id = v[iv];
69 int submesh_vertex_id = vertex_ids.
Get(mesh_vertex_id, new_vertex);
73 parent_vertex_ids.
Append(mesh_vertex_id);
75 submesh_v[iv] = submesh_vertex_id;
83 parent_element_ids.
Append(i);
85 return std::tuple<Array<int>,
Array<int>>(parent_vertex_ids,
98 const int vdim = parentfes.
GetVDim();
103 for (
int i = 0; i < m->GetNE(); i++)
116 "Only BasisType::GaussLobatto is supported for L2 spaces");
122 int face_info, parent_volel_id;
123 pm->GetBdrElementAdjacentElement(
124 parent_element_ids[i], parent_volel_id, face_info);
129 pm->GetLocalFaceTransformation(
130 pm->GetBdrElementType(parent_element_ids[i]),
131 pm->GetElementType(parent_volel_id),
138 "Nodal Finite Element is required");
147 for (
int j = 0; j < T.
Height(); j++)
149 for (
int k = 0; k < T.
Width(); k++)
153 for (
int vd=0; vd<vdim; vd++)
155 int sub_vdof = j + T.
Height() * vd;
156 int parent_vdof = k + T.
Width() * vd;
157 parent_vdofs[sub_vdof] =
158 z1[
static_cast<int>(parent_vdof)];
171 MFEM_ABORT(
"SubMesh::From type unknown");
177 MFEM_ASSERT(parent_vdofs.
Size() == sub_vdofs.
Size(),
"internal error");
178 for (
int j = 0; j < parent_vdofs.
Size(); j++)
181 int sub_vdof = subfes.
DecodeDof(sub_vdofs[j], sub_sign);
184 int parent_vdof = parentfes.
DecodeDof(parent_vdofs[j], parent_sign);
186 vdof_to_vdof_map[sub_vdof] =
187 (sub_sign * parent_sign > 0.0) ? parent_vdof : (-1-parent_vdof);
199 for (
int i = 0; i < sm.
GetNE(); i++)
201 int peid = parent_element_ids[i];
215 MFEM_ASSERT(sel_faces.
Size() == pel_faces.
Size(),
"internal error");
217 for (
int j = 0; j < sel_faces.
Size(); j++)
219 if (pfids[sel_faces[j]] != -1)
221 MFEM_ASSERT(pfids[sel_faces[j]] == pel_faces[j],
"internal error");
223 pfids[sel_faces[j]] = pel_faces[j];
void SetSize(int nsize)
Change the logical size of the array, keep existing entries.
int Size() const
Return the logical size of the array.
int Append(const T &el)
Append element 'el' to array, resize if necessary.
@ GaussLobatto
Closed type.
Data type dense matrix using column-major storage.
Abstract data type element.
virtual void GetVertices(Array< int > &v) const =0
Get the indices defining the vertices.
void SetAttribute(const int attr)
Set element's attribute.
int GetAttribute() const
Return element's attribute.
virtual void SetVertices(const Array< int > &v)=0
Set the indices defining the vertices.
Class FiniteElementSpace - responsible for providing FEM view of the mesh, mainly managing the set of...
DofTransformation * GetElementVDofs(int i, Array< int > &vdofs) const
Returns indices of degrees of freedom for the i'th element. The returned indices are offsets into an ...
virtual const FiniteElement * GetFE(int i) const
Returns pointer to the FiniteElement in the FiniteElementCollection associated with i'th element in t...
const FiniteElement * GetTraceElement(int i, Geometry::Type geom_type) const
Return the trace element from element 'i' to the given 'geom_type'.
const FiniteElementCollection * FEColl() const
Mesh * GetMesh() const
Returns the mesh.
int GetVSize() const
Return the number of vector dofs, i.e. GetNDofs() x GetVDim().
int GetVDim() const
Returns vector dimension.
bool IsDGSpace() const
Return whether or not the space is discontinuous (L2)
static int DecodeDof(int dof)
Helper to return the DOF associated with a sign encoded DOF.
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...
Abstract class for all finite elements.
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...
static int GetInverseOrientation(Type geom_type, int orientation)
Return the inverse of the given orientation for the specified geometry type.
Arbitrary order "L2-conforming" discontinuous finite elements.
Element * NewElement(int geom)
Element::Type GetElementType(int i) const
Returns the type of element i.
Element::Type GetBdrElementType(int i) const
Returns the type of boundary element i.
int GetNumFaces() const
Return the number of faces (3D), edges (2D) or vertices (1D).
Geometry::Type GetBdrElementGeometry(int i) const
const Element * GetElement(int i) const
Return pointer to the i'th element object.
static int EncodeFaceInfo(int local_face_index, int orientation)
Given local_face_index and orientation, return the corresponding encoded "face info int".
int AddVertex(real_t x, real_t y=0.0, real_t z=0.0)
int GetNE() const
Returns number of elements.
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.
int AddElement(Element *elem)
static int DecodeFaceInfoLocalIndex(int info)
Given a "face info int", return the local face index.
void GetElementFaces(int i, Array< int > &faces, Array< int > &ori) const
Return the indices and the orientations of all faces of element i.
static int DecodeFaceInfoOrientation(int info)
Given a "face info int", return the face orientation.
int GetNBE() const
Returns number of boundary elements.
void GetElementEdges(int i, Array< int > &edges, Array< int > &cor) const
Return the indices and the orientations of all edges of element i.
const real_t * GetVertex(int i) const
Return pointer to vertex i's coordinates.
Class for standard nodal finite elements.
int Height() const
Get the height (size of output) of the Operator. Synonym with NumRows().
int Width() const
Get the width (size of input) of the Operator. Synonym with NumCols().
From
Indicator from which part of the parent Mesh the SubMesh is created.
std::tuple< Array< int >, Array< int > > AddElementsToMesh(const Mesh &parent, Mesh &mesh, const Array< int > &attributes, bool from_boundary)
Given a Mesh parent and another Mesh mesh using the list of attributes in attributes,...
void BuildVdofToVdofMap(const FiniteElementSpace &subfes, const FiniteElementSpace &parentfes, const SubMesh::From &from, const Array< int > &parent_element_ids, Array< int > &vdof_to_vdof_map)
Build the vdof to vdof mapping between two FiniteElementSpace objects.
Array< int > BuildFaceMap(const Mesh &pm, const Mesh &sm, const Array< int > &parent_element_ids)
Given two meshes that have a parent to SubMesh relationship create a face map, using a SubMesh to par...
bool ElementHasAttribute(const Element &el, const Array< int > &attributes)
Given an element el and a list of attributes, determine if that element is in at least one attribute ...
std::function< real_t(const Vector &)> f(real_t mass_coeff)
Convenience object to create unique indices.
std::unordered_map< int, int > idx
int Get(int i, bool &new_index)
Returns the unique index from an index set.