15 #include "../config/config.hpp"
16 #include "../general/hash.hpp"
17 #include "../general/globals.hpp"
18 #include "../linalg/densemat.hpp"
21 #include "../fem/geom.hpp"
69 Table &coarse_to_fine,
71 Table &ref_type_to_matrix,
106 explicit NCMesh(
const Mesh *mesh, std::istream *vertex_parents = NULL);
194 void Clear(
bool hard =
false);
199 const MeshId&
LookUp(
int index,
int *type = NULL)
const;
281 bool oriented =
true)
const;
291 int vert_index[4],
int edge_index[4],
292 int edge_orientation[4])
const;
522 int n4,
int n5,
int n6,
int n7,
524 int fattr0,
int fattr1,
int fattr2,
525 int fattr3,
int fattr4,
int fattr5);
529 int eattr0,
int eattr1,
int eattr2,
int eattr3);
532 int attr,
int eattr0,
int eattr1,
int eattr2);
545 int mid12,
int mid34,
int level = 0);
548 int en1,
int en2,
int en3,
int en4,
int midf);
585 const PointMatrix& pm,
int level);
587 void TraverseEdge(
int vn0,
int vn1,
double t0,
double t1,
int flags,
657 for (
int i = 0; i <
dim; i++)
667 for (
int i = 0; i <
dim; i++)
753 int& h_level,
int& v_level)
const;
NCList face_list
lazy-initialized list of faces, see GetFaceList
void CollectLeafElements(int elem, int state)
NCList edge_list
lazy-initialized list of edges, see GetEdgeList
NCMesh(const Mesh *mesh, std::istream *vertex_parents=NULL)
int Size() const
Logical size of the array.
static void GridSfcOrdering3D(int width, int height, int depth, Array< int > &coords)
CoarseFineTransformations transforms
storage for data returned by Get[De]RefinementTransforms()
static void GridSfcOrdering2D(int width, int height, Array< int > &coords)
int NewQuadrilateral(int n0, int n1, int n2, int n3, int attr, int eattr0, int eattr1, int eattr2, int eattr3)
int elem[2]
up to 2 elements sharing the face
char ref_type
refinement XYZ bit mask (7 = full isotropic)
Array< double > top_vertex_pos
coordinates of top-level vertices (organized as triples)
void SetDerefMatrixCodes(int parent, Array< int > &fine_coarse)
const CoarseFineTransformations & GetDerefinementTransforms()
char flag
generic flag/marker, can be used by algorithms
PointMatrix(const Point &p0, const Point &p1, const Point &p2)
Point(const Point &p0, const Point &p1)
void PrintVertexParents(std::ostream &out) const
I/O: Print the "vertex_parents" section of the mesh file (ver. >= 1.1).
void GetPointMatrix(int geom, const char *ref_path, DenseMatrix &matrix)
virtual void LimitNCLevel(int max_nc_level)
void GetFaceVerticesEdges(const MeshId &face_id, int vert_index[4], int edge_index[4], int edge_orientation[4]) const
Return Mesh vertex and edge indices of a face identified by 'face_id'.
virtual void Trim()
Save memory by releasing all non-essential and cached data.
Geometry::Type GetElementGeometry() const
Return the type of elements in the mesh.
int index
element number in the Mesh, -1 if refined
PointMatrix(const Point &p0, const Point &p1, const Point &p2, const Point &p3)
void CopyElements(int elem, const BlockArray< Element > &tmp_elements, Array< int > &index_map)
void ForceRefinement(int vn1, int vn2, int vn3, int vn4)
virtual int GetNumGhostElements() const
PointMatrix(const Point &p0, const Point &p1, const Point &p2, const Point &p3, const Point &p4, const Point &p5, const Point &p6, const Point &p7)
Lists all edges/faces in the nonconforming mesh.
void GetMeshComponents(Array< mfem::Vertex > &mvertices, Array< mfem::Element * > &melements, Array< mfem::Element * > &mboundary) const
Return the basic Mesh arrays for the current finest level.
void TraverseEdge(int vn0, int vn1, double t0, double t1, int flags, int level)
void ClearTransforms()
Free all internal data created by the above three functions.
Table derefinements
possible derefinements, see GetDerefinementTable
Data type dense matrix using column-major storage.
void CollectFaceVertices(int v0, int v1, int v2, int v3, Array< int > &indices)
NCList vertex_list
lazy-initialized list of vertices, see GetVertexList
void InitDerefTransforms()
BlockArray< Element >::iterator elem_iterator
void InitRootState(int root_count)
int GetEdgeNCOrientation(const MeshId &edge_id) const
void OrientedPointMatrix(DenseMatrix &oriented_matrix) const
Return the point matrix oriented according to the master and slave edges.
void CheckAnisoFace(int vn1, int vn2, int vn3, int vn4, int mid12, int mid34, int level=0)
virtual int GetNumGhostVertices() const
static PointMatrix pm_tri_identity
void CountSplits(int elem, int splits[3]) const
void CollectDerefinements(int elem, Array< Connection > &list)
const Point & operator()(int i) const
std::vector< MeshId > conforming
Point & operator()(int i)
void GetLimitRefinements(Array< Refinement > &refinements, int max_level)
int PrintMemoryDetail() const
int spaceDim
dimensions of the elements and the vertex coordinates
Array< int > vertex_nodeId
int attribute
boundary element attribute, -1 if internal face
void DebugDump(std::ostream &out) const
void FindFaceNodes(int face, int node[4])
int index
Mesh element number.
int master
master number (in Mesh numbering)
const NCList & GetFaceList()
Return the current list of conforming and nonconforming faces.
const MeshId & LookUp(int index, int *type=NULL) const
virtual void OnMeshUpdated(Mesh *mesh)
void DebugLeafOrder(std::ostream &out) const
A parallel extension of the NCMesh class.
void CollectEdgeVertices(int v0, int v1, Array< int > &indices)
Array< Refinement > ref_stack
stack of scheduled refinements (temporary)
Point(const Point &p0, const Point &p1, const Point &p2, const Point &p3)
MeshId(int index=-1, int element=-1, int local=-1)
virtual bool IsGhost(const Element &el) const
void CheckIsoFace(int vn1, int vn2, int vn3, int vn4, int en1, int en2, int en3, int en4, int midf)
Face * GetFace(Element &elem, int face_no)
void TraverseRefinements(int elem, int coarse_index, std::string &ref_path, RefPathMap &map)
Element(Geometry::Type geom, int attr)
int PrintElements(std::ostream &out, int elem, int &coarse_id) const
Refinement(int index, int type=7)
int index
face number in the Mesh
const Table & GetDerefinementTable()
Table element_vertex
leaf-element to vertex table, see FindSetNeighbors
int local
local number within 'element'
int FindAltParents(int node1, int node2)
int Append(const T &el)
Append element to array, resize if necessary.
void GetMatrix(DenseMatrix &point_matrix) const
int AddElement(const Element &el)
bool NodeSetY1(int node, int *n)
virtual void Derefine(const Array< int > &derefs)
void FindNeighbors(int elem, Array< int > &neighbors, const Array< int > *search_set=NULL)
std::vector< Master > masters
Array< int > coarse_elements
state of leaf_elements before Refine(), set by MarkCoarseLevel()
virtual void UpdateVertices()
update Vertex::index and vertex_nodeId
void RegisterFaces(int elem, int *fattr=NULL)
virtual void BuildEdgeList()
const CoarseFineTransformations & GetRefinementTransforms()
Geometry::Type geom
Geometry::Type of the element.
void LoadCoarseElements(std::istream &input)
I/O: Load the element refinement hierarchy from a mesh file.
Identifies a vertex/edge/face in both Mesh and NCMesh.
int parent
parent element, -1 if this is a root element, -2 if free
Slave(int index, int element, int local)
virtual void ElementSharesFace(int elem, int local, int face)
virtual void ElementSharesVertex(int elem, int local, int vnode)
Master(int index, int element, int local, int sb, int se)
int Size() const
Returns the number of TYPE I elements.
A class for non-conforming AMR on higher-order hexahedral, quadrilateral or triangular meshes...
virtual void GetBoundaryClosure(const Array< int > &bdr_attr_is_ess, Array< int > &bdr_vertices, Array< int > &bdr_edges)
int element
NCMesh::Element containing this vertex/edge/face.
Embedding(int elem, int matrix=0)
static GeomInfo GI[Geometry::NumGeom]
void Clear(bool hard=false)
HashTable< Node >::iterator node_iterator
int slaves_end
slave faces
bool NodeSetY2(int node, int *n)
int NewTriangle(int n0, int n1, int n2, int attr, int eattr0, int eattr1, int eattr2)
void DeleteUnusedFaces(const Array< int > &elemFaces)
bool Iso
true if the mesh only contains isotropic refinements
Point(double x, double y, double z)
std::map< std::string, int > RefPathMap
int FaceSplitType(int v1, int v2, int v3, int v4, int mid[4]=NULL) const
int SpaceDimension() const
std::vector< Slave > slaves
virtual void BuildFaceList()
Nonconforming edge/face within a bigger edge/face.
void DerefineElement(int elem)
int ReorderFacePointMat(int v0, int v1, int v2, int v3, int elem, DenseMatrix &mat) const
void SetVertexPositions(const Array< mfem::Vertex > &vertices)
I/O: Set positions of all vertices (used by mesh loader).
int edge_flags
edge orientation flags
HashTable< Node >::const_iterator node_const_iterator
const NCList & GetVertexList()
void RegisterElement(int e)
static const PointMatrix & GetGeomIdentity(int geom)
mfem::Element * NewMeshElement(int geom) const
void DeleteLast()
Delete the last entry.
void UpdateLeafElements()
int RetrieveNode(const Element &el, int index)
Return el.node[index] correctly, even if the element is refined.
bool NodeSetZ2(int node, int *n)
static GeomInfo & gi_quad
void BuildElementToVertexTable()
bool NodeSetZ1(int node, int *n)
void ForgetElement(int e)
int GetMidFaceNode(int en1, int en2, int en3, int en4)
void RefineElement(int elem, char ref_type)
Geometry::Type GetFaceGeometry() const
int NewHexahedron(int n0, int n1, int n2, int n3, int n4, int n5, int n6, int n7, int attr, int fattr0, int fattr1, int fattr2, int fattr3, int fattr4, int fattr5)
Array< int > boundary_faces
subset of all faces, set by BuildFaceList
int child[8]
2-8 children (if ref_type != 0)
const NCList & GetNCList(int entity)
Return vertex/edge/face list (entity = 0/1/2, respectively).
Array< int > leaf_elements
static PointMatrix pm_quad_identity
void TraverseFace(int vn0, int vn1, int vn2, int vn3, const PointMatrix &pm, int level)
int EdgeSplitLevel(int vn1, int vn2) const
static int find_element_edge(const Element &el, int vn0, int vn1)
void Initialize(const mfem::Element *elem)
Array< int > free_element_ids
bool NodeSetX2(int node, int *n)
int parent
Element index in the coarse mesh.
Point(double x, double y)
virtual void AssignLeafIndices()
static PointMatrix pm_hex_identity
static int find_hex_face(int a, int b, int c)
virtual void CheckDerefinementNCLevel(const Table &deref_table, Array< int > &level_ok, int max_nc_level)
T & Last()
Return the last element in the array.
void NeighborExpand(const Array< int > &elems, Array< int > &expanded, const Array< int > *search_set=NULL)
BlockArray< Element > elements
void FindSetNeighbors(const Array< char > &elem_set, Array< int > *neighbors, Array< char > *neighbor_set=NULL)
void GetEdgeVertices(const MeshId &edge_id, int vert_index[2], bool oriented=true) const
Return Mesh vertex indices of an edge identified by 'edge_id'.
long MemoryUsage() const
Return total number of bytes allocated.
void PrintCoarseElements(std::ostream &out) const
I/O: Print the "coarse_elements" section of the mesh file (ver. >= 1.1).
virtual void BuildVertexList()
const NCList & GetEdgeList()
Return the current list of conforming and nonconforming edges.
void UpdateElementToVertexTable()
friend struct CompareRanks
virtual void ElementSharesEdge(int elem, int local, int enode)
int GetElementDepth(int i) const
Return the distance of leaf 'i' from the root.
HashTable< Face >::iterator face_iterator
char ref_type
bit mask of X,Y,Z refinements (bits 0,1,2 respectively)
OutStream out(std::cout)
Global stream used by the library for standard output. Initially it uses the same std::streambuf as s...
static int find_node(const Element &el, int node)
void LoadVertexParents(std::istream &input)
int GetMidEdgeNode(int vn1, int vn2)
Rank 3 tensor (array of matrices)
Abstract data type element.
void UnrefElement(int elem, Array< int > &elemFaces)
Point & operator=(const Point &src)
void PrintStats(std::ostream &out=mfem::out) const
int GetSingleElement() const
Return one of elem[0] or elem[1] and make sure the other is -1.
int FindNodeExt(const Element &el, int node, bool abort=false)
Extended version of find_node: works if 'el' is refined; optional abort.
const double * CalcVertexPos(int node) const
int rank
processor number (ParNCMesh), -1 if undefined/unknown
bool NodeSetX1(int node, int *n)
int node[8]
element corners (if ref_type == 0)
DenseMatrix point_matrix
position within the master edge/face
Defines the position of a fine element within a coarse element.
void RefElement(int elem)
void FaceSplitLevel(int vn1, int vn2, int vn3, int vn4, int &h_level, int &v_level) const
HashTable< Face >::const_iterator face_const_iterator
virtual void Refine(const Array< Refinement > &refinements)
int matrix
Index into the DenseTensor corresponding to the parent Geometry::Type stored in CoarseFineTransformat...
int GetEdgeMaster(int v1, int v2) const