MFEM v4.8.0
Finite element discretization library
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
element.hpp
Go to the documentation of this file.
1// Copyright (c) 2010-2025, Lawrence Livermore National Security, LLC. Produced
2// at the Lawrence Livermore National Laboratory. All Rights reserved. See files
3// LICENSE and NOTICE for details. LLNL-CODE-806117.
4//
5// This file is part of the MFEM library. For more information and source code
6// availability visit https://mfem.org.
7//
8// MFEM is free software; you can redistribute it and/or modify it under the
9// terms of the BSD-3 license. We welcome feedback and contributions, see file
10// CONTRIBUTING.md for details.
11
12#ifndef MFEM_ELEMENT
13#define MFEM_ELEMENT
14
15#include "../config/config.hpp"
16#include "../general/array.hpp"
17#include "../general/table.hpp"
19#include "../fem/geom.hpp"
20#include "../general/hash.hpp"
21
22namespace mfem
23{
24
25class Mesh;
26
27/// Abstract data type element
29{
30protected:
31
32 /// Element's attribute (specifying material property, etc).
34
35 /// Element's type from the Finite Element's perspective
37
38public:
39
40 /// Constants for the classes derived from Element.
43 };
44
45 /// Default element constructor.
47 { attribute = 1; base_geom = bg; }
48
49 /// Returns element's type
50 virtual Type GetType() const = 0;
51
52 /// Return the Element::Type associated with the given Geometry::Type.
53 static Type TypeFromGeometry(const Geometry::Type geom);
54
56
57 /// Return element's attribute.
58 inline int GetAttribute() const { return attribute; }
59
60 /// Set element's attribute.
61 inline void SetAttribute(const int attr) { attribute = attr; }
62
63 /// Get the indices defining the vertices.
64 virtual void GetVertices(Array<int> &v) const = 0;
65
66 /// Set the indices defining the vertices.
67 virtual void SetVertices(const Array<int> &v) = 0;
68
69 /// Set the indices defining the vertices.
70 virtual void SetVertices(const int *ind) = 0;
71
72 /// @note The returned array should NOT be deleted by the caller.
73 virtual int *GetVertices() = 0;
74
75 const int *GetVertices() const
76 { return const_cast<Element *>(this)->GetVertices(); }
77
78 virtual int GetNVertices() const = 0;
79
80 virtual int GetNEdges() const = 0;
81
82 virtual const int *GetEdgeVertices(int) const = 0;
83
84 /// @deprecated Use GetNFaces(void) and GetNFaceVertices(int) instead.
85 MFEM_DEPRECATED virtual int GetNFaces(int &nFaceVertices) const = 0;
86
87 virtual int GetNFaces() const = 0;
88
89 virtual int GetNFaceVertices(int fi) const = 0;
90
91 virtual const int *GetFaceVertices(int fi) const = 0;
92
93 /// Mark the longest edge by assuming/changing the order of the vertices.
94 virtual void MarkEdge(const DSTable &v_to_v, const int *length) {}
95
96 /// Return 1 if the element needs refinement in order to get conforming mesh.
97 virtual int NeedRefinement(HashTable<Hashed2> &v_to_v) const { return 0; }
98
99 /// Set current coarse-fine transformation number.
100 virtual void ResetTransform(int tr) {}
101
102 /// Add 'tr' to the current chain of coarse-fine transformations.
103 virtual void PushTransform(int tr) {}
104
105 /// Return current coarse-fine transformation.
106 virtual unsigned GetTransform() const { return 0; }
107
108 /// @note The returned object should be deleted by the caller.
109 virtual Element *Duplicate(Mesh *m) const = 0;
110
111 /// Destroys element.
112 virtual ~Element() { }
113};
114
115}
116
117#endif
Abstract data type element.
Definition element.hpp:29
int attribute
Element's attribute (specifying material property, etc).
Definition element.hpp:33
virtual MFEM_DEPRECATED int GetNFaces(int &nFaceVertices) const =0
virtual unsigned GetTransform() const
Return current coarse-fine transformation.
Definition element.hpp:106
Geometry::Type base_geom
Element's type from the Finite Element's perspective.
Definition element.hpp:36
virtual void ResetTransform(int tr)
Set current coarse-fine transformation number.
Definition element.hpp:100
virtual const int * GetFaceVertices(int fi) const =0
Geometry::Type GetGeometryType() const
Definition element.hpp:55
Element(Geometry::Type bg=Geometry::POINT)
Default element constructor.
Definition element.hpp:46
virtual Element * Duplicate(Mesh *m) const =0
virtual int * GetVertices()=0
virtual void GetVertices(Array< int > &v) const =0
Get the indices defining the vertices.
virtual void PushTransform(int tr)
Add 'tr' to the current chain of coarse-fine transformations.
Definition element.hpp:103
virtual int GetNFaceVertices(int fi) const =0
const int * GetVertices() const
Definition element.hpp:75
void SetAttribute(const int attr)
Set element's attribute.
Definition element.hpp:61
virtual int NeedRefinement(HashTable< Hashed2 > &v_to_v) const
Return 1 if the element needs refinement in order to get conforming mesh.
Definition element.hpp:97
virtual int GetNFaces() const =0
virtual Type GetType() const =0
Returns element's type.
Type
Constants for the classes derived from Element.
Definition element.hpp:41
virtual int GetNEdges() const =0
virtual const int * GetEdgeVertices(int) const =0
int GetAttribute() const
Return element's attribute.
Definition element.hpp:58
virtual ~Element()
Destroys element.
Definition element.hpp:112
virtual void MarkEdge(const DSTable &v_to_v, const int *length)
Mark the longest edge by assuming/changing the order of the vertices.
Definition element.hpp:94
static Type TypeFromGeometry(const Geometry::Type geom)
Return the Element::Type associated with the given Geometry::Type.
Definition element.cpp:17
virtual int GetNVertices() const =0
virtual void SetVertices(const Array< int > &v)=0
Set the indices defining the vertices.
Mesh data type.
Definition mesh.hpp:64