MFEM  v3.4
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 
21 namespace mfem
22 {
23 
24 class Mesh;
25 
26 /// Abstract data type element
27 class Element
28 {
29 protected:
30 
31  /// Element's attribute (specifying material property, etc).
33 
34 public:
35 
36  /// Constants for the classes derived from Element.
39  };
40 
41  /// Default element constructor.
42  explicit Element(int bg = Geometry::POINT) { attribute = -1; base_geom = bg; }
43 
44  /// Returns element's type
45  virtual int GetType() const = 0;
46 
47  int GetGeometryType() const { return base_geom; }
48 
49  /// Return element's attribute.
50  inline int GetAttribute() const { return attribute; }
51 
52  /// Set element's attribute.
53  inline void SetAttribute(const int attr) { attribute = attr; }
54 
55  /// Set the indices the element according to the input.
56  virtual void SetVertices(const int *ind);
57 
58  /// Returns element's vertices.
59  virtual void GetVertices(Array<int> &v) const = 0;
60 
61  virtual int *GetVertices() = 0;
62 
63  const int *GetVertices() const
64  { return const_cast<Element *>(this)->GetVertices(); }
65 
66  virtual int GetNVertices() const = 0;
67 
68  virtual int GetNEdges() const = 0;
69 
70  virtual const int *GetEdgeVertices(int) const = 0;
71 
72  virtual int GetNFaces(int &nFaceVertices) const = 0;
73 
74  virtual const int *GetFaceVertices(int fi) const = 0;
75 
76  /// Mark the longest edge by assuming/changing the order of the vertices.
77  virtual void MarkEdge(DenseMatrix &pmat) {}
78 
79  /// Mark the longest edge by assuming/changing the order of the vertices.
80  virtual void MarkEdge(const DSTable &v_to_v, const int *length) {}
81 
82  /// Return 1 if the element needs refinement in order to get conforming mesh.
83  virtual int NeedRefinement(DSTable &v_to_v, int *middle) const { return 0; }
84 
85  /// Set current coarse-fine transformation number.
86  virtual void ResetTransform(int tr) {}
87 
88  /// Add 'tr' to the current chain of coarse-fine transformations.
89  virtual void PushTransform(int tr) {}
90 
91  /// Return current coarse-fine transformation.
92  virtual unsigned GetTransform() const { return 0; }
93 
94  virtual int GetRefinementFlag() { return 0; }
95 
96  virtual Element *Duplicate(Mesh *m) const = 0;
97 
98  /// Destroys element.
99  virtual ~Element() { }
100 };
101 
102 }
103 
104 #endif
virtual int * GetVertices()=0
virtual Element * Duplicate(Mesh *m) const =0
virtual int GetNEdges() const =0
Data type dense matrix using column-major storage.
Definition: densemat.hpp:23
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:86
int GetGeometryType() const
Definition: element.hpp:47
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:80
virtual const int * GetEdgeVertices(int) const =0
virtual int GetRefinementFlag()
Definition: element.hpp:94
Type
Constants for the classes derived from Element.
Definition: element.hpp:37
virtual int NeedRefinement(DSTable &v_to_v, int *middle) const
Return 1 if the element needs refinement in order to get conforming mesh.
Definition: element.hpp:83
int GetAttribute() const
Return element&#39;s attribute.
Definition: element.hpp:50
virtual unsigned GetTransform() const
Return current coarse-fine transformation.
Definition: element.hpp:92
virtual void MarkEdge(DenseMatrix &pmat)
Mark the longest edge by assuming/changing the order of the vertices.
Definition: element.hpp:77
int attribute
Element&#39;s attribute (specifying material property, etc).
Definition: element.hpp:32
Element(int bg=Geometry::POINT)
Default element constructor.
Definition: element.hpp:42
virtual int GetNFaces(int &nFaceVertices) const =0
const int * GetVertices() const
Definition: element.hpp:63
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:53
virtual const int * GetFaceVertices(int fi) const =0
Abstract data type element.
Definition: element.hpp:27
virtual void PushTransform(int tr)
Add &#39;tr&#39; to the current chain of coarse-fine transformations.
Definition: element.hpp:89
virtual int GetType() const =0
Returns element&#39;s type.