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,
101 for (
int i = 0; i < m->GetNE(); i++)
104 if (from == SubMesh::From::Domain)
108 else if (from == SubMesh::From::Boundary)
112 MFEM_ASSERT(static_cast<const L2_FECollection*>
114 "Only BasisType::GaussLobatto is supported for L2 spaces");
118 int face_info, parent_volel_id;
122 pm->GetLocalFaceTransformation(
123 pm->GetBdrElementType(parent_element_ids[i]),
124 pm->GetElementType(parent_volel_id),
131 MFEM_VERIFY(dynamic_cast<const NodalFiniteElement*>(face_el),
132 "Nodal Finite Element is required");
141 for (
int j = 0; j < T.
Height(); j++)
143 for (
int k = 0; k < parentfes.
GetVDim() * T.
Width(); k++)
147 parent_vdofs[j] = z1[
static_cast<int>(k)];
159 MFEM_ABORT(
"SubMesh::From type unknown");
164 MFEM_ASSERT(parent_vdofs.
Size() == sub_vdofs.
Size(),
"internal error");
165 for (
int j = 0; j < parent_vdofs.
Size(); j++)
167 vdof_to_vdof_map[sub_vdofs[j]] = parent_vdofs[j];
179 for (
int i = 0; i < sm.
GetNE(); i++)
181 int peid = parent_element_ids[i];
187 MFEM_ASSERT(sel_faces.
Size() == pel_faces.
Size(),
"internal error");
189 for (
int j = 0; j < sel_faces.
Size(); j++)
191 if (pfids[sel_faces[j]] != -1)
193 MFEM_ASSERT(pfids[sel_faces[j]] == pel_faces[j],
"internal error");
195 pfids[sel_faces[j]] = pel_faces[j];
std::unordered_map< int, int > idx
Abstract class for all finite elements.
int Size() const
Return the logical size of the array.
int GetVSize() const
Return the number of vector dofs, i.e. GetNDofs() x GetVDim().
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.
const double * GetVertex(int i) const
Return pointer to vertex i's coordinates.
virtual void GetVertices(Array< int > &v) const =0
Returns element's vertices.
const FiniteElement * GetTraceElement(int i, Geometry::Type geom_type) const
Return the trace element from element 'i' to the given 'geom_type'.
int GetNBE() const
Returns number of boundary elements.
int Width() const
Get the width (size of input) of the Operator. Synonym with NumCols().
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.
Data type dense matrix using column-major storage.
int GetNE() const
Returns number of elements.
virtual void SetVertices(const int *ind)
Set the indices the element according to the input.
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...
Element * NewElement(int geom)
DofTransformation * GetBdrElementVDofs(int i, Array< int > &vdofs) const
Returns indexes of degrees of freedom for i'th boundary element.
int Get(int i, bool &new_index)
Returns the unique index from an index set.
int AddVertex(double x, double y=0.0, double z=0.0)
DofTransformation * GetElementVDofs(int i, Array< int > &vdofs) const
Returns indexes of degrees of freedom in array dofs for i'th element.
double f(const Vector &xvec)
int Height() const
Get the height (size of output) of the Operator. Synonym with NumRows().
int Append(const T &el)
Append element 'el' to array, resize if necessary.
Mesh * GetMesh() const
Returns the mesh.
int AddElement(Element *elem)
The parameter elem should be allocated using the NewElement() method.
int GetAttribute() const
Return element's attribute.
bool IsDGSpace() const
Return whether or not the space is discontinuous (L2)
const Element * GetElement(int i) const
int GetVDim() const
Returns vector dimension.
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.
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 ...
virtual const FiniteElement * GetFE(int i) const
Returns pointer to the FiniteElement in the FiniteElementCollection associated with i'th element in t...
void SetAttribute(const int attr)
Set element's attribute.
int GetNFaces() const
Return the number of faces in a 3D mesh.
const FiniteElementCollection * FEColl() const
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...
Abstract data type element.
const Element * GetBdrElement(int i) const
void GetElementFaces(int i, Array< int > &faces, Array< int > &ori) const
Return the indices and the orientations of all faces of element i.