OGS
CellRule.h
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#pragma once
5
6#include "MeshLib/Node.h"
7
8namespace MeshLib
9{
10
11class Element;
12
14{
15public:
17 static const unsigned dimension = 3u;
18
27 static bool testElementNodeOrder(Element const& e);
28
29protected:
31 template <typename ElementRule>
32 static unsigned identifyFace(Node const* const* element_nodes,
33 Node const* nodes[ElementRule::dimension])
34 {
35 for (unsigned i = 0; i < ElementRule::n_faces; i++)
36 {
37 unsigned flag(0);
38 constexpr std::size_t n = sizeof(ElementRule::face_nodes[0]) /
39 sizeof(ElementRule::face_nodes[0][0]);
40 for (unsigned j = 0; j < n; j++)
41 {
42 for (unsigned k = 0; k < ElementRule::dimension; k++)
43 {
44 if (ElementRule::face_nodes[i][j] != 99 &&
45 element_nodes[ElementRule::face_nodes[i][j]] ==
46 nodes[k])
47 {
48 flag++;
49 }
50 }
51 }
52 if (flag == ElementRule::dimension)
53 {
54 return i;
55 }
56 }
57 return std::numeric_limits<unsigned>::max();
58 }
59}; /* class */
60
61} // namespace MeshLib
static unsigned identifyFace(Node const *const *element_nodes, Node const *nodes[ElementRule::dimension])
Returns the ID of a face given an array of nodes.
Definition CellRule.h:32
static const unsigned dimension
Constant: Dimension of this mesh element.
Definition CellRule.h:17
static bool testElementNodeOrder(Element const &e)
Definition CellRule.cpp:11