MFEM  v3.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
Classes | Public Member Functions | Protected Types | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Friends | List of all members
mfem::NCMesh Class Reference

A class for non-conforming AMR on higher-order hexahedral, quadrilateral or triangular meshes. More...

#include <ncmesh.hpp>

Collaboration diagram for mfem::NCMesh:
[legend]

Classes

struct  Dependency
 
struct  DofData
 
struct  Edge
 
struct  Element
 
struct  Face
 
struct  FineTransform
 
struct  Node
 
struct  Point
 
struct  PointMatrix
 
struct  RefCount
 
struct  RefStackItem
 
struct  Vertex
 

Public Member Functions

 NCMesh (const Mesh *mesh)
 
int Dimension () const
 
void Refine (const Array< Refinement > &refinements)
 
void LimitNCLevel (int max_level)
 
SparseMatrix * GetInterpolation (FiniteElementSpace *space, SparseMatrix **cR_ptr=NULL)
 
void MarkCoarseLevel ()
 
void ClearCoarseLevel ()
 Free the internally stored array of coarse leaf elements. More...
 
FineTransform * GetFineTransforms ()
 
int GetEdgeMaster (int v1, int v2) const
 
long MemoryUsage ()
 
 ~NCMesh ()
 

Protected Types

typedef Array< Dependency > DepList
 

Protected Member Functions

void GetVerticesElementsBoundary (Array< mfem::Vertex > &vertices, Array< mfem::Element * > &elements, Array< mfem::Element * > &boundary)
 
void SetEdgeIndicesFromMesh (Mesh *mesh)
 
void SetFaceIndicesFromMesh (Mesh *mesh)
 
void Refine (Element *elem, int ref_type)
 
void UpdateVertices ()
 
void GetLeafElements (Element *e)
 
void UpdateLeafElements ()
 
void DeleteHierarchy (Element *elem)
 
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)
 
Element * NewQuadrilateral (Node *n0, Node *n1, Node *n2, Node *n3, int attr, int eattr0, int eattr1, int eattr2, int eattr3)
 
Element * NewTriangle (Node *n0, Node *n1, Node *n2, int attr, int eattr0, int eattr1, int eattr2)
 
Vertex * NewVertex (Node *v1, Node *v2)
 
Node * GetMidEdgeVertex (Node *v1, Node *v2)
 
Node * GetMidEdgeVertexSimple (Node *v1, Node *v2)
 
Node * GetMidFaceVertex (Node *e1, Node *e2, Node *e3, Node *e4)
 
int FaceSplitType (Node *v1, Node *v2, Node *v3, Node *v4, Node *mid[4]=NULL)
 
void ForceRefinement (Node *v1, Node *v2, Node *v3, Node *v4)
 
void CheckAnisoFace (Node *v1, Node *v2, Node *v3, Node *v4, Node *mid12, Node *mid34, int level=0)
 
void CheckIsoFace (Node *v1, Node *v2, Node *v3, Node *v4, Node *e1, Node *e2, Node *e3, Node *e4, Node *midf)
 
void RefElementNodes (Element *elem)
 
void UnrefElementNodes (Element *elem)
 
void RegisterFaces (Element *elem)
 
Node * PeekAltParents (Node *v1, Node *v2)
 
bool NodeSetX1 (Node *node, Node **n)
 
bool NodeSetX2 (Node *node, Node **n)
 
bool NodeSetY1 (Node *node, Node **n)
 
bool NodeSetY2 (Node *node, Node **n)
 
bool NodeSetZ1 (Node *node, Node **n)
 
bool NodeSetZ2 (Node *node, Node **n)
 
void ReorderFacePointMat (Node *v0, Node *v1, Node *v2, Node *v3, Element *elem, DenseMatrix &pm)
 
void AddDependencies (Array< int > &master_dofs, Array< int > &slave_dofs, DenseMatrix &I)
 
void ConstrainEdge (Node *v0, Node *v1, double t0, double t1, Array< int > &master_dofs, int level)
 
void ConstrainFace (Node *v0, Node *v1, Node *v2, Node *v3, const PointMatrix &pm, Array< int > &master_dofs, int level)
 
void ProcessMasterEdge (Node *node[2], Node *edge)
 
void ProcessMasterFace (Node *node[4], Face *face)
 
bool DofFinalizable (DofData &vd)
 
void GetFineTransforms (Element *elem, int coarse_index, FineTransform *transforms, const PointMatrix &pm)
 
int GetEdgeMaster (Node *n) const
 
