MFEM v4.9.0
Finite element discretization library
Loading...
Searching...
No Matches
mfem::Mesh Class Reference

Mesh data type. More...

#include <mesh.hpp>

Inheritance diagram for mfem::Mesh:
[legend]
Collaboration diagram for mfem::Mesh:
[legend]

Classes

struct  FaceInfo
 This structure stores the low level information necessary to interpret the configuration of elements on a specific face. This information can be accessed using methods like GetFaceElements(), GetFaceInfos(), FaceIsInterior(), etc. More...
 
struct  FaceInformation
 This structure is used as a human readable output format that deciphers the information contained in Mesh::FaceInfo when using the Mesh::GetFaceInformation() method. More...
 
class  GeometryList
 List of mesh geometries stored as Array<Geometry::Type>. More...
 
struct  NCFaceInfo
 

Public Types

enum  Operation { NONE , REFINE , DEREFINE , REBALANCE }
 
enum class  FaceTopology { Boundary , Conforming , Nonconforming , NA }
 
enum class  ElementLocation { Local , FaceNbr , NA }
 
enum class  ElementConformity { Coincident , Superset , Subset , NA }
 
enum class  FaceInfoTag {
  Boundary , LocalConforming , LocalSlaveNonconforming , SharedConforming ,
  SharedSlaveNonconforming , MasterNonconforming , GhostSlave , GhostMaster
}
 
typedef Geometry::Constants< Geometry::SEGMENTseg_t
 
typedef Geometry::Constants< Geometry::TRIANGLEtri_t
 
typedef Geometry::Constants< Geometry::SQUAREquad_t
 
typedef Geometry::Constants< Geometry::TETRAHEDRONtet_t
 
typedef Geometry::Constants< Geometry::CUBEhex_t
 
typedef Geometry::Constants< Geometry::PRISMpri_t
 
typedef Geometry::Constants< Geometry::PYRAMIDpyr_t
 

Public Member Functions

const Array< int > & GetFaceIndices (FaceType ftype) const
 Map from boundary or interior face indices to mesh face indices.
 
const std::unordered_map< int, int > & GetInvFaceIndices (FaceType ftype) const
 Inverse of the map FaceIndices(ftype)
 
 Mesh (const NURBSExtension &ext)
 Construct a Mesh from a NURBSExtension.
 
Standard Mesh constructors and related methods

These constructors and assignment operators accept mesh information in a variety of common forms. For more specialized constructors see Named mesh constructors.

 Mesh ()
 
 Mesh (const Mesh &mesh, bool copy_nodes=true)
 
 Mesh (Mesh &&mesh)
 Move constructor, useful for using a Mesh as a function return value.
 
Meshoperator= (Mesh &&mesh)
 Move assignment operator.
 
Meshoperator= (const Mesh &mesh)=delete
 Explicitly delete the copy assignment operator.
 
 Mesh (real_t *vertices, int num_vertices, int *element_indices, Geometry::Type element_type, int *element_attributes, int num_elements, int *boundary_indices, Geometry::Type boundary_type, int *boundary_attributes, int num_boundary_elements, int dimension, int space_dimension=-1)
 Construct a Mesh from the given primary data.
 
 Mesh (int Dim_, int NVert, int NElem, int NBdrElem=0, int spaceDim_=-1)
 Init constructor: begin the construction of a Mesh object.
 
 Mesh (const std::string &filename, int generate_edges=0, int refine=1, bool fix_orientation=true)
 
 Mesh (std::istream &input, int generate_edges=0, int refine=1, bool fix_orientation=true)
 
 Mesh (Mesh *mesh_array[], int num_pieces)
 
virtual void Load (std::istream &input, int generate_edges=0, int refine=1, bool fix_orientation=true)
 
void Swap (Mesh &other, bool non_geometry)
 
void Clear ()
 Clear the contents of the Mesh.
 
virtual ~Mesh ()
 Destroys Mesh.
 
void GetEdgeToUniqueKnotvector (Array< int > &edge_to_ukv, Array< int > &ukv_to_rpkv) const
 
Methods for piecewise Mesh construction.

These methods are intended to be used with the init constructor.

ElementNewElement (int geom)
 
int AddVertex (real_t x, real_t y=0.0, real_t z=0.0)
 
int AddVertex (const real_t *coords)
 
int AddVertex (const Vector &coords)
 
void AddVertexParents (int i, int p1, int p2)
 Mark vertex i as nonconforming, with parent vertices p1 and p2.
 
int AddVertexAtMeanCenter (const int *vi, const int nverts, int dim=3)
 
int AddSegment (int v1, int v2, int attr=1)
 Adds a segment to the mesh given by 2 vertices v1 and v2.
 
int AddSegment (const int *vi, int attr=1)
 Adds a segment to the mesh given by 2 vertices vi.
 
int AddTriangle (int v1, int v2, int v3, int attr=1)
 Adds a triangle to the mesh given by 3 vertices v1 through v3.
 
int AddTriangle (const int *vi, int attr=1)
 Adds a triangle to the mesh given by 3 vertices vi.
 
int AddTri (const int *vi, int attr=1)
 Adds a triangle to the mesh given by 3 vertices vi.
 
int AddQuad (int v1, int v2, int v3, int v4, int attr=1)
 Adds a quadrilateral to the mesh given by 4 vertices v1 through v4.
 
int AddQuad (const int *vi, int attr=1)
 Adds a quadrilateral to the mesh given by 4 vertices vi.
 
int AddTet (int v1, int v2, int v3, int v4, int attr=1)
 Adds a tetrahedron to the mesh given by 4 vertices v1 through v4.
 
int AddTet (const int *vi, int attr=1)
 Adds a tetrahedron to the mesh given by 4 vertices vi.
 
int AddWedge (int v1, int v2, int v3, int v4, int v5, int v6, int attr=1)
 Adds a wedge to the mesh given by 6 vertices v1 through v6.
 
int AddWedge (const int *vi, int attr=1)
 Adds a wedge to the mesh given by 6 vertices vi.
 
int AddPyramid (int v1, int v2, int v3, int v4, int v5, int attr=1)
 Adds a pyramid to the mesh given by 5 vertices v1 through v5.
 
int AddPyramid (const int *vi, int attr=1)
 Adds a pyramid to the mesh given by 5 vertices vi.
 
int AddHex (int v1, int v2, int v3, int v4, int v5, int v6, int v7, int v8, int attr=1)
 Adds a hexahedron to the mesh given by 8 vertices v1 through v8.
 
int AddHex (const int *vi, int attr=1)
 Adds a hexahedron to the mesh given by 8 vertices vi.
 
void AddHexAsTets (const int *vi, int attr=1)
 Adds 6 tetrahedrons to the mesh by splitting a hexahedron given by 8 vertices vi.
 
void AddHexAsWedges (const int *vi, int attr=1)
 Adds 2 wedges to the mesh by splitting a hexahedron given by 8 vertices vi.
 
void AddHexAsPyramids (const int *vi, int attr=1)
 Adds 6 pyramids to the mesh by splitting a hexahedron given by 8 vertices vi.
 
void AddHexAs24TetsWithPoints (int *vi, std::map< std::array< int, 4 >, int > &hex_face_verts, int attr=1)
 Adds 24 tetrahedrons to the mesh by splitting a hexahedron.
 
void AddQuadAs4TrisWithPoints (int *vi, int attr=1)
 Adds 4 triangles to the mesh by splitting a quadrilateral given by 4 vertices vi.
 
void AddQuadAs5QuadsWithPoints (int *vi, int attr=1)
 Adds 5 quadrilaterals to the mesh by splitting a quadrilateral given by 4 vertices vi.
 
int AddElement (Element *elem)
 
int AddBdrElement (Element *elem)
 
void AddBdrElements (Array< Element * > &bdr_elems, const Array< int > &be_to_face)
 Add an array of boundary elements to the mesh, along with map from the elements to their faces.
 
int AddBdrSegment (int v1, int v2, int attr=1)
 
int AddBdrSegment (const int *vi, int attr=1)
 
int AddBdrTriangle (int v1, int v2, int v3, int attr=1)
 
int AddBdrTriangle (const int *vi, int attr=1)
 
int AddBdrQuad (int v1, int v2, int v3, int v4, int attr=1)
 
int AddBdrQuad (const int *vi, int attr=1)
 
void AddBdrQuadAsTriangles (const int *vi, int attr=1)
 
int AddBdrPoint (int v, int attr=1)
 
virtual void GenerateBoundaryElements ()
 
void FinalizeTriMesh (int generate_edges=0, int refine=0, bool fix_orientation=true)
 Finalize the construction of a triangular Mesh.
 
void FinalizeQuadMesh (int generate_edges=0, int refine=0, bool fix_orientation=true)
 Finalize the construction of a quadrilateral Mesh.
 
void FinalizeTetMesh (int generate_edges=0, int refine=0, bool fix_orientation=true)
 Finalize the construction of a tetrahedral Mesh.
 
void FinalizeWedgeMesh (int generate_edges=0, int refine=0, bool fix_orientation=true)
 Finalize the construction of a wedge Mesh.
 
void FinalizeHexMesh (int generate_edges=0, int refine=0, bool fix_orientation=true)
 Finalize the construction of a hexahedral Mesh.
 
void FinalizeMesh (int refine=0, bool fix_orientation=true)
 Finalize the construction of any type of Mesh.
 
Mesh consistency methods
void FinalizeTopology (bool generate_bdr=true)
 Finalize the construction of the secondary topology (connectivity) data of a Mesh.
 
virtual void Finalize (bool refine=false, bool fix_orientation=false)
 Finalize the construction of a general Mesh.
 
virtual void SetAttributes (bool elem_attrs_changed=true, bool bdr_face_attrs_changed=true)
 Determine the sets of unique attribute values in domain if elem_attrs_changed and boundary elements if bdr_face_attrs_changed.
 
int CheckElementOrientation (bool fix_it=true)
 Check (and optionally attempt to fix) the orientation of the elements.
 
int CheckBdrElementOrientation (bool fix_it=true)
 Check the orientation of the boundary elements.
 
virtual MFEM_DEPRECATED void ReorientTetMesh ()
 
void RemoveUnusedVertices ()
 Remove unused vertices and rebuild mesh connectivity.
 
void RemoveInternalBoundaries ()
 
void DeleteBoundaryElementToEdge ()
 Clear the boundary element to edge map.
 
Element ordering methods
real_t GetGeckoElementOrdering (Array< int > &ordering, int iterations=4, int window=4, int period=2, int seed=0, bool verbose=false, real_t time_limit=0)
 
void GetHilbertElementOrdering (Array< int > &ordering)
 
void ReorderElements (const Array< int > &ordering, bool reorder_vertices=true)
 
Deprecated mesh constructors

These constructors have been deprecated in favor of Named mesh constructors.

MFEM_DEPRECATED Mesh (int nx, int ny, int nz, Element::Type type, bool generate_edges=false, real_t sx=1.0, real_t sy=1.0, real_t sz=1.0, bool sfc_ordering=true)
 Deprecated: see MakeCartesian3D.
 
MFEM_DEPRECATED Mesh (int nx, int ny, Element::Type type, bool generate_edges=false, real_t sx=1.0, real_t sy=1.0, bool sfc_ordering=true)
 Deprecated: see MakeCartesian2D.
 
MFEM_DEPRECATED Mesh (int n, real_t sx=1.0)
 Deprecated: see MakeCartesian1D.
 
MFEM_DEPRECATED Mesh (Mesh *orig_mesh, int ref_factor, int ref_type)
 Deprecated: see MakeRefined.
 
Information about the mesh as a whole
int Dimension () const
 Dimension of the reference space used within the elements.
 
int SpaceDimension () const
 Dimension of the physical space containing the mesh.
 
int EulerNumber () const
 Equals 1 + num_holes - num_loops.
 
int EulerNumber2D () const
 Equals 1 - num_holes.
 
int MeshGenerator () const
 Get the mesh generator/type.
 
virtual bool HasBoundaryElements () const
 Checks if the mesh has boundary elements.
 
bool HasGeometry (Geometry::Type geom) const
 Return true iff the given geom is encountered in the mesh. Geometries of dimensions lower than Dimension() are counted as well.
 
int GetNumGeometries (int dim) const
 Return the number of geometries of the given dimension present in the mesh.
 
void GetGeometries (int dim, Array< Geometry::Type > &el_geoms) const
 Return all element geometries of the given dimension present in the mesh.
 
bool IsMixedMesh () const
 Returns true if the mesh is a mixed mesh, false otherwise.
 
void GetBoundingBox (Vector &min, Vector &max, int ref=2)
 Returns the minimum and maximum corners of the mesh bounding box.
 
void GetCharacteristics (real_t &h_min, real_t &h_max, real_t &kappa_min, real_t &kappa_max, Vector *Vh=NULL, Vector *Vk=NULL)
 
Information concerning numbers of mesh entities
int GetNV () const
 Returns number of vertices. Vertices are only at the corners of elements, where you would expect them in the lowest-order mesh.
 
int GetNE () const
 Returns number of elements.
 
int GetNBE () const
 Returns number of boundary elements.
 
int GetNEdges () const
 Return the number of edges.
 
int GetNFaces () const
 Return the number of faces in a 3D mesh.
 
int GetNumFaces () const
 Return the number of faces (3D), edges (2D) or vertices (1D).
 
int GetNumFacesWithGhost () const
 Return the number of faces (3D), edges (2D) or vertices (1D) including ghost faces.
 
virtual int GetNFbyType (FaceType type) const
 Returns the number of faces according to the requested type, does not count master nonconforming faces.
 
long long GetGlobalNE () const
 Return the total (global) number of elements.
 
Access to individual mesh entities
const real_tGetVertex (int i) const
 Return pointer to vertex i's coordinates.
 
real_tGetVertex (int i)
 Return pointer to vertex i's coordinates.
 
const ElementGetElement (int i) const
 Return pointer to the i'th element object.
 
ElementGetElement (int i)
 Return pointer to the i'th element object.
 
const ElementGetBdrElement (int i) const
 Return pointer to the i'th boundary element object.
 
ElementGetBdrElement (int i)
 Return pointer to the i'th boundary element object.
 
const ElementGetFace (int i) const
 Return pointer to the i'th face element object.
 
Access to groups of mesh entities
const Element *const * GetElementsArray () const
 
void GetElementData (int geom, Array< int > &elem_vtx, Array< int > &attr) const
 
void GetBdrElementData (int geom, Array< int > &bdr_elem_vtx, Array< int > &bdr_attr) const
 
Access information concerning individual mesh entites
int GetAttribute (int i) const
 Return the attribute of element i.
 
void SetAttribute (int i, int attr)
 Set the attribute of element i.
 
int GetBdrAttribute (int i) const
 Return the attribute of boundary element i.
 
void SetBdrAttribute (int i, int attr)
 Set the attribute of boundary element i.
 
int GetPatchAttribute (int i) const
 Return the attribute of patch i, for a NURBS mesh.
 
void SetPatchAttribute (int i, int attr)
 Set the attribute of patch i, for a NURBS mesh.
 
int GetPatchBdrAttribute (int i) const
 Return the attribute of patch boundary element i, for a NURBS mesh.
 
void SetPatchBdrAttribute (int i, int attr)
 Set the attribute of patch boundary element i, for a NURBS mesh.
 
void GetNURBSPatches (Array< NURBSPatch * > &patches)
 
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.
 
MFEM_DEPRECATED Geometry::Type GetFaceGeometryType (int Face) const
 Deprecated in favor of Mesh::GetFaceGeometry.
 
Element::Type GetFaceElementType (int Face) const
 
Geometry::Type GetFaceGeometry (int i) const
 Return the Geometry::Type associated with face i.
 
Geometry::Type GetTypicalFaceGeometry () const
 If the local mesh is not empty, return GetFaceGeometry(0); otherwise return a typical face geometry present in the global mesh.
 
Geometry::Type GetElementGeometry (int i) const
 
Geometry::Type GetTypicalElementGeometry () const
 If the local mesh is not empty, return GetElementGeometry(0); otherwise, return a typical Geometry present in the global mesh.
 
Geometry::Type GetBdrElementGeometry (int i) const
 
MFEM_DEPRECATED Geometry::Type GetFaceBaseGeometry (int i) const
 Deprecated in favor of Mesh::GetFaceGeometry.
 
Geometry::Type GetElementBaseGeometry (int i) const
 
Geometry::Type GetBdrElementBaseGeometry (int i) const
 
bool FaceIsInterior (int FaceNo) const
 Return true if the given face is interior.
 
real_t GetElementSize (int i, int type=0)
 Get the size of the i-th element relative to the perfect reference element.
 
real_t GetElementSize (int i, const Vector &dir)
 
real_t GetElementSize (ElementTransformation *T, int type=0) const
 
real_t GetElementVolume (int i)
 
void GetElementCenter (int i, Vector &center)
 
void GetElementJacobian (int i, DenseMatrix &J, const IntegrationPoint *ip=NULL)
 
Access connectivity for individual mesh entites
void GetElementVertices (int i, Array< int > &v) const
 Returns the indices of the vertices of element i.
 
void GetBdrElementVertices (int i, Array< int > &v) const
 Returns the indices of the vertices of boundary element i.
 
void GetElementEdges (int i, Array< int > &edges, Array< int > &cor) const
 Return the indices and the orientations of all edges of element i.
 
void GetBdrElementEdges (int i, Array< int > &edges, Array< int > &cor) const
 Return the indices and the orientations of all edges of bdr element i.
 
void GetFaceEdges (int i, Array< int > &edges, Array< int > &o) const
 
void GetFaceVertices (int i, Array< int > &vert) const
 Returns the indices of the vertices of face i.
 
void GetEdgeVertices (int i, Array< int > &vert) const
 Returns the indices of the vertices of edge i.
 
void GetElementFaces (int i, Array< int > &faces, Array< int > &ori) const
 Return the indices and the orientations of all faces of element i.
 
Array< int > FindFaceNeighbors (const int elem) const
 Returns the sorted, unique indices of elements sharing a face with element elem, including elem.
 
void GetBdrElementFace (int i, int *f, int *o) const
 
void GetBdrElementAdjacentElement (int bdr_el, int &el, int &info) const
 For the given boundary element, bdr_el, return its adjacent element and its info, i.e. 64*local_bdr_index+bdr_orientation.
 
MFEM_DEPRECATED void GetBdrElementAdjacentElement2 (int bdr_el, int &el, int &info) const
 Deprecated.
 
int GetBdrElementFaceIndex (int be_idx) const
 Return the local face (codimension-1) index for the given boundary element index.
 
MFEM_DEPRECATED int GetBdrFace (int i) const
 Deprecated in favor of GetBdrElementFaceIndex().
 
MFEM_DEPRECATED int GetBdrElementEdgeIndex (int i) const
 
Access connectivity data
TableGetVertexToElementTable ()
 
TableGetVertexToBdrElementTable ()
 
TableGetFaceToElementTable () const
 
TableGetFaceEdgeTable () const
 
TableGetEdgeVertexTable () const
 
void GetVertexToVertexTable (DSTable &) const
 
const TableElementToElementTable ()
 
const TableElementToFaceTable () const
 
const TableElementToEdgeTable () const
 
Array< int > GetFaceToBdrElMap () const
 
Access the coordinate transformation for individual elements

See also the methods related to Geometric Factors for accessing information cached at quadrature points.

void GetElementTransformation (int i, IsoparametricTransformation *ElTr) const
 Builds the transformation defining the i-th element in ElTr. ElTr must be allocated in advance and will be owned by the caller.
 
ElementTransformationGetElementTransformation (int i)
 Returns a pointer to the transformation defining the i-th element.
 
ElementTransformationGetTypicalElementTransformation ()
 If the local mesh is not empty return GetElementTransformation(0); otherwise, return the identity transformation for a typical geometry in the mesh and a typical finite element in the nodal finite element space (if present).
 
void GetElementTransformation (int i, const Vector &nodes, IsoparametricTransformation *ElTr) const
 Builds the transformation defining the i-th element in ElTr assuming position of the vertices/nodes are given by nodes. ElTr must be allocated in advance and will be owned by the caller.
 
ElementTransformationGetBdrElementTransformation (int i)
 Returns a pointer to the transformation defining the i-th boundary element.
 
void GetBdrElementTransformation (int i, IsoparametricTransformation *ElTr) const
 Builds the transformation defining the i-th boundary element in ElTr. ElTr must be allocated in advance and will be owned by the caller.
 
ElementTransformationGetFaceTransformation (int FaceNo)
 Returns a pointer to the transformation defining the given face element.
 
void GetFaceTransformation (int i, IsoparametricTransformation *FTr) const
 Builds the transformation defining the i-th face element in FTr. FTr must be allocated in advance and will be owned by the caller.
 
void GetLocalFaceTransformation (int face_type, int elem_type, IsoparametricTransformation &Transf, int info) const
 A helper method that constructs a transformation from the reference space of a face to the reference space of an element.
 
void GetEdgeTransformation (int i, IsoparametricTransformation *EdTr) const
 Builds the transformation defining the i-th edge element in EdTr. EdTr must be allocated in advance and will be owned by the caller.
 
ElementTransformationGetEdgeTransformation (int EdgeNo)
 Returns a pointer to the transformation defining the given edge element.
 
virtual FaceElementTransformationsGetFaceElementTransformations (int FaceNo, int mask=31)
 
virtual void GetFaceElementTransformations (int FaceNo, FaceElementTransformations &FElTr, IsoparametricTransformation &ElTr1, IsoparametricTransformation &ElTr2, int mask=31) const
 Variant of GetFaceElementTransformations using a user allocated FaceElementTransformations object.
 
FaceElementTransformationsGetInteriorFaceTransformations (int FaceNo)
 See GetFaceElementTransformations().
 
void GetInteriorFaceTransformations (int FaceNo, FaceElementTransformations &FElTr, IsoparametricTransformation &ElTr1, IsoparametricTransformation &ElTr2) const
 Variant of GetInteriorFaceTransformations using a user allocated FaceElementTransformations object.
 
FaceElementTransformationsGetBdrFaceTransformations (int BdrElemNo)
 Builds the transformation defining the given boundary face.
 
void GetBdrFaceTransformations (int BdrElemNo, FaceElementTransformations &FElTr, IsoparametricTransformation &ElTr1, IsoparametricTransformation &ElTr2) const
 Variant of GetBdrFaceTransformations using a user allocated FaceElementTransformations object.
 
Access the coordinate transformation at quadrature points

See also methods related to Element-wise coordinate transformation.

const GeometricFactorsGetGeometricFactors (const IntegrationRule &ir, const int flags, MemoryType d_mt=MemoryType::DEFAULT)
 Return the mesh geometric factors corresponding to the given integration rule.
 
const FaceGeometricFactorsGetFaceGeometricFactors (const IntegrationRule &ir, const int flags, FaceType type, MemoryType d_mt=MemoryType::DEFAULT)
 Return the mesh geometric factors for the faces corresponding to the given integration rule.
 
void DeleteGeometricFactors ()
 Destroy all GeometricFactors stored by the Mesh.
 
More advanced entity information access methods
void GetPointMatrix (int i, DenseMatrix &pointmat) const
 
void GetBdrPointMatrix (int i, DenseMatrix &pointmat) const
 
FaceInformation GetFaceInformation (int f) const
 
void GetFaceElements (int Face, int *Elem1, int *Elem2) const
 
void GetFaceInfos (int Face, int *Inf1, int *Inf2) const
 
void GetFaceInfos (int Face, int *Inf1, int *Inf2, int *NCFace) const
 
