OGS
HexRule8.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 "HexRule8.h"
5
6#include <array>
7
8#include "BaseLib/Logging.h"
9#include "Line.h"
11#include "MeshLib/Node.h"
12#include "Quad.h"
13
14namespace MeshLib
15{
16const Element* HexRule8::getFace(const Element* e, unsigned i)
17{
18 if (i < n_faces)
19 {
20 std::array<Node*, 4> nodes{};
21 for (unsigned j = 0; j < 4; j++)
22 {
23 nodes[j] = const_cast<Node*>(e->getNode(face_nodes[i][j]));
24 }
25 return new Quad(nodes, e->getID());
26 }
27 ERR("Error in MeshLib::Element::getFace() - Index {:d} does not exist.", i);
28 return nullptr;
29}
30} // 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 Element * getFace(const Element *e, unsigned i)
Returns the i-th face of the element.
Definition HexRule8.cpp:16
static constexpr const unsigned face_nodes[6][4]
Constant: Local node index table for faces.
Definition HexRule8.h:46
static const unsigned n_faces
Constant: The number of faces.
Definition HexRule.h:22
TemplateElement< MeshLib::QuadRule4 > Quad
Definition Quad.h:17