void FaceSplitLevel (Node *v1, Node *v2, Node *v3, Node *v4, int &h_level, int &v_level)
 
void CountSplits (Element *elem, int splits[3])
 
int CountElements (Element *elem)
 

Static Protected Member Functions

static int find_node (Element *elem, Node *node)
 

Protected Attributes

int Dim
 
Array< Element * > root_elements
 
Array< Element * > leaf_elements
 
Array< Element * > coarse_elements
 
Array< int > vertex_nodeId
 
HashTable< Node > nodes
 
HashTable< Face > faces
 
Array< RefStackItem > ref_stack
 stack of scheduled refinements More...
 
DofData * dof_data
 DOF temporary data. More...
 
FiniteElementSpace * space
 

Friends

class Mesh
 

Detailed Description

A class for non-conforming AMR on higher-order hexahedral, quadrilateral or triangular meshes.

The class is used as follows:

  1. NCMesh is constructed from elements of an existing Mesh. The elements are copied and become the roots of the refinement hierarchy.
  2. Some elements are refined with the Refine() method. Both isotropic and anisotropic refinements of quads/hexes are supported.
  3. A new Mesh is created from NCMesh containing the leaf elements. This new mesh may have non-conforming (hanging) edges and faces.
  4. A conforming interpolation matrix is obtained using GetInterpolation(). The matrix can be used to constrain the hanging DOFs so a continous solution is obtained.
  5. Refine some more leaf elements, i.e., repeat from step 2.

Definition at line 65 of file ncmesh.hpp.

Member Typedef Documentation

Definition at line 350 of file ncmesh.hpp.

Constructor & Destructor Documentation

mfem::NCMesh::NCMesh ( const Mesh *  mesh)

Definition at line 61 of file ncmesh.cpp.

mfem::NCMesh::~NCMesh ( )

Definition at line 151 of file ncmesh.cpp.

Member Function Documentation

void mfem::NCMesh::AddDependencies ( Array< int > &  master_dofs,
Array< int > &  slave_dofs,
DenseMatrix &  I 
)
protected

Definition at line 1286 of file ncmesh.cpp.

void mfem::NCMesh::CheckAnisoFace ( Node *  v1,
Node *  v2,
Node *  v3,
Node *  v4,
Node *  mid12,
Node *  mid34,
int  level = 0 
)
protected

Definition at line 550 of file ncmesh.cpp.

void mfem::NCMesh::CheckIsoFace ( Node *  v1,
Node *  v2,
Node *  v3,
Node *  v4,
Node *  e1,
Node *  e2,
Node *  e3,
Node *  e4,
Node *  midf 
)
protected

Definition at line 601 of file ncmesh.cpp.

void mfem::NCMesh::ClearCoarseLevel ( )
inline

Free the internally stored array of coarse leaf elements.

Definition at line 113 of file ncmesh.hpp.

void mfem::NCMesh::ConstrainEdge ( Node *  v0,
Node *  v1,
double  t0,
double  t1,
Array< int > &  master_dofs,
int  level 
)
protected

Definition at line 1313 of file ncmesh.cpp.

void mfem::NCMesh::ConstrainFace ( Node *  v0,
Node *  v1,
Node *  v2,
Node *  v3,
const PointMatrix &  pm,
Array< int > &  master_dofs,
int  level 
)
protected

Definition at line 1357 of file ncmesh.cpp.

int mfem::NCMesh::CountElements ( Element *  elem)
protected

Definition at line 2037 of file ncmesh.cpp.

void mfem::NCMesh::CountSplits ( Element *  elem,
int  splits[3] 
)
protected

Definition at line 1986 of file ncmesh.cpp.

void mfem::NCMesh::DeleteHierarchy ( Element *  elem)
protected

Definition at line 157 of file ncmesh.cpp.

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

Definition at line 70 of file ncmesh.hpp.

bool mfem::NCMesh::DofFinalizable ( DofData &  vd)
protected

Definition at line 1460 of file ncmesh.cpp.

void mfem::NCMesh::FaceSplitLevel ( Node *  v1,
Node *  v2,
Node *  v3,
Node *  v4,
int &  h_level,
int &  v_level 
)
protected

Definition at line 1954 of file ncmesh.cpp.

int mfem::NCMesh::FaceSplitType ( Node *  v1,
Node *  v2,
Node *  v3,
Node *  v4,
Node *  mid[4] = NULL 
)
protected

Definition at line 1196 of file ncmesh.cpp.