virtual void GetExteriorFaceMarker (Array< int > &face_marker) const
 Populate a marker array identifying exterior faces.
 
virtual void UnmarkInternalBoundaries (Array< int > &bdr_marker, bool excl=true) const
 Unmark boundary attributes of internal boundaries.
 
virtual void UnmarkNamedBoundaries (const std::string &set_name, Array< int > &bdr_marker) const
 Unmark boundary attributes in the named set.
 
virtual void MarkExternalBoundaries (Array< int > &bdr_marker, bool excl=true) const
 Mark boundary attributes of external boundaries.
 
virtual void MarkNamedBoundaries (const std::string &set_name, Array< int > &bdr_marker) const
 Mark boundary attributes in the named set.
 
Methods related to mesh partitioning
int * CartesianPartitioning (int nxyz[])
 
int * GeneratePartitioning (int nparts, int part_method=1)
 
void CheckPartitioning (int *partitioning_)
 
Methods related to accessing/altering mesh coordinates
void MoveVertices (const Vector &displacements)
 
void GetVertices (Vector &vert_coord) const
 
void SetVertices (const Vector &vert_coord)
 
void ChangeVertexDataOwnership (real_t *vertices, int len_vertices, bool zerocopy=false)
 Set the internal Vertex array to point to the given vertices array without assuming ownership of the pointer.
 
void GetNode (int i, real_t *coord) const
 
void SetNode (int i, const real_t *coord)
 
void MoveNodes (const Vector &displacements)
 
void GetNodes (Vector &node_coord) const
 
void SetNodes (const Vector &node_coord)
 Updates the vertex/node locations. Invokes NodesUpdated().
 
void ScaleSubdomains (real_t sf)
 
void ScaleElements (real_t sf)
 
void Transform (std::function< void(const Vector &, Vector &)> f)
 
void Transform (VectorCoefficient &deformation)
 
void NodesUpdated ()
 This function should be called after the mesh node coordinates have been updated externally, e.g. by modifying the internal nodal GridFunction returned by GetNodes().
 
const Array< int > & GetElementAttributes () const
 Returns the attributes for all elements in this mesh. The i'th entry of the array is the attribute of the i'th element of the mesh.
 
const Array< int > & GetBdrFaceAttributes () const
 Returns the attributes for all boundary elements in this mesh.
 
Methods related to nodal coordinates stored as a GridFunction
GridFunctionGetNodes ()
 Return a pointer to the internal node GridFunction (may be NULL).
 
const GridFunctionGetNodes () const
 
bool OwnsNodes () const
 Return the mesh nodes ownership flag.
 
void SetNodesOwner (bool nodes_owner)
 Set the mesh nodes ownership flag.
 
void NewNodes (GridFunction &nodes, bool make_owner=false)
 Replace the internal node GridFunction with the given GridFunction.
 
void SwapNodes (GridFunction *&nodes, int &own_nodes_)
 Swap the internal node GridFunction pointer and ownership flag members with the given ones.
 
void GetNodes (GridFunction &nodes) const
 Return the mesh nodes/vertices projected on the given GridFunction.
 
virtual void SetNodalFESpace (FiniteElementSpace *nfes)
 
void SetNodalGridFunction (GridFunction *nodes, bool make_owner=false)
 
const FiniteElementSpaceGetNodalFESpace () const
 
void EnsureNodes ()
 Make sure that the mesh has valid nodes, i.e. its geometry is described by a vector finite element grid function (even if it is a low-order mesh with straight edges).
 
virtual void SetCurvature (int order, bool discont=false, int space_dim=-1, int ordering=1)
 Set the curvature of the mesh nodes using the given polynomial degree.
 
Methods related to mesh refinement
void UniformRefinement (int ref_algo=0)
 Refine all mesh elements.
 
virtual void NURBSUniformRefinement (int rf=2, real_t tol=1.0e-12)
 Refine NURBS mesh, with an optional refinement factor, generally anisotropic.
 
virtual void NURBSUniformRefinement (const Array< int > &rf, real_t tol=1.e-12)
 
virtual void RefineNURBSWithKVFactors (int rf, const std::string &kvf)
 
void NURBSCoarsening (int cf=2, real_t tol=1.0e-12)
 
void GeneralRefinement (const Array< Refinement > &refinements, int nonconforming=-1, int nc_limit=0)
 
void GeneralRefinement (const Array< int > &el_to_refine, int nonconforming=-1, int nc_limit=0)
 
void RandomRefinement (real_t prob, bool aniso=false, int nonconforming=-1, int nc_limit=0)
 Refine each element with given probability. Uses GeneralRefinement.
 
void RefineAtVertex (const Vertex &vert, real_t eps=0.0, int nonconforming=-1)
 Refine elements sharing the specified vertex. Uses GeneralRefinement.
 
bool RefineByError (const Array< real_t > &elem_error, real_t threshold, int nonconforming=-1, int nc_limit=0)
 
bool RefineByError (const Vector &elem_error, real_t threshold, int nonconforming=-1, int nc_limit=0)
 
bool DerefineByError (Array< real_t > &elem_error, real_t threshold, int nc_limit=0, int op=1)
 
bool DerefineByError (const Vector &elem_error, real_t threshold, int nc_limit=0, int op=1)
 Same as DerefineByError for an error vector.
 
void EnsureNCMesh (bool simplices_nonconforming=false)
 
bool Conforming () const
 
bool Nonconforming () const
 
void SetScaledNCMesh ()
 
const CoarseFineTransformationsGetRefinementTransforms () const
 
Operation GetLastOperation () const
 Return type of last modification of the mesh.
 
long GetSequence () const
 
long GetNodesSequence () const
 Return the nodes update counter.
 
NURBS mesh refinement methods
void RefineNURBSFromFile (std::string ref_file)
 
void KnotInsert (Array< KnotVector * > &kv)
 For NURBS meshes, insert the new knots in kv, for each direction.
 
void KnotInsert (Array< Vector * > &kv)
 For NURBS meshes, insert the knots in kv, for each direction.
 
void KnotRemove (Array< Vector * > &kv)
 For NURBS meshes, remove the knots in kv, for each direction.
 
void DegreeElevate (int rel_degree, int degree=16)
 
Miscellaneous or undocumented methods
std::vector< int > CreatePeriodicVertexMapping (const std::vector< Vector > &translations, real_t tol=1e-8) const
 Creates a mapping v2v from the vertex indices of the mesh such that coincident vertices under the given translations are identified.
 
virtual int FindPoints (DenseMatrix &point_mat, Array< int > &elem_ids, Array< IntegrationPoint > &ips, bool warn=true, InverseElementTransformation *inv_trans=NULL)
 Find the ids of the elements that contain the given points, and their corresponding reference coordinates.
 
void GetGeometricParametersFromJacobian (const DenseMatrix &J, real_t &volume, Vector &aspr, Vector &skew, Vector &ori) const
 Computes geometric parameters associated with a Jacobian matrix in 2D/3D. These parameters are (1) Area/Volume, (2) Aspect-ratio (1 in 2D, and 2 non-dimensional and 2 dimensional parameters in 3D. Dimensional parameters are used for target construction in TMOP), (3) skewness (1 in 2D and 3 in 3D), and finally (4) orientation (1 in 2D and 3 in 3D).
 
virtual long long ReduceInt (int value) const
 Utility function: sum integers from all processors (Allreduce).
 
void GetElementColoring (Array< int > &colors, int el0=0)
 
void CheckDisplacements (const Vector &displacements, real_t &tmax)
 

Static Public Member Functions

static FiniteElementGetTransformationFEforElementType (Element::Type)
 Return FiniteElement for reference element of the specified type.
 
static IntegrationPoint TransformBdrElementToFace (Geometry::Type geom, int o, const IntegrationPoint &ip)
 For the vertex (1D), edge (2D), or face (3D) of a boundary element with the orientation o, return the transformation of the boundary element integration point @ ip to the face element. In 2D, the the orientation is 0 or 1 as returned by GetBdrElementFace, not +/-1. Supports both internal and external boundaries.
 
static int DecodeFaceInfoOrientation (int info)
 Given a "face info int", return the face orientation.
 
static int DecodeFaceInfoLocalIndex (int info)
 Given a "face info int", return the local face index.
 
static int EncodeFaceInfo (int local_face_index, int orientation)
 Given local_face_index and orientation, return the corresponding encoded "face info int".
 
Named mesh constructors.

Each of these constructors uses the move constructor, and can be used as the right-hand side of an assignment when creating new meshes. For more general mesh constructors see Standard mesh constructors.

static Mesh LoadFromFile (const std::string &filename, int generate_edges=0, int refine=1, bool fix_orientation=true)
 
static Mesh MakeCartesian1D (int n, real_t sx=1.0)
 Creates 1D mesh, divided into n equal intervals.
 
static Mesh MakeCartesian2D (int nx, int ny, Element::Type type, bool generate_edges=false, real_t sx=1.0, real_t sy=1.0, bool sfc_ordering=true)
 Creates mesh for the rectangle [0,sx]x[0,sy], divided into nx*ny quadrilaterals if type = QUADRILATERAL or into 2*nx*ny triangles if type = TRIANGLE.
 
static Mesh MakeCartesian3D (int nx, int ny, int nz, Element::Type type, real_t sx=1.0, real_t sy=1.0, real_t sz=1.0, bool sfc_ordering=true)
 Creates a mesh for the parallelepiped [0,sx]x[0,sy]x[0,sz], divided into nx*ny*nz hexahedra if type = HEXAHEDRON or into 6*nx*ny*nz tetrahedrons if type = TETRAHEDRON.
 
static Mesh MakeCartesian3DWith24TetsPerHex (int nx, int ny, int nz, real_t sx=1.0, real_t sy=1.0, real_t sz=1.0)
 Creates a mesh for the parallelepiped [0,sx]x[0,sy]x[0,sz], divided into nx*ny*nz*24 tetrahedrons.
 
static Mesh MakeCartesian2DWith4TrisPerQuad (int nx, int ny, real_t sx=1.0, real_t sy=1.0)
 Creates mesh for the rectangle [0,sx]x[0,sy], divided into nx*ny*4 triangles.
 
static Mesh MakeCartesian2DWith5QuadsPerQuad (int nx, int ny, real_t sx=1.0, real_t sy=1.0)
 Creates mesh for the rectangle [0,sx]x[0,sy], divided into nx*ny*5 quadrilaterals.
 
static Mesh MakeRefined (Mesh &orig_mesh, int ref_factor, int ref_type)
 Create a refined (by any factor) version of orig_mesh.
 
static Mesh MakeRefined (Mesh &orig_mesh, const Array< int > &ref_factors, int ref_type)
 refined ref_factors[i] times in each dimension.
 
static Mesh MakeSimplicial (const Mesh &orig_mesh)
 
static Mesh MakePeriodic (const Mesh &orig_mesh, const std::vector< int > &v2v)
 Create a periodic mesh by identifying vertices of orig_mesh.
 

Public Attributes

Array< int > attributes
 A list of all unique element attributes used by the Mesh.
 
Array< int > bdr_attributes
 A list of all unique boundary attributes used by the Mesh.
 
AttributeSets attribute_sets
 Named sets of element attributes.
 
AttributeSets bdr_attribute_sets
 Named sets of boundary element attributes.
 
NURBSExtensionNURBSext
 Optional NURBS mesh extension.
 
NCMeshncmesh
 Optional nonconforming mesh extension.
 
Array< GeometricFactors * > geom_factors
 Optional geometric factors.
 
Array< FaceGeometricFactors * > face_geom_factors
 

Static Public Attributes

static bool remove_unused_vertices = true
 

Protected Member Functions

void ComputeFaceInfo (FaceType ftype) const
 compute face_indices[ftype] and inv_face_indices[type]
 
void Init ()
 
void InitTables ()
 
void SetEmpty ()
 
void DestroyTables ()
 
void DeleteTables ()
 
void DestroyPointers ()
 
void Destroy ()
 
void ResetLazyData ()
 
ElementReadElementWithoutAttr (std::istream &input)
 
ElementReadElement (std::istream &input)
 
void ReadMFEMMesh (std::istream &input, int version, int &curved)
 
void ReadLineMesh (std::istream &input)
 
void ReadNetgen2DMesh (std::istream &input, int &curved)
 
void ReadNetgen3DMesh (std::istream &input)
 
void ReadTrueGridMesh (std::istream &input)
 
void CreateVTKMesh (const Vector &points, const Array< int > &cell_data, const Array< int > &cell_offsets, const Array< int > &cell_types, const Array< int > &cell_attributes, int &curved, int &read_gf, bool &finalize_topo)
 
void ReadVTKMesh (std::istream &input, int &curved, int &read_gf, bool &finalize_topo)
 
void ReadXML_VTKMesh (std::istream &input, int &curved, int &read_gf, bool &finalize_topo, const std::string &xml_prefix="")
 
void ReadNURBSMesh (std::istream &input, int &curved, int &read_gf, bool spacing=false, bool nc=false)
 
void ReadInlineMesh (std::istream &input, bool generate_edges=false)
 
void ReadGmshMesh (std::istream &input, int &curved, int &read_gf)
 
void ReadCubit (const std::string &filename, int &curved, int &read_gf)
 Load a mesh from a Genesis file.
 
void BuildCubitVertices (const std::vector< int > &unique_vertex_ids, const std::vector< double > &coordx, const std::vector< double > &coordy, const std::vector< double > &coordz)
 Called internally in ReadCubit. This method creates the vertices.
 
void BuildCubitElements (const int num_elements, const cubit::CubitBlock *blocks, const std::vector< int > &block_ids, const std::map< int, std::vector< int > > &element_ids_for_block_id, const std::map< int, std::vector< int > > &node_ids_for_element_id, const std::map< int, int > &cubit_to_mfem_vertex_map)
 Called internally in ReadCubit. This method builds the mesh elements.
 
void BuildCubitBoundaries (const cubit::CubitBlock *blocks, const std::vector< int > &boundary_ids, const std::map< int, std::vector< int > > &element_ids_for_boundary_id, const std::map< int, std::vector< std::vector< int > > > &node_ids_for_boundary_id, const std::map< int, std::vector< int > > &side_ids_for_boundary_id, const std::map< int, int > &block_id_for_element_id, const std::map< int, int > &cubit_to_mfem_vertex_map)
 Called internally in ReadCubit. This method adds the mesh boundary elements.
 
void SetMeshGen ()
 Determine the mesh generator bitmask meshgen, see MeshGenerator().
 
real_t GetLength (int i, int j) const
 Return the length of the segment from node i to node j.
 
void MarkForRefinement ()
 
void MarkTriMeshForRefinement ()
 
void GetEdgeOrdering (const DSTable &v_to_v, Array< int > &order)
 
virtual void MarkTetMeshForRefinement (const DSTable &v_to_v)
 
void PrepareNodeReorder (DSTable **old_v_to_v, Table **old_elem_vert)
 
void DoNodeReorder (DSTable *old_v_to_v, Table *old_elem_vert)
 
STable3DGetFacesTable ()
 
STable3DGetElementToFaceTable (int ret_ftbl=0)
 
void RedRefinement (int i, const DSTable &v_to_v, int *edge1, int *edge2, int *middle)
 
void GreenRefinement (int i, const DSTable &v_to_v, int *edge1, int *edge2, int *middle)
 
void Bisection (int i, const DSTable &, int *, int *, int *)
 Bisect a triangle: element with index i is bisected.
 
void Bisection (int i, HashTable< Hashed2 > &)
 Bisect a tetrahedron: element with index i is bisected.
 
void BdrBisection (int i, const HashTable< Hashed2 > &)
 Bisect a boundary triangle: boundary element with index i is bisected.
 
void UniformRefinement (int i, const DSTable &, int *, int *, int *)
 
void AverageVertices (const int *indexes, int n, int result)
 Averages the vertices with given indexes and saves the result in vertices[result].
 
void InitRefinementTransforms ()
 
int FindCoarseElement (int i)
 
void UpdateNodes ()
 Update the nodes of a curved mesh after the topological part of a Mesh::Operation, such as refinement, has been performed.
 
void SetVerticesFromNodes (const GridFunction *nodes)
 Helper to set vertex coordinates given a high-order curvature function.
 
void UniformRefinement2D_base (bool update_nodes=true)
 
virtual void UniformRefinement2D ()
 Refine a mixed 2D mesh uniformly.
 
void UniformRefinement3D_base (Array< int > *f2qf=NULL, DSTable *v_to_v_p=NULL, bool update_nodes=true)
 
virtual void UniformRefinement3D ()
 Refine a mixed 3D mesh uniformly.
 
virtual void LocalRefinement (const Array< int > &marked_el, int type=3)
 This function is not public anymore. Use GeneralRefinement instead.
 
virtual void NonconformingRefinement (const Array< Refinement > &refinements, int nc_limit=0)
 This function is not public anymore. Use GeneralRefinement instead.
 
virtual bool NonconformingDerefinement (Array< real_t > &elem_error, real_t threshold, int nc_limit=0, int op=1)
 NC version of GeneralDerefinement.
 
real_t AggregateError (const Array< real_t > &elem_error, const int *fine, int nfine, int op)
 Derefinement helper.
 
void LoadPatchTopo (std::istream &input, Array< int > &edge_to_ukv)
 Read NURBS patch/macro-element mesh.
 
void LoadNonconformingPatchTopo (std::istream &input, Array< int > &edge_to_ukv)
 Read NURBS patch/macro-element mesh (MFEM NURBS NC-patch mesh format)
 
void UpdateNURBS ()
 
void RefineNURBS (bool usingKVF, real_t tol, const Array< int > &rf, const std::string &kvf)
 Refine the NURBS mesh with default refinement factors in rf for each dimension.
 
void PrintTopo (std::ostream &os, const Array< int > &e_to_k, const int version, const std::string &comment="") const
 Write the beginning of a NURBS mesh to os, specifying the NURBS patch topology. Optional file comments can be provided in comments.
 
void PrintTopoEdges (std::ostream &out, const Array< int > &e_to_k, bool vmap=false) const
 Write the patch topology edges of a NURBS mesh (see PrintTopo()).
 
void GetLocalPtToSegTransformation (IsoparametricTransformation &, int i) const
 Used in GetFaceElementTransformations (...)
 
void GetLocalSegToTriTransformation (IsoparametricTransformation &loc, int i) const
 
void GetLocalSegToQuadTransformation (IsoparametricTransformation &loc, int i) const
 
void GetLocalTriToTetTransformation (IsoparametricTransformation &loc, int i) const
 
void GetLocalTriToWdgTransformation (IsoparametricTransformation &loc, int i) const
 
void GetLocalTriToPyrTransformation (IsoparametricTransformation &loc, int i) const
 
void GetLocalQuadToHexTransformation (IsoparametricTransformation &loc, int i) const
 
void GetLocalQuadToWdgTransformation (IsoparametricTransformation &loc, int i) const
 
void GetLocalQuadToPyrTransformation (IsoparametricTransformation &loc, int i) const
 
void ApplyLocalSlaveTransformation (FaceElementTransformations &FT, const FaceInfo &fi, bool is_ghost) const
 
bool IsSlaveFace (const FaceInfo &fi) const
 
int GetElementToEdgeTable (Table &)
 
void AddPointFaceElement (int lf, int gf, int el)
 Used in GenerateFaces()
 
void AddSegmentFaceElement (int lf, int gf, int el, int v0, int v1)
 
void AddTriangleFaceElement (int lf, int gf, int el, int v0, int v1, int v2)
 
void AddQuadFaceElement (int lf, int gf, int el, int v0, int v1, int v2, int v3)
 
bool FaceIsTrueInterior (int FaceNo) const
 
void FreeElement (Element *E)
 
void GenerateFaces ()
 
void GenerateNCFaceInfo ()
 
void InitMesh (int Dim_, int spaceDim_, int NVert, int NElem, int NBdrElem)
 Begin construction of a mesh.
 
void FinalizeCheck ()
 
void Loader (std::istream &input, int generate_edges=0, std::string parse_tag="")
 
void Printer (std::ostream &os=mfem::out, std::string section_delimiter="", const std::string &comments="") const
 If NURBS mesh, write NURBS format. If NCMesh, write mfem v1.1 format. If section_delimiter is empty, write mfem v1.0 format. Otherwise, write mfem v1.2 format with the given section_delimiter at the end.
 
void Make3D (int nx, int ny, int nz, Element::Type type, real_t sx, real_t sy, real_t sz, bool sfc_ordering)
 Creates a mesh for the parallelepiped [0,sx]x[0,sy]x[0,sz], divided into nx*ny*nz hexahedra if type = HEXAHEDRON or into 6*nx*ny*nz tetrahedrons if type = TETRAHEDRON.
 
void Make3D24TetsFromHex (int nx, int ny, int nz, real_t sx, real_t sy, real_t sz)
 Creates a mesh for the parallelepiped [0,sx]x[0,sy]x[0,sz], divided into nx*ny*nz*24 tetrahedrons.
 
void Make2D4TrisFromQuad (int nx, int ny, real_t sx, real_t sy)
 Creates mesh for the rectangle [0,sx]x[0,sy], divided into nx*ny*4 triangles.
 
void Make2D5QuadsFromQuad (int nx, int ny, real_t sx, real_t sy)
 Creates mesh for the rectangle [0,sx]x[0,sy], divided into nx*ny*5 quadrilaterals.
 
void Make2D (int nx, int ny, Element::Type type, real_t sx, real_t sy, bool generate_edges, bool sfc_ordering)
 Creates mesh for the rectangle [0,sx]x[0,sy], divided into nx*ny quadrilaterals if type = QUADRILATERAL or into 2*nx*ny triangles if type = TRIANGLE.
 
void Make1D (int n, real_t sx=1.0)
 
void MakeRefined_ (Mesh &orig_mesh, const Array< int > &ref_factors, int ref_type)
 Internal function used in Mesh::MakeRefined.
 
void InitFromNCMesh (const NCMesh &ncmesh)
 Initialize vertices/elements/boundary/tables from a nonconforming mesh.
 
 Mesh (const NCMesh &ncmesh)
 Create from a nonconforming mesh.
 
void GetElementData (const Array< Element * > &elem_array, int geom, Array< int > &elem_vtx, Array< int > &attr) const
 
Array< int > MakeSimplicial_ (const Mesh &orig_mesh, int *vglobal)
 Internal helper user in MakeSimplicial (and ParMesh::MakeSimplicial). Optional return is used in assembling a higher order mesh.
 
void MakeHigherOrderSimplicial_ (const Mesh &orig_mesh, const Array< int > &parent_elements)
 Helper function for constructing higher order nodes from a mesh transformed into simplices. Only to be called as part of MakeSimplicial or ParMesh::MakeSimplicial.
 

Static Protected Member Functions

static void PrintElementWithoutAttr (const Element *el, std::ostream &os)
 
static void PrintElement (const Element *el, std::ostream &os)
 
static int GetTriOrientation (const int *base, const int *test)
 Returns the orientation of "test" relative to "base".
 
static int InvertTriOrientation (int ori)
 
static int ComposeTriOrientations (int ori_a_b, int ori_b_c)
 
static int GetQuadOrientation (const int *base, const int *test)
 Returns the orientation of "test" relative to "base".
 
static int InvertQuadOrientation (int ori)
 
static int ComposeQuadOrientations (int ori_a_b, int ori_b_c)
 
static int GetTetOrientation (const int *base, const int *test)
 Returns the orientation of "test" relative to "base".
 
static void GetElementArrayEdgeTable (const Array< Element * > &elem_array, const DSTable &v_to_v, Table &el_to_edge)
 

Protected Attributes

int Dim
 
int spaceDim
 
