MFEM v4.7.0
Finite element discretization library
Loading...
Searching...
No Matches
pyramid.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// Implementation of class Pyramid
13
14#include "mesh_headers.hpp"
15
16namespace mfem
17{
18
19Pyramid::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
29Pyramid::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
40void 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 std::copy(indices, indices + 5, v.begin());
52}
53
55{
56 MFEM_ASSERT(v.Size() == 5, "!");
57 std::copy(v.begin(), v.end(), indices);
58}
59
60int Pyramid::GetNFaces(int &nFaceVertices) const
61{
62 MFEM_ABORT("this method is not valid for Pyramid elements");
63 nFaceVertices = 4;
64 return 5;
65}
66
67}
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.
Definition pyramid.cpp:54
int indices[5]
Definition pyramid.hpp:25
int GetNFaces() const override
Definition pyramid.hpp:64
int * GetVertices() override
Definition pyramid.hpp:49