int mfem::NCMesh::find_node ( Element *  elem,
Node *  node 
)
staticprotected

Definition at line 1225 of file ncmesh.cpp.

void mfem::NCMesh::ForceRefinement ( Node *  v1,
Node *  v2,
Node *  v3,
Node *  v4 
)
protected

Definition at line 518 of file ncmesh.cpp.

int mfem::NCMesh::GetEdgeMaster ( int  v1,
int  v2 
) const

Given an edge (by its vertex indices v1 and v2) return the first (geometric) parent edge that exists in the Mesh or -1 if there is no such parent.

Definition at line 1946 of file ncmesh.cpp.

int mfem::NCMesh::GetEdgeMaster ( Node *  n) const
protected

Definition at line 1918 of file ncmesh.cpp.

NCMesh::FineTransform * mfem::NCMesh::GetFineTransforms ( )

Return an array of structures 'FineTransform', one for each leaf element. This data can be used to transfer functions from a previous coarse level of the mesh (marked with 'MarkCoarseLevel') to a newly refined state of the mesh. NOTE: the caller needs to free the returned array.

Definition at line 1870 of file ncmesh.cpp.

void mfem::NCMesh::GetFineTransforms ( Element *  elem,
int  coarse_index,
FineTransform *  transforms,
const PointMatrix &  pm 
)
protected

Definition at line 1627 of file ncmesh.cpp.

SparseMatrix * mfem::NCMesh::GetInterpolation ( FiniteElementSpace *  space,
SparseMatrix **  cR_ptr = NULL 
)

Calculate the conforming interpolation matrix P that ties slave DOFs to independent DOFs. P is rectangular with M rows and N columns, where M is the number of DOFs of the nonconforming ('cut') space, and N is the number of independent ('true') DOFs. If x is a solution vector containing the values of the independent DOFs, Px can be used to obtain the values of all DOFs, including the slave DOFs.

Definition at line 1470 of file ncmesh.cpp.

void mfem::NCMesh::GetLeafElements ( Element *  e)
protected

Definition at line 1068 of file ncmesh.cpp.

NCMesh::Node * mfem::NCMesh::GetMidEdgeVertex ( Node *  v1,
Node *  v2 
)
protected

Definition at line 463 of file ncmesh.cpp.

NCMesh::Node * mfem::NCMesh::GetMidEdgeVertexSimple ( Node *  v1,
Node *  v2 
)
protected

Definition at line 472 of file ncmesh.cpp.

NCMesh::Node * mfem::NCMesh::GetMidFaceVertex ( Node *  e1,
Node *  e2,
Node *  e3,
Node *  e4 
)
protected

Definition at line 481 of file ncmesh.cpp.

void mfem::NCMesh::GetVerticesElementsBoundary ( Array< mfem::Vertex > &  vertices,
Array< mfem::Element * > &  elements,
Array< mfem::Element * > &  boundary 
)
protected

Definition at line 1092 of file ncmesh.cpp.

void mfem::NCMesh::LimitNCLevel ( int  max_level)

Derefine – not implemented yet Check mesh and potentially refine some elements so that the maximum level of hanging nodes is not greater than 'max_level'.

Definition at line 2007 of file ncmesh.cpp.

void mfem::NCMesh::MarkCoarseLevel ( )
inline

Store the current layer of leaf elements before the mesh is refined. This is later used by 'GetFineTransforms' to determine the relations of the coarse and refined elements.

Definition at line 110 of file ncmesh.hpp.

long mfem::NCMesh::MemoryUsage ( )

Return total number of bytes allocated.

Definition at line 2049 of file ncmesh.cpp.

NCMesh::Element * mfem::NCMesh::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 
)
protected

Definition at line 371 of file ncmesh.cpp.

NCMesh::Element * mfem::NCMesh::NewQuadrilateral ( Node *  n0,
Node *  n1,
Node *  n2,
Node *  n3,
int  attr,
int  eattr0,
int  eattr1,
int  eattr2,
int  eattr3 
)
protected

Definition at line 399 of file ncmesh.cpp.

NCMesh::Element * mfem::NCMesh::NewTriangle ( Node *  n0,
Node *  n1,
Node *  n2,
int  attr,
int  eattr0,
int  eattr1,
int  eattr2 
)
protected

Definition at line 426 of file ncmesh.cpp.

NCMesh::Vertex * mfem::NCMesh::NewVertex ( Node *  v1,
Node *  v2 
)
protected

Definition at line 450 of file ncmesh.cpp.

