OGS
PyramidRule5.cpp
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) OpenGeoSys Community (opengeosys.org)
2// SPDX-License-Identifier: BSD-3-Clause
3
4#include "PyramidRule5.h"
5
6#include "BaseLib/Logging.h"
7#include "MeshLib/Node.h"
8#include "Quad.h"
9#include "Tri.h"
10
11namespace MeshLib
12{
13const unsigned PyramidRule5::n_face_nodes[5] = {3, 3, 3, 3, 4};
14
15const Element* PyramidRule5::getFace(const Element* e, unsigned i)
16{
17 if (i < n_faces)
18 {
19 unsigned nFaceNodes(PyramidRule5::n_face_nodes[i]);
20 auto** nodes = new Node*[nFaceNodes];
21 for (unsigned j = 0; j < nFaceNodes; j++)
22 {
23 nodes[j] = const_cast<Node*>(e->getNode(face_nodes[i][j]));
24 }
25
26 if (i < 4)
27 {
28 return new Tri(nodes, e->getID());
29 }
30
31 return new Quad(nodes, e->getID());
32 }
33 ERR("Error in MeshLib::Element::getFace() - Index {:d} does not exist.", i);
34 return nullptr;
35}
36
37} // end namespace MeshLib
void ERR(fmt::format_string< Args... > fmt, Args &&... args)
Definition Logging.h:40
virtual const Node * getNode(unsigned idx) const =0
std::size_t getID() const
Returns the ID of the element.
Definition Element.h:80
static const unsigned n_face_nodes[5]
Constant: Table for the number of nodes for each face.
static constexpr const unsigned face_nodes[5][4]
Constant: Local node index table for faces.
static const Element * getFace(const Element *e, unsigned i)
Returns the i-th face of the element.
static const unsigned n_faces
Constant: The number of faces.
Definition PyramidRule.h:23
TemplateElement< MeshLib::QuadRule4 > Quad
Definition Quad.h:17
TemplateElement< MeshLib::TriRule3 > Tri
Definition Tri.h:15