int NumOfVertices
 
int NumOfElements
 
int NumOfBdrElements
 
int NumOfEdges
 
int NumOfFaces
 
int nbInteriorFaces
 
int nbBoundaryFaces
 
int meshgen
 
int mesh_geoms
 
long sequence
 
long nodes_sequence
 Counter for geometric factor invalidation.
 
Array< Element * > elements
 
Array< Vertexvertices
 
Array< Element * > boundary
 
Array< Element * > faces
 
Array< int > elem_attrs_cache
 internal cache for element attributes
 
Array< int > bdr_face_attrs_cache
 internal cache for boundary element attributes
 
Array< FaceInfofaces_info
 
Array< NCFaceInfonc_faces_info
 
Tableel_to_edge
 
Tableel_to_face
 
Tableel_to_el
 
Array< int > be_to_face
 
Tablebel_to_edge
 
Tableface_to_elem
 
Tableface_edge
 
Tableedge_vertex
 
IsoparametricTransformation Transformation
 
IsoparametricTransformation Transformation2
 
IsoparametricTransformation BdrTransformation
 
IsoparametricTransformation FaceTransformation
 
IsoparametricTransformation EdgeTransformation
 
FaceElementTransformations FaceElemTr
 
CoarseFineTransformations CoarseFineTr
 
GridFunctionNodes
 
int own_nodes
 
MemAlloc< Tetrahedron, 1024 > TetMemory
 
Array< Triple< int, int, int > > tmp_vertex_parents
 
Array< int > face_indices [2]
 cache for FaceIndices(ftype)
 
std::unordered_map< int, int > inv_face_indices [2]
 cache for FaceIndices(ftype)
 
Operation last_operation
 

Static Protected Attributes

static const int vtk_quadratic_tet [10]
 
static const int vtk_quadratic_pyramid [13]
 
static const int vtk_quadratic_wedge [18]
 
static const int vtk_quadratic_hex [27]
 

Friends

class NCMesh
 
class NURBSExtension
 
class NCNURBSExtension
 
class ParMesh
 
class ParNCMesh
 
class adios2stream
 
class Tetrahedron
 

Print/Save/Export methods

virtual void PrintXG (std::ostream &os=mfem::out) const
 Print the mesh to the given stream using Netgen/Truegrid format.
 
virtual void Print (std::ostream &os=mfem::out, const std::string &comments="") const
 Print the mesh to the given stream using the default MFEM mesh format.
 
virtual void Save (const std::string &fname, int precision=16) const
 
virtual void Print (adios2stream &os) const
 Print the mesh to the given stream using the adios2 bp format.
 
void PrintVTK (std::ostream &os)
 
void PrintVTK (std::ostream &os, int ref, int field_data=0)
 
void PrintVTU (std::ostream &os, int ref=1, VTKFormat format=VTKFormat::ASCII, bool high_order_output=false, int compression_level=0, bool bdr_elements=false)
 
virtual void PrintVTU (std::string fname, VTKFormat format=VTKFormat::ASCII, bool high_order_output=false, int compression_level=0, bool bdr_elements=false)
 
void PrintBdrVTU (std::string fname, VTKFormat format=VTKFormat::ASCII, bool high_order_output=false, int compression_level=0)
 
void SaveVTKHDF (const std::string &fname, bool high_order=true)
 Save the Mesh in VTKHDF format.
 
void PrintExodusII (const std::string &fpath)
 Export a mesh to an Exodus II file.
 
void PrintWithPartitioning (int *partitioning, std::ostream &os, int elem_attr=0) const
 Prints the mesh with boundary elements given by the boundary of the subdomains, so that the boundary of subdomain i has boundary attribute i+1.
 
void PrintElementsWithPartitioning (int *partitioning, std::ostream &os, int interior_faces=0)
 
void PrintSurfaces (const Table &Aface_face, std::ostream &os) const
 Print set of disjoint surfaces:
 
void PrintCharacteristics (Vector *Vh=NULL, Vector *Vk=NULL, std::ostream &os=mfem::out)
 Compute and print mesh characteristics such as number of vertices, number of elements, number of boundary elements, minimal and maximal element sizes, minimal and maximal element aspect ratios, etc.
 
virtual void PrintInfo (std::ostream &os=mfem::out)
 In serial, this method calls PrintCharacteristics(). In parallel, additional information about the parallel decomposition is also printed.
 
void DebugDump (std::ostream &os) const
 Output an NCMesh-compatible debug dump.
 
static void PrintElementsByGeometry (int dim, const Array< int > &num_elems_by_geom, std::ostream &os)
 Auxiliary method used by PrintCharacteristics().
 

Detailed Description

Mesh data type.

Definition at line 64 of file mesh.hpp.

Member Typedef Documentation

◆ hex_t

Definition at line 295 of file mesh.hpp.

◆ pri_t

Definition at line 296 of file mesh.hpp.

◆ pyr_t

Definition at line 297 of file mesh.hpp.

◆ quad_t

Definition at line 293 of file mesh.hpp.

◆ seg_t

Definition at line 291 of file mesh.hpp.

◆ tet_t

◆ tri_t

Member Enumeration Documentation

◆ ElementConformity

enum class mfem::Mesh::ElementConformity
strong

This enumerated type describes the topological relation of an element to a face:

  • Coincident meaning that the element's face is topologically equal to the mesh face.
  • Superset meaning that the element's face is topologically coarser than the mesh face, i.e., the element's face contains the mesh face.
  • Subset meaning that the element's face is topologically finer than the mesh face, i.e., the element's face is contained in the mesh face. Superset and Subset are only relevant for nonconforming faces. Master nonconforming faces have a conforming element on one side, and a fine element on the other side. Slave nonconforming faces have a conforming element on one side, and a coarse element on the other side.
Enumerator
Coincident 
Superset 
Subset 
NA 

Definition at line 2041 of file mesh.hpp.

◆ ElementLocation

enum class mfem::Mesh::ElementLocation
strong

This enumerated type describes the location of the two elements sharing a face, Local meaning that the element is local to the MPI rank, FaceNbr meaning that the element is distributed on a different MPI rank, this typically means that methods with FaceNbr should be used to access the relevant information, e.g., ParFiniteElementSpace::GetFaceNbrElementVDofs.

Enumerator
Local 
FaceNbr 
NA 

Definition at line 2026 of file mesh.hpp.

◆ FaceInfoTag

enum class mfem::Mesh::FaceInfoTag
strong

This enumerated type describes the corresponding FaceInfo internal representation (encoded cases), c.f. FaceInfo's documentation: Classification of a local (non-ghost) face based on its FaceInfo:

  • Elem2No >= 0 --> local interior face; can be either:
    • NCFace == -1 --> LocalConforming,
    • NCFace >= 0 --> LocalSlaveNonconforming,
  • Elem2No < 0 --> local "boundary" face; can be one of:
    • NCFace == -1 --> conforming face; can be either:
      • Elem2Inf < 0 --> Boundary,
      • Elem2Inf >= 0 --> SharedConforming,
    • NCFace >= 0 --> nonconforming face; can be one of:
      • Elem2Inf < 0 --> MasterNonconforming (shared or not shared),
      • Elem2Inf >= 0 --> SharedSlaveNonconforming. Classification of a ghost (non-local) face based on its FaceInfo:
  • Elem1No == -1 --> GhostMaster (includes other unused ghost faces),
  • Elem1No >= 0 --> GhostSlave.
Enumerator
Boundary 
LocalConforming 
LocalSlaveNonconforming 
SharedConforming 
SharedSlaveNonconforming 
MasterNonconforming 
GhostSlave 
GhostMaster 

Definition at line 2060 of file mesh.hpp.

◆ FaceTopology

enum class mfem::Mesh::FaceTopology
strong

This enumerated type describes the three main face topologies:

  • Boundary, for faces on the boundary of the computational domain,
  • Conforming, for conforming faces interior to the computational domain,
  • Nonconforming, for nonconforming faces interior to the computational domain.
Enumerator
Boundary 
Conforming 
Nonconforming 
NA 

Definition at line 2014 of file mesh.hpp.

◆ Operation

Enumerator
NONE 
REFINE 
DEREFINE 
REBALANCE 

Definition at line 299 of file mesh.hpp.

Constructor & Destructor Documentation

◆ Mesh() [1/14]

mfem::Mesh::Mesh ( const NCMesh & ncmesh)
explicitprotected

Create from a nonconforming mesh.

Definition at line 11027 of file mesh.cpp.

◆ Mesh() [2/14]

mfem::Mesh::Mesh ( )
inline

Definition at line 742 of file mesh.hpp.

◆ Mesh() [3/14]

mfem::Mesh::Mesh ( const Mesh & mesh,
bool copy_nodes = true )
explicit

Copy constructor. Performs a deep copy of (almost) all data, so that the source mesh can be modified (e.g. deleted, refined) without affecting the new mesh. If 'copy_nodes' is false, use a shallow (pointer) copy for the nodes, if present.

Definition at line 4457 of file mesh.cpp.

◆ Mesh() [4/14]

mfem::Mesh::Mesh ( Mesh && mesh)

Move constructor, useful for using a Mesh as a function return value.

Definition at line 4588 of file mesh.cpp.

◆ Mesh() [5/14]

mfem::Mesh::Mesh ( real_t * vertices,
int num_vertices,
int * element_indices,
Geometry::Type element_type,
int * element_attributes,
int num_elements,
int * boundary_indices,
Geometry::Type boundary_type,
int * boundary_attributes,
int num_boundary_elements,
int dimension,
int space_dimension = -1 )

Construct a Mesh from the given primary data.

The array vertices is used as external data, i.e. the Mesh does not copy the data and will not delete the pointer.

The data from the other arrays is copied into the internal Mesh data structures.

This method calls the method FinalizeTopology(). The method Finalize() may be called after this constructor and after optionally setting the Mesh nodes.

Definition at line 4732 of file mesh.cpp.

◆ Mesh() [6/14]

mfem::Mesh::Mesh ( int Dim_,
int NVert,
int NElem,
int NBdrElem = 0,
int spaceDim_ = -1 )
inline

Init constructor: begin the construction of a Mesh object.

Construct a shell of a mesh object allocating space to store pointers to the vertices, elements, and boundary elements. The vertices and elements themselves can later be added using methods from the Mesh construction group.

Definition at line 784 of file mesh.hpp.

◆ Mesh() [7/14]

mfem::Mesh::Mesh ( const std::string & filename,
int generate_edges = 0,
int refine = 1,
bool fix_orientation = true )
explicit

Creates mesh by reading a file in MFEM, Netgen, or VTK format. If generate_edges = 0 (default) edges are not generated, if 1 edges are generated. See also Mesh::LoadFromFile. See Mesh::Finalize for the meaning of refine.

Definition at line 4681 of file mesh.cpp.

◆ Mesh() [8/14]

mfem::Mesh::Mesh ( std::istream & input,
int generate_edges = 0,
int refine = 1,
bool fix_orientation = true )
explicit

Creates mesh by reading data stream in MFEM, Netgen, or VTK format. If generate_edges = 0 (default) edges are not generated, if 1 edges are generated.

Definition at line 4700 of file mesh.cpp.

◆ Mesh() [9/14]

mfem::Mesh::Mesh ( Mesh * mesh_array[],
int num_pieces )

Create a disjoint mesh from the given mesh array

Note
Data is copied from the meshes in mesh_array.

Definition at line 5184 of file mesh.cpp.

◆ ~Mesh()

virtual mfem::Mesh::~Mesh ( )
inlinevirtual

Destroys Mesh.

Definition at line 830 of file mesh.hpp.

◆ Mesh() [10/14]

mfem::Mesh::Mesh ( const NURBSExtension & ext)
explicit

Construct a Mesh from a NURBSExtension.

make an internal copy of the NURBSExtension

Definition at line 4775 of file mesh.cpp.

◆ Mesh() [11/14]

MFEM_DEPRECATED mfem::Mesh::Mesh ( int nx,
int ny,
int nz,
Element::Type type,
bool generate_edges = false,
real_t sx = 1.0,
real_t sy = 1.0,
real_t sz = 1.0,
bool sfc_ordering = true )
inline

Deprecated: see MakeCartesian3D.

Definition at line 1268 of file mesh.hpp.

◆ Mesh() [12/14]

MFEM_DEPRECATED mfem::Mesh::Mesh ( int nx,
int ny,
Element::Type type,
bool generate_edges = false,
real_t sx = 1.0,
real_t sy = 1.0,
bool sfc_ordering = true )
inline

Deprecated: see MakeCartesian2D.

Definition at line 1279 of file mesh.hpp.

◆ Mesh() [13/14]

MFEM_DEPRECATED mfem::Mesh::Mesh ( int n,
real_t sx = 1.0 )
inlineexplicit

Deprecated: see MakeCartesian1D.

Definition at line 1289 of file mesh.hpp.

◆ Mesh() [14/14]

mfem::Mesh::Mesh ( Mesh * orig_mesh,
int ref_factor,
int ref_type )

Deprecated: see MakeRefined.

Definition at line 5327 of file mesh.cpp.

Member Function Documentation

◆ AddBdrElement()

int mfem::Mesh::AddBdrElement ( Element * elem)

The parameter elem should be allocated using the NewElement() method

Note
Ownership of elem will pass to the Mesh object

Definition at line 2370 of file mesh.cpp.

◆ AddBdrElements()

void mfem::Mesh::AddBdrElements ( Array< Element * > & bdr_elems,
const Array< int > & be_to_face )

Add an array of boundary elements to the mesh, along with map from the elements to their faces.

Parameters
[in]bdr_elemsThe set of boundary element pointers, ownership of the pointers will be transferred to the Mesh object
[in]be_to_faceThe map from the boundary element index to the face index

Definition at line 2377 of file mesh.cpp.

◆ AddBdrPoint()

int mfem::Mesh::AddBdrPoint ( int v,
int attr = 1 )

Definition at line 2446 of file mesh.cpp.

◆ AddBdrQuad() [1/2]

int mfem::Mesh::AddBdrQuad ( const int * vi,
int attr = 1 )

Definition at line 2424 of file mesh.cpp.

◆ AddBdrQuad() [2/2]

int mfem::Mesh::AddBdrQuad ( int v1,
int v2,
int v3,
int v4,
int attr = 1 )

Definition at line 2417 of file mesh.cpp.

◆ AddBdrQuadAsTriangles()

void mfem::Mesh::AddBdrQuadAsTriangles ( const int * vi,
int attr = 1 )

Definition at line 2431 of file mesh.cpp.

◆ AddBdrSegment() [1/2]

int mfem::Mesh::AddBdrSegment ( const int * vi,
int attr = 1 )

Definition at line 2396 of file mesh.cpp.

◆ AddBdrSegment() [2/2]

int mfem::Mesh::AddBdrSegment ( int v1,
int v2,
int attr = 1 )

Definition at line 2389 of file mesh.cpp.

◆ AddBdrTriangle() [1/2]

int mfem::Mesh::AddBdrTriangle ( const int * vi,
int attr = 1 )

Definition at line 2410 of file mesh.cpp.

◆ AddBdrTriangle() [2/2]

int mfem::Mesh::AddBdrTriangle ( int v1,
int v2,
int v3,
int attr = 1 )

Definition at line 2403 of file mesh.cpp.

◆ AddElement()

int mfem::Mesh::AddElement ( Element * elem)

The parameter elem should be allocated using the NewElement() method

Note
Ownership of elem will pass to the Mesh object

Definition at line 2363 of file mesh.cpp.

◆ AddHex() [1/2]

int mfem::Mesh::AddHex ( const int * vi,
int attr = 1 )

Adds a hexahedron to the mesh given by 8 vertices vi.

Definition at line 2157 of file mesh.cpp.

◆ AddHex() [2/2]

int mfem::Mesh::AddHex ( int v1,
int v2,
int v3,
int v4,
int v5,
int v6,
int v7,
int v8,
int attr = 1 )

Adds a hexahedron to the mesh given by 8 vertices v1 through v8.

Definition at line 2148 of file mesh.cpp.

◆ AddHexAs24TetsWithPoints()

void mfem::Mesh::AddHexAs24TetsWithPoints ( int * vi,
std::map< std::array< int, 4 >, int > & hex_face_verts,
int attr = 1 )

Adds 24 tetrahedrons to the mesh by splitting a hexahedron.

vi are the 8 vertices of the hexahedron, hex_face_verts has the map from the 4 vertices of each face of the hexahedron to the index of the point created at the center of the face, and attr is the attribute of the new elements. See Make3D24TetsFromHex for usage.

Definition at line 2302 of file mesh.cpp.

◆ AddHexAsPyramids()

void mfem::Mesh::AddHexAsPyramids ( const int * vi,
int attr = 1 )

Adds 6 pyramids to the mesh by splitting a hexahedron given by 8 vertices vi.

Definition at line 2201 of file mesh.cpp.

◆ AddHexAsTets()

void mfem::Mesh::AddHexAsTets ( const int * vi,
int attr = 1 )

Adds 6 tetrahedrons to the mesh by splitting a hexahedron given by 8 vertices vi.

Definition at line 2164 of file mesh.cpp.

◆ AddHexAsWedges()

void mfem::Mesh::AddHexAsWedges ( const int * vi,
int attr = 1 )

Adds 2 wedges to the mesh by splitting a hexahedron given by 8 vertices vi.

Definition at line 2183 of file mesh.cpp.

◆ AddPointFaceElement()

void mfem::Mesh::AddPointFaceElement ( int lf,
int gf,
int el )
protected

Used in GenerateFaces()

Definition at line 8161 of file mesh.cpp.

◆ AddPyramid() [1/2]

int mfem::Mesh::AddPyramid ( const int * vi,
int attr = 1 )

Adds a pyramid to the mesh given by 5 vertices vi.

Definition at line 2141 of file mesh.cpp.

◆ AddPyramid() [2/2]

int mfem::Mesh::AddPyramid ( int v1,
int v2,
int v3,
int v4,
int v5,
int attr = 1 )

Adds a pyramid to the mesh given by 5 vertices v1 through v5.

Definition at line 2134 of file mesh.cpp.

◆ AddQuad() [1/2]

int mfem::Mesh::AddQuad ( const int * vi,
int attr = 1 )

Adds a quadrilateral to the mesh given by 4 vertices vi.

Definition at line 2092 of file mesh.cpp.

◆ AddQuad() [2/2]

int mfem::Mesh::AddQuad ( int v1,
int v2,
int v3,
int v4,
int attr = 1 )

Adds a quadrilateral to the mesh given by 4 vertices v1 through v4.

Definition at line 2085 of file mesh.cpp.

◆ AddQuadAs4TrisWithPoints()

void mfem::Mesh::AddQuadAs4TrisWithPoints ( int * vi,
int attr = 1 )

Adds 4 triangles to the mesh by splitting a quadrilateral given by 4 vertices vi.

attr is the attribute of the new elements. See Make2D4TrisFromQuad for usage.

Definition at line 2220 of file mesh.cpp.

◆ AddQuadAs5QuadsWithPoints()

void mfem::Mesh::AddQuadAs5QuadsWithPoints ( int * vi,
int attr = 1 )

Adds 5 quadrilaterals to the mesh by splitting a quadrilateral given by 4 vertices vi.

attr is the attribute of the new elements. See Make2D5QuadsFromQuad for usage.

Definition at line 2242 of file mesh.cpp.

◆ AddQuadFaceElement()

void mfem::Mesh::AddQuadFaceElement ( int lf,
int gf,
int el,
int v0,
int v1,
int v2,
int v3 )
protected

Definition at line 8258 of file mesh.cpp.

◆ AddSegment() [1/2]

int mfem::Mesh::AddSegment ( const int * vi,
int attr = 1 )

Adds a segment to the mesh given by 2 vertices vi.

Definition at line 2064 of file mesh.cpp.

◆ AddSegment() [2/2]

int mfem::Mesh::AddSegment ( int v1,
int v2,
int attr = 1 )

Adds a segment to the mesh given by 2 vertices v1 and v2.

Definition at line 2057 of file mesh.cpp.

◆ AddSegmentFaceElement()

void mfem::Mesh::AddSegmentFaceElement ( int lf,
int gf,
int el,
int v0,
int v1 )
protected

Definition at line 8193 of file mesh.cpp.

◆ AddTet() [1/2]

int mfem::Mesh::AddTet ( const int * vi,
int attr = 1 )

Adds a tetrahedron to the mesh given by 4 vertices vi.

Definition at line 2105 of file mesh.cpp.

◆ AddTet() [2/2]

int mfem::Mesh::AddTet ( int v1,
int v2,
int v3,
int v4,
int attr = 1 )

Adds a tetrahedron to the mesh given by 4 vertices v1 through v4.

Definition at line 2099 of file mesh.cpp.

◆ AddTri()

int mfem::Mesh::AddTri ( const int * vi,
int attr = 1 )
inline

Adds a triangle to the mesh given by 3 vertices vi.

Definition at line 1019 of file mesh.hpp.

◆ AddTriangle() [1/2]

int mfem::Mesh::AddTriangle ( const int * vi,
int attr = 1 )

Adds a triangle to the mesh given by 3 vertices vi.

Definition at line 2078 of file mesh.cpp.

◆ AddTriangle() [2/2]

int mfem::Mesh::AddTriangle ( int v1,
int v2,
int v3,
int attr = 1 )

Adds a triangle to the mesh given by 3 vertices v1 through v3.

Definition at line 2071 of file mesh.cpp.

◆ AddTriangleFaceElement()

void mfem::Mesh::AddTriangleFaceElement ( int lf,
int gf,
int el,
int v0,
int v1,
int v2 )
protected

Definition at line 8230 of file mesh.cpp.

◆ AddVertex() [1/3]

int mfem::Mesh::AddVertex ( const real_t * coords)

Definition at line 2010 of file mesh.cpp.

◆ AddVertex() [2/3]

int mfem::Mesh::AddVertex ( const Vector & coords)

Definition at line 2017 of file mesh.cpp.

◆ AddVertex() [3/3]

int mfem::Mesh::AddVertex ( real_t x,
real_t y = 0.0,
real_t z = 0.0 )

Definition at line 2000 of file mesh.cpp.

◆ AddVertexAtMeanCenter()

int mfem::Mesh::AddVertexAtMeanCenter ( const int * vi,
const int nverts,
int dim = 3 )

Adds a vertex at the mean center of the nverts vertex indices given by vi.

Definition at line 2040 of file mesh.cpp.

◆ AddVertexParents()

void mfem::Mesh::AddVertexParents ( int i,
int p1,
int p2 )

Mark vertex i as nonconforming, with parent vertices p1 and p2.

Definition at line 2024 of file mesh.cpp.

◆ AddWedge() [1/2]

int mfem::Mesh::AddWedge ( const int * vi,
int attr = 1 )

Adds a wedge to the mesh given by 6 vertices vi.

Definition at line 2127 of file mesh.cpp.

◆ AddWedge() [2/2]

int mfem::Mesh::AddWedge ( int v1,
int v2,
int v3,
int v4,
int v5,
int v6,
int attr = 1 )

Adds a wedge to the mesh given by 6 vertices v1 through v6.

Definition at line 2120 of file mesh.cpp.

◆ AggregateError()

real_t mfem::Mesh::AggregateError ( const Array< real_t > & elem_error,
const int * fine,
int nfine,
int op )
protected

Derefinement helper.

Definition at line 10891 of file mesh.cpp.

◆ ApplyLocalSlaveTransformation()

void mfem::Mesh::ApplyLocalSlaveTransformation ( FaceElementTransformations & FT,
const FaceInfo & fi,
bool is_ghost ) const
protected

