16 namespace SubMeshUtils
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++)
106 if (from == SubMesh::From::Domain)
110 else if (from == SubMesh::From::Boundary)
114 MFEM_ASSERT(static_cast<const L2_FECollection*>
116 "Only BasisType::GaussLobatto is supported for L2 spaces");
120 int face_info, parent_volel_id;
124 pm->GetLocalFaceTransformation(
125 pm->GetBdrElementType(parent_element_ids[i]),
126 pm->GetElementType(parent_volel_id),
133 MFEM_VERIFY(dynamic_cast<const NodalFiniteElement*>(face_el),
134 "Nodal Finite Element is required");
142 parent_vdofs.
SetSize(vdim * T.Height());
143 for (
int j = 0; j < T.Height(); j++)
145 for (
int k = 0; k < T.Width(); k++)
149 for (
int vd=0; vd<vdim; vd++)
151 int sub_vdof = j + T.Height() * vd;
152 int parent_vdof = k + T.Width() * vd;
153 parent_vdofs[sub_vdof] =
154 z1[
static_cast<int>(parent_vdof)];
167 MFEM_ABORT(
"SubMesh::From type unknown");
172 MFEM_ASSERT(parent_vdofs.
Size() == sub_vdofs.
Size(),
"internal error");
173 for (
int j = 0; j < parent_vdofs.
Size(); j++)
175 vdof_to_vdof_map[sub_vdofs[j]] = parent_vdofs[j];
187 for (
int i = 0; i < sm.
GetNE(); i++)
189 int peid = parent_element_ids[i];
195 MFEM_ASSERT(sel_faces.
Size() == pel_faces.
Size(),
"internal error");
197 for (
int j = 0; j < sel_faces.
Size(); j++)
199 if (pfids[sel_faces[j]] != -1)
201 MFEM_ASSERT(pfids[sel_faces[j]] == pel_faces[j],
"internal error");
203 pfids[sel_faces[j]] = pel_faces[j];
std::unordered_map< int, int > idx
Abstract class for all finite elements.
Convenience object to create unique indices.
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.
virtual void GetVertices(Array< int > &v) const =0
Returns element's vertices.
Element::Type GetBdrElementType(int i) const
Returns the type of boundary element i.
int GetAttribute() const
Return element's attribute.
Data type dense matrix using column-major storage.
const FiniteElement * GetTraceElement(int i, Geometry::Type geom_type) const
Return the trace element from element 'i' to the given 'geom_type'.
virtual void SetVertices(const int *ind)
Set the indices the element according to the input.
const Element * GetElement(int i) const
int GetNBE() const
Returns number of boundary elements.
virtual const FiniteElement * GetFE(int i) const
Returns pointer to the FiniteElement in the FiniteElementCollection associated with i'th element in t...
Element * NewElement(int geom)
int Get(int i, bool &new_index)
Returns the unique index from an index set.
void GetBdrElementAdjacentElement2(int bdr_el, int &el, int &info) const
For the given boundary element, bdr_el, return its adjacent element and its info, i...
int AddVertex(double x, double y=0.0, double z=0.0)
void GetElementFaces(int i, Array< int > &faces, Array< int > &ori) const
Return the indices and the orientations of all faces of element i.
double f(const Vector &xvec)
int Append(const T &el)
Append element 'el' to array, resize if necessary.
const FiniteElementCollection * FEColl() const
const double * GetVertex(int i) const
Return pointer to vertex i's coordinates.
int AddElement(Element *elem)
The parameter elem should be allocated using the NewElement() method.
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 GetVDim() const
Returns vector dimension.
DofTransformation * GetElementVDofs(int i, Array< int > &vdofs) const
Returns indexes of degrees of freedom in array dofs for i'th element.
Mesh * GetMesh() const
Returns the mesh.
Class FiniteElementSpace - responsible for providing FEM view of the mesh, mainly managing the set of...
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, this function adds matching elements with those attributes from parent to mesh.
void SetSize(int nsize)
Change the logical size of the array, keep existing entries.
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...
From
Indicator from which part of the parent Mesh the SubMesh is created.
int GetNE() const
Returns number of elements.
Element::Type GetElementType(int i) const
Returns the type of element i.
DofTransformation * GetBdrElementVDofs(int i, Array< int > &vdofs) const
Returns indexes of degrees of freedom for i'th boundary element.
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 ...
int GetVSize() const
Return the number of vector dofs, i.e. GetNDofs() x GetVDim().
void SetAttribute(const int attr)
Set element's attribute.
int Size() const
Return the logical size of the array.
int GetNFaces() const
Return the number of faces in a 3D mesh.
bool IsDGSpace() const
Return whether or not the space is discontinuous (L2)
const Element * GetBdrElement(int i) const
Abstract data type element.