OGS
ElementErrorCode.h
Go to the documentation of this file.
1 
15 #pragma once
16 
17 #include <bitset>
18 #include <string>
19 
20 
22 enum class ElementErrorFlag
23 {
24  ZeroVolume,
26  NonConvex,
27  NodeOrder,
28  //... add other error flags here
29  MaxValue // this needs to be last to set the bitset size correctly!
30 };
31 
33 class ElementErrorCode : public std::bitset<static_cast<std::size_t>(ElementErrorFlag::MaxValue)>
34 {
35 public:
37  bool get(ElementErrorFlag e) const { return test(static_cast<std::size_t>(e)); }
39  void set(ElementErrorFlag e) { std::bitset<static_cast<std::size_t>(ElementErrorFlag::MaxValue)>::set(static_cast<std::size_t>(e), true); }
41  void reset(ElementErrorFlag e) { std::bitset<static_cast<std::size_t>(ElementErrorFlag::MaxValue)>::set(static_cast<std::size_t>(e), false); }
42 
43  inline reference operator[](const ElementErrorFlag e) { return std::bitset<static_cast<std::size_t>(ElementErrorFlag::MaxValue)>::operator[](static_cast<std::size_t>(e)); }
44  inline bool operator[](const ElementErrorFlag e) const { return std::bitset<static_cast<std::size_t>(ElementErrorFlag::MaxValue)>::operator[](static_cast<std::size_t>(e)); }
45 
47  static std::string toString(const ElementErrorFlag e)
48  {
50  {
51  return "zero volume";
52  }
54  {
55  return "non coplanar nodes";
56  }
58  {
59  return "non-convex geometry";
60  }
62  {
63  return "wrong node order";
64  }
65  return "nonspecified error";
66  }
67 
68 private:
69 
70 };
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.