OGS
ElementErrorCode.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 <bitset>
7#include <string>
8
9
12{
17 //... add other error flags here
18 MaxValue // this needs to be last to set the bitset size correctly!
19};
20
22class ElementErrorCode : public std::bitset<static_cast<std::size_t>(ElementErrorFlag::MaxValue)>
23{
24public:
26 bool get(ElementErrorFlag e) const { return test(static_cast<std::size_t>(e)); }
28 void set(ElementErrorFlag e) { std::bitset<static_cast<std::size_t>(ElementErrorFlag::MaxValue)>::set(static_cast<std::size_t>(e), true); }
30 void reset(ElementErrorFlag e) { std::bitset<static_cast<std::size_t>(ElementErrorFlag::MaxValue)>::set(static_cast<std::size_t>(e), false); }
31
32 inline reference operator[](const ElementErrorFlag e) { return std::bitset<static_cast<std::size_t>(ElementErrorFlag::MaxValue)>::operator[](static_cast<std::size_t>(e)); }
33 inline bool operator[](const ElementErrorFlag e) const { return std::bitset<static_cast<std::size_t>(ElementErrorFlag::MaxValue)>::operator[](static_cast<std::size_t>(e)); }
34
36 static std::string toString(const ElementErrorFlag e)
37 {
39 {
40 return "zero volume";
41 }
43 {
44 return "non coplanar nodes";
45 }
47 {
48 return "non-convex geometry";
49 }
51 {
52 return "wrong node order";
53 }
54 return "nonspecified error";
55 }
56
57private:
58
59};
ElementErrorFlag
Possible error flags for mesh elements.
Collects error flags for mesh elements.
bool operator[](const ElementErrorFlag e) const
bool get(ElementErrorFlag e) const
Get value for a specific flag.
reference operator[](const ElementErrorFlag e)
static std::string toString(const ElementErrorFlag e)
Returns a string output for a specific error flag.
void set(ElementErrorFlag e)
Set a specific flag.
void reset(ElementErrorFlag e)
Reset a specific flag.