MFEM v4.7.0
Finite element discretization library
Loading...
Searching...
No Matches
hexahedron.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_HEXAHEDRON
13#define MFEM_HEXAHEDRON
14
15#include "../config/config.hpp"
16#include "element.hpp"
17
18namespace mfem
19{
20
21/// Data type hexahedron element
22class Hexahedron : public Element
23{
24protected:
25 int indices[8];
26
27public:
29
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 override { return Element::HEXAHEDRON; }
41
42 /// Get the indices defining the vertices.
43 void GetVertices(Array<int> &v) const override;
44
45 /// Set the indices defining the vertices.
46 void SetVertices(const Array<int> &v) override;
47
48 /// @note The returned array should NOT be deleted by the caller.
49 int * GetVertices () override { return indices; }
50
51 /// Set the indices defining the vertices.
52 void SetVertices(const int *ind) override;
53
54 int GetNVertices() const override { return 8; }
55
56 int GetNEdges() const override { return 12; }
57
58 const int *GetEdgeVertices(int ei) const override
59 { return geom_t::Edges[ei]; }
60
61 /// @deprecated Use GetNFaces(void) and GetNFaceVertices(int) instead.
62 MFEM_DEPRECATED int GetNFaces(int &nFaceVertices) const override
63 { nFaceVertices = 4; return 6; }
64
65 int GetNFaces() const override { return 6; }
66
67 int GetNFaceVertices(int) const override { return 4; }
68
69 const int *GetFaceVertices(int fi) const override
70 { return geom_t::FaceVert[fi]; }
71
72 Element *Duplicate(Mesh *m) const override
73 { return new Hexahedron(indices, attribute); }
74
75 virtual ~Hexahedron() = default;
76};
77
78extern MFEM_EXPORT class TriLinear3DFiniteElement HexahedronFE;
79
80}
81
82#endif
Abstract data type element.
Definition element.hpp:29
int attribute
Element's attribute (specifying material property, etc).
Definition element.hpp:33
Type
Constants for the classes derived from Element.
Definition element.hpp:41
Data type hexahedron element.
Geometry::Constants< Geometry::CUBE > geom_t
Type GetType() const override
Return element's type.
Element * Duplicate(Mesh *m) const override
void SetVertices(const Array< int > &v) override
Set the indices defining the vertices.
int * GetVertices() override
const int * GetEdgeVertices(int ei) const override
virtual ~Hexahedron()=default
const int * GetFaceVertices(int fi) const override
int GetNVertices() const override
int GetNEdges() const override
MFEM_DEPRECATED int GetNFaces(int &nFaceVertices) const override
int GetNFaces() const override
int GetNFaceVertices(int) const override
Mesh data type.
Definition mesh.hpp:56
A 3D tri-linear element on a cube with nodes at the vertices of the cube.
TriLinear3DFiniteElement HexahedronFE
static const int FaceVert[NumFaces][MaxFaceVert]
Definition geom.hpp:255
static const int Edges[NumEdges][2]
Definition geom.hpp:251