MFEM v4.7.0
Finite element discretization library
Loading...
Searching...
No Matches
hexahedron.cpp
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
13#include "mesh_headers.hpp"
14
15namespace mfem
16{
17
18Hexahedron::Hexahedron(const int *ind, int attr)
19 : Element(Geometry::CUBE)
20{
21 attribute = attr;
22 for (int i = 0; i < 8; i++)
23 {
24 indices[i] = ind[i];
25 }
26}
27
28Hexahedron::Hexahedron(int ind1, int ind2, int ind3, int ind4,
29 int ind5, int ind6, int ind7, int ind8,
30 int attr) : Element(Geometry::CUBE)
31{
32 attribute = attr;
33 indices[0] = ind1;
34 indices[1] = ind2;
35 indices[2] = ind3;
36 indices[3] = ind4;
37 indices[4] = ind5;
38 indices[5] = ind6;
39 indices[6] = ind7;
40 indices[7] = ind8;
41}
42
44{
45 v.SetSize(8);
46 std::copy(indices, indices + 8, v.begin());
47}
48
50{
51 MFEM_ASSERT(v.Size() == 8, "!");
52 std::copy(v.begin(), v.end(), indices);
53}
54
55void Hexahedron::SetVertices(const int *ind)
56{
57 std::copy(ind, ind + 8, indices);
58}
59
61
62}
void SetSize(int nsize)
Change the logical size of the array, keep existing entries.
Definition array.hpp:697
int Size() const
Return the logical size of the array.
Definition array.hpp:144
T * end()
STL-like end. Returns pointer after the last element of the array.
Definition array.hpp:305
T * begin()
STL-like begin. Returns pointer to the first element of the array.
Definition array.hpp:302
Abstract data type element.
Definition element.hpp:29
int attribute
Element's attribute (specifying material property, etc).
Definition element.hpp:33
void SetVertices(const Array< int > &v) override
Set the indices defining the vertices.
int * GetVertices() override
A 3D tri-linear element on a cube with nodes at the vertices of the cube.
TriLinear3DFiniteElement HexahedronFE