MFEM v4.7.0
Finite element discretization library
Loading...
Searching...
No Matches
element.hpp
Go to the documentation of this file.
1// Copyright (c) 2010-2024, 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
53
54 /// Return element's attribute.
55 inline int GetAttribute() const { return attribute; }
56
57 /// Set element's attribute.
58 inline void SetAttribute(const int attr) { attribute = attr; }
59
60 /// Get the indices defining the vertices.
61 virtual void GetVertices(Array<int> &v) const = 0;
62
63 /// Set the indices defining the vertices.
64 virtual void SetVertices(const Array<int> &v) = 0;
65
66 /// Set the indices defining the vertices.
67 virtual void SetVertices(const int *ind) = 0;
68
69 /// @note The returned array should NOT be deleted by the caller.
70 virtual int *GetVertices() = 0;
71
72 const int *GetVertices() const
73 { return const_cast<Element *>(this)->GetVertices(); }
74
75 virtual int GetNVertices() const = 0;
76
77 virtual int GetNEdges() const = 0;
78
79 virtual const int *GetEdgeVertices(int) const = 0;
80
81 /// @deprecated Use GetNFaces(void) and GetNFaceVertices(int) instead.
82 MFEM_DEPRECATED virtual int GetNFaces(int &nFaceVertices) const = 0;
83
84 virtual int GetNFaces() const = 0;
85
86 virtual int GetNFaceVertices(int fi) const = 0;
87
88 virtual const int *GetFaceVertices(int fi) const = 0;
89
90 /// Mark the longest edge by assuming/changing the order of the vertices.
91 virtual void MarkEdge(const DSTable &v_to_v, const int *length) {}
92
93 /// Return 1 if the element needs refinement in order to get conforming mesh.
94 virtual int NeedRefinement(HashTable<Hashed2> &v_to_v) const { return 0; }
95
96 /// Set current coarse-fine transformation number.
97 virtual void ResetTransform(int tr) {}
98
99 /// Add 'tr' to the current chain of coarse-fine transformations.
100 virtual void PushTransform(int tr) {}
101
102 /// Return current coarse-fine transformation.
103 virtual unsigned GetTransform() const { return 0; }
104
105 /// @note The returned object should be deleted by the caller.
106 virtual Element *Duplicate(Mesh *m) const = 0;
107
108 /// Destroys element.
109 virtual ~Element() { }
110};
111
112}
113
114#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:103
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:97
virtual const int * GetFaceVertices(int fi) const =0
Geometry::Type GetGeometryType() const
Definition element.hpp:52
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:100
virtual int GetNFaceVertices(int fi) const =0
const int * GetVertices() const
Definition element.hpp:72
void SetAttribute(const int attr)
Set element's attribute.
Definition element.hpp:58
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:94
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:55
virtual ~Element()
Destroys element.
Definition element.hpp:109
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:91
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:56