MFEM  v4.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, Lawrence Livermore National Security, LLC. Produced at
2 // the Lawrence Livermore National Laboratory. LLNL-CODE-443211. All Rights
3 // reserved. See file COPYRIGHT for details.
4 //
5 // This file is part of the MFEM library. For more information and source code
6 // availability see http://mfem.org.
7 //
8 // MFEM is free software; you can redistribute it and/or modify it under the
9 // terms of the GNU Lesser General Public License (as published by the Free
10 // Software Foundation) version 2.1 dated February 1999.
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  virtual int GetNFaces(int &nFaceVertices) const = 0;
78 
79  virtual const int *GetFaceVertices(int fi) const = 0;
80 
81  /// Mark the longest edge by assuming/changing the order of the vertices.
82  virtual void MarkEdge(const DSTable &v_to_v, const int *length) {}
83 
84  /// Return 1 if the element needs refinement in order to get conforming mesh.
85  virtual int NeedRefinement(HashTable<Hashed2> &v_to_v) const { return 0; }
86 
87  /// Set current coarse-fine transformation number.
88  virtual void ResetTransform(int tr) {}
89 
90  /// Add 'tr' to the current chain of coarse-fine transformations.
91  virtual void PushTransform(int tr) {}
92 
93  /// Return current coarse-fine transformation.
94  virtual unsigned GetTransform() const { return 0; }
95 
96  virtual Element *Duplicate(Mesh *m) const = 0;
97 
98  /// Destroys element.
99  virtual ~Element() { }
100 };
101 
102 }
103 
104 #endif
Geometry::Type GetGeometryType() const
Definition: element.hpp:52
virtual int * GetVertices()=0
virtual Element * Duplicate(Mesh *m) const =0
virtual int GetNEdges() const =0
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:88
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:82
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
Type
Constants for the classes derived from Element.
Definition: element.hpp:41
int GetAttribute() const
Return element&#39;s attribute.
Definition: element.hpp:55
virtual unsigned GetTransform() const
Return current coarse-fine transformation.
Definition: element.hpp:94
int attribute
Element&#39;s attribute (specifying material property, etc).
Definition: element.hpp:33
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:85
virtual int GetNFaces(int &nFaceVertices) const =0
const int * GetVertices() const
Definition: element.hpp:68
virtual ~Element()
Destroys element.
Definition: element.hpp:99
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
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:91
virtual Type GetType() const =0
Returns element&#39;s type.