Used in GetFaceElementTransformations to account for the fact that a slave face occupies only a portion of its master face.

Definition at line 1254 of file mesh.cpp.

◆ AverageVertices()

void mfem::Mesh::AverageVertices ( const int * indexes,
int n,
int result )
protected

Averages the vertices with given indexes and saves the result in vertices[result].

Definition at line 9697 of file mesh.cpp.

◆ BdrBisection()

void mfem::Mesh::BdrBisection ( int i,
const HashTable< Hashed2 > & v_to_v )
protected

Bisect a boundary triangle: boundary element with index i is bisected.

Definition at line 11600 of file mesh.cpp.

◆ Bisection() [1/2]

void mfem::Mesh::Bisection ( int i,
const DSTable & v_to_v,
int * edge1,
int * edge2,
int * middle )
protected

Bisect a triangle: element with index i is bisected.

Definition at line 11391 of file mesh.cpp.

◆ Bisection() [2/2]

void mfem::Mesh::Bisection ( int i,
HashTable< Hashed2 > & v_to_v )
protected

Bisect a tetrahedron: element with index i is bisected.

Definition at line 11480 of file mesh.cpp.

◆ BuildCubitBoundaries()

void mfem::Mesh::BuildCubitBoundaries ( const cubit::CubitBlock * blocks,
const std::vector< int > & boundary_ids,
const std::map< int, std::vector< int > > & element_ids_for_boundary_id,
const std::map< int, std::vector< std::vector< int > > > & node_ids_for_boundary_id,
const std::map< int, std::vector< int > > & side_ids_for_boundary_id,
const std::map< int, int > & block_id_for_element_id,
const std::map< int, int > & cubit_to_mfem_vertex_map )
protected

Called internally in ReadCubit. This method adds the mesh boundary elements.

Build the Cubit boundaries.

Definition at line 4234 of file mesh_readers.cpp.

◆ BuildCubitElements()

void mfem::Mesh::BuildCubitElements ( const int num_elements,
const cubit::CubitBlock * blocks,
const std::vector< int > & block_ids,
const std::map< int, std::vector< int > > & element_ids_for_block_id,
const std::map< int, std::vector< int > > & node_ids_for_element_id,
const std::map< int, int > & cubit_to_mfem_vertex_map )
protected

Called internally in ReadCubit. This method builds the mesh elements.

Create Cubit elements.

Definition at line 4188 of file mesh_readers.cpp.

◆ BuildCubitVertices()

void mfem::Mesh::BuildCubitVertices ( const std::vector< int > & unique_vertex_ids,
const std::vector< double > & coordx,
const std::vector< double > & coordy,
const std::vector< double > & coordz )
protected

Called internally in ReadCubit. This method creates the vertices.

Set the coordinates of the Cubit vertices.

Definition at line 4165 of file mesh_readers.cpp.

◆ CartesianPartitioning()

int * mfem::Mesh::CartesianPartitioning ( int nxyz[])
Note
The returned array should be deleted by the caller.

Definition at line 8705 of file mesh.cpp.

◆ ChangeVertexDataOwnership()

void mfem::Mesh::ChangeVertexDataOwnership ( real_t * vertices,
int len_vertices,
bool zerocopy = false )

Set the internal Vertex array to point to the given vertices array without assuming ownership of the pointer.

If zerocopy is true, the vertices must be given as an array of 3 doubles per vertex. If zerocopy is false then the current Vertex data is first copied to the vertices array.

Definition at line 4708 of file mesh.cpp.

◆ CheckBdrElementOrientation()

int mfem::Mesh::CheckBdrElementOrientation ( bool fix_it = true)

Check the orientation of the boundary elements.

Returns
The number of boundary elements with wrong orientation.

Definition at line 7342 of file mesh.cpp.

◆ CheckDisplacements()

void mfem::Mesh::CheckDisplacements ( const Vector & displacements,
real_t & tmax )

Definition at line 9467 of file mesh.cpp.

◆ CheckElementOrientation()

int mfem::Mesh::CheckElementOrientation ( bool fix_it = true)

Check (and optionally attempt to fix) the orientation of the elements.

Parameters
[in]fix_itIf true, attempt to fix the orientations of some elements: triangles, quads, and tets.
Returns
The number of elements with wrong orientation.
Note
For meshes with nodes (e.g. high-order or periodic meshes), fixing the element orientations may require additional permutation of the nodal GridFunction of the mesh which is not performed by this method. Instead, the method Finalize() should be used with the parameter fix_orientation set to true.
This method performs a simple check if an element is inverted, e.g. for most elements types, it checks if the Jacobian of the mapping from the reference element is non-negative at the center of the element.

Definition at line 6890 of file mesh.cpp.

◆ CheckPartitioning()

void mfem::Mesh::CheckPartitioning ( int * partitioning_)

Definition at line 9149 of file mesh.cpp.

◆ Clear()

void mfem::Mesh::Clear ( )
inline

Clear the contents of the Mesh.

Definition at line 827 of file mesh.hpp.

◆ ComposeQuadOrientations()

int mfem::Mesh::ComposeQuadOrientations ( int ori_a_b,
int ori_b_c )
staticprotected

Returns the orientation of "c" relative to "a" by composing previously computed orientations relative to an intermediate set "b".

Definition at line 7178 of file mesh.cpp.

◆ ComposeTriOrientations()

int mfem::Mesh::ComposeTriOrientations ( int ori_a_b,
int ori_b_c )
staticprotected

Returns the orientation of "c" relative to "a" by composing previously computed orientations relative to an intermediate set "b".

Definition at line 7101 of file mesh.cpp.

◆ ComputeFaceInfo()

void mfem::Mesh::ComputeFaceInfo ( FaceType ftype) const
protected

compute face_indices[ftype] and inv_face_indices[type]

Definition at line 982 of file mesh.cpp.

◆ Conforming()

bool mfem::Mesh::Conforming ( ) const

Definition at line 15455 of file mesh.cpp.

◆ CreatePeriodicVertexMapping()

std::vector< int > mfem::Mesh::CreatePeriodicVertexMapping ( const std::vector< Vector > & translations,
real_t tol = 1e-8 ) const

Creates a mapping v2v from the vertex indices of the mesh such that coincident vertices under the given translations are identified.

Each Vector in translations should be of size sdim (the spatial dimension of the mesh). Two vertices are considered coincident if the translated coordinates of one vertex are within the given tolerance (tol, relative to the mesh diameter) of the coordinates of the other vertex.

Warning
This algorithm does not scale well with the number of boundary vertices in the mesh, and may run slowly on very large meshes.

Definition at line 6076 of file mesh.cpp.

◆ CreateVTKMesh()

void mfem::Mesh::CreateVTKMesh ( const Vector & points,
const Array< int > & cell_data,
const Array< int > & cell_offsets,
const Array< int > & cell_types,
const Array< int > & cell_attributes,
int & curved,
int & read_gf,
bool & finalize_topo )
protected

Definition at line 398 of file mesh_readers.cpp.

◆ DebugDump()

void mfem::Mesh::DebugDump ( std::ostream & os) const

Output an NCMesh-compatible debug dump.

Definition at line 15470 of file mesh.cpp.

◆ DecodeFaceInfoLocalIndex()

static int mfem::Mesh::DecodeFaceInfoLocalIndex ( int info)
inlinestatic

Given a "face info int", return the local face index.

See also
FaceInfo.

Definition at line 2173 of file mesh.hpp.

◆ DecodeFaceInfoOrientation()

static int mfem::Mesh::DecodeFaceInfoOrientation ( int info)
inlinestatic

Given a "face info int", return the face orientation.

See also
FaceInfo.

Definition at line 2170 of file mesh.hpp.

◆ DegreeElevate()

void mfem::Mesh::DegreeElevate ( int rel_degree,
int degree = 16 )

Definition at line 6388 of file mesh.cpp.

◆ DeleteBoundaryElementToEdge()

void mfem::Mesh::DeleteBoundaryElementToEdge ( )
inline

Clear the boundary element to edge map.

Definition at line 1212 of file mesh.hpp.

◆ DeleteGeometricFactors()

void mfem::Mesh::DeleteGeometricFactors ( )

Destroy all GeometricFactors stored by the Mesh.

This method can be used to force recomputation of the GeometricFactors, for example, after the mesh nodes are modified externally.

Note
In general, the preferred method for resetting the GeometricFactors should be to call NodesUpdated().

Definition at line 1022 of file mesh.cpp.

◆ DeleteTables()

void mfem::Mesh::DeleteTables ( )
inlineprotected

Definition at line 335 of file mesh.hpp.

◆ DerefineByError() [1/2]

bool mfem::Mesh::DerefineByError ( Array< real_t > & elem_error,
real_t threshold,
int nc_limit = 0,
int op = 1 )

Derefine the mesh based on an error measure associated with each element. A derefinement is performed if the sum of errors of its fine elements is smaller than 'threshold'. If 'nc_limit' > 0, derefinements that would increase the maximum level of hanging nodes of the mesh are skipped. Returns true if the mesh changed, false otherwise.

Definition at line 10962 of file mesh.cpp.

◆ DerefineByError() [2/2]

bool mfem::Mesh::DerefineByError ( const Vector & elem_error,
real_t threshold,
int nc_limit = 0,
int op = 1 )

Same as DerefineByError for an error vector.

Definition at line 10979 of file mesh.cpp.

◆ Destroy()

void mfem::Mesh::Destroy ( )
protected

Definition at line 1881 of file mesh.cpp.

◆ DestroyPointers()

void mfem::Mesh::DestroyPointers ( )
protected

Definition at line 1855 of file mesh.cpp.

◆ DestroyTables()

void mfem::Mesh::DestroyTables ( )
protected

Definition at line 1836 of file mesh.cpp.

◆ Dimension()

int mfem::Mesh::Dimension ( ) const
inline

Dimension of the reference space used within the elements.

Definition at line 1306 of file mesh.hpp.

◆ DoNodeReorder()

void mfem::Mesh::DoNodeReorder ( DSTable * old_v_to_v,
Table * old_elem_vert )
protected

Definition at line 3110 of file mesh.cpp.

◆ ElementToEdgeTable()

const Table & mfem::Mesh::ElementToEdgeTable ( ) const

Definition at line 8152 of file mesh.cpp.

◆ ElementToElementTable()

const Table & mfem::Mesh::ElementToElementTable ( )

Definition at line 8107 of file mesh.cpp.

◆ ElementToFaceTable()

const Table & mfem::Mesh::ElementToFaceTable ( ) const

Definition at line 8143 of file mesh.cpp.

◆ EncodeFaceInfo()

static int mfem::Mesh::EncodeFaceInfo ( int local_face_index,
int orientation )
inlinestatic

Given local_face_index and orientation, return the corresponding encoded "face info int".

See also
FaceInfo.

Definition at line 2177 of file mesh.hpp.

◆ EnsureNCMesh()

void mfem::Mesh::EnsureNCMesh ( bool simplices_nonconforming = false)

Make sure that a quad/hex mesh is considered to be nonconforming (i.e., has an associated NCMesh object). Simplex meshes can be both conforming (default) or nonconforming.

Definition at line 11293 of file mesh.cpp.

◆ EnsureNodes()

void mfem::Mesh::EnsureNodes ( )

Make sure that the mesh has valid nodes, i.e. its geometry is described by a vector finite element grid function (even if it is a low-order mesh with straight edges).

See also
GetNodes().

Definition at line 6747 of file mesh.cpp.

◆ EulerNumber()

int mfem::Mesh::EulerNumber ( ) const
inline

Equals 1 + num_holes - num_loops.

Definition at line 1312 of file mesh.hpp.

◆ EulerNumber2D()

int mfem::Mesh::EulerNumber2D ( ) const
inline

Equals 1 - num_holes.

Definition at line 1315 of file mesh.hpp.

◆ FaceIsInterior()

bool mfem::Mesh::FaceIsInterior ( int FaceNo) const
inline

Return true if the given face is interior.

See also
FaceIsTrueInterior().

Definition at line 1563 of file mesh.hpp.

◆ FaceIsTrueInterior()

bool mfem::Mesh::FaceIsTrueInterior ( int FaceNo) const
inlineprotected

For a serial Mesh, return true if the face is interior. For a parallel ParMesh return true if the face is interior or shared. In parallel, this method only works if the face neighbor data is exchanged.

Definition at line 610 of file mesh.hpp.

◆ Finalize()

void mfem::Mesh::Finalize ( bool refine = false,
bool fix_orientation = false )
virtual

Finalize the construction of a general Mesh.

This method will:

  • check and optionally fix the orientation of regular elements
  • check and fix the orientation of boundary elements
  • assume that vertices are defined, if Nodes == NULL
  • assume that Nodes are defined, if Nodes != NULL.
    Parameters
    [in]refineIf true, prepare the Mesh for conforming refinement of triangular or tetrahedral meshes.
    [in]fix_orientationIf true, fix the orientation of inverted mesh elements by permuting their vertices.
    Before calling this method, call FinalizeTopology() and ensure that the Mesh vertices or nodes are set.

Reimplemented in mfem::ParMesh.

Definition at line 3608 of file mesh.cpp.

◆ FinalizeCheck()

void mfem::Mesh::FinalizeCheck ( )
protected

Definition at line 2488 of file mesh.cpp.

◆ FinalizeHexMesh()

void mfem::Mesh::FinalizeHexMesh ( int generate_edges = 0,
int refine = 0,
bool fix_orientation = true )

Finalize the construction of a hexahedral Mesh.

Definition at line 3466 of file mesh.cpp.

◆ FinalizeMesh()

void mfem::Mesh::FinalizeMesh ( int refine = 0,
bool fix_orientation = true )

Finalize the construction of any type of Mesh.

This method calls FinalizeTopology() and Finalize().

Definition at line 3496 of file mesh.cpp.

◆ FinalizeQuadMesh()

void mfem::Mesh::FinalizeQuadMesh ( int generate_edges = 0,
int refine = 0,
bool fix_orientation = true )

Finalize the construction of a quadrilateral Mesh.

Definition at line 2531 of file mesh.cpp.

◆ FinalizeTetMesh()

void mfem::Mesh::FinalizeTetMesh ( int generate_edges = 0,
int refine = 0,
bool fix_orientation = true )

Finalize the construction of a tetrahedral Mesh.

Definition at line 3390 of file mesh.cpp.

◆ FinalizeTopology()

void mfem::Mesh::FinalizeTopology ( bool generate_bdr = true)

Finalize the construction of the secondary topology (connectivity) data of a Mesh.

This method does not require any actual coordinate data (either vertex coordinates for linear meshes or node coordinates for meshes with nodes) to be available. However, the data generated by this method is generally required by the FiniteElementSpace class.

After calling this method, setting the Mesh vertices or nodes, it may be appropriate to call the method Finalize().

Definition at line 3502 of file mesh.cpp.

◆ FinalizeTriMesh()

void mfem::Mesh::FinalizeTriMesh ( int generate_edges = 0,
int refine = 0,
bool fix_orientation = true )

Finalize the construction of a triangular Mesh.

Definition at line 2502 of file mesh.cpp.

◆ FinalizeWedgeMesh()

void mfem::Mesh::FinalizeWedgeMesh ( int generate_edges = 0,
int refine = 0,
bool fix_orientation = true )

Finalize the construction of a wedge Mesh.

Definition at line 3431 of file mesh.cpp.

◆ FindCoarseElement()

int mfem::Mesh::FindCoarseElement ( int i)
protected

Definition at line 11739 of file mesh.cpp.

◆ FindFaceNeighbors()

Array< int > mfem::Mesh::FindFaceNeighbors ( const int elem) const

Returns the sorted, unique indices of elements sharing a face with element elem, including elem.

Definition at line 7858 of file mesh.cpp.

◆ FindPoints()

int mfem::Mesh::FindPoints ( DenseMatrix & point_mat,
Array< int > & elem_ids,
Array< IntegrationPoint > & ips,
bool warn = true,
InverseElementTransformation * inv_trans = NULL )
virtual

Find the ids of the elements that contain the given points, and their corresponding reference coordinates.

The DenseMatrix point_mat describes the given points - one point for each column; it should have SpaceDimension() rows.

The InverseElementTransformation object, inv_trans, is used to attempt the element transformation inversion. If NULL pointer is given, the method will use a default constructed InverseElementTransformation. Note that the algorithms in the base class InverseElementTransformation can be completely overwritten by deriving custom classes that override the Transform() method.

If no element is found for the i-th point, elem_ids[i] is set to -1.

In the ParMesh implementation, the point_mat is expected to be the same on all ranks. If the i-th point is found by multiple ranks, only one of them will mark that point as found, i.e. set its elem_ids[i] to a non-negative number; the other ranks will set their elem_ids[i] to -2 to indicate that the point was found but assigned to another rank.

Returns
The total number of points that were found.
Note
This method is not 100 percent reliable, i.e. it is not guaranteed to find a point, even if it lies inside a mesh element.

Reimplemented in mfem::ParMesh.

Definition at line 13800 of file mesh.cpp.

◆ FreeElement()

void mfem::Mesh::FreeElement ( Element * E)
protected

Definition at line 13775 of file mesh.cpp.

◆ GeneralRefinement() [1/2]

void mfem::Mesh::GeneralRefinement ( const Array< int > & el_to_refine,
int nonconforming = -1,
int nc_limit = 0 )

Simplified version of GeneralRefinement taking a simple list of elements to refine, without refinement types.

Definition at line 11282 of file mesh.cpp.

◆ GeneralRefinement() [2/2]

void mfem::Mesh::GeneralRefinement ( const Array< Refinement > & refinements,
int nonconforming = -1,
int nc_limit = 0 )

Refine selected mesh elements. Refinement type can be specified for each element. The function can do conforming refinement of triangles and tetrahedra and nonconforming refinement (i.e., with hanging-nodes) of triangles, quadrilaterals and hexahedra. If 'nonconforming' = -1, suitable refinement method is selected automatically (namely, conforming refinement for triangles). Use nonconforming = 0/1 to force the method. For nonconforming refinements, nc_limit optionally specifies the maximum level of hanging nodes (unlimited by default).

Definition at line 11225 of file mesh.cpp.

◆ GenerateBoundaryElements()

void mfem::Mesh::GenerateBoundaryElements ( )
virtual

Reimplemented in mfem::ParMesh.

Definition at line 2453 of file mesh.cpp.

◆ GenerateFaces()

void mfem::Mesh::GenerateFaces ( )
protected

Definition at line 8285 of file mesh.cpp.

◆ GenerateNCFaceInfo()

void mfem::Mesh::GenerateNCFaceInfo ( )
protected

Definition at line 8392 of file mesh.cpp.

◆ GeneratePartitioning()

int * mfem::Mesh::GeneratePartitioning ( int nparts,
int part_method = 1 )
Note
The returned array should be deleted by the caller.

Definition at line 8749 of file mesh.cpp.

◆ GetAttribute()

int mfem::Mesh::GetAttribute ( int i) const
inline

Return the attribute of element i.

Definition at line 1484 of file mesh.hpp.

◆ GetBdrAttribute()

int mfem::Mesh::GetBdrAttribute ( int i) const
inline

Return the attribute of boundary element i.

Definition at line 1490 of file mesh.hpp.

◆ GetBdrElement() [1/2]

Element * mfem::Mesh::GetBdrElement ( int i)
inline

Return pointer to the i'th boundary element object.

Note
Provides read/write access to the i'th boundary element object so that boundary attributes or connectivity can be adjusted. However, the Element object itself should not be deleted by the caller.

Definition at line 1456 of file mesh.hpp.

◆ GetBdrElement() [2/2]

const Element * mfem::Mesh::GetBdrElement ( int i) const
inline

Return pointer to the i'th boundary element object.

The index i should be in the range [0, Mesh::GetNBE())

In parallel, i is the local boundary element index which is in the same range mentioned above.

Definition at line 1449 of file mesh.hpp.

◆ GetBdrElementAdjacentElement()

void mfem::Mesh::GetBdrElementAdjacentElement ( int bdr_el,
int & el,
int & info ) const

For the given boundary element, bdr_el, return its adjacent element and its info, i.e. 64*local_bdr_index+bdr_orientation.

The returned bdr_orientation is that of the boundary element relative to the respective face element.

See also
GetBdrElementAdjacentElement2()

Definition at line 7905 of file mesh.cpp.

◆ GetBdrElementAdjacentElement2()

void mfem::Mesh::GetBdrElementAdjacentElement2 ( int bdr_el,
int & el,
int & info ) const

Deprecated.

For the given boundary element, bdr_el, return its adjacent element and its info, i.e. 64*local_bdr_index+inverse_bdr_orientation.

The returned inverse_bdr_orientation is the inverse of the orientation of the boundary element relative to the respective face element. In other words this is the orientation of the face element relative to the boundary element.

Warning
This only differs from GetBdrElementAdjacentElement by returning the face info with inverted orientation. It does not return information corresponding to a second adjacent face. This function is deprecated, use Geometry::GetInverseOrientation, Mesh::EncodeFaceInfo, Mesh::DecodeFaceInfoOrientation, and Mesh::DecodeFaceInfoLocalIndex instead.
See also
GetBdrElementAdjacentElement()

Definition at line 7927 of file mesh.cpp.

◆ GetBdrElementBaseGeometry()

Geometry::Type mfem::Mesh::GetBdrElementBaseGeometry ( int i) const
inline

Definition at line 1559 of file mesh.hpp.

◆ GetBdrElementData()

void mfem::Mesh::GetBdrElementData ( int geom,
Array< int > & bdr_elem_vtx,
Array< int > & bdr_attr ) const
inline

Definition at line 1474 of file mesh.hpp.

◆ GetBdrElementEdgeIndex()

MFEM_DEPRECATED int mfem::Mesh::GetBdrElementEdgeIndex ( int i) const
inline

Return the vertex index of boundary element i. (1D) Return the edge index of boundary element i. (2D) Return the face index of boundary element i. (3D)

Deprecated in favor of GetBdrElementFaceIndex().

Definition at line 1699 of file mesh.hpp.

◆ GetBdrElementEdges()

void mfem::Mesh::GetBdrElementEdges ( int i,
Array< int > & edges,
Array< int > & cor ) const

Return the indices and the orientations of all edges of bdr element i.

Definition at line 7610 of file mesh.cpp.

◆ GetBdrElementFace()

void mfem::Mesh::GetBdrElementFace ( int i,
int * f,
int * o ) const

Return the index and the orientation of the vertex of bdr element i. (1D) Return the index and the orientation of the edge of bdr element i. (2D) Return the index and the orientation of the face of bdr element i. (3D)

In 2D, the returned edge orientation is 0 or 1, not +/-1 as returned by GetElementEdges/GetBdrElementEdges.

Definition at line 7886 of file mesh.cpp.

◆ GetBdrElementFaceIndex()

int mfem::Mesh::GetBdrElementFaceIndex ( int be_idx) const
inline

Return the local face (codimension-1) index for the given boundary element index.

Definition at line 1689 of file mesh.hpp.

◆ GetBdrElementGeometry()

Geometry::Type mfem::Mesh::GetBdrElementGeometry ( int i) const
inline

Definition at line 1547 of file mesh.hpp.

◆ GetBdrElementTransformation() [1/2]

ElementTransformation * mfem::Mesh::GetBdrElementTransformation ( int i)

Returns a pointer to the transformation defining the i-th boundary element.

Note
The returned object is owned by the class and is shared, i.e., calling this function resets pointers obtained from previous calls. Also, the returned object should NOT be deleted by the caller.

Definition at line 533 of file mesh.cpp.

◆ GetBdrElementTransformation() [2/2]

