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