38class GeometricFactors;
39class FaceGeometricFactors;
42class FiniteElementSpace;
260#ifdef MFEM_USE_MEMALLOC
321 void ReadMFEMMesh(std::istream &input,
int version,
int &curved);
330 int &curved,
int &read_gf,
bool &finalize_topo);
331 void ReadVTKMesh(std::istream &input,
int &curved,
int &read_gf,
332 bool &finalize_topo);
334 bool &finalize_topo,
const std::string &xml_prefix=
"");
335 void ReadNURBSMesh(std::istream &input,
int &curved,
int &read_gf,
337 void ReadInlineMesh(std::istream &input,
bool generate_edges =
false);
338 void ReadGmshMesh(std::istream &input,
int &curved,
int &read_gf);
341#ifdef MFEM_USE_NETCDF
343 void ReadCubit(
const std::string &filename,
int &curved,
int &read_gf);
372 int *edge1,
int *edge2,
int *middle)
378 int *edge1,
int *edge2,
int *middle)
379 {
Bisection(i, v_to_v, edge1, edge2, middle); }
423 bool update_nodes =
true);
437 real_t threshold,
int nc_limit = 0,
441 const int *fine,
int nfine,
int op);
458 const std::string &comment =
"")
const;
483 const FaceInfo &fi,
bool is_ghost)
const;
533 int v0,
int v1,
int v2);
536 int v0,
int v1,
int v2,
int v3);
551 void InitMesh(
int Dim_,
int spaceDim_,
int NVert,
int NElem,
int NBdrElem);
556 void Loader(std::istream &input,
int generate_edges = 0,
557 std::string parse_tag =
"");
565 std::string section_delimiter =
"",
566 const std::string &comments =
"")
const;
613 bool generate_edges,
bool sfc_ordering);
652 explicit Mesh(
const Mesh &mesh,
bool copy_nodes =
true);
675 int *element_attributes,
int num_elements,
677 int *boundary_attributes,
int num_boundary_elements,
678 int dimension,
int space_dimension = -1);
687 Mesh(
int Dim_,
int NVert,
int NElem,
int NBdrElem = 0,
int spaceDim_ = -1)
690 if (spaceDim_ == -1) { spaceDim_ = Dim_; }
691 InitMesh(Dim_, spaceDim_, NVert, NElem, NBdrElem);
698 explicit Mesh(
const std::string &filename,
int generate_edges = 0,
699 int refine = 1,
bool fix_orientation =
true);
704 explicit Mesh(std::istream &input,
int generate_edges = 0,
int refine = 1,
705 bool fix_orientation =
true);
710 Mesh(
Mesh *mesh_array[],
int num_pieces);
718 virtual void Load(std::istream &input,
int generate_edges = 0,
719 int refine = 1,
bool fix_orientation =
true)
721 Loader(input, generate_edges);
727 void Swap(
Mesh& other,
bool non_geometry);
753 int generate_edges = 0,
int refine = 1,
754 bool fix_orientation =
true);
768 int nx,
int ny,
Element::Type type,
bool generate_edges =
false,
769 real_t sx = 1.0,
real_t sy = 1.0,
bool sfc_ordering =
true);
781 bool sfc_ordering =
true);
890 int AddTriangle(
int v1,
int v2,
int v3,
int attr = 1);
897 int AddQuad(
int v1,
int v2,
int v3,
int v4,
int attr = 1);
899 int AddQuad(
const int *vi,
int attr = 1);
902 int AddTet(
int v1,
int v2,
int v3,
int v4,
int attr = 1);
904 int AddTet(
const int *vi,
int attr = 1);
907 int AddWedge(
int v1,
int v2,
int v3,
int v4,
int v5,
int v6,
int attr = 1);
909 int AddWedge(
const int *vi,
int attr = 1);
912 int AddPyramid(
int v1,
int v2,
int v3,
int v4,
int v5,
int attr = 1);
917 int AddHex(
int v1,
int v2,
int v3,
int v4,
int v5,
int v6,
int v7,
int v8,
920 int AddHex(
const int *vi,
int attr = 1);
938 std::map<std::array<int, 4>,
int>
969 int AddBdrQuad(
int v1,
int v2,
int v3,
int v4,
int attr = 1);
978 bool fix_orientation =
true);
981 bool fix_orientation =
true);
984 bool fix_orientation =
true);
987 bool fix_orientation =
true);
990 bool fix_orientation =
true);
993 void FinalizeMesh(
int refine = 0,
bool fix_orientation =
true);
1025 virtual void Finalize(
bool refine =
false,
bool fix_orientation =
false);
1097 int iterations = 4,
int window = 4,
1098 int period = 2,
int seed = 0,
1099 bool verbose =
false,
real_t time_limit = 0);
1124 bool sfc_ordering =
true)
1127 Make3D(nx, ny, nz, type, sx, sy, sz, sfc_ordering);
1134 real_t sx = 1.0,
real_t sy = 1.0,
bool sfc_ordering =
true)
1137 Make2D(nx, ny, type, sx, sy, generate_edges, sfc_ordering);
1152 Mesh(
Mesh *orig_mesh,
int ref_factor,
int ref_type);
1373 return elements[i]->GetGeometryType();
1378 return boundary[i]->GetGeometryType();
1464 faces[i]->GetVertices(vert);
1726 int mask = 31)
const;
1991 {
return orientation + local_face_index*64; }
2010 void GetFaceInfos (
int Face,
int *Inf1,
int *Inf2)
const;
2011 void GetFaceInfos (
int Face,
int *Inf1,
int *Inf2,
int *NCFace)
const;
2045 bool zerocopy =
false);
2140 virtual void SetCurvature(
int order,
bool discont =
false,
int space_dim = -1,
2186 int nonconforming = -1,
int nc_limit = 0);
2191 int nonconforming = -1,
int nc_limit = 0);
2195 int nonconforming = -1,
int nc_limit = 0);
2199 real_t eps = 0.0,
int nonconforming = -1);
2204 int nonconforming = -1,
int nc_limit = 0);
2209 int nonconforming = -1,
int nc_limit = 0);
2217 int nc_limit = 0,
int op = 1);
2221 int nc_limit = 0,
int op = 1);
2226 void EnsureNCMesh(
bool simplices_nonconforming =
false);
2289 const std::string &comments =
"")
const
2290 {
Printer(os,
"", comments); }
2294 virtual void Save(
const std::string &fname,
int precision=16)
const;
2297#ifdef MFEM_USE_ADIOS2
2308 void PrintVTK(std::ostream &os,
int ref,
int field_data=0);
2316 bool high_order_output=
false,
2317 int compression_level=0,
2318 bool bdr_elements=
false);
2320 virtual void PrintVTU(std::string fname,
2322 bool high_order_output=
false,
2323 int compression_level=0,
2329 bool high_order_output=
false,
2330 int compression_level=0);
2337 std::ostream &os,
int elem_attr = 0)
const;
2341 int interior_faces = 0);
2392 const std::vector<Vector> &translations,
real_t tol = 1e-8)
const;
2439 virtual long long ReduceInt(
int value)
const {
return value; }
2648 void Print(std::ostream &os)
const;
2730 int part_method = 1);
2758 std::unique_ptr<FiniteElementSpace>
2778 std::unique_ptr<GridFunction>
2913 const bool closed =
false);
2922 a = c; c =
b;
b =
t;
void SetSize(int nsize)
Change the logical size of the array, keep existing entries.
Data type dense matrix using column-major storage.
Abstract data type element.
Type
Constants for the classes derived from Element.
Structure for storing face geometric factors: coordinates, Jacobians, determinants of the Jacobians,...
Vector normal
Normals at all quadrature points.
Vector J
Jacobians of the element transformations at all quadrature points.
const IntegrationRule * IntRule
Vector X
Mapped (physical) coordinates of all quadrature points.
FaceGeometricFactors(const Mesh *mesh, const IntegrationRule &ir, int flags, FaceType type, MemoryType d_mt=MemoryType::DEFAULT)
Vector detJ
Determinants of the Jacobians at all quadrature points.
Class FiniteElementSpace - responsible for providing FEM view of the mesh, mainly managing the set of...
Abstract class for all finite elements.
Structure for storing mesh geometric factors: coordinates, Jacobians, and determinants of the Jacobia...
Vector X
Mapped (physical) coordinates of all quadrature points.
const IntegrationRule * IntRule
Vector detJ
Determinants of the Jacobians at all quadrature points.
Vector J
Jacobians of the element transformations at all quadrature points.
GeometricFactors(const Mesh *mesh, const IntegrationRule &ir, int flags, MemoryType d_mt=MemoryType::DEFAULT)
Class for grid function - Vector with associated FE space.
Class for integration point with weight.
Class for an integration rule - an Array of IntegrationPoint.
Class containing a minimal description of a part (a subset of the elements) of a Mesh and its connect...
Array< real_t > vertex_coordinates
int dimension
Reference space dimension of the elements.
int num_vertices
Number of vertices.
Table group_shared_entity_to_vertex[Geometry::NumGeom]
Array< int > entity_to_vertex[Geometry::NumGeom]
std::unique_ptr< Mesh > mesh
Array< int > boundary_map
Optional re-ordering for the boundary elements, similar to 'element_map'.
std::unique_ptr< FiniteElementSpace > nodal_fes
int num_parts
Total number of MeshParts.
Array< int > tet_refine_flags
Store the refinement flags for tetraheral elements. If all tets have zero refinement flags then this ...
int space_dimension
Dimension of the physical space into which the MeshPart is embedded.
int num_bdr_elements
Number of boundary elements with reference space dimension equal to 'dimension'-1.
int num_elements
Number of elements with reference space dimension equal to 'dimension'.
Mesh & GetMesh()
Construct a serial Mesh object from the MeshPart.
int my_part_id
Index of the part described by this MeshPart: 0 <= 'my_part_id' < 'num_parts'.
std::unique_ptr< GridFunction > nodes
void Print(std::ostream &os) const
Write the MeshPart to a stream using the parallel format "MFEM mesh v1.2".
Array< int > bdr_attributes
Class that allows serial meshes to be partitioned into MeshPart objects, typically one MeshPart at a ...
Array< int > partitioning
std::unique_ptr< FiniteElementSpace > ExtractFESpace(MeshPart &mesh_part, const FiniteElementSpace &global_fespace) const
Construct a local version of the given FiniteElementSpace global_fespace corresponding to the given m...
MeshPartitioner(Mesh &mesh_, int num_parts_, int *partitioning_=NULL, int part_method=1)
Construct a MeshPartitioner.
std::unique_ptr< GridFunction > ExtractGridFunction(const MeshPart &mesh_part, const GridFunction &global_gf, FiniteElementSpace &local_fespace) const
Construct a local version of the given GridFunction, global_gf, corresponding to the given mesh_part....
void ExtractPart(int part_id, MeshPart &mesh_part) const
Construct a MeshPart corresponding to the given part_id.
List of mesh geometries stored as Array<Geometry::Type>.
Geometry::Type geom_buf[Geometry::NumGeom]
GeometryList(const Mesh &mesh)
Construct a GeometryList of all element geometries in mesh.
GeometryList(const Mesh &mesh, int dim)
Construct a GeometryList of all geometries of dimension dim in mesh.
int CheckElementOrientation(bool fix_it=true)
Check (and optionally attempt to fix) the orientation of the elements.
void GetFaceEdges(int i, Array< int > &edges, Array< int > &o) const
void GetEdgeOrdering(const DSTable &v_to_v, Array< int > &order)
Geometry::Constants< Geometry::TETRAHEDRON > tet_t
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 ...
void NURBSCoarsening(int cf=2, real_t tol=1.0e-12)
void SetVerticesFromNodes(const GridFunction *nodes)
Helper to set vertex coordinates given a high-order curvature function.
void ReadGmshMesh(std::istream &input, int &curved, int &read_gf)
int GetPatchBdrAttribute(int i) const
Return the attribute of patch boundary element i, for a NURBS mesh.
int GetElementToEdgeTable(Table &)
void GetGeometries(int dim, Array< Geometry::Type > &el_geoms) const
Return all element geometries of the given dimension present in the mesh.
void SetVertices(const Vector &vert_coord)
Element * NewElement(int geom)
Operation GetLastOperation() const
Return type of last modification of the mesh.
IsoparametricTransformation Transformation2
int GetNEdges() const
Return the number of edges.
void GetBdrElementFace(int i, int *f, int *o) const
void InitMesh(int Dim_, int spaceDim_, int NVert, int NElem, int NBdrElem)
Begin construction of a mesh.
static void PrintElement(const Element *el, std::ostream &os)
Array< FaceInfo > faces_info
int EulerNumber() const
Equals 1 + num_holes - num_loops.
CoarseFineTransformations CoarseFineTr
void GetElementJacobian(int i, DenseMatrix &J, const IntegrationPoint *ip=NULL)
int AddSegment(int v1, int v2, int attr=1)
Adds a segment to the mesh given by 2 vertices v1 and v2.
int AddBdrElement(Element *elem)
void GetElementColoring(Array< int > &colors, int el0=0)
virtual FaceElementTransformations * GetFaceElementTransformations(int FaceNo, int mask=31)
void FinalizeMesh(int refine=0, bool fix_orientation=true)
Finalize the construction of any type of Mesh.
Array< int > bdr_attributes
A list of all unique boundary attributes used by the Mesh.
static void PrintElementWithoutAttr(const Element *el, std::ostream &os)
Element * GetElement(int i)
Return pointer to the i'th element object.
MemAlloc< Tetrahedron, 1024 > TetMemory
void RedRefinement(int i, const DSTable &v_to_v, int *edge1, int *edge2, int *middle)
NURBSExtension * NURBSext
Optional NURBS mesh extension.
void ReadTrueGridMesh(std::istream &input)
static const int vtk_quadratic_tet[10]
void GetFaceInfos(int Face, int *Inf1, int *Inf2) const
const GridFunction * GetNodes() const
IsoparametricTransformation EdgeTransformation
static FiniteElement * GetTransformationFEforElementType(Element::Type)
Return FiniteElement for reference element of the specified type.
int AddBdrQuad(int v1, int v2, int v3, int v4, int attr=1)
int * CartesianPartitioning(int nxyz[])
Array< int > FindFaceNeighbors(const int elem) const
Returns the sorted, unique indices of elements sharing a face with element elem, including elem.
static int GetQuadOrientation(const int *base, const int *test)
Returns the orientation of "test" relative to "base".
Element::Type GetElementType(int i) const
Returns the type of element i.
void GetLocalSegToQuadTransformation(IsoparametricTransformation &loc, int i) const
virtual long long ReduceInt(int value) const
Utility function: sum integers from all processors (Allreduce).
void BdrBisection(int i, const HashTable< Hashed2 > &)
Bisect a boundary triangle: boundary element with index i is bisected.
Element::Type GetBdrElementType(int i) const
Returns the type of boundary element i.
const Table & ElementToEdgeTable() const
int GetNumFaces() const
Return the number of faces (3D), edges (2D) or vertices (1D).
void ReadNetgen3DMesh(std::istream &input)
void GetBdrElementVertices(int i, Array< int > &v) const
Returns the indices of the vertices of boundary element i.
Geometry::Type GetFaceGeometry(int i) const
Return the Geometry::Type associated with face i.
void GeneralRefinement(const Array< Refinement > &refinements, int nonconforming=-1, int nc_limit=0)
Geometry::Type GetElementGeometry(int i) const
Geometry::Type GetBdrElementGeometry(int i) const
int AddTri(const int *vi, int attr=1)
Adds a triangle to the mesh given by 3 vertices vi.
static Mesh MakeCartesian1D(int n, real_t sx=1.0)
Creates 1D mesh, divided into n equal intervals.
int GetAttribute(int i) const
Return the attribute of element i.
void NodesUpdated()
This function should be called after the mesh node coordinates have been updated externally,...
void EnsureNodes()
Make sure that the mesh has valid nodes, i.e. its geometry is described by a vector finite element gr...
void GetElementVertices(int i, Array< int > &v) const
Returns the indices of the vertices of element i.
void UniformRefinement3D_base(Array< int > *f2qf=NULL, DSTable *v_to_v_p=NULL, bool update_nodes=true)
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.
long nodes_sequence
Counter for geometric factor invalidation.
virtual void Load(std::istream &input, int generate_edges=0, int refine=1, bool fix_orientation=true)
IsoparametricTransformation FaceTransformation
Array< NCFaceInfo > nc_faces_info
void MakeRefined_(Mesh &orig_mesh, const Array< int > &ref_factors, int ref_type)
Internal function used in Mesh::MakeRefined.
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.
Array< int > GetFaceToBdrElMap() const
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.
void ReadInlineMesh(std::istream &input, bool generate_edges=false)
void SetPatchAttribute(int i, int attr)
Set the attribute of patch i, for a NURBS mesh.
void FinalizeTetMesh(int generate_edges=0, int refine=0, bool fix_orientation=true)
Finalize the construction of a tetrahedral Mesh.
real_t GetLength(int i, int j) const
Return the length of the segment from node i to node j.
const FiniteElementSpace * GetNodalFESpace() const
void AddBdrQuadAsTriangles(const int *vi, int attr=1)
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.
void Loader(std::istream &input, int generate_edges=0, std::string parse_tag="")
const Table & ElementToElementTable()
void ScaleElements(real_t sf)
void GenerateNCFaceInfo()
void ReadLineMesh(std::istream &input)
void ApplyLocalSlaveTransformation(FaceElementTransformations &FT, const FaceInfo &fi, bool is_ghost) const
real_t AggregateError(const Array< real_t > &elem_error, const int *fine, int nfine, int op)
Derefinement helper.
void CheckPartitioning(int *partitioning_)
void DoNodeReorder(DSTable *old_v_to_v, Table *old_elem_vert)
void GetLocalPtToSegTransformation(IsoparametricTransformation &, int i) const
Used in GetFaceElementTransformations (...)
const Element *const * GetElementsArray() const
bool Nonconforming() const
int GetBdrAttribute(int i) const
Return the attribute of boundary element i.
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,...
static int ComposeQuadOrientations(int ori_a_b, int ori_b_c)
int AddTriangle(int v1, int v2, int v3, int attr=1)
Adds a triangle to the mesh given by 3 vertices v1 through v3.
static const int vtk_quadratic_wedge[18]
int EulerNumber2D() const
Equals 1 - num_holes.
AttributeSets bdr_attribute_sets
Named sets of boundary element attributes.
int GetBdrElementFaceIndex(int be_idx) const
Return the local face (codimension-1) index for the given boundary element index.
void GetVertices(Vector &vert_coord) const
void InitFromNCMesh(const NCMesh &ncmesh)
Initialize vertices/elements/boundary/tables from a nonconforming mesh.
virtual int GetNFbyType(FaceType type) const
Returns the number of faces according to the requested type, does not count master nonconforming face...
void Make1D(int n, real_t sx=1.0)
void RefineNURBSFromFile(std::string ref_file)
const Element * GetElement(int i) const
Return pointer to the i'th element object.
int AddBdrPoint(int v, int attr=1)
void FinalizeWedgeMesh(int generate_edges=0, int refine=0, bool fix_orientation=true)
Finalize the construction of a wedge Mesh.
static int GetTriOrientation(const int *base, const int *test)
Returns the orientation of "test" relative to "base".
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 comment...
Geometry::Constants< Geometry::SEGMENT > seg_t
void GetElementData(int geom, Array< int > &elem_vtx, Array< int > &attr) const
static Mesh MakeSimplicial(const Mesh &orig_mesh)
void SetPatchBdrAttribute(int i, int attr)
Set the attribute of patch boundary element i, for a NURBS mesh.
int GetNFaces() const
Return the number of faces in a 3D mesh.
int AddVertexAtMeanCenter(const int *vi, const int nverts, int dim=3)
static int GetTetOrientation(const int *base, const int *test)
Returns the orientation of "test" relative to "base".
Geometry::Constants< Geometry::PRISM > pri_t
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)
static int EncodeFaceInfo(int local_face_index, int orientation)
Given local_face_index and orientation, return the corresponding encoded "face info int".
bool FaceIsTrueInterior(int FaceNo) const
const CoarseFineTransformations & GetRefinementTransforms() const
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.
Geometry::Constants< Geometry::SQUARE > quad_t
void GetLocalQuadToWdgTransformation(IsoparametricTransformation &loc, int i) const
ElementTransformation * GetFaceTransformation(int FaceNo)
Returns a pointer to the transformation defining the given face element.
void SetAttribute(int i, int attr)
Set the attribute of element i.
Element * GetBdrElement(int i)
Return pointer to the i'th boundary element object.
void FinalizeTopology(bool generate_bdr=true)
Finalize the construction of the secondary topology (connectivity) data of a Mesh.
virtual void Print(std::ostream &os=mfem::out, const std::string &comments="") const
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.
const FaceGeometricFactors * 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.
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 ...
void Clear()
Clear the contents of the Mesh.
void PrepareNodeReorder(DSTable **old_v_to_v, Table **old_elem_vert)
void ReadXML_VTKMesh(std::istream &input, int &curved, int &read_gf, bool &finalize_topo, const std::string &xml_prefix="")
int AddVertex(real_t x, real_t y=0.0, real_t z=0.0)
virtual void LocalRefinement(const Array< int > &marked_el, int type=3)
This function is not public anymore. Use GeneralRefinement instead.
int GetNE() const
Returns number of elements.
const Element * GetFace(int i) const
Return pointer to the i'th face element object.
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 =...
virtual void Save(const std::string &fname, int precision=16) const
Mesh(int Dim_, int NVert, int NElem, int NBdrElem=0, int spaceDim_=-1)
Init constructor: begin the construction of a Mesh object.
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.
void GetBoundingBox(Vector &min, Vector &max, int ref=2)
Returns the minimum and maximum corners of the mesh bounding box.
void GetBdrPointMatrix(int i, DenseMatrix &pointmat) const
int Dimension() const
Dimension of the reference space used within the elements.
void RandomRefinement(real_t prob, bool aniso=false, int nonconforming=-1, int nc_limit=0)
Refine each element with given probability. Uses GeneralRefinement.
const Element * GetBdrElement(int i) const
Return pointer to the i'th boundary element object.
void CheckDisplacements(const Vector &displacements, real_t &tmax)
void AddTriangleFaceElement(int lf, int gf, int el, int v0, int v1, int v2)
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 GetNode(int i, real_t *coord) const
bool OwnsNodes() const
Return the mesh nodes ownership flag.
void ReorderElements(const Array< int > &ordering, bool reorder_vertices=true)
void GreenRefinement(int i, const DSTable &v_to_v, int *edge1, int *edge2, int *middle)
void UpdateNodes()
Update the nodes of a curved mesh after the topological part of a Mesh::Operation,...
void PrintElementsWithPartitioning(int *partitioning, std::ostream &os, int interior_faces=0)
Mesh & operator=(Mesh &&mesh)
Move assignment operator.
Geometry::Constants< Geometry::CUBE > hex_t
static int InvertQuadOrientation(int ori)
Array< FaceGeometricFactors * > face_geom_factors
void GetLocalTriToPyrTransformation(IsoparametricTransformation &loc, int i) const
Geometry::Constants< Geometry::TRIANGLE > tri_t
static Mesh MakeRefined(Mesh &orig_mesh, int ref_factor, int ref_type)
Create a refined (by any factor) version of orig_mesh.
real_t GetElementSize(int i, int type=0)
Get the size of the i-th element relative to the perfect reference element.
Element * ReadElementWithoutAttr(std::istream &input)
void SetNodesOwner(bool nodes_owner)
Set the mesh nodes ownership flag.
int AddBdrSegment(int v1, int v2, int attr=1)
bool DerefineByError(Array< real_t > &elem_error, real_t threshold, int nc_limit=0, int op=1)
void FinalizeHexMesh(int generate_edges=0, int refine=0, bool fix_orientation=true)
Finalize the construction of a hexahedral Mesh.
int AddElement(Element *elem)
static int DecodeFaceInfoLocalIndex(int info)
Given a "face info int", return the local face index.
FaceInformation GetFaceInformation(int f) const
int GetNumFacesWithGhost() const
Return the number of faces (3D), edges (2D) or vertices (1D) including ghost faces.
void GetElementTransformation(int i, IsoparametricTransformation *ElTr) const
Builds the transformation defining the i-th element in ElTr. ElTr must be allocated in advance and wi...
void RefineAtVertex(const Vertex &vert, real_t eps=0.0, int nonconforming=-1)
Refine elements sharing the specified vertex. Uses GeneralRefinement.
void GetBdrElementEdges(int i, Array< int > &edges, Array< int > &cor) const
Return the indices and the orientations of all edges of bdr element i.
static int InvertTriOrientation(int ori)
STable3D * GetElementToFaceTable(int ret_ftbl=0)
void FinalizeQuadMesh(int generate_edges=0, int refine=0, bool fix_orientation=true)
Finalize the construction of a quadrilateral Mesh.
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.
virtual bool NonconformingDerefinement(Array< real_t > &elem_error, real_t threshold, int nc_limit=0, int op=1)
NC version of GeneralDerefinement.
void AddVertexParents(int i, int p1, int p2)
Mark vertex i as nonconforming, with parent vertices p1 and p2.
MFEM_DEPRECATED void GetBdrElementAdjacentElement2(int bdr_el, int &el, int &info) const
Deprecated.
int GetPatchAttribute(int i) const
Return the attribute of patch i, for a NURBS mesh.
void GetFaceElements(int Face, int *Elem1, int *Elem2) const
void Printer(std::ostream &os=mfem::out, std::string section_delimiter="", const std::string &comments="") const
bool FaceIsInterior(int FaceNo) const
Return true if the given face is interior.
ElementTransformation * GetBdrElementTransformation(int i)
Returns a pointer to the transformation defining the i-th boundary element.
static bool remove_unused_vertices
IsoparametricTransformation Transformation
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.
MFEM_DEPRECATED Geometry::Type GetFaceGeometryType(int Face) const
Deprecated in favor of Mesh::GetFaceGeometry.
void GetLocalTriToWdgTransformation(IsoparametricTransformation &loc, int i) const
void GetElementFaces(int i, Array< int > &faces, Array< int > &ori) const
Return the indices and the orientations of all faces of element i.
int SpaceDimension() const
Dimension of the physical space containing the mesh.
void ReadNURBSMesh(std::istream &input, int &curved, int &read_gf, bool spacing=false)
const GeometricFactors * GetGeometricFactors(const IntegrationRule &ir, const int flags, MemoryType d_mt=MemoryType::DEFAULT)
Return the mesh geometric factors corresponding to the given integration rule.
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 =...
void LoadPatchTopo(std::istream &input, Array< int > &edge_to_knot)
Read NURBS patch/macro-element mesh.
void GetCharacteristics(real_t &h_min, real_t &h_max, real_t &kappa_min, real_t &kappa_max, Vector *Vh=NULL, Vector *Vk=NULL)
void SetNodalGridFunction(GridFunction *nodes, bool make_owner=false)
void ReadCubit(const std::string &filename, int &curved, int &read_gf)
Load a mesh from a Genesis file.
static const int vtk_quadratic_pyramid[13]
void SetNode(int i, const real_t *coord)
AttributeSets attribute_sets
Named sets of element attributes.
virtual void UniformRefinement3D()
Refine a mixed 3D mesh uniformly.
static int ComposeTriOrientations(int ori_a_b, int ori_b_c)
Mesh & operator=(const Mesh &mesh)=delete
Explicitly delete the copy assignment operator.
void PrintBdrVTU(std::string fname, VTKFormat format=VTKFormat::ASCII, bool high_order_output=false, int compression_level=0)
void AddSegmentFaceElement(int lf, int gf, int el, int v0, int v1)
FaceElementTransformations * GetBdrFaceTransformations(int BdrElemNo)
Builds the transformation defining the given boundary face.
int AddBdrTriangle(int v1, int v2, int v3, int attr=1)
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) Ar...
int MeshGenerator() const
Get the mesh generator/type.
int GetNV() const
Returns number of vertices. Vertices are only at the corners of elements, where you would expect them...
static int DecodeFaceInfoOrientation(int info)
Given a "face info int", return the face orientation.
void GetHilbertElementOrdering(Array< int > &ordering)
void GetEdgeVertices(int i, Array< int > &vert) const
Returns the indices of the vertices of edge i.
void AddQuadAs5QuadsWithPoints(int *vi, int attr=1)
Adds 5 quadrilaterals to the mesh by splitting a quadrilateral given by 4 vertices vi.
void ReadVTKMesh(std::istream &input, int &curved, int &read_gf, bool &finalize_topo)
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 UniformRefinement2D()
Refine a mixed 2D mesh uniformly.
static Mesh MakePeriodic(const Mesh &orig_mesh, const std::vector< int > &v2v)
Create a periodic mesh by identifying vertices of orig_mesh.
Element::Type GetFaceElementType(int Face) const
int CheckBdrElementOrientation(bool fix_it=true)
Check the orientation of the boundary elements.
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....
void AverageVertices(const int *indexes, int n, int result)
Averages the vertices with given indexes and saves the result in vertices[result].
real_t GetElementVolume(int i)
static Mesh LoadFromFile(const std::string &filename, int generate_edges=0, int refine=1, bool fix_orientation=true)
static const int vtk_quadratic_hex[27]
void Swap(Mesh &other, bool non_geometry)
Array< Triple< int, int, int > > tmp_vertex_parents
virtual void GenerateBoundaryElements()
static void GetElementArrayEdgeTable(const Array< Element * > &elem_array, const DSTable &v_to_v, Table &el_to_edge)
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 giv...
void Bisection(int i, const DSTable &, int *, int *, int *)
Bisect a triangle: element with index i is bisected.
void GetFaceVertices(int i, Array< int > &vert) const
Returns the indices of the vertices of face i.
void UniformRefinement2D_base(bool update_nodes=true)
IsoparametricTransformation BdrTransformation
void GetLocalSegToTriTransformation(IsoparametricTransformation &loc, int i) const
void DegreeElevate(int rel_degree, int degree=16)
void GetBdrElementData(int geom, Array< int > &bdr_elem_vtx, Array< int > &bdr_attr) const
int FindCoarseElement(int i)
void FinalizeTriMesh(int generate_edges=0, int refine=0, bool fix_orientation=true)
Finalize the construction of a triangular Mesh.
void GetElementCenter(int i, Vector ¢er)
void AddHexAsPyramids(const int *vi, int attr=1)
Adds 6 pyramids to the mesh by splitting a hexahedron given by 8 vertices vi.
static void PrintElementsByGeometry(int dim, const Array< int > &num_elems_by_geom, std::ostream &os)
Auxiliary method used by PrintCharacteristics().
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.
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,...
MFEM_DEPRECATED int GetBdrFace(int i) const
Deprecated in favor of GetBdrElementFaceIndex().
virtual void SetNodalFESpace(FiniteElementSpace *nfes)
int GetNBE() const
Returns number of boundary elements.
long long GetGlobalNE() const
Return the total (global) number of elements.
virtual void Finalize(bool refine=false, bool fix_orientation=false)
Finalize the construction of a general Mesh.
MFEM_DEPRECATED Mesh(int n, real_t sx=1.0)
Deprecated: see MakeCartesian1D.
void AddQuadFaceElement(int lf, int gf, int el, int v0, int v1, int v2, int v3)
void ReadMFEMMesh(std::istream &input, int version, int &curved)
Geometry::Constants< Geometry::PYRAMID > pyr_t
void KnotRemove(Array< Vector * > &kv)
For NURBS meshes, remove the knots in kv, for each direction.
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 coordin...
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 GetEdgeTransformation(int i, IsoparametricTransformation *EdTr) const
Builds the transformation defining the i-th edge element in EdTr. EdTr must be allocated in advance a...
void GetElementData(const Array< Element * > &elem_array, int geom, Array< int > &elem_vtx, Array< int > &attr) const
void PrintSurfaces(const Table &Aface_face, std::ostream &os) const
Print set of disjoint surfaces:
bool IsSlaveFace(const FaceInfo &fi) const
void FreeElement(Element *E)
Array< Element * > boundary
virtual void MarkTetMeshForRefinement(const DSTable &v_to_v)
void GetPointMatrix(int i, DenseMatrix &pointmat) const
FaceElementTransformations * GetInteriorFaceTransformations(int FaceNo)
See GetFaceElementTransformations().
void GetLocalTriToTetTransformation(IsoparametricTransformation &loc, int i) const
virtual void PrintInfo(std::ostream &os=mfem::out)
In serial, this method calls PrintCharacteristics(). In parallel, additional information about the pa...
virtual void PrintXG(std::ostream &os=mfem::out) const
Print the mesh to the given stream using Netgen/Truegrid format.
MFEM_DEPRECATED Geometry::Type GetFaceBaseGeometry(int i) const
Deprecated in favor of Mesh::GetFaceGeometry.
NCMesh * ncmesh
Optional nonconforming mesh extension.
void NewNodes(GridFunction &nodes, bool make_owner=false)
Replace the internal node GridFunction with the given GridFunction.
virtual void NURBSUniformRefinement(int rf=2, real_t tol=1.0e-12)
Refine NURBS mesh, with an optional refinement factor, generally anisotropic.
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.
void DebugDump(std::ostream &os) const
Output an NCMesh-compatible debug dump.
real_t * GetVertex(int i)
Return pointer to vertex i's coordinates.
MFEM_DEPRECATED int GetBdrElementEdgeIndex(int i) const
GridFunction * GetNodes()
Return a pointer to the internal node GridFunction (may be NULL).
bool RefineByError(const Array< real_t > &elem_error, real_t threshold, int nonconforming=-1, int nc_limit=0)
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.
virtual ~Mesh()
Destroys Mesh.
STable3D * GetFacesTable()
Table * GetFaceEdgeTable() const
void EnsureNCMesh(bool simplices_nonconforming=false)
bool HasGeometry(Geometry::Type geom) const
Return true iff the given geom is encountered in the mesh. Geometries of dimensions lower than Dimens...
virtual MFEM_DEPRECATED void ReorientTetMesh()
void PrintVTK(std::ostream &os)
void MoveNodes(const Vector &displacements)
Array< GeometricFactors * > geom_factors
Optional geometric factors.
void SetMeshGen()
Determine the mesh generator bitmask meshgen, see MeshGenerator().
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 = QUADRILATER...
void GetElementEdges(int i, Array< int > &edges, Array< int > &cor) const
Return the indices and the orientations of all edges of element i.
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 = QUADRILATER...
void AddHexAsTets(const int *vi, int attr=1)
Adds 6 tetrahedrons to the mesh by splitting a hexahedron given by 8 vertices vi.
FaceElementTransformations FaceElemTr
void MesquiteSmooth(const int mesquite_option=0)
void SetNodes(const Vector &node_coord)
Updates the vertex/node locations. Invokes NodesUpdated().
int GetNumGeometries(int dim) const
Return the number of geometries of the given dimension present in the mesh.
void GetLocalQuadToPyrTransformation(IsoparametricTransformation &loc, int i) const
void AddHexAsWedges(const int *vi, int attr=1)
Adds 2 wedges to the mesh by splitting a hexahedron given by 8 vertices vi.
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.
Element * ReadElement(std::istream &input)
virtual bool HasBoundaryElements() const
Checks if the mesh has boundary elements.
void ScaleSubdomains(real_t sf)
void GetVertexToVertexTable(DSTable &) const
void GetLocalQuadToHexTransformation(IsoparametricTransformation &loc, int i) const
void Transform(void(*f)(const Vector &, Vector &))
void UniformRefinement(int i, const DSTable &, int *, int *, int *)
Geometry::Type GetElementBaseGeometry(int i) const
@ LocalSlaveNonconforming
@ SharedSlaveNonconforming
void SwapNodes(GridFunction *&nodes, int &own_nodes_)
Swap the internal node GridFunction pointer and ownership flag members with the given ones.
void SetBdrAttribute(int i, int attr)
Set the attribute of boundary element i.
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 ...
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.
Table * GetVertexToElementTable()
void InitRefinementTransforms()
Geometry::Type GetBdrElementBaseGeometry(int i) const
Table * GetEdgeVertexTable() const
int * GeneratePartitioning(int nparts, int part_method=1)
Table * GetFaceToElementTable() const
void MarkTriMeshForRefinement()
void ReadNetgen2DMesh(std::istream &input, int &curved)
Array< Element * > elements
Array< int > attributes
A list of all unique element attributes used by the Mesh.
void AddPointFaceElement(int lf, int gf, int el)
Used in GenerateFaces()
void RemoveInternalBoundaries()
virtual void NonconformingRefinement(const Array< Refinement > &refinements, int nc_limit=0)
This function is not public anymore. Use GeneralRefinement instead.
void MakeSimplicial_(const Mesh &orig_mesh, int *vglobal)
void MoveVertices(const Vector &displacements)
virtual void SetAttributes()
Determine the sets of unique attribute values in domain and boundary elements.
const real_t * GetVertex(int i) const
Return pointer to vertex i's coordinates.
void DeleteGeometricFactors()
Destroy all GeometricFactors stored by the Mesh.
const Table & ElementToFaceTable() const
long GetNodesSequence() const
Return the nodes update counter.
void AddQuadAs4TrisWithPoints(int *vi, int attr=1)
Adds 4 triangles to the mesh by splitting a quadrilateral given by 4 vertices vi.
void RemoveUnusedVertices()
Remove unused vertices and rebuild mesh connectivity.
void KnotInsert(Array< KnotVector * > &kv)
For NURBS meshes, insert the new knots in kv, for each direction.
A class for non-conforming AMR. The class is not used directly by the user, rather it is an extension...
Class used to extrude the nodes of a mesh.
void SetLayer(const int l)
virtual void Eval(Vector &V, ElementTransformation &T, const IntegrationPoint &ip)
Evaluate the vector coefficient in the element described by T at the point ip, storing the result in ...
NodeExtrudeCoefficient(const int dim, const int n_, const real_t s_)
virtual ~NodeExtrudeCoefficient()
Class for parallel meshes.
A parallel extension of the NCMesh class.
Symmetric 3D Table stored as an array of rows each of which has a stack of column,...
Data type tetrahedron element.
Base class for vector Coefficients that optionally depend on time and space.
virtual void Eval(Vector &V, ElementTransformation &T, const IntegrationPoint &ip)=0
Evaluate the vector coefficient in the element described by T at the point ip, storing the result in ...
constexpr int dimension
This example only works in 3D. Kernels for 2D are not implemented.
std::ostream & operator<<(std::ostream &os, SparseMatrix const &mat)
OutStream out(std::cout)
Global stream used by the library for standard output. Initially it uses the same std::streambuf as s...
void ShiftRight(int &a, int &b, int &c)
Mesh * Extrude1D(Mesh *mesh, const int ny, const real_t sy, const bool closed)
Extrude a 1D mesh.
Mesh * Extrude2D(Mesh *mesh, const int nz, const real_t sz)
Extrude a 2D mesh.
VTKFormat
Data array format for VTK and VTU files.
@ ASCII
Data arrays will be written in ASCII format.
MemoryType
Memory types supported by MFEM.
std::function< real_t(const Vector &)> f(real_t mass_coeff)
EntityHelper(int dim_, const Array< int >(&entity_to_vertex_)[Geometry::NumGeom])
Entity FindEntity(int bytype_entity_id)
entity_to_vertex_type & entity_to_vertex
const Array< int > entity_to_vertex_type[Geometry::NumGeom]
int geom_offsets[Geometry::NumGeom+1]
This structure stores the low level information necessary to interpret the configuration of elements ...
const DenseMatrix * PointMatrix
NCFaceInfo(bool slave, int master, const DenseMatrix *pm)