void mfem::Mesh::GetBdrElementTransformation ( int i,
IsoparametricTransformation * ElTr ) const

Builds the transformation defining the i-th boundary element in ElTr. ElTr must be allocated in advance and will be owned by the caller.

Note
The provided pointer must not be NULL. In the future this should be changed to a reference parameter consistent with GetFaceElementTransformations.

Definition at line 466 of file mesh.cpp.

◆ GetBdrElementType()

Element::Type mfem::Mesh::GetBdrElementType ( int i) const

Returns the type of boundary element i.

Definition at line 7967 of file mesh.cpp.

◆ GetBdrElementVertices()

void mfem::Mesh::GetBdrElementVertices ( int i,
Array< int > & v ) const
inline

Returns the indices of the vertices of boundary element i.

Definition at line 1613 of file mesh.hpp.

◆ GetBdrFace()

MFEM_DEPRECATED int mfem::Mesh::GetBdrFace ( int i) const
inline

Deprecated in favor of GetBdrElementFaceIndex().

Definition at line 1692 of file mesh.hpp.

◆ GetBdrFaceAttributes()

const Array< int > & mfem::Mesh::GetBdrFaceAttributes ( ) const

Returns the attributes for all boundary elements in this mesh.

The face restriction will give "face E-vectors" on the boundary that are numbered in the order of the faces of mesh. This numbering will be different than the numbering of the boundary elements. We compute mappings so that the array bdr_attributes[i] gives the boundary attribute of the ith boundary face in the mesh face order. Attributes <= 0 indicate there is no boundary element and should be skipped.

The returned array points to an internal object that may be invalidated by mesh operations such as refinement or any element attributes are modified. Since not all such modifications can be tracked by the Mesh class (e.g. if a user calls GetElement() then changes the element attribute directly), one needs to account for such changes by calling the method SetAttributes().

Definition at line 925 of file mesh.cpp.

◆ GetBdrFaceTransformations() [1/2]

FaceElementTransformations * mfem::Mesh::GetBdrFaceTransformations ( int BdrElemNo)

Builds the transformation defining the given boundary face.

Note
The returned object is owned by the class and is shared, i.e., calling this function resets pointers obtained from previous calls. Also, this pointer should NOT be deleted by the caller.

Definition at line 1223 of file mesh.cpp.

◆ GetBdrFaceTransformations() [2/2]

void mfem::Mesh::GetBdrFaceTransformations ( int BdrElemNo,
FaceElementTransformations & FElTr,
IsoparametricTransformation & ElTr1,
IsoparametricTransformation & ElTr2 ) const

Variant of GetBdrFaceTransformations using a user allocated FaceElementTransformations object.

Definition at line 1230 of file mesh.cpp.

◆ GetBdrPointMatrix()

void mfem::Mesh::GetBdrPointMatrix ( int i,
DenseMatrix & pointmat ) const

Definition at line 7990 of file mesh.cpp.

◆ GetBoundingBox()

void mfem::Mesh::GetBoundingBox ( Vector & min,
Vector & max,
int ref = 2 )

Returns the minimum and maximum corners of the mesh bounding box.

For high-order meshes, the geometry is first refined ref times.

Definition at line 141 of file mesh.cpp.

◆ GetCharacteristics()

void mfem::Mesh::GetCharacteristics ( real_t & h_min,
real_t & h_max,
real_t & kappa_min,
real_t & kappa_max,
Vector * Vh = NULL,
Vector * Vk = NULL )

Definition at line 205 of file mesh.cpp.

◆ GetEdgeOrdering()

void mfem::Mesh::GetEdgeOrdering ( const DSTable & v_to_v,
Array< int > & order )
protected

Definition at line 2996 of file mesh.cpp.

◆ GetEdgeToUniqueKnotvector()

void mfem::Mesh::GetEdgeToUniqueKnotvector ( Array< int > & edge_to_ukv,
Array< int > & ukv_to_rpkv ) const

Get the edge to unique knotvector map used by NURBS patch topology meshes Various index maps are defined using the following indices:

edge: Edge index in the patch topology mesh pkv: Patch knotvector index, equivalent to (p * dim + d) where p is the patch index, dim is the topological dimension of the patch, and d is the local dimension rpkv: Root patch knotvector index; the lowest index pkv for all equivalent pkv. ukv: (signed) Unique knotvector index. Equivalent to rpkv reordered from 0 to N-1, where N is the number of unique knotvectors + sign, which indicates the orientation of the edge.

Parameters
[in,out]edge_to_ukvArray<int> Map from edge index to (signed) unique knotvector index. Will be resized to the number of edges.
[in,out]ukv_to_rpkvArray<int> Map from (unsigned) unique knotvector index to the (unsigned) root patch knotvector index. Will be resized to the number of unique knotvectors.

Definition at line 6542 of file mesh.cpp.

◆ GetEdgeTransformation() [1/2]

ElementTransformation * mfem::Mesh::GetEdgeTransformation ( int EdgeNo)

Returns a pointer to the transformation defining the given edge element.

Note
The returned object is owned by the class and is shared, i.e., calling this function resets pointers obtained from previous calls. Also, the returned object should NOT be deleted by the caller.

Definition at line 677 of file mesh.cpp.

◆ GetEdgeTransformation() [2/2]

void mfem::Mesh::GetEdgeTransformation ( int i,
IsoparametricTransformation * EdTr ) const

Builds the transformation defining the i-th edge element in EdTr. EdTr must be allocated in advance and will be owned by the caller.

Note
The provided pointer must not be NULL. In the future this should be changed to a reference parameter consistent with GetFaceElementTransformations.

Definition at line 616 of file mesh.cpp.

◆ GetEdgeVertexTable()

Table * mfem::Mesh::GetEdgeVertexTable ( ) const

Returns the edge-to-vertex Table (3D)

Note
The returned object should NOT be deleted by the caller.

Definition at line 7709 of file mesh.cpp.

◆ GetEdgeVertices()

void mfem::Mesh::GetEdgeVertices ( int i,
Array< int > & vert ) const

Returns the indices of the vertices of edge i.

Definition at line 7672 of file mesh.cpp.

◆ GetElement() [1/2]

Element * mfem::Mesh::GetElement ( int i)
inline

Return pointer to the i'th element object.

Note
Provides read/write access to the i'th element object so that element attributes or connectivity can be adjusted. However, the Element object itself should not be deleted by the caller.

Definition at line 1441 of file mesh.hpp.

◆ GetElement() [2/2]

const Element * mfem::Mesh::GetElement ( int i) const
inline

Return pointer to the i'th element object.

The index i should be in the range [0, Mesh::GetNE())

In parallel, i is the local element index which is in the same range mentioned above.

Definition at line 1434 of file mesh.hpp.

◆ GetElementArrayEdgeTable()

void mfem::Mesh::GetElementArrayEdgeTable ( const Array< Element * > & elem_array,
const DSTable & v_to_v,
Table & el_to_edge )
staticprotected

Definition at line 8021 of file mesh.cpp.

◆ GetElementAttributes()

const Array< int > & mfem::Mesh::GetElementAttributes ( ) const

Returns the attributes for all elements in this mesh. The i'th entry of the array is the attribute of the i'th element of the mesh.

The returned array points to an internal object that may be invalidated by mesh operations such as refinement or any element attributes are modified. Since not all such modifications can be tracked by the Mesh class (e.g. if a user calls GetElement() then changes the element attribute directly), one needs to account for such changes by calling the method SetAttributes().

Definition at line 965 of file mesh.cpp.

◆ GetElementBaseGeometry()

Geometry::Type mfem::Mesh::GetElementBaseGeometry ( int i) const
inline

Definition at line 1556 of file mesh.hpp.

◆ GetElementCenter()

void mfem::Mesh::GetElementCenter ( int i,
Vector & center )

Definition at line 80 of file mesh.cpp.

◆ GetElementColoring()

void mfem::Mesh::GetElementColoring ( Array< int > & colors,
int el0 = 0 )

Definition at line 12766 of file mesh.cpp.

◆ GetElementData() [1/2]

void mfem::Mesh::GetElementData ( const Array< Element * > & elem_array,
int geom,
Array< int > & elem_vtx,
Array< int > & attr ) const
protected

Definition at line 11105 of file mesh.cpp.

◆ GetElementData() [2/2]

void mfem::Mesh::GetElementData ( int geom,
Array< int > & elem_vtx,
Array< int > & attr ) const
inline

Definition at line 1471 of file mesh.hpp.

◆ GetElementEdges()

void mfem::Mesh::GetElementEdges ( int i,
Array< int > & edges,
Array< int > & cor ) const

Return the indices and the orientations of all edges of element i.

Definition at line 7588 of file mesh.cpp.

◆ GetElementFaces()

void mfem::Mesh::GetElementFaces ( int i,
Array< int > & faces,
Array< int > & ori ) const

Return the indices and the orientations of all faces of element i.

Definition at line 7835 of file mesh.cpp.

◆ GetElementGeometry()

Geometry::Type mfem::Mesh::GetElementGeometry ( int i) const
inline

Definition at line 1535 of file mesh.hpp.

◆ GetElementJacobian()

void mfem::Mesh::GetElementJacobian ( int i,
DenseMatrix & J,
const IntegrationPoint * ip = NULL )

Compute the Jacobian of the transformation from the perfect reference element at the given integration point (defaults to the center of the element if no integration point is specified)

Definition at line 65 of file mesh.cpp.

◆ GetElementsArray()

const Element *const * mfem::Mesh::GetElementsArray ( ) const
inline

Definition at line 1468 of file mesh.hpp.

◆ GetElementSize() [1/3]

real_t mfem::Mesh::GetElementSize ( ElementTransformation * T,
int type = 0 ) const

Definition at line 88 of file mesh.cpp.

◆ GetElementSize() [2/3]

real_t mfem::Mesh::GetElementSize ( int i,
const Vector & dir )

Definition at line 115 of file mesh.cpp.

◆ GetElementSize() [3/3]

real_t mfem::Mesh::GetElementSize ( int i,
int type = 0 )

Get the size of the i-th element relative to the perfect reference element.

Definition at line 110 of file mesh.cpp.

◆ GetElementToEdgeTable()

int mfem::Mesh::GetElementToEdgeTable ( Table & e_to_f)
protected

Return element to edge table and the indices for the boundary edges. The entries in the table are ordered according to the order of the nodes in the elements. For example, if T is the element to edge table T(i, 0) gives the index of edge in element i that connects vertex 0 to vertex 1, etc. Returns the number of the edges.

Definition at line 8068 of file mesh.cpp.

◆ GetElementToFaceTable()

STable3D * mfem::Mesh::GetElementToFaceTable ( int ret_ftbl = 0)
protected

Definition at line 8513 of file mesh.cpp.

◆ GetElementTransformation() [1/3]

ElementTransformation * mfem::Mesh::GetElementTransformation ( int i)

Returns a pointer to the transformation defining the i-th element.

Note
The returned object is owned by the class and is shared, i.e., calling this function resets pointers obtained from previous calls. Also, this pointer should not be deleted by the caller.

Definition at line 416 of file mesh.cpp.

◆ GetElementTransformation() [2/3]

void mfem::Mesh::GetElementTransformation ( int i,
const Vector & nodes,
IsoparametricTransformation * ElTr ) const

Builds the transformation defining the i-th element in ElTr assuming position of the vertices/nodes are given by nodes. ElTr must be allocated in advance and will be owned by the caller.

Note
The provided pointer must not be NULL. In the future this should be changed to a reference parameter consistent with GetFaceElementTransformations.

Definition at line 422 of file mesh.cpp.

◆ GetElementTransformation() [3/3]

void mfem::Mesh::GetElementTransformation ( int i,
IsoparametricTransformation * ElTr ) const

Builds the transformation defining the i-th element in ElTr. ElTr must be allocated in advance and will be owned by the caller.

Note
The provided pointer must not be NULL. In the future this should be changed to a reference parameter consistent with GetFaceElementTransformations.

Definition at line 360 of file mesh.cpp.

◆ GetElementType()

Element::Type mfem::Mesh::GetElementType ( int i) const

Returns the type of element i.

Definition at line 7962 of file mesh.cpp.

◆ GetElementVertices()

void mfem::Mesh::GetElementVertices ( int i,
Array< int > & v ) const
inline

Returns the indices of the vertices of element i.

Definition at line 1609 of file mesh.hpp.

◆ GetElementVolume()

real_t mfem::Mesh::GetElementVolume ( int i)

Definition at line 124 of file mesh.cpp.

◆ GetExteriorFaceMarker()

void mfem::Mesh::GetExteriorFaceMarker ( Array< int > & face_marker) const
virtual

Populate a marker array identifying exterior faces.

Parameters
[in,out]face_markerResized if necessary to the number of local faces. The array entries will be zero for interior faces and 1 for exterior faces.

Reimplemented in mfem::ParMesh.

Definition at line 1656 of file mesh.cpp.

◆ GetFace()

const Element * mfem::Mesh::GetFace ( int i) const
inline

Return pointer to the i'th face element object.

The index i should be in the range [0, Mesh::GetNFaces())

Definition at line 1461 of file mesh.hpp.

◆ GetFaceBaseGeometry()

MFEM_DEPRECATED Geometry::Type mfem::Mesh::GetFaceBaseGeometry ( int i) const
inline

Deprecated in favor of Mesh::GetFaceGeometry.

Definition at line 1553 of file mesh.hpp.

◆ GetFaceEdges()

void mfem::Mesh::GetFaceEdges ( int i,
Array< int > & edges,
Array< int > & o ) const

Return the indices and the orientations of all edges of face i. Works for both 2D (face=edge) and 3D faces.

Definition at line 7642 of file mesh.cpp.

◆ GetFaceEdgeTable()

Table * mfem::Mesh::GetFaceEdgeTable ( ) const

Returns the face-to-edge Table (3D)

Note
The returned object should NOT be deleted by the caller.

Definition at line 7681 of file mesh.cpp.

◆ GetFaceElements()

void mfem::Mesh::GetFaceElements ( int Face,
int * Elem1,
int * Elem2 ) const

Definition at line 1557 of file mesh.cpp.

◆ GetFaceElementTransformations() [1/2]

void mfem::Mesh::GetFaceElementTransformations ( int FaceNo,
FaceElementTransformations & FElTr,
IsoparametricTransformation & ElTr1,
IsoparametricTransformation & ElTr2,
int mask = 31 ) const
virtual

Variant of GetFaceElementTransformations using a user allocated FaceElementTransformations object.

Reimplemented in mfem::ParMesh.

Definition at line 1112 of file mesh.cpp.

◆ GetFaceElementTransformations() [2/2]

FaceElementTransformations * mfem::Mesh::GetFaceElementTransformations ( int FaceNo,
int mask = 31 )
virtual

Returns (a pointer to an object containing) the following data:

1) Elem1No - the index of the first element that contains this face this is the element that has the same outward unit normal vector as the face;

2) Elem2No - the index of the second element that contains this face this element has outward unit normal vector as the face multiplied with -1;

3) Elem1, Elem2 - pointers to the ElementTransformation's of the first and the second element respectively;

4) Face - pointer to the ElementTransformation of the face;

5) Loc1, Loc2 - IntegrationPointTransformation's mapping the face coordinate system to the element coordinate system (both in their reference elements). Used to transform IntegrationPoints from face to element. More formally, let: TL1, TL2 be the transformations represented by Loc1, Loc2, TE1, TE2 - the transformations represented by Elem1, Elem2, TF - the transformation represented by Face, then TF(x) = TE1(TL1(x)) = TE2(TL2(x)) for all x in the reference face.

6) FaceGeom - the base geometry for the face.

The mask specifies which fields in the structure to return: mask & 1 - Elem1, mask & 2 - Elem2 mask & 4 - Loc1, mask & 8 - Loc2, mask & 16 - Face. These mask values are defined in the ConfigMasks enum type as part of the FaceElementTransformations class in fem/eltrans.hpp.

Note
The returned object is owned by the class and is shared, i.e., calling this function resets pointers obtained from previous calls. Also, this pointer should NOT be deleted by the caller.

Reimplemented in mfem::ParMesh.

Definition at line 1104 of file mesh.cpp.

◆ GetFaceElementType()

Element::Type mfem::Mesh::GetFaceElementType ( int Face) const

Definition at line 1612 of file mesh.cpp.

◆ GetFaceGeometricFactors()

const FaceGeometricFactors * mfem::Mesh::GetFaceGeometricFactors ( const IntegrationRule & ir,
const int flags,
FaceType type,
MemoryType d_mt = MemoryType::DEFAULT )

Return the mesh geometric factors for the faces corresponding to the given integration rule.

The IntegrationRule used with GetFaceGeometricFactors needs to remain valid until the internally stored FaceGeometricFactors objects are destroyed (by either calling Mesh::DeleteGeometricFactors(), Mesh::NodesUpdated(), or the Mesh destructor).

If the device MemoryType parameter d_mt is specified, then the returned object will use that type unless it was previously allocated with a different type.

The returned pointer points to an internal object that may be invalidated by mesh operations such as refinement, vertex/node movement, etc. Since not all such modifications can be tracked by the Mesh class (e.g. when using the pointer returned by GetNodes() to change the nodes) one needs to account for such changes by calling the method NodesUpdated() which, in particular, will call DeleteGeometricFactors().

Definition at line 903 of file mesh.cpp.

◆ GetFaceGeometry()

Geometry::Type mfem::Mesh::GetFaceGeometry ( int i) const

Return the Geometry::Type associated with face i.

Definition at line 1576 of file mesh.cpp.

◆ GetFaceGeometryType()

MFEM_DEPRECATED Geometry::Type mfem::Mesh::GetFaceGeometryType ( int Face) const
inline

Deprecated in favor of Mesh::GetFaceGeometry.

Definition at line 1520 of file mesh.hpp.

◆ GetFaceIndices()

const Array< int > & mfem::Mesh::GetFaceIndices ( FaceType ftype) const

Map from boundary or interior face indices to mesh face indices.

Definition at line 1003 of file mesh.cpp.

◆ GetFaceInformation()

Mesh::FaceInformation mfem::Mesh::GetFaceInformation ( int f) const

This method aims to provide face information in a deciphered format, i.e. Mesh::FaceInformation, compared to the raw encoded information returned by Mesh::GetFaceElements() and Mesh::GetFaceInfos().

Definition at line 1293 of file mesh.cpp.

◆ GetFaceInfos() [1/2]

void mfem::Mesh::GetFaceInfos ( int Face,
int * Inf1,
int * Inf2 ) const

Definition at line 1563 of file mesh.cpp.

◆ GetFaceInfos() [2/2]

void mfem::Mesh::GetFaceInfos ( int Face,
int * Inf1,
int * Inf2,
int * NCFace ) const

Definition at line 1569 of file mesh.cpp.

◆ GetFacesTable()

STable3D * mfem::Mesh::GetFacesTable ( )
protected

Definition at line 8450 of file mesh.cpp.

◆ GetFaceToBdrElMap()

Array< int > mfem::Mesh::GetFaceToBdrElMap ( ) const

Definition at line 1617 of file mesh.cpp.

◆ GetFaceToElementTable()

Table * mfem::Mesh::GetFaceToElementTable ( ) const

Return the "face"-element Table. Here "face" refers to face (3D), edge (2D), or vertex (1D).

Note
The returned Table should be deleted by the caller.

Definition at line 7801 of file mesh.cpp.

◆ GetFaceTransformation() [1/2]

ElementTransformation * mfem::Mesh::GetFaceTransformation ( int FaceNo)

Returns a pointer to the transformation defining the given face element.

Note
The returned object is owned by the class and is shared, i.e., calling this function resets pointers obtained from previous calls. Also, the returned object should NOT be deleted by the caller.

Definition at line 610 of file mesh.cpp.

◆ GetFaceTransformation() [2/2]

void mfem::Mesh::GetFaceTransformation ( int i,
IsoparametricTransformation * FTr ) const

Builds the transformation defining the i-th face element in FTr. FTr must be allocated in advance and will be owned by the caller.

Note
The provided pointer must not be NULL. In the future this should be changed to a reference parameter consistent with GetFaceElementTransformations.

Definition at line 539 of file mesh.cpp.

◆ GetFaceVertices()

void mfem::Mesh::GetFaceVertices ( int i,
Array< int > & vert ) const
inline

Returns the indices of the vertices of face i.

Definition at line 1627 of file mesh.hpp.

◆ GetGeckoElementOrdering()

real_t mfem::Mesh::GetGeckoElementOrdering ( Array< int > & ordering,
int iterations = 4,
int window = 4,
int period = 2,
int seed = 0,
bool verbose = false,
real_t time_limit = 0 )

This is our integration with the Gecko library. The method finds an element ordering that will increase memory coherency by putting elements that are in physical proximity closer in memory. It can also be used to obtain a space-filling curve ordering for ParNCMesh partitioning.

Parameters
[out]orderingOutput element ordering.
iterationsTotal number of V cycles. The ordering may improve with more iterations. The best iteration is returned at the end.
windowInitial window size. This determines the number of permutations tested at each multigrid level and strongly influences the quality of the result, but the cost of increasing 'window' is exponential.
periodThe window size is incremented every 'period' iterations.
seedSeed for initial random ordering (0 = skip random reorder).
verbosePrint the progress of the optimization to mfem::out.
time_limitOptional time limit for the optimization, in seconds. When reached, ordering from the best iteration so far is returned (0 = no limit).
Returns
The final edge product cost of the ordering. The function may be called in an external loop with different seeds, and the best ordering can then be retained.

Definition at line 2593 of file mesh.cpp.

◆ GetGeometricFactors()

const GeometricFactors * mfem::Mesh::GetGeometricFactors ( const IntegrationRule & ir,
const int flags,
MemoryType d_mt = MemoryType::DEFAULT )

Return the mesh geometric factors corresponding to the given integration rule.

The IntegrationRule used with GetGeometricFactors needs to remain valid until the internally stored GeometricFactors objects are destroyed (by calling Mesh::DeleteGeometricFactors(), Mesh::NodesUpdated(), or the Mesh destructor).

If the device MemoryType parameter d_mt is specified, then the returned object will use that type unless it was previously allocated with a different type.

The returned pointer points to an internal object that may be invalidated by mesh operations such as refinement, vertex/node movement, etc. Since not all such modifications can be tracked by the Mesh class (e.g. when using the pointer returned by GetNodes() to change the nodes) one needs to account for such changes by calling the method NodesUpdated() which, in particular, will call DeleteGeometricFactors().

Definition at line 883 of file mesh.cpp.

◆ GetGeometricParametersFromJacobian()

void mfem::Mesh::GetGeometricParametersFromJacobian ( const DenseMatrix & J,
real_t & volume,
Vector & aspr,
Vector & skew,
Vector & ori ) const

Computes geometric parameters associated with a Jacobian matrix in 2D/3D. These parameters are (1) Area/Volume, (2) Aspect-ratio (1 in 2D, and 2 non-dimensional and 2 dimensional parameters in 3D. Dimensional parameters are used for target construction in TMOP), (3) skewness (1 in 2D and 3 in 3D), and finally (4) orientation (1 in 2D and 3 in 3D).

Definition at line 13914 of file mesh.cpp.

◆ GetGeometries()

void mfem::Mesh::GetGeometries ( int dim,
Array< Geometry::Type > & el_geoms ) const

Return all element geometries of the given dimension present in the mesh.

For a parallel mesh only the local geometries are returned.

The returned geometries are sorted.

Definition at line 7569 of file mesh.cpp.

◆ GetGlobalNE()

long long mfem::Mesh::GetGlobalNE ( ) const
inline