bool mfem::NCMesh::NodeSetX1 ( Node *  node,
Node **  n 
)
inlineprotected

Definition at line 499 of file ncmesh.cpp.

bool mfem::NCMesh::NodeSetX2 ( Node *  node,
Node **  n 
)
inlineprotected

Definition at line 502 of file ncmesh.cpp.

bool mfem::NCMesh::NodeSetY1 ( Node *  node,
Node **  n 
)
inlineprotected

Definition at line 505 of file ncmesh.cpp.

bool mfem::NCMesh::NodeSetY2 ( Node *  node,
Node **  n 
)
inlineprotected

Definition at line 508 of file ncmesh.cpp.

bool mfem::NCMesh::NodeSetZ1 ( Node *  node,
Node **  n 
)
inlineprotected

Definition at line 511 of file ncmesh.cpp.

bool mfem::NCMesh::NodeSetZ2 ( Node *  node,
Node **  n 
)
inlineprotected

Definition at line 514 of file ncmesh.cpp.

NCMesh::Node * mfem::NCMesh::PeekAltParents ( Node *  v1,
Node *  v2 
)
protected

Definition at line 309 of file ncmesh.cpp.

void mfem::NCMesh::ProcessMasterEdge ( Node *  node[2],
Node *  edge 
)
protected

Definition at line 1426 of file ncmesh.cpp.

void mfem::NCMesh::ProcessMasterFace ( Node *  node[4],
Face *  face 
)
protected

Definition at line 1444 of file ncmesh.cpp.

void mfem::NCMesh::RefElementNodes ( Element *  elem)
protected

Definition at line 209 of file ncmesh.cpp.

void mfem::NCMesh::Refine ( const Array< Refinement > &  refinements)

Perform the given batch of refinements. Please note that in the presence of anisotropic splits additional refinements may be necessary to keep the mesh consistent. However, the function always performas at least the requested refinements.

Definition at line 1005 of file ncmesh.cpp.

void mfem::NCMesh::Refine ( Element *  elem,
int  ref_type 
)
protected

Definition at line 616 of file ncmesh.cpp.

void mfem::NCMesh::RegisterFaces ( Element *  elem)
protected

Definition at line 282 of file ncmesh.cpp.

void mfem::NCMesh::ReorderFacePointMat ( Node *  v0,
Node *  v1,
Node *  v2,
Node *  v3,
Element *  elem,
DenseMatrix &  pm 
)
protected

Definition at line 1251 of file ncmesh.cpp.

void mfem::NCMesh::SetEdgeIndicesFromMesh ( Mesh *  mesh)
protected

Definition at line 1166 of file ncmesh.cpp.

void mfem::NCMesh::SetFaceIndicesFromMesh ( Mesh *  mesh)
protected

Definition at line 1180 of file ncmesh.cpp.

void mfem::NCMesh::UnrefElementNodes ( Element *  elem)
protected

Definition at line 235 of file ncmesh.cpp.

void mfem::NCMesh::UpdateLeafElements ( )
protected

Definition at line 1084 of file ncmesh.cpp.

void mfem::NCMesh::UpdateVertices ( )
protected

Definition at line 1050 of file ncmesh.cpp.

Friends And Related Function Documentation

friend class Mesh
friend

Definition at line 142 of file ncmesh.hpp.

Member Data Documentation

Array<Element*> mfem::NCMesh::coarse_elements
protected

Definition at line 268 of file ncmesh.hpp.

int mfem::NCMesh::Dim
protected

Definition at line 147 of file ncmesh.hpp.

DofData* mfem::NCMesh::dof_data
protected

DOF temporary data.

Definition at line 363 of file ncmesh.hpp.

HashTable<Face> mfem::NCMesh::faces
protected

Definition at line 273 of file ncmesh.hpp.

Array<Element*> mfem::NCMesh::leaf_elements
protected

Definition at line 267 of file ncmesh.hpp.

HashTable<Node> mfem::NCMesh::nodes
protected

Definition at line 272 of file ncmesh.hpp.

Array<RefStackItem> mfem::NCMesh::ref_stack
protected

stack of scheduled refinements

Definition at line 284 of file ncmesh.hpp.

Array<Element*> mfem::NCMesh::root_elements
protected

Definition at line 266 of file ncmesh.hpp.

FiniteElementSpace* mfem::NCMesh::space
protected

Definition at line 365 of file ncmesh.hpp.

Array<int> mfem::NCMesh::vertex_nodeId
protected

Definition at line 270 of file ncmesh.hpp.


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