19 #include "../config/config.hpp"
20 #include "../general/hash.hpp"
21 #include "../linalg/densemat.hpp"
24 #include "../fem/geom.hpp"
89 NCMesh(
const Mesh *mesh, std::istream *vertex_parents = NULL);
300 if (!ret) {
delete this; }
314 {
pos[0] = x,
pos[1] = y, pos[2] = z; }
315 Vertex(
const Vertex& other) { std::memcpy(
this, &other,
sizeof(*
this)); }
325 Edge(
const Edge &other) { std::memcpy(
this, &other,
sizeof(*
this)); }
475 int fattr0,
int fattr1,
int fattr2,
476 int fattr3,
int fattr4,
int fattr5);
480 int eattr0,
int eattr1,
int eattr2,
int eattr3);
483 int attr,
int eattr0,
int eattr1,
int eattr2);
494 Node* mid[4] = NULL )
500 Node* mid12,
Node* mid34,
int level = 0);
603 for (
int i = 0; i <
dim; i++)
613 for (
int i = 0; i <
dim; i++)
685 int& h_level,
int& v_level)
const;
694 void CountObjects(
int &nelem,
int &nvert,
int &nedges)
const;
NCList face_list
lazy-initialized list of faces, see GetFaceList
NCList edge_list
lazy-initialized list of edges, see GetEdgeList
NCMesh(const Mesh *mesh, std::istream *vertex_parents=NULL)
Element * NewHexahedron(Node *n0, Node *n1, Node *n2, Node *n3, Node *n4, Node *n5, Node *n6, Node *n7, int attr, int fattr0, int fattr1, int fattr2, int fattr3, int fattr4, int fattr5)
CoarseFineTransformations transforms
storage for data returned by Get[De]RefinementTransforms()
void FindNeighbors(const Element *elem, Array< Element * > &neighbors, const Array< Element * > *search_set=NULL)
char ref_type
refinement XYZ bit mask (7 = full isotropic)
const CoarseFineTransformations & GetDerefinementTransforms()
int index
edge number in the Mesh
char flag
generic flag/marker, can be used by algorithms
Array< Element * > coarse_elements
state of leaf_elements before Refine(), set by MarkCoarseLevel()
int PrintElements(std::ostream &out, Element *elem, int &coarse_id) const
PointMatrix(const Point &p0, const Point &p1, const Point &p2)
Point(const Point &p0, const Point &p1)
Slave(int index, Element *element, int local)
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)
Node * PeekAltParents(Node *v1, Node *v2)
virtual void LimitNCLevel(int max_nc_level)
void PrintMemoryDetail() const
int index
element number in the Mesh, -1 if refined
PointMatrix(const Point &p0, const Point &p1, const Point &p2, const Point &p3)
virtual int GetNumGhosts() const
int GetElementGeometry() const
Return the type of elements in the mesh.
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 DebugLeafOrder() const
Print the space-filling curve formed by the sequence of leaf elements.
int attribute
boundary element attribute, -1 if internal edge (2D)
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 InitDerefTransforms()
void RefElementNodes(Element *elem)
char geom
Geometry::Type of the element.
static int find_node(Element *elem, Node *node)
void SetDerefMatrixCodes(Element *parent, Array< Element * > &coarse)
int FaceSplitType(Node *v1, Node *v2, Node *v3, Node *v4, Node *mid[4]=NULL) const
virtual void ElementSharesFace(Element *elem, Face *face)
void OrientedPointMatrix(DenseMatrix &oriented_matrix) const
Return the point matrix oriented according to the master and slave edges.
static PointMatrix pm_tri_identity
int index
vertex number in the Mesh
void NeighborExpand(const Array< Element * > &elements, Array< Element * > &expanded, const Array< Element * > *search_set=NULL)
MeshId(int index=-1, Element *element=NULL, int local=-1)
void CountObjects(int &nelem, int &nvert, int &nedges) const
const Point & operator()(int i) const
std::vector< MeshId > conforming
Point & operator()(int i)
void GetLimitRefinements(Array< Refinement > &refinements, int max_level)
Element * parent
parent element, NULL if this is a root element
Vertex * NewVertex(Node *v1, Node *v2)
bool NodeSetY1(Node *node, Node **n)
int spaceDim
dimensions of the elements and the vertex coordinates
Array< int > vertex_nodeId
int attribute
boundary element attribute, -1 if internal face
int index
Mesh element number.
int master
master number (in Mesh numbering)
Element * element
NCMesh::Element containing this vertex/edge/face.
const NCList & GetFaceList()
Return the current list of conforming and nonconforming faces.
virtual void OnMeshUpdated(Mesh *mesh)
A parallel extension of the NCMesh class.
Element * NewQuadrilateral(Node *n0, Node *n1, Node *n2, Node *n3, int attr, int eattr0, int eattr1, int eattr2, int eattr3)
void DebugNeighbors(Array< char > &elem_set)
void CollectEdgeVertices(Node *v0, Node *v1, Array< int > &indices)
virtual bool IsGhost(const Element *elem) const
Point(const Point &p0, const Point &p1, const Point &p2, const Point &p3)
Vertex(double x, double y, double z)
int num_vertices
width of the table
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'
Element * elem[2]
up to 2 elements sharing the face
static void UnrefEdge(Node *node, HashTable< Node > &nodes)
void GetMatrix(DenseMatrix &point_matrix) const
void CheckAnisoFace(Node *v1, Node *v2, Node *v3, Node *v4, Node *mid12, Node *mid34, int level=0)
virtual void Derefine(const Array< int > &derefs)
void RegisterFaces(Element *elem, int *fattr=NULL)
std::vector< Master > masters
virtual void UpdateVertices()
update Vertex::index and vertex_nodeId
void RegisterElement(Element *e)
int ReorderFacePointMat(Node *v0, Node *v1, Node *v2, Node *v3, Element *elem, DenseMatrix &mat) const
Element * CopyHierarchy(Element *elem)
void RefineElement(Element *elem, char ref_type)
void FaceSplitLevel(Node *v1, Node *v2, Node *v3, Node *v4, int &h_level, int &v_level) const
Element(int geom, int attr)
virtual void BuildEdgeList()
const CoarseFineTransformations & GetRefinementTransforms()
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.
virtual void ElementSharesEdge(Element *elem, Edge *edge)
int Size() const
Returns the number of TYPE I elements.
A class for non-conforming AMR on higher-order hexahedral, quadrilateral or triangular meshes...
bool NodeSetX1(Node *node, Node **n)
virtual void GetBoundaryClosure(const Array< int > &bdr_attr_is_ess, Array< int > &bdr_vertices, Array< int > &bdr_edges)
Embedding(int elem, int matrix=0)
static GeomInfo GI[Geometry::NumGeom]
void DeleteHierarchy(Element *elem)
int slaves_end
slave faces
bool Iso
true if the mesh only contains isotropic refinements
void TraverseEdge(Node *v0, Node *v1, double t0, double t1, int flags, int level)
Point(double x, double y, double z)
void DerefineElement(Element *elem)
std::map< std::string, int > RefPathMap
Array< Node * > boundary_edges
subset of all edges, set by BuildEdgeList
void FindSetNeighbors(const Array< char > &elem_set, Array< Element * > *neighbors, Array< char > *neighbor_set=NULL)
int SpaceDimension() const
std::vector< Slave > slaves
virtual void BuildFaceList()
void ForceRefinement(Node *v1, Node *v2, Node *v3, Node *v4)
void SetVertexPositions(const Array< mfem::Vertex > &vertices)
I/O: Set positions of all vertices (used by mesh loader).
int edge_flags
edge orientation flags
static const PointMatrix & GetGeomIdentity(int geom)
Element * child[8]
2-8 children (if ref_type != 0)
Face * GetFace(Element *elem, int face_no)
Array< Element * > leaf_elements
mfem::Element * NewMeshElement(int geom) const
void UpdateLeafElements()
Vertex(const Vertex &other)
bool NodeSetZ1(Node *node, Node **n)
Node * GetMidEdgeVertexSimple(Node *v1, Node *v2)
void BuildElementToVertexTable()
void UnrefElementNodes(Element *elem)
Master(int index, Element *element, int local, int sb, int se)
static PointMatrix pm_quad_identity
void CheckIsoFace(Node *v1, Node *v2, Node *v3, Node *v4, Node *e1, Node *e2, Node *e3, Node *e4, Node *midf)
Node * GetMidFaceVertex(Node *e1, Node *e2, Node *e3, Node *e4)
Element(const Element &other)
void CollectFaceVertices(Node *v0, Node *v1, Node *v2, Node *v3, Array< int > &indices)
bool NodeSetZ2(Node *node, Node **n)
void Initialize(const mfem::Element *elem)
bool NodeSetX2(Node *node, Node **n)
void GetMeshComponents(Array< mfem::Vertex > &vertices, Array< mfem::Element * > &elements, Array< mfem::Element * > &boundary) const
Return the basic Mesh arrays for the current finest level.
Node * node[8]
element corners (if ref_type == 0)
void CollectLeafElements(Element *elem, int state)
Element * NewTriangle(Node *n0, Node *n1, Node *n2, int attr, int eattr0, int eattr1, int eattr2)
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)
Array< ElemRefType > ref_stack
stack of scheduled refinements (temporary)
static void find_face_nodes(const Face *face, Node *node[4])
Array< Element * > root_elements
long MemoryUsage() const
Return total number of bytes allocated.
Node * GetMidEdgeVertex(Node *v1, Node *v2)
int EdgeSplitLevel(Node *v1, Node *v2) const
Element * GetSingleElement() const
Return one of elem[0] or elem[1] and make sure the other is NULL.
void PrintCoarseElements(std::ostream &out) const
I/O: Print the "coarse_elements" section of the mesh file (ver. >= 1.1).
static int find_element_edge(Element *elem, int v0, int v1)
const NCList & GetEdgeList()
Return the current list of conforming and nonconforming edges.
void TraverseFace(Node *v0, Node *v1, Node *v2, Node *v3, const PointMatrix &pm, int level)
void UpdateElementToVertexTable()
int GetElementDepth(int i) const
Return the distance of leaf 'i' from the root.
void CountSplits(Element *elem, int splits[3]) const
void ForgetElement(Element *e)
char ref_type
bit mask of X,Y,Z refinements (bits 0,1,2 respectively)
ElemRefType(Element *elem, int type)
bool NodeSetY2(Node *node, Node **n)
void LoadVertexParents(std::istream &input)
Rank 3 tensor (array of matrices)
int CountElements(Element *elem) const
Abstract data type element.
Point & operator=(const Point &src)
Array< Face * > boundary_faces
subset of all faces, set by BuildFaceList
void TraverseRefinements(Element *elem, int coarse_index, std::string &ref_path, RefPathMap &map)
int rank
processor number (ParNCMesh)
void CollectDerefinements(Element *elem, Array< Connection > &list)
DenseMatrix point_matrix
position within the master edge/face
Defines the position of a fine element within a coarse element.
virtual void Refine(const Array< Refinement > &refinements)
int matrix
index into CoarseFineTransformations::point_matrices
int GetEdgeMaster(int v1, int v2) const
void UnrefVertex(HashTable< Node > &nodes)