Return the total (global) number of elements.

Definition at line 1406 of file mesh.hpp.

◆ GetHilbertElementOrdering()

void mfem::Mesh::GetHilbertElementOrdering ( Array< int > & ordering)

Return an ordering of the elements that approximately follows the Hilbert curve. The method performs a spatial (Hilbert) sort on the centers of all elements and returns the resulting sequence, which can then be passed to ReorderElements. This is a cheap alternative to GetGeckoElementOrdering.

Definition at line 2760 of file mesh.cpp.

◆ GetInteriorFaceTransformations() [1/2]

FaceElementTransformations * mfem::Mesh::GetInteriorFaceTransformations ( int FaceNo)

See GetFaceElementTransformations().

Note
The returned object is owned by the class and is shared, i.e., calling this function resets pointers obtained from previous calls. Also, this pointer should NOT be deleted by the caller.

Definition at line 1203 of file mesh.cpp.

◆ GetInteriorFaceTransformations() [2/2]

void mfem::Mesh::GetInteriorFaceTransformations ( int FaceNo,
FaceElementTransformations & FElTr,
IsoparametricTransformation & ElTr1,
IsoparametricTransformation & ElTr2 ) const

Variant of GetInteriorFaceTransformations using a user allocated FaceElementTransformations object.

Definition at line 1210 of file mesh.cpp.

◆ GetInvFaceIndices()

const std::unordered_map< int, int > & mfem::Mesh::GetInvFaceIndices ( FaceType ftype) const

Inverse of the map FaceIndices(ftype)

Definition at line 1013 of file mesh.cpp.

◆ GetLastOperation()

Operation mfem::Mesh::GetLastOperation ( ) const
inline

Return type of last modification of the mesh.

Definition at line 2513 of file mesh.hpp.

◆ GetLength()

real_t mfem::Mesh::GetLength ( int i,
int j ) const
protected

Return the length of the segment from node i to node j.

Definition at line 8006 of file mesh.cpp.

◆ GetLocalFaceTransformation()

void mfem::Mesh::GetLocalFaceTransformation ( int face_type,
int elem_type,
IsoparametricTransformation & Transf,
int info ) const

A helper method that constructs a transformation from the reference space of a face to the reference space of an element.

The local index of the face as a face in the element and its orientation are given by the input parameter info, as info = 64*loc_face_idx + loc_face_orientation.

Definition at line 1038 of file mesh.cpp.

◆ GetLocalPtToSegTransformation()

void mfem::Mesh::GetLocalPtToSegTransformation ( IsoparametricTransformation & Transf,
int i ) const
protected

Used in GetFaceElementTransformations (...)

Definition at line 684 of file mesh.cpp.

◆ GetLocalQuadToHexTransformation()

void mfem::Mesh::GetLocalQuadToHexTransformation ( IsoparametricTransformation & loc,
int i ) const
protected

Definition at line 814 of file mesh.cpp.

◆ GetLocalQuadToPyrTransformation()

void mfem::Mesh::GetLocalQuadToPyrTransformation ( IsoparametricTransformation & loc,
int i ) const
protected

Definition at line 860 of file mesh.cpp.

◆ GetLocalQuadToWdgTransformation()

void mfem::Mesh::GetLocalQuadToWdgTransformation ( IsoparametricTransformation & loc,
int i ) const
protected

Definition at line 836 of file mesh.cpp.

◆ GetLocalSegToQuadTransformation()

void mfem::Mesh::GetLocalSegToQuadTransformation ( IsoparametricTransformation & loc,
int i ) const
protected

Definition at line 719 of file mesh.cpp.

◆ GetLocalSegToTriTransformation()

void mfem::Mesh::GetLocalSegToTriTransformation ( IsoparametricTransformation & loc,
int i ) const
protected

Definition at line 699 of file mesh.cpp.

◆ GetLocalTriToPyrTransformation()

void mfem::Mesh::GetLocalTriToPyrTransformation ( IsoparametricTransformation & loc,
int i ) const
protected

Definition at line 789 of file mesh.cpp.

◆ GetLocalTriToTetTransformation()

void mfem::Mesh::GetLocalTriToTetTransformation ( IsoparametricTransformation & loc,
int i ) const
protected

Definition at line 739 of file mesh.cpp.

◆ GetLocalTriToWdgTransformation()

void mfem::Mesh::GetLocalTriToWdgTransformation ( IsoparametricTransformation & loc,
int i ) const
protected

Definition at line 763 of file mesh.cpp.

◆ GetNBE()

int mfem::Mesh::GetNBE ( ) const
inline

Returns number of boundary elements.

Definition at line 1380 of file mesh.hpp.

◆ GetNE()

int mfem::Mesh::GetNE ( ) const
inline

Returns number of elements.

Definition at line 1377 of file mesh.hpp.

◆ GetNEdges()

int mfem::Mesh::GetNEdges ( ) const
inline

Return the number of edges.

Definition at line 1383 of file mesh.hpp.

◆ GetNFaces()

int mfem::Mesh::GetNFaces ( ) const
inline

Return the number of faces in a 3D mesh.

Definition at line 1386 of file mesh.hpp.

◆ GetNFbyType()

int mfem::Mesh::GetNFbyType ( FaceType type) const
virtual

Returns the number of faces according to the requested type, does not count master nonconforming faces.

If type==Boundary returns only the number of true boundary faces contrary to GetNBE() that returns all "boundary" elements which may include actual interior faces. Similarly, if type==Interior, only the true interior faces are counted excluding all master nonconforming faces.

Reimplemented in mfem::ParMesh.

Definition at line 6862 of file mesh.cpp.

◆ GetNodalFESpace()

const FiniteElementSpace * mfem::Mesh::GetNodalFESpace ( ) const

Return the FiniteElementSpace on which the current mesh nodes are defined or NULL if the mesh does not have nodes.

Definition at line 6794 of file mesh.cpp.

◆ GetNode()

void mfem::Mesh::GetNode ( int i,
real_t * coord ) const

Definition at line 9573 of file mesh.cpp.

◆ GetNodes() [1/4]

GridFunction * mfem::Mesh::GetNodes ( )
inline

Return a pointer to the internal node GridFunction (may be NULL).

If the mesh is straight-sided (low-order), it may not have a GridFunction for the nodes, in which case this function returns NULL. To ensure that the nodal GridFunction exists, first call EnsureNodes().

See also
SetCurvature().
Note
The returned object should NOT be deleted by the caller.

Definition at line 2359 of file mesh.hpp.

◆ GetNodes() [2/4]

const GridFunction * mfem::Mesh::GetNodes ( ) const
inline

Definition at line 2360 of file mesh.hpp.

◆ GetNodes() [3/4]

void mfem::Mesh::GetNodes ( GridFunction & nodes) const

Return the mesh nodes/vertices projected on the given GridFunction.

Definition at line 6727 of file mesh.cpp.

◆ GetNodes() [4/4]

void mfem::Mesh::GetNodes ( Vector & node_coord) const

Definition at line 9627 of file mesh.cpp.

◆ GetNodesSequence()

long mfem::Mesh::GetNodesSequence ( ) const
inline

Return the nodes update counter.

This counter starts at zero, and is incremented every time the geometric factors must be recomputed (e.g. on calls to Mesh::Transform, Mesh::NodesUpdated, etc.)

Definition at line 2526 of file mesh.hpp.

◆ GetNumFaces()

int mfem::Mesh::GetNumFaces ( ) const

Return the number of faces (3D), edges (2D) or vertices (1D).

Definition at line 6846 of file mesh.cpp.

◆ GetNumFacesWithGhost()

int mfem::Mesh::GetNumFacesWithGhost ( ) const

Return the number of faces (3D), edges (2D) or vertices (1D) including ghost faces.

Definition at line 6857 of file mesh.cpp.

◆ GetNumGeometries()

int mfem::Mesh::GetNumGeometries ( int dim) const

Return the number of geometries of the given dimension present in the mesh.

For a parallel mesh only the local geometries are counted.

Definition at line 7558 of file mesh.cpp.

◆ GetNURBSPatches()

void mfem::Mesh::GetNURBSPatches ( Array< NURBSPatch * > & patches)

Returns a deep copy of all patches. This method is not const as it first sets the patches in NURBSext using control points defined by Nodes. Caller gets ownership of the returned object, and is responsible for deletion.

Definition at line 3377 of file mesh.cpp.

◆ GetNV()

int mfem::Mesh::GetNV ( ) const
inline

Returns number of vertices. Vertices are only at the corners of elements, where you would expect them in the lowest-order mesh.

Definition at line 1374 of file mesh.hpp.

◆ GetPatchAttribute()

int mfem::Mesh::GetPatchAttribute ( int i) const

Return the attribute of patch i, for a NURBS mesh.

Definition at line 3353 of file mesh.cpp.

◆ GetPatchBdrAttribute()

int mfem::Mesh::GetPatchBdrAttribute ( int i) const

Return the attribute of patch boundary element i, for a NURBS mesh.

Definition at line 3371 of file mesh.cpp.

◆ GetPointMatrix()

void mfem::Mesh::GetPointMatrix ( int i,
DenseMatrix & pointmat ) const

Definition at line 7972 of file mesh.cpp.

◆ GetQuadOrientation()

int mfem::Mesh::GetQuadOrientation ( const int * base,
const int * test )
staticprotected

Returns the orientation of "test" relative to "base".

Definition at line 7130 of file mesh.cpp.

◆ GetRefinementTransforms()

const CoarseFineTransformations & mfem::Mesh::GetRefinementTransforms ( ) const

Return fine element transformations following a mesh refinement. Space uses this to construct a global interpolation matrix.

Definition at line 11749 of file mesh.cpp.

◆ GetSequence()

long mfem::Mesh::GetSequence ( ) const
inline

Return update counter. The counter starts at zero and is incremented each time refinement, derefinement, or rebalancing method is called. It is used for checking proper sequence of Space:: and GridFunction:: Update() calls.

Definition at line 2519 of file mesh.hpp.

◆ GetTetOrientation()

int mfem::Mesh::GetTetOrientation ( const int * base,
const int * test )
staticprotected

Returns the orientation of "test" relative to "base".

Definition at line 7209 of file mesh.cpp.

◆ GetTransformationFEforElementType()

FiniteElement * mfem::Mesh::GetTransformationFEforElementType ( Element::Type ElemType)
static

Return FiniteElement for reference element of the specified type.

Note
The returned object is a pointer to a global object and should not be deleted by the caller.

Definition at line 339 of file mesh.cpp.

◆ GetTriOrientation()

int mfem::Mesh::GetTriOrientation ( const int * base,
const int * test )
staticprotected

Returns the orientation of "test" relative to "base".

Definition at line 7041 of file mesh.cpp.

◆ GetTypicalElementGeometry()

Geometry::Type mfem::Mesh::GetTypicalElementGeometry ( ) const

If the local mesh is not empty, return GetElementGeometry(0); otherwise, return a typical Geometry present in the global mesh.

This method can be used to replace calls like GetElementGeometry(0) in order to handle empty local meshes better.

Definition at line 1628 of file mesh.cpp.

◆ GetTypicalElementTransformation()

ElementTransformation * mfem::Mesh::GetTypicalElementTransformation ( )

If the local mesh is not empty return GetElementTransformation(0); otherwise, return the identity transformation for a typical geometry in the mesh and a typical finite element in the nodal finite element space (if present).

This method can be used to replace calls like GetElementTransformation(0) in order to handle empty local meshes better.

Note
The returned object is owned by the class and is shared, i.e., calling this function resets pointers obtained from previous calls. Also, this pointer should not be deleted by the caller.

Definition at line 393 of file mesh.cpp.

◆ GetTypicalFaceGeometry()

Geometry::Type mfem::Mesh::GetTypicalFaceGeometry ( ) const

If the local mesh is not empty, return GetFaceGeometry(0); otherwise return a typical face geometry present in the global mesh.

Note that in mixed meshes or meshes with prism or pyramid elements, there will be more than one face geometry.

Definition at line 1596 of file mesh.cpp.

◆ GetVertex() [1/2]

real_t * mfem::Mesh::GetVertex ( int i)
inline

Return pointer to vertex i's coordinates.

Warning
For high-order meshes (when Nodes != NULL) vertices may not being updated and should not be used!
Note
The pointer returned by this function can be used to alter vertex locations but the pointer itself should not be changed by the caller.

Definition at line 1426 of file mesh.hpp.

◆ GetVertex() [2/2]

const real_t * mfem::Mesh::GetVertex ( int i) const
inline

Return pointer to vertex i's coordinates.

Warning
For high-order meshes (when Nodes != NULL) vertices may not be updated and should not be used!

Definition at line 1416 of file mesh.hpp.

◆ GetVertexToBdrElementTable()

Table * mfem::Mesh::GetVertexToBdrElementTable ( )
Note
The returned Table should be deleted by the caller

Definition at line 7768 of file mesh.cpp.

◆ GetVertexToElementTable()

Table * mfem::Mesh::GetVertexToElementTable ( )
Note
The returned Table should be deleted by the caller

Definition at line 7735 of file mesh.cpp.

◆ GetVertexToVertexTable()

void mfem::Mesh::GetVertexToVertexTable ( DSTable & v_to_v) const

Return vertex to vertex table. The connections stored in the table are from smaller to bigger vertex index, i.e. if i<j and (i, j) is in the table, then (j, i) is not stored.

Note
This data is not stored internally as a Table. The Table passed as an argument is populated using the EdgeVertex Table (see GetEdgeVertexTable) if available or the element connectivity.

Definition at line 8043 of file mesh.cpp.

◆ GetVertices()

void mfem::Mesh::GetVertices ( Vector & vert_coord) const

Definition at line 9553 of file mesh.cpp.

◆ GreenRefinement()

void mfem::Mesh::GreenRefinement ( int i,
const DSTable & v_to_v,
int * edge1,
int * edge2,
int * middle )
inlineprotected

Green refinement. Element with index i is refined. The default refinement for now is Bisection.

Definition at line 427 of file mesh.hpp.

◆ HasBoundaryElements()

virtual bool mfem::Mesh::HasBoundaryElements ( ) const
inlinevirtual

Checks if the mesh has boundary elements.

Reimplemented in mfem::ParMesh.

Definition at line 1336 of file mesh.hpp.

◆ HasGeometry()

bool mfem::Mesh::HasGeometry ( Geometry::Type geom) const
inline

Return true iff the given geom is encountered in the mesh. Geometries of dimensions lower than Dimension() are counted as well.

Definition at line 1340 of file mesh.hpp.

◆ Init()

void mfem::Mesh::Init ( )
protected

Definition at line 1804 of file mesh.cpp.

◆ InitFromNCMesh()

void mfem::Mesh::InitFromNCMesh ( const NCMesh & ncmesh)
protected

Initialize vertices/elements/boundary/tables from a nonconforming mesh.

Definition at line 10991 of file mesh.cpp.

◆ InitMesh()

void mfem::Mesh::InitMesh ( int Dim_,
int spaceDim_,
int NVert,
int NElem,
int NBdrElem )
protected

Begin construction of a mesh.

Definition at line 1977 of file mesh.cpp.

◆ InitRefinementTransforms()

void mfem::Mesh::InitRefinementTransforms ( )
protected

Definition at line 11727 of file mesh.cpp.

◆ InitTables()

void mfem::Mesh::InitTables ( )
protected

Definition at line 1823 of file mesh.cpp.

◆ InvertQuadOrientation()

int mfem::Mesh::InvertQuadOrientation ( int ori)
staticprotected

Returns the orientation of "base" relative to "test" In other words: GetQuadOrientation(test, base) should equal InvertQuadOrientation(GetQuadOrientation(base, test))

Definition at line 7203 of file mesh.cpp.

◆ InvertTriOrientation()

int mfem::Mesh::InvertTriOrientation ( int ori)
staticprotected

Returns the orientation of "base" relative to "test" In other words: GetTriOrientation(test, base) should equal InvertTriOrientation(GetTriOrientation(base, test))

Definition at line 7124 of file mesh.cpp.

◆ IsMixedMesh()

bool mfem::Mesh::IsMixedMesh ( ) const

Returns true if the mesh is a mixed mesh, false otherwise.

A mixed mesh is one where there are multiple types of element geometries.

Definition at line 7582 of file mesh.cpp.

◆ IsSlaveFace()

bool mfem::Mesh::IsSlaveFace ( const FaceInfo & fi) const
protected

Definition at line 1249 of file mesh.cpp.

◆ KnotInsert() [1/2]

void mfem::Mesh::KnotInsert ( Array< KnotVector * > & kv)

For NURBS meshes, insert the new knots in kv, for each direction.

Definition at line 6249 of file mesh.cpp.

◆ KnotInsert() [2/2]

void mfem::Mesh::KnotInsert ( Array< Vector * > & kv)

For NURBS meshes, insert the knots in kv, for each direction.

Definition at line 6271 of file mesh.cpp.

◆ KnotRemove()

void mfem::Mesh::KnotRemove ( Array< Vector * > & kv)

For NURBS meshes, remove the knots in kv, for each direction.

Definition at line 6293 of file mesh.cpp.

◆ Load()

virtual void mfem::Mesh::Load ( std::istream & input,
int generate_edges = 0,
int refine = 1,
bool fix_orientation = true )
inlinevirtual

This is similar to the mesh constructor with the same arguments, but here the current mesh is destroyed and another one created based on the data stream again given in MFEM, Netgen, or VTK format. If generate_edges = 0 (default) edges are not generated, if 1 edges are generated.

See also
mfem::ifgzstream() for on-the-fly decompression of compressed ascii inputs.

Reimplemented in mfem::ParMesh, and mfem::PumiMesh.

Definition at line 815 of file mesh.hpp.

◆ Loader()

void mfem::Mesh::Loader ( std::istream & input,
int generate_edges = 0,
std::string parse_tag = "" )
protected

Definition at line 4943 of file mesh.cpp.

◆ LoadFromFile()

Mesh mfem::Mesh::LoadFromFile ( const std::string & filename,
int generate_edges = 0,
int refine = 1,
bool fix_orientation = true )
static

Creates mesh by reading a file in MFEM, Netgen, or VTK format. If generate_edges = 0 (default) edges are not generated, if 1 edges are generated.

Note
filename is not cached by the Mesh object and can be safely deleted following this function call.

Definition at line 4599 of file mesh.cpp.

◆ LoadNonconformingPatchTopo()

void mfem::Mesh::LoadNonconformingPatchTopo ( std::istream & input,
Array< int > & edge_to_ukv )
protected

Read NURBS patch/macro-element mesh (MFEM NURBS NC-patch mesh format)

Definition at line 6658 of file mesh.cpp.

◆ LoadPatchTopo()

void mfem::Mesh::LoadPatchTopo ( std::istream & input,
Array< int > & edge_to_ukv )
protected

Read NURBS patch/macro-element mesh.

Definition at line 6467 of file mesh.cpp.

◆ LocalRefinement()

void mfem::Mesh::LocalRefinement ( const Array< int > & marked_el,
int type = 3 )
protectedvirtual

This function is not public anymore. Use GeneralRefinement instead.

Reimplemented in mfem::ParMesh.

Definition at line 10603 of file mesh.cpp.

◆ Make1D()

void mfem::Mesh::Make1D ( int n,
real_t sx = 1.0 )
protected

brief Creates a 1D mesh for the interval [0,sx] divided into n equal intervals.

Definition at line 4408 of file mesh.cpp.

◆ Make2D()

void mfem::Mesh::Make2D ( int nx,
int ny,
Element::Type type,
real_t sx,
real_t sy,
bool generate_edges,
bool sfc_ordering )
protected

Creates mesh for the rectangle [0,sx]x[0,sy], divided into nx*ny quadrilaterals if type = QUADRILATERAL or into 2*nx*ny triangles if type = TRIANGLE.

If generate_edges = 0 (default) edges are not generated, if 1 edges are generated. The parameter sfc_ordering controls how the elements (when type = QUADRILATERAL) are ordered: true - use space-filling curve ordering, or false - use lexicographic ordering.

Definition at line 4230 of file mesh.cpp.

◆ Make2D4TrisFromQuad()

void mfem::Mesh::Make2D4TrisFromQuad ( int nx,
int ny,
real_t sx,
real_t sy )
protected

Creates mesh for the rectangle [0,sx]x[0,sy], divided into nx*ny*4 triangles.

The mesh is generated by taking nx*ny quadrilaterals and splitting each quadrilateral into 4 triangles by connecting the vertices to a quad-centered point.

Definition at line 3966 of file mesh.cpp.

◆ Make2D5QuadsFromQuad()

void mfem::Mesh::Make2D5QuadsFromQuad ( int nx,
int ny,
real_t sx,
real_t sy )
protected

Creates mesh for the rectangle [0,sx]x[0,sy], divided into nx*ny*5 quadrilaterals.

The mesh is generated by taking nx*ny quadrilaterals and splitting each quadrilateral into 5 quadrilaterals. Each quadrilateral is projected inwards and connected to the original quadrilateral.

Definition at line 4039 of file mesh.cpp.

◆ Make3D()

void mfem::Mesh::Make3D ( int nx,
int ny,
int nz,
Element::Type type,
real_t sx,
real_t sy,
real_t sz,
bool sfc_ordering )
protected

Creates a mesh for the parallelepiped [0,sx]x[0,sy]x[0,sz], divided into nx*ny*nz hexahedra if type = HEXAHEDRON or into 6*nx*ny*nz tetrahedrons if type = TETRAHEDRON.

The parameter sfc_ordering controls how the elements (when type = HEXAHEDRON) are ordered: true - use space-filling curve ordering, or false - use lexicographic ordering.

Definition at line 3683 of file mesh.cpp.

◆ Make3D24TetsFromHex()

void mfem::Mesh::Make3D24TetsFromHex ( int nx,
int ny,
int nz,
real_t sx,
real_t sy,
real_t sz )
protected

Creates a mesh for the parallelepiped [0,sx]x[0,sy]x[0,sz], divided into nx*ny*nz*24 tetrahedrons.

The mesh is generated by taking nx*ny*nz hexahedra and splitting each hexahedron into 24 tetrahedrons. Each face of the hexahedron is split into 4 triangles (face edges are connected to a face-centered point), and the triangles are connected to a hex-centered point.

Definition at line 4113 of file mesh.cpp.

◆ MakeCartesian1D()

Mesh mfem::Mesh::MakeCartesian1D ( int n,
real_t sx = 1.0 )
static

Creates 1D mesh, divided into n equal intervals.

Definition at line 4609 of file mesh.cpp.

◆ MakeCartesian2D()

Mesh mfem::Mesh::MakeCartesian2D ( int nx,
int ny,
Element::Type type,
bool generate_edges = false,
real_t sx = 1.0,
real_t sy = 1.0,
bool sfc_ordering = true )
static

Creates mesh for the rectangle [0,sx]x[0,sy], divided into nx*ny quadrilaterals if type = QUADRILATERAL or into 2*nx*ny triangles if type = TRIANGLE.

If generate_edges = 0 (default) edges are not generated, if 1 edges are generated. The parameter sfc_ordering controls how the elements (when type = QUADRILATERAL) are ordered: true - use space-filling curve ordering, or false - use lexicographic ordering.

Definition at line 4617 of file mesh.cpp.

◆ MakeCartesian2DWith4TrisPerQuad()

Mesh mfem::Mesh::MakeCartesian2DWith4TrisPerQuad ( int nx,
int ny,
real_t sx = 1.0,
real_t sy = 1.0 )
static

Creates mesh for the rectangle [0,sx]x[0,sy], divided into nx*ny*4 triangles.

