OGS
PrismRule15.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 "PrismRule15.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 PrismRule15::n_face_nodes[5] = {6, 8, 8, 8, 6};
14
15const Element* PrismRule15::getFace(const Element* e, unsigned i)
16{
17 if (i < n_faces)
18 {
19 unsigned nFaceNodes(PrismRule15::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 == 0 || i == 4)
27 {
28 return new Tri6(nodes, e->getID());
29 }
30
31 return new Quad8(nodes);
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 constexpr const unsigned face_nodes[5][8]
Constant: Local node index table for faces.
Definition PrismRule15.h:47
static const Element * getFace(const Element *e, unsigned i)
Returns the i-th face of the element.
static const unsigned n_face_nodes[5]
Constant: Table for the number of nodes for each face.
Definition PrismRule15.h:69
static const unsigned n_faces
Constant: The number of faces.
Definition PrismRule.h:22
TemplateElement< MeshLib::QuadRule8 > Quad8
Definition Quad.h:18
TemplateElement< MeshLib::TriRule6 > Tri6
Definition Tri.h:16