15 #include "../config/config.hpp"
16 #include "../general/stable3d.hpp"
21 #include "../fem/eltrans.hpp"
22 #include "../fem/coefficient.hpp"
32 class FiniteElementSpace;
108 #ifdef MFEM_USE_MEMALLOC
154 int *edge1,
int *edge2,
int *middle)
160 int *edge1,
int *edge2,
int *middle)
161 {
Bisection(i, v_to_v, edge1, edge2, middle); }
252 int v0,
int v1,
int v2);
255 int v0,
int v1,
int v2,
int v3);
265 inline static void ShiftL2R(
int &,
int &,
int &);
267 inline static void Rotate3(
int &,
int &,
int &);
274 void InitMesh(
int _Dim,
int _spaceDim,
int NVert,
int NElem,
int NBdrElem);
281 double sx,
double sy,
double sz);
288 double sx,
double sy);
291 void Make1D(
int n,
double sx = 1.0);
298 void Swap(
Mesh& other,
bool non_geometry =
false);
312 Mesh(
int _Dim,
int NVert,
int NElem,
int NBdrElem = 0,
int _spaceDim= -1)
316 InitMesh(_Dim, _spaceDim, NVert, NElem, NBdrElem);
322 void AddTri(
const int *vi,
int attr = 1);
324 void AddQuad(
const int *vi,
int attr = 1);
325 void AddTet(
const int *vi,
int attr = 1);
326 void AddHex(
const int *vi,
int attr = 1);
336 bool fix_orientation =
true);
338 bool fix_orientation =
true);
340 bool fix_orientation =
true);
342 bool fix_orientation =
true);
351 double sx = 1.0,
double sy = 1.0,
double sz = 1.0)
353 Make3D(nx, ny, nz, type, generate_edges, sx, sy, sz);
361 double sx = 1.0,
double sy = 1.0)
363 Make2D(nx, ny, type, generate_edges, sx, sy);
367 explicit Mesh(
int n,
double sx = 1.0)
375 Mesh(std::istream &input,
int generate_edges = 0,
int refine = 1,
376 bool fix_orientation =
true);
379 Mesh(
Mesh *mesh_array[],
int num_pieces);
385 void Load(std::istream &input,
int generate_edges = 0,
int refine = 1,
386 bool fix_orientation =
true);
437 {
return elements[i]->GetGeometryType(); }
440 {
return boundary[i]->GetGeometryType(); }
468 faces[i]->GetVertices(vert);
564 {
if (
faces_info[FaceNo].Elem2No < 0)
return NULL;
627 void GetNode(
int i,
double *coord);
628 void SetNode(
int i,
const double *coord);
671 int nonconforming = -1,
int nc_limit = 0);
676 int nonconforming = -1,
int nc_limit = 0);
713 virtual void PrintXG(std::ostream &out = std::cout)
const;
716 virtual void Print(std::ostream &out = std::cout)
const;
725 void PrintVTK(std::ostream &out,
int ref,
int field_data=0);
733 std::ostream &out,
int elem_attr = 0)
const;
737 int interior_faces = 0);
769 std::ostream &
operator<<(std::ostream &out,
const Mesh &mesh);
790 Mesh *
Extrude1D(Mesh *mesh,
const int ny,
const double sy,
791 const bool closed =
false);
Abstract class for Finite Elements.
void AddHex(const int *vi, int attr=1)
void SetState(int s)
Change the mesh state to NORMAL, TWO_LEVEL_COARSE, TWO_LEVEL_FINE.
std::ostream & operator<<(std::ostream &out, const Mesh &mesh)
void GetFaceEdges(int i, Array< int > &, Array< int > &) const
void PrintSurfaces(const Table &Aface_face, std::ostream &out) const
Print set of disjoint surfaces:
void GetPointMatrix(int i, DenseMatrix &pointmat) const
int * CartesianPartitioning(int nxyz[])
int GetBdrAttribute(int i) const
Return the attribute of boundary element i.
const double * GetVertex(int i) const
Return pointer to vertex i's coordinates.
void ScaleElements(double sf)
Class for grid function - Vector with associated FE space.
Table * GetEdgeVertexTable() const
Returns the edge-to-vertex Table (3D)
void FreeElement(Element *E)
void GetFaceInfos(int Face, int *Inf1, int *Inf2)
void SetVertices(const Vector &vert_coord)
void GetEdgeVertices(int i, Array< int > &vert) const
Returns the indices of the vertices of edge i.
bool FaceIsTrueInterior(int FaceNo) const
virtual void Eval(Vector &V, ElementTransformation &T, const IntegrationPoint &ip)
int GetBdrElementBaseGeometry(int i) const
void AddHexAsTets(const int *vi, int attr=1)
void GetFaceElements(int Face, int *Elem1, int *Elem2)
virtual void Eval(Vector &V, ElementTransformation &T, const IntegrationPoint &ip)=0
Array< Element * > boundary
int * GeneratePartitioning(int nparts, int part_method=1)
void BisectTetTrans(DenseMatrix &pointmat, Tetrahedron *tet, int child)
void MoveVertices(const Vector &displacements)
int GetNBE() const
Returns number of boundary elements.
IsoparametricTransformation Transformation
void GetLocalPtToSegTransformation(IsoparametricTransformation &, int)
Used in GetFaceElementTransformations (...)
void PrintWithPartitioning(int *partitioning, std::ostream &out, int elem_attr=0) const
void NewNodes(GridFunction &nodes, bool make_owner=false)
Replace the internal node GridFunction with the given GridFunction.
void SwapNodes(GridFunction *&nodes, int &own_nodes_)
void GetElementFaces(int i, Array< int > &, Array< int > &) const
Return the indices and the orientations of all faces of element i.
int GetElementBaseGeometry(int i) const
void DegreeElevate(int t)
int EulerNumber2D() const
Equals 1 - num_holes.
void AddTri(const int *vi, int attr=1)
void GetFaceVertices(int i, Array< int > &vert) const
Returns the indices of the vertices of face i.
Mesh * Extrude1D(Mesh *mesh, const int ny, const double sy, const bool closed)
Extrude a 1D mesh.
void Transform(void(*f)(const Vector &, Vector &))
int GetBdrElementEdgeIndex(int i) const
int GetNE() const
Returns number of elements.
const Element * GetFace(int i) const
Element * GetElement(int i)
void BisectTriTrans(DenseMatrix &pointmat, Triangle *tri, int child)
void GenerateBoundaryElements()
void GetElementEdges(int i, Array< int > &, Array< int > &) const
Return the indices and the orientations of all edges of element i.
void GetElementVertices(int i, Array< int > &dofs) const
Returns the indices of the dofs of element i.
void DeleteCoarseTables()
ElementTransformation * GetFineElemTrans(int i, int j)
static int GetQuadOrientation(const int *base, const int *test)
Returns the orientation of "test" relative to "base".
void GetVertices(Vector &vert_coord) const
virtual ~Mesh()
Destroys mesh.
void AddBdrSegment(const int *vi, int attr=1)
FaceElementTransformations * GetInteriorFaceTransformations(int FaceNo)
void CheckBdrElementOrientation(bool fix_it=true)
Check the orientation of the boundary elements.
FaceElementTransformations * GetFaceElementTransformations(int FaceNo, int mask=31)
void FinalizeHexMesh(int generate_edges=0, int refine=0, bool fix_orientation=true)
void GetVertexToVertexTable(DSTable &) const
void RedRefinement(int i, const DSTable &v_to_v, int *edge1, int *edge2, int *middle)
void MarkTriMeshForRefinement()
IsoparametricTransformation FaceTransformation
Element * ReadElement(std::istream &)
void KnotInsert(Array< KnotVector * > &kv)
Array< FaceInfo > fc_faces_info
int GetFineElemPath(int i, int j)
Element * NewElement(int geom)
FaceElementTransformations FaceElemTr
void GetEdgeTransformation(int i, IsoparametricTransformation *EdTr)
static const int tet_faces[4][3]
ElementTransformation * GetBdrElementTransformation(int i)
Returns the transformation defining the i-th boundary element.
void AddVertex(const double *)
Mesh(int _Dim, int NVert, int NElem, int NBdrElem=0, int _spaceDim=-1)
void PrintTopo(std::ostream &out, const Array< int > &e_to_k) const
int GetNumFaces() const
Return the number of faces (3D), edges (2D) or vertices (1D).
void AddElement(Element *elem)
void Load(std::istream &input, int generate_edges=0, int refine=1, bool fix_orientation=true)
void GetElementJacobian(int i, DenseMatrix &J)
void MesquiteSmooth(const int mesquite_option=0)
Mesh(int nx, int ny, Element::Type type, int generate_edges=0, double sx=1.0, double sy=1.0)
void MoveNodes(const Vector &displacements)
void GetEdgeOrdering(DSTable &v_to_v, Array< int > &order)
void FinalizeTriMesh(int generate_edges=0, int refine=0, bool fix_orientation=true)
static const int quad_orientations[8][4]
void FinalizeTetMesh(int generate_edges=0, int refine=0, bool fix_orientation=true)
void AddBdrQuadAsTriangles(const int *vi, int attr=1)
void AddSegmentFaceElement(int lf, int gf, int el, int v0, int v1)
void MarkTetMeshForRefinement()
void GetFaceTransformation(int i, IsoparametricTransformation *FTr)
void GetLocalSegToTriTransformation(IsoparametricTransformation &loc, int i)
void AddQuadFaceElement(int lf, int gf, int el, int v0, int v1, int v2, int v3)
int GetRefinementType(int i)
For a given coarse element i returns its refinement type.
static FiniteElement * GetTransformationFEforElementType(int)
void LoadPatchTopo(std::istream &input, Array< int > &edge_to_knot)
Read NURBS patch/macro-element mesh.
STable3D * GetElementToFaceTable(int ret_ftbl=0)
static void Rotate3(int &, int &, int &)
void Make2D(int nx, int ny, Element::Type type, int generate_edges, double sx, double sy)
int MeshGenerator()
Truegrid or NetGen?
Type
Constants for the classes derived from Element.
void GetBdrPointMatrix(int i, DenseMatrix &pointmat) const
void GetBdrElementEdges(int i, Array< int > &, Array< int > &) const
Return the indices and the orientations of all edges of bdr element i.
void CheckDisplacements(const Vector &displacements, double &tmax)
void CheckElementOrientation(bool fix_it=true)
Check the orientation of the elements.
void SetLayer(const int l)
int GetElementToEdgeTable(Table &, Array< int > &)
int GetElementType(int i) const
Returns the type of element i.
Data type triangle element.
const Element * GetElement(int i) const
Mesh(int n, double sx=1.0)
void GetLocalQuadToHexTransformation(IsoparametricTransformation &loc, int i)
Used in GetFaceElementTransformations (...)
IsoparametricTransformation Transformation2
void SetNodalFESpace(FiniteElementSpace *nfes)
Element * GetBdrElement(int i)
A class for non-conforming AMR on higher-order hexahedral, quadrilateral or triangular meshes...
FaceElementTransformations * GetBdrFaceTransformations(int BdrElemNo)
virtual void ReorientTetMesh()
static void ShiftL2R(int &, int &, int &)
virtual void LocalRefinement(const Array< int > &marked_el, int type=3)
This function is not public anymore. Use GeneralRefinement instead.
int GetBdrElementType(int i) const
Returns the type of boundary element i.
Data type tetrahedron element.
double GetElementSize(int i, int type=0)
int SpaceDimension() const
void GetBdrElementFace(int i, int *, int *) const
Return the index and the orientation of the face of bdr element i. (3D)
void CheckPartitioning(int *partitioning)
virtual void Print(std::ostream &out=std::cout) const
Print the mesh to the given stream using the default MFEM mesh format.
void PrintElementsWithPartitioning(int *partitioning, std::ostream &out, int interior_faces=0)
bool FaceIsInterior(int FaceNo) const
Return true if the given face is interior.
void AddPointFaceElement(int lf, int gf, int el)
Used in GenerateFaces()
void Make1D(int n, double sx=1.0)
Creates a 1D mesh for the interval [0,sx] divided into n equal intervals.
int GetNumFineElems(int i)
Array< int > bdr_attributes
void NonconformingRefinement(const Array< Refinement > &refinements, int nc_limit=0)
This function is not public anymore. Use GeneralRefinement instead.
void PrintVTK(std::ostream &out)
Print the mesh in VTK format (linear and quadratic meshes only).
void UseTwoLevelState(int use)
int GetBisectionHierarchy(Element *E)
Abstract finite element space.
static void PrintElement(const Element *, std::ostream &)
virtual void NURBSUniformRefinement()
Refine NURBS mesh.
static void GetElementArrayEdgeTable(const Array< Element * > &elem_array, const DSTable &v_to_v, Table &el_to_edge)
GridFunction * GetNodes()
Return a pointer to the internal node GridFunction (may be NULL).
void SetSize(int nsize)
Change logical size of the array, keep existing entries.
void PrepareNodeReorder(DSTable **old_v_to_v, Table **old_elem_vert)
void AddQuad(const int *vi, int attr=1)
MemAlloc< BisectedElement, 1024 > BEMemory
virtual void QuadUniformRefinement()
Refine quadrilateral mesh.
virtual void HexUniformRefinement()
Refine hexahedral mesh.
void Swap(Mesh &other, bool non_geometry=false)
Array< Element * > elements
const Table & ElementToElementTable()
double GetLength(int i, int j) const
Return the length of the segment from node i to node j.
void AddBdrTriangle(const int *vi, int attr=1)
Array< int > fc_be_to_edge
Table * GetFaceToElementTable() const
void GetLocalTriToTetTransformation(IsoparametricTransformation &loc, int i)
Used in GetFaceElementTransformations (...)
int EulerNumber() const
Equals 1 + num_holes - num_loops.
NURBSExtension * NURBSext
void AddBdrQuad(const int *vi, int attr=1)
const Table & ElementToFaceTable() const
Class for integration point with weight.
Element * ReadElementWithoutAttr(std::istream &)
void AddTriangle(const int *vi, int attr=1)
static const int hex_faces[6][4]
void GetElementTransformation(int i, IsoparametricTransformation *ElTr)
void GetLocalSegToQuadTransformation(IsoparametricTransformation &loc, int i)
const FiniteElementSpace * GetNodalFESpace()
void FinalizeQuadMesh(int generate_edges=0, int refine=0, bool fix_orientation=true)
NodeExtrudeCoefficient(const int dim, const int _n, const double _s)
void GetBdrElementVertices(int i, Array< int > &dofs) const
Returns the indices of the dofs of boundary element i.
virtual ~NodeExtrudeCoefficient()
Array< FaceInfo > faces_info
STable3D * GetFacesTable()
void Make3D(int nx, int ny, int nz, Element::Type type, int generate_edges, double sx, double sy, double sz)
static void PrintElementWithoutAttr(const Element *, std::ostream &)
int GetFineElem(int i, int j)
int GetNEdges() const
Return the number of edges.
double * GetVertex(int i)
int GetNFaces() const
Return the number of faces in a 3D mesh.
int GetFaceBaseGeometry(int i) const
void AverageVertices(int *indexes, int n, int result)
Mesh(int nx, int ny, int nz, Element::Type type, int generate_edges=0, double sx=1.0, double sy=1.0, double sz=1.0)
static int GetTriOrientation(const int *base, const int *test)
Returns the orientation of "test" relative to "base".
void SetNode(int i, const double *coord)
void GetNode(int i, double *coord)
void GetElementColoring(Array< int > &colors, int el0=0)
IsoparametricTransformation EdgeTransformation
void AddTet(const int *vi, int attr=1)
MemAlloc< Tetrahedron, 1024 > TetMemory
Table * GetFaceEdgeTable() const
Returns the face-to-edge Table (3D)
void DoNodeReorder(DSTable *old_v_to_v, Table *old_elem_vert)
void SetNodes(const Vector &node_coord)
void SetNodalGridFunction(GridFunction *nodes, bool make_owner=false)
void ScaleSubdomains(double sf)
virtual void PrintXG(std::ostream &out=std::cout) const
Print the mesh to the given stream using Netgen/Truegrid format.
void Bisection(int i, const DSTable &, int *, int *, int *)
Class for parallel meshes.
Abstract data type element.
int GetAttribute(int i) const
Return the attribute of element i.
void AddTriangleFaceElement(int lf, int gf, int el, int v0, int v1, int v2)
const Table & ElementToEdgeTable() const
double GetElementVolume(int i)
void InitMesh(int _Dim, int _spaceDim, int NVert, int NElem, int NBdrElem)
Begin construction of a mesh.
void PrintCharacteristics(Vector *Vh=NULL, Vector *Vk=NULL)
Table * GetVertexToElementTable()
The returned Table must be destroyed by the caller.
const Element * GetBdrElement(int i) const
void GeneralRefinement(Array< Refinement > &refinements, int nonconforming=-1, int nc_limit=0)
void UpdateNodes()
Update the nodes of a curved mesh after refinement.
void GreenRefinement(int i, const DSTable &v_to_v, int *edge1, int *edge2, int *middle)
static const int tri_orientations[6][3]
Class used to exrude the nodes of a mesh.