The mesh is generated by taking nx*ny quadrilaterals and splitting each quadrilateral into 4 triangles by connecting the vertices to a quad-centered point.

Definition at line 4646 of file mesh.cpp.

◆ MakeCartesian2DWith5QuadsPerQuad()

Mesh mfem::Mesh::MakeCartesian2DWith5QuadsPerQuad ( int nx,
int ny,
real_t sx = 1.0,
real_t sy = 1.0 )
static

Creates mesh for the rectangle [0,sx]x[0,sy], divided into nx*ny*5 quadrilaterals.

The mesh is generated by taking nx*ny quadrilaterals and splitting each quadrilateral into 5 quadrilaterals. Each quadrilateral is projected inwards and connected to the original quadrilateral.

Definition at line 4655 of file mesh.cpp.

◆ MakeCartesian3D()

Mesh mfem::Mesh::MakeCartesian3D ( int nx,
int ny,
int nz,
Element::Type type,
real_t sx = 1.0,
real_t sy = 1.0,
real_t sz = 1.0,
bool sfc_ordering = true )
static

Creates a mesh for the parallelepiped [0,sx]x[0,sy]x[0,sz], divided into nx*ny*nz hexahedra if type = HEXAHEDRON or into 6*nx*ny*nz tetrahedrons if type = TETRAHEDRON.

The parameter sfc_ordering controls how the elements (when type = HEXAHEDRON) are ordered: true - use space-filling curve ordering, or false - use lexicographic ordering.

Definition at line 4627 of file mesh.cpp.

◆ MakeCartesian3DWith24TetsPerHex()

Mesh mfem::Mesh::MakeCartesian3DWith24TetsPerHex ( int nx,
int ny,
int nz,
real_t sx = 1.0,
real_t sy = 1.0,
real_t sz = 1.0 )
static

Creates a mesh for the parallelepiped [0,sx]x[0,sy]x[0,sz], divided into nx*ny*nz*24 tetrahedrons.

The mesh is generated by taking nx*ny*nz hexahedra and splitting each hexahedron into 24 tetrahedrons. Each face of the hexahedron is split into 4 triangles (face edges are connected to a face-centered point), and the triangles are connected to a hex-centered point.

Definition at line 4637 of file mesh.cpp.

◆ MakeHigherOrderSimplicial_()

void mfem::Mesh::MakeHigherOrderSimplicial_ ( const Mesh & orig_mesh,
const Array< int > & parent_elements )
protected

Helper function for constructing higher order nodes from a mesh transformed into simplices. Only to be called as part of MakeSimplicial or ParMesh::MakeSimplicial.

Parameters
orig_meshThe mesh that was used to transform this mesh into simplices.
parent_elementsparent_elements[i] gives the element in orig_mesh split to give element i.

Definition at line 5912 of file mesh.cpp.

◆ MakePeriodic()

Mesh mfem::Mesh::MakePeriodic ( const Mesh & orig_mesh,
const std::vector< int > & v2v )
static

Create a periodic mesh by identifying vertices of orig_mesh.

Each vertex i will be mapped to vertex v2v[i], such that all vertices that are coincident under the periodic mapping get mapped to the same index. The mapping v2v can be generated from translation vectors using Mesh::CreatePeriodicVertexMapping.

Note
MFEM requires that each edge of the resulting mesh be uniquely identifiable by a pair of distinct vertices. As a consequence, periodic boundaries must be separated by at least two interior vertices.
The resulting mesh uses a discontinuous nodal function, see SetCurvature() for further details.

Definition at line 6042 of file mesh.cpp.

◆ MakeRefined() [1/2]

Mesh mfem::Mesh::MakeRefined ( Mesh & orig_mesh,
const Array< int > & ref_factors,
int ref_type )
static

refined ref_factors[i] times in each dimension.

Create a refined mesh, where each element of the original mesh may be refined by a different factor.

Parameters
[in]orig_meshThe starting coarse mesh.
[in]ref_factorsAn array of integers whose size is the number of elements of orig_mesh. The ith element of orig_mesh is refined by refinement factor ref_factors[i].
[in]ref_typeSpecify the positions of the new vertices. The options are BasisType::ClosedUniform or BasisType::GaussLobatto.

The refinement data which can be accessed with GetRefinementTransforms() is set to reflect the performed refinements.

Note
The constructed Mesh is straight-sided.

Definition at line 4673 of file mesh.cpp.

◆ MakeRefined() [2/2]

Mesh mfem::Mesh::MakeRefined ( Mesh & orig_mesh,
int ref_factor,
int ref_type )
static

Create a refined (by any factor) version of orig_mesh.

Parameters
[in]orig_meshThe starting coarse mesh.
[in]ref_factorThe refinement factor, an integer > 1.
[in]ref_typeSpecify the positions of the new vertices. The options are BasisType::ClosedUniform or BasisType::GaussLobatto.

The refinement data which can be accessed with GetRefinementTransforms() is set to reflect the performed refinements.

Note
The constructed Mesh is straight-sided.

Definition at line 4664 of file mesh.cpp.

◆ MakeRefined_()

void mfem::Mesh::MakeRefined_ ( Mesh & orig_mesh,
const Array< int > & ref_factors,
int ref_type )
protected

Internal function used in Mesh::MakeRefined.

Definition at line 5335 of file mesh.cpp.

◆ MakeSimplicial()

Mesh mfem::Mesh::MakeSimplicial ( const Mesh & orig_mesh)
static

Create a mesh by splitting each element of orig_mesh into simplices. Quadrilaterals are split into two triangles, prisms are split into 3 tetrahedra, and hexahedra are split into either 5 or 6 tetrahedra depending on the configuration.

Warning
The curvature of the original mesh is not carried over to the new mesh. Periodic meshes are not supported.

Definition at line 5564 of file mesh.cpp.

◆ MakeSimplicial_()

Array< int > mfem::Mesh::MakeSimplicial_ ( const Mesh & orig_mesh,
int * vglobal )
protected

Internal helper user in MakeSimplicial (and ParMesh::MakeSimplicial). Optional return is used in assembling a higher order mesh.

The construction of the higher order nodes must be separated out because the

Parameters
orig_meshThe mesh from to create the simplices
vglobalAn optional global ordering of vertices. Necessary for parallel splitting.
Returns
Array<int> parent elements from the orig_mesh for each split element

Definition at line 5575 of file mesh.cpp.

◆ MarkExternalBoundaries()

void mfem::Mesh::MarkExternalBoundaries ( Array< int > & bdr_marker,
bool excl = true ) const
virtual

Mark boundary attributes of external boundaries.

Parameters
[in,out]bdr_markerArray of length bdr_attributes.Max(). Entries associated with external boundaries will be set to one. Other entries will remain unchanged.
[in]exclOnly mark entries which exclusively contain external faces [default: true].

Reimplemented in mfem::ParMesh.

Definition at line 1741 of file mesh.cpp.

◆ MarkForRefinement()

void mfem::Mesh::MarkForRefinement ( )
protected

Definition at line 2964 of file mesh.cpp.

◆ MarkNamedBoundaries()

void mfem::Mesh::MarkNamedBoundaries ( const std::string & set_name,
Array< int > & bdr_marker ) const
virtual

Mark boundary attributes in the named set.

Parameters
[in]set_nameName of a named boundary attribute set.
[in,out]bdr_markerArray of length bdr_attributes.Max(). Entries associated with the named set will be set to one. Other entries will remain unchanged.

Definition at line 1783 of file mesh.cpp.

◆ MarkTetMeshForRefinement()

void mfem::Mesh::MarkTetMeshForRefinement ( const DSTable & v_to_v)
protectedvirtual

Reimplemented in mfem::ParMesh.

Definition at line 3021 of file mesh.cpp.

◆ MarkTriMeshForRefinement()

void mfem::Mesh::MarkTriMeshForRefinement ( )
protected

Definition at line 2981 of file mesh.cpp.

◆ MeshGenerator()

int mfem::Mesh::MeshGenerator ( ) const
inline

Get the mesh generator/type.

The purpose of this is to be able to quickly tell what type of elements one has in the mesh. Examination of this bitmask along with knowledge of the mesh dimension can be used to identify which element types are present.

Returns
A bitmask:
  • bit 0 - simplices are present in the mesh (segments, triangles, tets),
  • bit 1 - tensor product elements are present in the mesh (quads, hexes),
  • bit 2 - the mesh has wedge elements.
  • bit 3 - the mesh has pyramid elements.

In parallel, the result takes into account elements on all processors.

Definition at line 1333 of file mesh.hpp.

◆ MoveNodes()

void mfem::Mesh::MoveNodes ( const Vector & displacements)

Definition at line 9612 of file mesh.cpp.

◆ MoveVertices()

void mfem::Mesh::MoveVertices ( const Vector & displacements)

Definition at line 9544 of file mesh.cpp.

◆ NewElement()

Element * mfem::Mesh::NewElement ( int geom)
Note
The returned object should be deleted by the caller.

Definition at line 4818 of file mesh.cpp.

◆ NewNodes()

void mfem::Mesh::NewNodes ( GridFunction & nodes,
bool make_owner = false )

Replace the internal node GridFunction with the given GridFunction.

Invokes NodesUpdated().

Definition at line 9654 of file mesh.cpp.

◆ NodesUpdated()

void mfem::Mesh::NodesUpdated ( )
inline

This function should be called after the mesh node coordinates have been updated externally, e.g. by modifying the internal nodal GridFunction returned by GetNodes().

It deletes internal quantities derived from the node coordinates, such as the (Face)GeometricFactors.

Note
Unlike the similarly named protected method UpdateNodes() this method does not modify the nodes.

Definition at line 2312 of file mesh.hpp.

◆ Nonconforming()

bool mfem::Mesh::Nonconforming ( ) const
inline

Definition at line 2499 of file mesh.hpp.

◆ NonconformingDerefinement()

bool mfem::Mesh::NonconformingDerefinement ( Array< real_t > & elem_error,
real_t threshold,
int nc_limit = 0,
int op = 1 )
protectedvirtual

NC version of GeneralDerefinement.

Reimplemented in mfem::ParMesh.

Definition at line 10914 of file mesh.cpp.

◆ NonconformingRefinement()

void mfem::Mesh::NonconformingRefinement ( const Array< Refinement > & refinements,
int nc_limit = 0 )
protectedvirtual

This function is not public anymore. Use GeneralRefinement instead.

Reimplemented in mfem::ParMesh.

Definition at line 10845 of file mesh.cpp.

◆ NURBSCoarsening()

void mfem::Mesh::NURBSCoarsening ( int cf = 2,
real_t tol = 1.0e-12 )

Coarsening for a NURBS mesh, with an optional coarsening factor cf > 1 which divides the number of elements in each dimension.

Definition at line 11169 of file mesh.cpp.

◆ NURBSUniformRefinement() [1/2]

void mfem::Mesh::NURBSUniformRefinement ( const Array< int > & rf,
real_t tol = 1.e-12 )
virtual

Reimplemented in mfem::ParMesh.

Definition at line 6327 of file mesh.cpp.

◆ NURBSUniformRefinement() [2/2]

void mfem::Mesh::NURBSUniformRefinement ( int rf = 2,
real_t tol = 1.0e-12 )
virtual

Refine NURBS mesh, with an optional refinement factor, generally anisotropic.

Parameters
[in]rfOptional refinement factor. If scalar, the factor is used for all dimensions. If an array, factors can be specified for each dimension. The factor multiplies the number of elements in each dimension. Some factors can be 1.
[in]tolNURBS geometry deviation tolerance, cf. Algorithm A5.8 of "The NURBS Book", 2nd ed, Piegl and Tiller.

Reimplemented in mfem::ParMesh.

Definition at line 6320 of file mesh.cpp.

◆ operator=() [1/2]

Mesh & mfem::Mesh::operator= ( const Mesh & mesh)
delete

Explicitly delete the copy assignment operator.

◆ operator=() [2/2]

Mesh & mfem::Mesh::operator= ( Mesh && mesh)

Move assignment operator.

Definition at line 4593 of file mesh.cpp.

◆ OwnsNodes()

bool mfem::Mesh::OwnsNodes ( ) const
inline

Return the mesh nodes ownership flag.

Definition at line 2362 of file mesh.hpp.

◆ PrepareNodeReorder()

void mfem::Mesh::PrepareNodeReorder ( DSTable ** old_v_to_v,
Table ** old_elem_vert )
protected

Definition at line 3044 of file mesh.cpp.

◆ Print() [1/2]

void mfem::Mesh::Print ( adios2stream & os) const
virtual

Print the mesh to the given stream using the adios2 bp format.

Reimplemented in mfem::ParMesh.

Definition at line 12186 of file mesh.cpp.

◆ Print() [2/2]

virtual void mfem::Mesh::Print ( std::ostream & os = mfem::out,
const std::string & comments = "" ) const
inlinevirtual

Print the mesh to the given stream using the default MFEM mesh format.

See also
mfem::ofgzstream() for on-the-fly compression of ascii outputs. If comments is non-empty, it will be printed after the first line of the file, and each line should begin with '#'.

Reimplemented in mfem::ParMesh.

Definition at line 2567 of file mesh.hpp.

◆ PrintBdrVTU()

void mfem::Mesh::PrintBdrVTU ( std::string fname,
VTKFormat format = VTKFormat::ASCII,
bool high_order_output = false,
int compression_level = 0 )

Print the boundary elements of the mesh in VTU format, and output the boundary attributes as a data array (useful for boundary conditions).

Definition at line 12384 of file mesh.cpp.

◆ PrintCharacteristics()

void mfem::Mesh::PrintCharacteristics ( Vector * Vh = NULL,
Vector * Vk = NULL,
std::ostream & os = mfem::out )

Compute and print mesh characteristics such as number of vertices, number of elements, number of boundary elements, minimal and maximal element sizes, minimal and maximal element aspect ratios, etc.

If Vh or Vk are not NULL, return the element sizes and aspect ratios for all elements in the given Vectors.

Definition at line 254 of file mesh.cpp.

◆ PrintElement()

void mfem::Mesh::PrintElement ( const Element * el,
std::ostream & os )
staticprotected

Definition at line 4884 of file mesh.cpp.

◆ PrintElementsByGeometry()

void mfem::Mesh::PrintElementsByGeometry ( int dim,
const Array< int > & num_elems_by_geom,
std::ostream & os )
static

Auxiliary method used by PrintCharacteristics().

It is also used in the mesh-explorer miniapp.

Definition at line 240 of file mesh.cpp.

◆ PrintElementsWithPartitioning()

void mfem::Mesh::PrintElementsWithPartitioning ( int * partitioning,
std::ostream & os,
int interior_faces = 0 )

Definition at line 12960 of file mesh.cpp.

◆ PrintElementWithoutAttr()

void mfem::Mesh::PrintElementWithoutAttr ( const Element * el,
std::ostream & os )
staticprotected

Definition at line 4860 of file mesh.cpp.

◆ Printer()

void mfem::Mesh::Printer ( std::ostream & os = mfem::out,
std::string section_delimiter = "",
const std::string & comments = "" ) const
protected

If NURBS mesh, write NURBS format. If NCMesh, write mfem v1.1 format. If section_delimiter is empty, write mfem v1.0 format. Otherwise, write mfem v1.2 format with the given section_delimiter at the end.

If comments is non-empty, it will be printed after the first line of the file, and each line should begin with '#'.

Definition at line 11976 of file mesh.cpp.

◆ PrintExodusII()

void mfem::Mesh::PrintExodusII ( const std::string & fpath)

Export a mesh to an Exodus II file.

Definition at line 300 of file exodus_writer.cpp.

◆ PrintInfo()

virtual void mfem::Mesh::PrintInfo ( std::ostream & os = mfem::out)
inlinevirtual

In serial, this method calls PrintCharacteristics(). In parallel, additional information about the parallel decomposition is also printed.

Reimplemented in mfem::ParMesh.

Definition at line 2656 of file mesh.hpp.

◆ PrintSurfaces()

void mfem::Mesh::PrintSurfaces ( const Table & Aface_face,
std::ostream & os ) const

Print set of disjoint surfaces:

If Aface_face(i,j) != 0, print face j as a boundary element with attribute i+1.

Definition at line 13333 of file mesh.cpp.

◆ PrintTopo()

void mfem::Mesh::PrintTopo ( std::ostream & os,
const Array< int > & e_to_k,
const int version,
const std::string & comment = "" ) const
protected

Write the beginning of a NURBS mesh to os, specifying the NURBS patch topology. Optional file comments can be provided in comments.

Parameters
[in]osOutput stream to which to write.
[in]e_to_kMap from edge to signed knotvector indices.
[in]versionNURBS mesh version number times 10 (e.g. 11 for v1.1).
[in]commentOptional comment string, written after version line.

Definition at line 12102 of file mesh.cpp.

◆ PrintTopoEdges()

void mfem::Mesh::PrintTopoEdges ( std::ostream & out,
const Array< int > & e_to_k,
bool vmap = false ) const
protected

Write the patch topology edges of a NURBS mesh (see PrintTopo()).

Definition at line 12138 of file mesh.cpp.

◆ PrintVTK() [1/2]

void mfem::Mesh::PrintVTK ( std::ostream & os)

Print the mesh in VTK format (linear and quadratic meshes only).

See also
mfem::ofgzstream() for on-the-fly compression of ascii outputs

Definition at line 12192 of file mesh.cpp.

◆ PrintVTK() [2/2]

void mfem::Mesh::PrintVTK ( std::ostream & os,
int ref,
int field_data = 0 )

Print the mesh in VTK format. The parameter ref > 0 specifies an element subdivision number (useful for high order fields and curved meshes). If the optional field_data is set, we also add a FIELD section in the beginning of the file with additional dataset information.

See also
mfem::ofgzstream() for on-the-fly compression of ascii outputs

Definition at line 12601 of file mesh.cpp.

◆ PrintVTU() [1/2]

void mfem::Mesh::PrintVTU ( std::ostream & os,
int ref = 1,
VTKFormat format = VTKFormat::ASCII,
bool high_order_output = false,
int compression_level = 0,
bool bdr_elements = false )

Print the mesh in VTU format. The parameter ref > 0 specifies an element subdivision number (useful for high order fields and curved meshes). If bdr_elements is true, then output (only) the boundary elements, otherwise output only the non-boundary elements.

Definition at line 12392 of file mesh.cpp.

◆ PrintVTU() [2/2]

void mfem::Mesh::PrintVTU ( std::string fname,
VTKFormat format = VTKFormat::ASCII,
bool high_order_output = false,
int compression_level = 0,
bool bdr_elements = false )
virtual

Print the mesh in VTU format with file name fname.

Reimplemented in mfem::ParMesh.

Definition at line 12358 of file mesh.cpp.

◆ PrintWithPartitioning()

void mfem::Mesh::PrintWithPartitioning ( int * partitioning,
std::ostream & os,
int elem_attr = 0 ) const

Prints the mesh with boundary elements given by the boundary of the subdomains, so that the boundary of subdomain i has boundary attribute i+1.

See also
mfem::ofgzstream() for on-the-fly compression of ascii outputs

Definition at line 12841 of file mesh.cpp.

◆ PrintXG()

void mfem::Mesh::PrintXG ( std::ostream & os = mfem::out) const
virtual

Print the mesh to the given stream using Netgen/Truegrid format.

Reimplemented in mfem::ParMesh.

Definition at line 11812 of file mesh.cpp.

◆ RandomRefinement()

void mfem::Mesh::RandomRefinement ( real_t prob,
bool aniso = false,
int nonconforming = -1,
int nc_limit = 0 )

Refine each element with given probability. Uses GeneralRefinement.

Definition at line 11317 of file mesh.cpp.

◆ ReadCubit()

void mfem::Mesh::ReadCubit ( const std::string & filename,
int & curved,
int & read_gf )
protected

Load a mesh from a Genesis file.

Definition at line 4295 of file mesh_readers.cpp.

◆ ReadElement()

Element * mfem::Mesh::ReadElement ( std::istream & input)
protected

Definition at line 4872 of file mesh.cpp.

◆ ReadElementWithoutAttr()

Element * mfem::Mesh::ReadElementWithoutAttr ( std::istream & input)
protected

Definition at line 4842 of file mesh.cpp.

◆ ReadGmshMesh()

void mfem::Mesh::ReadGmshMesh ( std::istream & input,
int & curved,
int & read_gf )
protected

The following mappings convert the Gmsh node orderings for high order elements to MFEM's L2 degree of freedom ordering. To support more options examine Gmsh's ordering and read off the indices in MFEM's order. For example 2nd order Gmsh quadrilaterals use the following ordering:

3–6–2 | | | 7 8 5 | | | 0–4–1

(from https://gmsh.info/doc/texinfo/gmsh.html#Node-ordering)

Whereas MFEM uses a tensor product ordering with the horizontal axis cycling fastest so we would read off:

0 4 1 7 8 5 3 6 2

This corresponds to the quad9 mapping below.

Definition at line 1515 of file mesh_readers.cpp.

◆ ReadInlineMesh()

void mfem::Mesh::ReadInlineMesh ( std::istream & input,
bool generate_edges = false )
protected

Definition at line 1355 of file mesh_readers.cpp.

◆ ReadLineMesh()

void mfem::Mesh::ReadLineMesh ( std::istream & input)
protected

Definition at line 134 of file mesh_readers.cpp.

◆ ReadMFEMMesh()

void mfem::Mesh::ReadMFEMMesh ( std::istream & input,
int version,
int & curved )
protected

Definition at line 41 of file mesh_readers.cpp.

◆ ReadNetgen2DMesh()

void mfem::Mesh::ReadNetgen2DMesh ( std::istream & input,
int & curved )
protected

Definition at line 168 of file mesh_readers.cpp.

◆ ReadNetgen3DMesh()

void mfem::Mesh::ReadNetgen3DMesh ( std::istream & input)
protected

Definition at line 230 of file mesh_readers.cpp.

◆ ReadNURBSMesh()

void mfem::Mesh::ReadNURBSMesh ( std::istream & input,
int & curved,
int & read_gf,
bool spacing = false,
bool nc = false )
protected

Definition at line 1312 of file mesh_readers.cpp.

◆ ReadTrueGridMesh()

void mfem::Mesh::ReadTrueGridMesh ( std::istream & input)
protected

Definition at line 284 of file mesh_readers.cpp.

◆ ReadVTKMesh()

void mfem::Mesh::ReadVTKMesh ( std::istream & input,
int & curved,
int & read_gf,
bool & finalize_topo )
protected

Definition at line 1178 of file mesh_readers.cpp.

◆ ReadXML_VTKMesh()

void mfem::Mesh::ReadXML_VTKMesh ( std::istream & input,
int & curved,
int & read_gf,
bool & finalize_topo,
const std::string & xml_prefix = "" )
protected

Definition at line 1051 of file mesh_readers.cpp.

◆ RedRefinement()

void mfem::Mesh::RedRefinement ( int i,
const DSTable & v_to_v,
int * edge1,
int * edge2,
int * middle )
inlineprotected

Red refinement. Element with index i is refined. The default red refinement for now is Uniform.

Definition at line 421 of file mesh.hpp.

◆ ReduceInt()

virtual long long mfem::Mesh::ReduceInt ( int value) const
inlinevirtual

Utility function: sum integers from all processors (Allreduce).

Reimplemented in mfem::ParMesh.

Definition at line 2728 of file mesh.hpp.

◆ RefineAtVertex()

void mfem::Mesh::RefineAtVertex ( const Vertex & vert,
real_t eps = 0.0,
int nonconforming = -1 )

Refine elements sharing the specified vertex. Uses GeneralRefinement.

Definition at line 11336 of file mesh.cpp.

◆ RefineByError() [1/2]

bool mfem::Mesh::RefineByError ( const Array< real_t > & elem_error,
real_t threshold,
int nonconforming = -1,
int nc_limit = 0 )

Refine element i if elem_error[i] > threshold, for all i. Returns true if at least one element was refined, false otherwise.

Definition at line 11362 of file mesh.cpp.

◆ RefineByError() [2/2]

bool mfem::Mesh::RefineByError ( const Vector & elem_error,
real_t threshold,
int nonconforming = -1,
int nc_limit = 0 )

Refine element i if elem_error(i) > threshold, for all i. Returns true if at least one element was refined, false otherwise.

Definition at line 11382 of file mesh.cpp.

◆ RefineNURBS()

void mfem::Mesh::RefineNURBS ( bool usingKVF,
real_t tol,
const Array< int > & rf,
const std::string & kvf )
protected

Refine the NURBS mesh with default refinement factors in rf for each dimension.

Optionally, if usingKVF is true, use refinement factors specified for particular KnotVectors, from the file with name in kvf. When coarsening by knot removal is necessary for non-nested spacing formulas, tolerance tol is used (see NURBSPatch::KnotRemove()).

Definition at line 6335 of file mesh.cpp.

◆ RefineNURBSFromFile()

void mfem::Mesh::RefineNURBSFromFile ( std::string ref_file)

Refine a NURBS mesh with the knots specified in the file named ref_file. The file has the number of knot vectors on the first line. It is the same number of knot vectors specified in the NURBS mesh in the section edges. Then for each knot vector specified in the section edges (with the same ordering), a line describes (in this order): 1) an integer giving the number of knots inserted, 2) the knots inserted as a double. The advantage of this method is that it is possible to specifically refine a coarse NURBS mesh without changing the mesh file itself. Examples in miniapps/nurbs/meshes.

