MFEM  v4.6.0
Finite element discretization library
hexahedron.hpp
Go to the documentation of this file.
1 // Copyright (c) 2010-2023, 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_HEXAHEDRON
13 #define MFEM_HEXAHEDRON
14 
15 #include "../config/config.hpp"
16 #include "element.hpp"
17 
18 namespace mfem
19 {
20 
21 /// Data type hexahedron element
22 class Hexahedron : public Element
23 {
24 protected:
25  int indices[8];
26 
27 public:
29 
30  Hexahedron() : Element(Geometry::CUBE) { }
31 
32  /// Constructs hexahedron by specifying the indices and the attribute.
33  Hexahedron(const int *ind, int attr = 1);
34 
35  /// Constructs hexahedron by specifying the indices and the attribute.
36  Hexahedron(int ind1, int ind2, int ind3, int ind4,
37  int ind5, int ind6, int ind7, int ind8, int attr = 1);
38 
39  /// Return element's type
40  Type GetType() const { return Element::HEXAHEDRON; }
41 
42  /// Returns the indices of the element's vertices.
43  virtual void GetVertices(Array<int> &v) const;
44 
45  virtual int *GetVertices() { return indices; }
46 
47  virtual int GetNVertices() const { return 8; }
48 
49  virtual int GetNEdges() const { return 12; }
50 
51  virtual const int *GetEdgeVertices(int ei) const
52  { return geom_t::Edges[ei]; }
53 
54  /// @deprecated Use GetNFaces(void) and GetNFaceVertices(int) instead.
55  MFEM_DEPRECATED virtual int GetNFaces(int &nFaceVertices) const
56  { nFaceVertices = 4; return 6; }
57 
58  virtual int GetNFaces() const { return 6; }
59 
60  virtual int GetNFaceVertices(int) const { return 4; }
61 
62  virtual const int *GetFaceVertices(int fi) const
63  { return geom_t::FaceVert[fi]; }
64 
65  virtual Element *Duplicate(Mesh *m) const
66  { return new Hexahedron(indices, attribute); }
67 
68  virtual ~Hexahedron() { }
69 };
70 
71 extern MFEM_EXPORT class TriLinear3DFiniteElement HexahedronFE;
72 
73 }
74 
75 #endif
virtual int GetNFaces() const
Definition: hexahedron.hpp:58
Type GetType() const
Return element&#39;s type.
Definition: hexahedron.hpp:40
virtual const int * GetEdgeVertices(int ei) const
Definition: hexahedron.hpp:51
TriLinear3DFiniteElement HexahedronFE
Definition: hexahedron.cpp:52
virtual int GetNFaceVertices(int) const
Definition: hexahedron.hpp:60
virtual int GetNEdges() const
Definition: hexahedron.hpp:49
virtual ~Hexahedron()
Definition: hexahedron.hpp:68
Data type hexahedron element.
Definition: hexahedron.hpp:22
virtual int GetNVertices() const
Definition: hexahedron.hpp:47
Type
Constants for the classes derived from Element.
Definition: element.hpp:41
Geometry::Constants< Geometry::CUBE > geom_t
Definition: hexahedron.hpp:28
virtual int * GetVertices()
Definition: hexahedron.hpp:45
int attribute
Element&#39;s attribute (specifying material property, etc).
Definition: element.hpp:33
virtual Element * Duplicate(Mesh *m) const
Definition: hexahedron.hpp:65
static const int FaceVert[NumFaces][MaxFaceVert]
Definition: geom.hpp:252
virtual MFEM_DEPRECATED int GetNFaces(int &nFaceVertices) const
Definition: hexahedron.hpp:55
static const int Edges[NumEdges][2]
Definition: geom.hpp:248
virtual const int * GetFaceVertices(int fi) const
Definition: hexahedron.hpp:62
Abstract data type element.
Definition: element.hpp:28