MFEM  v4.6.0
Finite element discretization library
pyramid.cpp
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 // Implementation of class Pyramid
13 
14 #include "mesh_headers.hpp"
15 
16 namespace mfem
17 {
18 
19 Pyramid::Pyramid(const int *ind, int attr)
20  : Element(Geometry::PYRAMID)
21 {
22  attribute = attr;
23  for (int i = 0; i < 5; i++)
24  {
25  indices[i] = ind[i];
26  }
27 }
28 
29 Pyramid::Pyramid(int ind1, int ind2, int ind3, int ind4, int ind5, int attr)
30  : Element(Geometry::PYRAMID)
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 }
39 
40 void Pyramid::SetVertices(const int *ind)
41 {
42  for (int i = 0; i < 5; i++)
43  {
44  indices[i] = ind[i];
45  }
46 }
47 
49 {
50  v.SetSize(5);
51  for (int i = 0; i < 5; i++)
52  {
53  v[i] = indices[i];
54  }
55 }
56 
57 int Pyramid::GetNFaces(int &nFaceVertices) const
58 {
59  MFEM_ABORT("this method is not valid for Pyramid elements");
60  nFaceVertices = 4;
61  return 5;
62 }
63 
64 }
virtual void SetVertices(const int *ind)
Set the vertices according to the given input.
Definition: pyramid.cpp:40
virtual int * GetVertices()
Definition: pyramid.hpp:48
virtual int GetNFaces() const
Definition: pyramid.hpp:60
int attribute
Element&#39;s attribute (specifying material property, etc).
Definition: element.hpp:33
int indices[5]
Definition: pyramid.hpp:25
void SetSize(int nsize)
Change the logical size of the array, keep existing entries.
Definition: array.hpp:687
Abstract data type element.
Definition: element.hpp:28