Definition at line 6212 of file mesh.cpp.

◆ RefineNURBSWithKVFactors()

void mfem::Mesh::RefineNURBSWithKVFactors ( int rf,
const std::string & kvf )
virtual

brief Use knotvector refinement factors loaded from the file with name in kvf. Everywhere else, use the default refinement factor rf.

Reimplemented in mfem::ParMesh.

Definition at line 6315 of file mesh.cpp.

◆ RemoveInternalBoundaries()

void mfem::Mesh::RemoveInternalBoundaries ( )

Remove boundary elements that lie in the interior of the mesh, i.e. that have two adjacent faces in 3D, or edges in 2D.

Definition at line 13698 of file mesh.cpp.

◆ RemoveUnusedVertices()

void mfem::Mesh::RemoveUnusedVertices ( )

Remove unused vertices and rebuild mesh connectivity.

Definition at line 13591 of file mesh.cpp.

◆ ReorderElements()

void mfem::Mesh::ReorderElements ( const Array< int > & ordering,
bool reorder_vertices = true )

Rebuilds the mesh with a different order of elements. For each element i, the array ordering[i] contains its desired new index. Note that the method reorders vertices, edges and faces along with the elements.

Definition at line 2812 of file mesh.cpp.

◆ ReorientTetMesh()

void mfem::Mesh::ReorientTetMesh ( )
virtual

This method modifies a tetrahedral mesh so that Nedelec spaces of order greater than 1 can be defined on the mesh. Specifically, we 1) rotate all tets in the mesh so that the vertices {v0, v1, v2, v3} satisfy: v0 < v1 < min(v2, v3). 2) rotate all boundary triangles so that the vertices {v0, v1, v2} satisfy: v0 < min(v1, v2).

Note
Refinement does not work after a call to this method!

Reimplemented in mfem::ParMesh.

Definition at line 8643 of file mesh.cpp.

◆ ResetLazyData()

void mfem::Mesh::ResetLazyData ( )
protected

Definition at line 1918 of file mesh.cpp.

◆ Save()

void mfem::Mesh::Save ( const std::string & fname,
int precision = 16 ) const
virtual

Save the mesh to a file using Mesh::Print. The given precision will be used for ASCII output.

Reimplemented in mfem::ParMesh.

Definition at line 12178 of file mesh.cpp.

◆ SaveVTKHDF()

void mfem::Mesh::SaveVTKHDF ( const std::string & fname,
bool high_order = true )

Save the Mesh in VTKHDF format.

Definition at line 12746 of file mesh.cpp.

◆ ScaleElements()

void mfem::Mesh::ScaleElements ( real_t sf)

Definition at line 13470 of file mesh.cpp.

◆ ScaleSubdomains()

void mfem::Mesh::ScaleSubdomains ( real_t sf)

Definition at line 13400 of file mesh.cpp.

◆ SetAttribute()

void mfem::Mesh::SetAttribute ( int i,
int attr )

Set the attribute of element i.

Definition at line 7950 of file mesh.cpp.

◆ SetAttributes()

void mfem::Mesh::SetAttributes ( bool elem_attrs_changed = true,
bool bdr_face_attrs_changed = true )
virtual

Determine the sets of unique attribute values in domain if elem_attrs_changed and boundary elements if bdr_face_attrs_changed.

Separately scan the domain and boundary elements to generate unique, sorted sets of the element attribute values present in the mesh and store these in the Mesh::attributes and Mesh::bdr_attributes arrays.

Reimplemented in mfem::ParMesh.

Definition at line 1937 of file mesh.cpp.

◆ SetBdrAttribute()

void mfem::Mesh::SetBdrAttribute ( int i,
int attr )
inline

Set the attribute of boundary element i.

Definition at line 1493 of file mesh.hpp.

◆ SetCurvature()

void mfem::Mesh::SetCurvature ( int order,
bool discont = false,
int space_dim = -1,
int ordering = 1 )
virtual

Set the curvature of the mesh nodes using the given polynomial degree.

Creates a nodal GridFunction if one doesn't already exist.

Parameters
[in]orderPolynomial degree of the nodal FE space. If this value is <= 0 then the method will remove the nodal GridFunction and the Mesh will use the vertices array instead; the other arguments are ignored in this case.
[in]discontWhether to use a discontinuous or continuous finite element space (continuous is default).
[in]space_dimThe space dimension (optional).
[in]orderingThe Ordering of the finite element space (Ordering::byVDIM is the default).

Reimplemented in mfem::ParMesh.

Definition at line 6799 of file mesh.cpp.

◆ SetEmpty()

void mfem::Mesh::SetEmpty ( )
protected

Definition at line 1830 of file mesh.cpp.

◆ SetMeshGen()

void mfem::Mesh::SetMeshGen ( )
protected

Determine the mesh generator bitmask meshgen, see MeshGenerator().

Also, initializes mesh_geoms.

Definition at line 4890 of file mesh.cpp.

◆ SetNodalFESpace()

void mfem::Mesh::SetNodalFESpace ( FiniteElementSpace * nfes)
virtual

Replace the internal node GridFunction with a new GridFunction defined on the given FiniteElementSpace. The new node coordinates are projected (derived) from the current nodes/vertices.

Reimplemented in mfem::ParMesh.

Definition at line 6741 of file mesh.cpp.

◆ SetNodalGridFunction()

void mfem::Mesh::SetNodalGridFunction ( GridFunction * nodes,
bool make_owner = false )

Replace the internal node GridFunction with the given GridFunction. The given GridFunction is updated with node coordinates projected (derived) from the current nodes/vertices.

Definition at line 6788 of file mesh.cpp.

◆ SetNode()

void mfem::Mesh::SetNode ( int i,
const real_t * coord )

Definition at line 9592 of file mesh.cpp.

◆ SetNodes()

void mfem::Mesh::SetNodes ( const Vector & node_coord)

Updates the vertex/node locations. Invokes NodesUpdated().

Definition at line 9639 of file mesh.cpp.

◆ SetNodesOwner()

void mfem::Mesh::SetNodesOwner ( bool nodes_owner)
inline

Set the mesh nodes ownership flag.

Definition at line 2364 of file mesh.hpp.

◆ SetPatchAttribute()

void mfem::Mesh::SetPatchAttribute ( int i,
int attr )

Set the attribute of patch i, for a NURBS mesh.

Definition at line 3342 of file mesh.cpp.

◆ SetPatchBdrAttribute()

void mfem::Mesh::SetPatchBdrAttribute ( int i,
int attr )

Set the attribute of patch boundary element i, for a NURBS mesh.

Definition at line 3359 of file mesh.cpp.

◆ SetScaledNCMesh()

void mfem::Mesh::SetScaledNCMesh ( )
inline

Designate this mesh for output as "NC mesh v1.1", meaning it is nonconforming with nonuniform refinement spacings.

Definition at line 2503 of file mesh.hpp.

◆ SetVertices()

void mfem::Mesh::SetVertices ( const Vector & vert_coord)

Definition at line 9564 of file mesh.cpp.

◆ SetVerticesFromNodes()

void mfem::Mesh::SetVerticesFromNodes ( const GridFunction * nodes)
protected

Helper to set vertex coordinates given a high-order curvature function.

Definition at line 6832 of file mesh.cpp.

◆ SpaceDimension()

int mfem::Mesh::SpaceDimension ( ) const
inline

Dimension of the physical space containing the mesh.

Definition at line 1309 of file mesh.hpp.

◆ Swap()

void mfem::Mesh::Swap ( Mesh & other,
bool non_geometry )

Swaps internal data with another mesh. By default, non-geometry members like 'ncmesh' and 'NURBSExt' are only swapped when 'non_geometry' is set.

Definition at line 11036 of file mesh.cpp.

◆ SwapNodes()

void mfem::Mesh::SwapNodes ( GridFunction *& nodes,
int & own_nodes_ )

Swap the internal node GridFunction pointer and ownership flag members with the given ones.

Invokes NodesUpdated().

Definition at line 9676 of file mesh.cpp.

◆ Transform() [1/2]

void mfem::Mesh::Transform ( std::function< void(const Vector &, Vector &)> f)

Definition at line 13540 of file mesh.cpp.

◆ Transform() [2/2]

void mfem::Mesh::Transform ( VectorCoefficient & deformation)

Definition at line 13566 of file mesh.cpp.

◆ TransformBdrElementToFace()

IntegrationPoint mfem::Mesh::TransformBdrElementToFace ( Geometry::Type geom,
int o,
const IntegrationPoint & ip )
static

For the vertex (1D), edge (2D), or face (3D) of a boundary element with the orientation o, return the transformation of the boundary element integration point @ ip to the face element. In 2D, the the orientation is 0 or 1 as returned by GetBdrElementFace, not +/-1. Supports both internal and external boundaries.

Definition at line 7453 of file mesh.cpp.

◆ UniformRefinement() [1/2]

void mfem::Mesh::UniformRefinement ( int i,
const DSTable & v_to_v,
int * edge1,
int * edge2,
int * middle )
protected

Uniform Refinement. Element with index i is refined uniformly.

Definition at line 11637 of file mesh.cpp.

◆ UniformRefinement() [2/2]

void mfem::Mesh::UniformRefinement ( int ref_algo = 0)

Refine all mesh elements.

Parameters
[in]ref_algoRefinement algorithm. Currently used only for pure tetrahedral meshes. If set to zero (default), a tet mesh will be refined using algorithm A, that produces elements with better quality compared to algorithm B used when the parameter is non-zero.

For tetrahedral meshes, after using algorithm A, the mesh cannot be refined locally using methods like GeneralRefinement() unless it is re-finalized using Finalize() with the parameter refine set to true. Note that calling Finalize() in this way will generally invalidate any FiniteElementSpaces and GridFunctions defined on the mesh.

Definition at line 11140 of file mesh.cpp.

◆ UniformRefinement2D()

virtual void mfem::Mesh::UniformRefinement2D ( )
inlineprotectedvirtual

Refine a mixed 2D mesh uniformly.

Reimplemented in mfem::ParMesh.

Definition at line 466 of file mesh.hpp.

◆ UniformRefinement2D_base()

void mfem::Mesh::UniformRefinement2D_base ( bool update_nodes = true)
protected

Definition at line 9733 of file mesh.cpp.

◆ UniformRefinement3D()

virtual void mfem::Mesh::UniformRefinement3D ( )
inlineprotectedvirtual

Refine a mixed 3D mesh uniformly.

Reimplemented in mfem::ParMesh.

Definition at line 476 of file mesh.hpp.

◆ UniformRefinement3D_base()

void mfem::Mesh::UniformRefinement3D_base ( Array< int > * f2qf = NULL,
DSTable * v_to_v_p = NULL,
bool update_nodes = true )
protected

Definition at line 9892 of file mesh.cpp.

◆ UnmarkInternalBoundaries()

void mfem::Mesh::UnmarkInternalBoundaries ( Array< int > & bdr_marker,
bool excl = true ) const
virtual

Unmark boundary attributes of internal boundaries.

Parameters
[in,out]bdr_markerArray of length bdr_attributes.Max(). Entries associated with internal boundaries will be set to zero. Other entries will remain unchanged.
[in]exclOnly unmark entries which exclusively contain internal faces [default: true].

Reimplemented in mfem::ParMesh.

Definition at line 1675 of file mesh.cpp.

◆ UnmarkNamedBoundaries()

void mfem::Mesh::UnmarkNamedBoundaries ( const std::string & set_name,
Array< int > & bdr_marker ) const
virtual

Unmark boundary attributes in the named set.

Parameters
[in]set_nameName of a named boundary attribute set.
[in,out]bdr_markerArray of length bdr_attributes.Max(). Entries associated with the named set will be set to zero. Other entries will remain unchanged.

Definition at line 1720 of file mesh.cpp.

◆ UpdateNodes()

void mfem::Mesh::UpdateNodes ( )
protected

Update the nodes of a curved mesh after the topological part of a Mesh::Operation, such as refinement, has been performed.

If Nodes GridFunction is defined, i.e. not NULL, this method calls NodesUpdated().

Note
Unlike the similarly named public method NodesUpdated() this method modifies the mesh nodes (if they exist) and calls NodesUpdated().

Definition at line 9718 of file mesh.cpp.

◆ UpdateNURBS()

void mfem::Mesh::UpdateNURBS ( )
protected

Update this NURBS Mesh and its NURBS data structures after a change, such as refinement, derefinement, or degree change.

Definition at line 6405 of file mesh.cpp.

Friends And Related Symbol Documentation

◆ adios2stream

friend class adios2stream
friend

Definition at line 74 of file mesh.hpp.

◆ NCMesh

friend class NCMesh
friend

Definition at line 66 of file mesh.hpp.

◆ NCNURBSExtension

friend class NCNURBSExtension
friend

Definition at line 68 of file mesh.hpp.

◆ NURBSExtension

friend class NURBSExtension
friend

Definition at line 67 of file mesh.hpp.

◆ ParMesh

friend class ParMesh
friend

Definition at line 70 of file mesh.hpp.

◆ ParNCMesh

friend class ParNCMesh
friend

Definition at line 71 of file mesh.hpp.

◆ Tetrahedron

friend class Tetrahedron
friend

Definition at line 276 of file mesh.hpp.

Member Data Documentation

◆ attribute_sets

AttributeSets mfem::Mesh::attribute_sets

Named sets of element attributes.

Definition at line 307 of file mesh.hpp.

◆ attributes

Array<int> mfem::Mesh::attributes

A list of all unique element attributes used by the Mesh.

Definition at line 302 of file mesh.hpp.

◆ bdr_attribute_sets

AttributeSets mfem::Mesh::bdr_attribute_sets

Named sets of boundary element attributes.

Definition at line 310 of file mesh.hpp.

◆ bdr_attributes

Array<int> mfem::Mesh::bdr_attributes

A list of all unique boundary attributes used by the Mesh.

Definition at line 304 of file mesh.hpp.

◆ bdr_face_attrs_cache

Array<int> mfem::Mesh::bdr_face_attrs_cache
mutableprotected

internal cache for boundary element attributes

Definition at line 114 of file mesh.hpp.

◆ BdrTransformation

IsoparametricTransformation mfem::Mesh::BdrTransformation
protected

Definition at line 257 of file mesh.hpp.

◆ be_to_face

Array<int> mfem::Mesh::be_to_face
protected

Definition at line 245 of file mesh.hpp.

◆ bel_to_edge

Table* mfem::Mesh::bel_to_edge
protected

Definition at line 247 of file mesh.hpp.

◆ boundary

Array<Element *> mfem::Mesh::boundary
protected

Definition at line 108 of file mesh.hpp.

◆ CoarseFineTr

CoarseFineTransformations mfem::Mesh::CoarseFineTr
mutableprotected

Definition at line 262 of file mesh.hpp.

◆ Dim

int mfem::Mesh::Dim
protected

Definition at line 78 of file mesh.hpp.

◆ edge_vertex

Table* mfem::Mesh::edge_vertex
mutableprotected

Definition at line 254 of file mesh.hpp.

◆ EdgeTransformation

IsoparametricTransformation mfem::Mesh::EdgeTransformation
protected

Definition at line 258 of file mesh.hpp.

◆ el_to_edge

Table* mfem::Mesh::el_to_edge
protected

Definition at line 242 of file mesh.hpp.

◆ el_to_el

Table* mfem::Mesh::el_to_el
protected

Definition at line 244 of file mesh.hpp.

◆ el_to_face

Table* mfem::Mesh::el_to_face
protected

Definition at line 243 of file mesh.hpp.

◆ elem_attrs_cache

Array<int> mfem::Mesh::elem_attrs_cache
mutableprotected

internal cache for element attributes

Definition at line 112 of file mesh.hpp.

◆ elements

Array<Element *> mfem::Mesh::elements
protected

Definition at line 102 of file mesh.hpp.

◆ face_edge

Table* mfem::Mesh::face_edge
mutableprotected

Definition at line 253 of file mesh.hpp.

◆ face_geom_factors

Array<FaceGeometricFactors*> mfem::Mesh::face_geom_factors

Optional face geometric factors.

Definition at line 315 of file mesh.hpp.

◆ face_indices

Array<int> mfem::Mesh::face_indices[2]
mutableprotected

cache for FaceIndices(ftype)

Definition at line 283 of file mesh.hpp.

◆ face_to_elem

Table* mfem::Mesh::face_to_elem
mutableprotected

Definition at line 252 of file mesh.hpp.

◆ FaceElemTr

FaceElementTransformations mfem::Mesh::FaceElemTr
protected

Definition at line 259 of file mesh.hpp.

◆ faces

Array<Element *> mfem::Mesh::faces
protected

Definition at line 109 of file mesh.hpp.

◆ faces_info

Array<FaceInfo> mfem::Mesh::faces_info
protected

Definition at line 239 of file mesh.hpp.

◆ FaceTransformation

IsoparametricTransformation mfem::Mesh::FaceTransformation
protected

Definition at line 258 of file mesh.hpp.

◆ geom_factors

Array<GeometricFactors*> mfem::Mesh::geom_factors

Optional geometric factors.

Definition at line 314 of file mesh.hpp.

◆ inv_face_indices

std::unordered_map<int, int> mfem::Mesh::inv_face_indices[2]
mutableprotected

cache for FaceIndices(ftype)

Definition at line 285 of file mesh.hpp.

◆ last_operation

Operation mfem::Mesh::last_operation
protected

Definition at line 329 of file mesh.hpp.

◆ mesh_geoms

int mfem::Mesh::mesh_geoms
protected

Definition at line 92 of file mesh.hpp.

◆ meshgen

int mfem::Mesh::meshgen
protected

Definition at line 90 of file mesh.hpp.

◆ nbBoundaryFaces

int mfem::Mesh::nbBoundaryFaces
protected

Definition at line 87 of file mesh.hpp.

◆ nbInteriorFaces

int mfem::Mesh::nbInteriorFaces
mutableprotected

These variables store the number of Interior and Boundary faces. Calling fes->GetMesh()->GetNBE() doesn't return the expected value in 3D because periodic meshes in 3D have some of their faces marked as boundary for visualization purpose in GLVis.

Definition at line 87 of file mesh.hpp.

◆ nc_faces_info

Array<NCFaceInfo> mfem::Mesh::nc_faces_info
protected

Definition at line 240 of file mesh.hpp.

◆ ncmesh

NCMesh* mfem::Mesh::ncmesh

Optional nonconforming mesh extension.

Definition at line 313 of file mesh.hpp.

◆ Nodes

GridFunction* mfem::Mesh::Nodes
protected

Definition at line 267 of file mesh.hpp.

◆ nodes_sequence

long mfem::Mesh::nodes_sequence
protected

Counter for geometric factor invalidation.

Definition at line 100 of file mesh.hpp.

◆ NumOfBdrElements

int mfem::Mesh::NumOfBdrElements
protected

Definition at line 81 of file mesh.hpp.

◆ NumOfEdges

int mfem::Mesh::NumOfEdges
protected

Definition at line 82 of file mesh.hpp.

◆ NumOfElements

int mfem::Mesh::NumOfElements
protected

Definition at line 81 of file mesh.hpp.

◆ NumOfFaces

int mfem::Mesh::NumOfFaces
protected

Definition at line 82 of file mesh.hpp.

◆ NumOfVertices

int mfem::Mesh::NumOfVertices
protected

Definition at line 81 of file mesh.hpp.

◆ NURBSext

NURBSExtension* mfem::Mesh::NURBSext

Optional NURBS mesh extension.

Definition at line 312 of file mesh.hpp.

◆ own_nodes

int mfem::Mesh::own_nodes
protected

Definition at line 268 of file mesh.hpp.

◆ remove_unused_vertices

bool mfem::Mesh::remove_unused_vertices = true
static

Definition at line 321 of file mesh.hpp.

◆ sequence

long mfem::Mesh::sequence
protected

Definition at line 97 of file mesh.hpp.

◆ spaceDim

int mfem::Mesh::spaceDim
protected

Definition at line 79 of file mesh.hpp.

◆ TetMemory

MemAlloc<Tetrahedron, 1024> mfem::Mesh::TetMemory
protected

Definition at line 277 of file mesh.hpp.

◆ tmp_vertex_parents

Array<Triple<int, int, int> > mfem::Mesh::tmp_vertex_parents
protected

Definition at line 281 of file mesh.hpp.

◆ Transformation

IsoparametricTransformation mfem::Mesh::Transformation
protected

Definition at line 256 of file mesh.hpp.

◆ Transformation2

IsoparametricTransformation mfem::Mesh::Transformation2
protected

Definition at line 256 of file mesh.hpp.

◆ vertices

Array<Vertex> mfem::Mesh::vertices
protected

Definition at line 107 of file mesh.hpp.

◆ vtk_quadratic_hex

const int mfem::Mesh::vtk_quadratic_hex
staticprotected
Initial value:
=
{
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
24, 22, 21, 23, 20, 25, 26
}

Definition at line 273 of file mesh.hpp.

◆ vtk_quadratic_pyramid

const int mfem::Mesh::vtk_quadratic_pyramid
staticprotected
Initial value:
=
{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12}

Definition at line 271 of file mesh.hpp.

◆ vtk_quadratic_tet

const int mfem::Mesh::vtk_quadratic_tet
staticprotected
Initial value:
=
{ 0, 1, 2, 3, 4, 7, 5, 6, 8, 9 }

Definition at line 270 of file mesh.hpp.

◆ vtk_quadratic_wedge

const int mfem::Mesh::vtk_quadratic_wedge
staticprotected
Initial value:
=
{ 0, 2, 1, 3, 5, 4, 8, 7, 6, 11, 10, 9, 12, 14, 13, 17, 16, 15}

Definition at line 272 of file mesh.hpp.


The documentation for this class was generated from the following files: