MFEM  v4.5.0
Finite element discretization library
element.hpp
Go to the documentation of this file.
1 // Copyright (c) 2010-2022, 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"
18 #include "../linalg/densemat.hpp"
19 #include "../fem/geom.hpp"
20 #include "../general/hash.hpp"
21 
22 namespace mfem
23 {
24 
25 class Mesh;
26 
27 /// Abstract data type element
28 class Element
29 {
30 protected:
31 
32  /// Element's attribute (specifying material property, etc).
33  int attribute;
34 
35  /// Element's type from the Finite Element's perspective
37 
38 public:
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  /// Set the indices the element according to the input.
61  virtual void SetVertices(const int *ind);
62 
63  /// Returns element's vertices.
64  virtual void GetVertices(Array<int> &v) const = 0;
65 
66  virtual int *GetVertices() = 0;
67 
68  const int *GetVertices() const
69  { return const_cast<Element *>(this)->GetVertices(); }
70 
71  virtual int GetNVertices() const = 0;
72 
73  virtual int GetNEdges() const = 0;
74 
75  virtual const int *GetEdgeVertices(int) const = 0;
76 
77  /// @deprecated Use GetNFaces(void) and GetNFaceVertices(int) instead.
78  MFEM_DEPRECATED virtual int GetNFaces(int &nFaceVertices) const = 0;
79 
80  virtual int GetNFaces() const = 0;
81 
82  virtual int GetNFaceVertices(int fi) const = 0;
83 
84  virtual const int *GetFaceVertices(int fi) const = 0;
85 
86  /// Mark the longest edge by assuming/changing the order of the vertices.
87  virtual void MarkEdge(const DSTable &v_to_v, const int *length) {}
88 
89  /// Return 1 if the element needs refinement in order to get conforming mesh.
90  virtual int NeedRefinement(HashTable<Hashed2> &v_to_v) const { return 0; }
91 
92  /// Set current coarse-fine transformation number.
93  virtual void ResetTransform(int tr) {}
94 
95  /// Add 'tr' to the current chain of coarse-fine transformations.
96  virtual void PushTransform(int tr) {}
97 
98  /// Return current coarse-fine transformation.
99  virtual unsigned GetTransform() const { return 0; }
100 
101  virtual Element *Duplicate(Mesh *m) const = 0;
102 
103  /// Destroys element.
104  virtual ~Element() { }
105 };
106 
107 }
108 
109 #endif
virtual int * GetVertices()=0
virtual Element * Duplicate(Mesh *m) const =0
virtual int GetNEdges() const =0
const int * GetVertices() const
Definition: element.hpp:68
int GetAttribute() const
Return element&#39;s attribute.
Definition: element.hpp:55
virtual void SetVertices(const int *ind)
Set the indices the element according to the input.
Definition: element.cpp:17
virtual void ResetTransform(int tr)
Set current coarse-fine transformation number.
Definition: element.hpp:93
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:87
virtual int GetNFaceVertices(int fi) const =0
Element(Geometry::Type bg=Geometry::POINT)
Default element constructor.
Definition: element.hpp:46
virtual const int * GetEdgeVertices(int) const =0
Geometry::Type base_geom
Element&#39;s type from the Finite Element&#39;s perspective.
Definition: element.hpp:36
Geometry::Type GetGeometryType() const
Definition: element.hpp:52
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:90
Type
Constants for the classes derived from Element.
Definition: element.hpp:41
virtual unsigned GetTransform() const
Return current coarse-fine transformation.
Definition: element.hpp:99
int attribute
Element&#39;s attribute (specifying material property, etc).
Definition: element.hpp:33
virtual ~Element()
Destroys element.
Definition: element.hpp:104
virtual int GetNVertices() const =0
void SetAttribute(const int attr)
Set element&#39;s attribute.
Definition: element.hpp:58
virtual const int * GetFaceVertices(int fi) const =0
virtual int GetNFaces() const =0
Abstract data type element.
Definition: element.hpp:28
virtual void PushTransform(int tr)
Add &#39;tr&#39; to the current chain of coarse-fine transformations.
Definition: element.hpp:96
virtual Type GetType() const =0
Returns element&#39;s type.