VTK  9.7.1
vtkCellStatus.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-License-Identifier: BSD-3-Clause
3 #ifndef vtkCellStatus_h
4 #define vtkCellStatus_h
5 
6 #include "vtkCommonDataModelModule.h" // For export macro
7 
8 #include <ostream>
9 
10 VTK_ABI_NAMESPACE_BEGIN
11 
16 enum class vtkCellStatus : short
17 {
18  Valid = 0x00,
19  WrongNumberOfPoints = 0x01,
20  IntersectingEdges = 0x02,
21  IntersectingFaces = 0x04,
22  NoncontiguousEdges = 0x08,
23  Nonconvex = 0x10,
25  NonPlanarFaces = 0x40,
26  DegenerateFaces = 0x80,
27  CoincidentPoints = 0x100,
28 };
29 
30 inline bool operator!=(short a, vtkCellStatus b)
31 {
32  return a != static_cast<short>(b);
33 }
34 
35 inline bool operator==(short a, vtkCellStatus b)
36 {
37  return a == static_cast<short>(b);
38 }
39 
40 inline bool operator!=(vtkCellStatus a, short b)
41 {
42  return static_cast<short>(a) != b;
43 }
44 
45 inline bool operator==(vtkCellStatus a, short b)
46 {
47  return static_cast<short>(a) == b;
48 }
49 
51 {
52  return static_cast<vtkCellStatus>(static_cast<short>(a) & static_cast<short>(b));
53 }
54 
56 {
57  return static_cast<vtkCellStatus>(static_cast<short>(a) | static_cast<short>(b));
58 }
59 
61 {
62  a = static_cast<vtkCellStatus>(static_cast<short>(a) & static_cast<short>(b));
63  return a;
64 }
65 
67 {
68  a = static_cast<vtkCellStatus>(static_cast<short>(a) | static_cast<short>(b));
69  return a;
70 }
71 
72 inline bool operator!(const vtkCellStatus& s)
73 {
74  return s != vtkCellStatus::Valid;
75 }
76 
77 inline std::ostream& operator<<(std::ostream& os, vtkCellStatus state)
78 {
79  if (state == vtkCellStatus::Valid)
80  {
81  os << "valid";
82  }
83  else
84  {
85  bool comma = false;
86  os << "invalid(";
87  if ((state & vtkCellStatus::WrongNumberOfPoints) == vtkCellStatus::WrongNumberOfPoints)
88  {
89  os << "too few points";
90  comma = true;
91  }
92  if ((state & vtkCellStatus::IntersectingEdges) == vtkCellStatus::IntersectingEdges)
93  {
94  if (comma)
95  {
96  os << ", ";
97  }
98  os << "intersecting edges";
99  comma = true;
100  }
101  if ((state & vtkCellStatus::IntersectingFaces) == vtkCellStatus::IntersectingFaces)
102  {
103  if (comma)
104  {
105  os << ", ";
106  }
107  os << "intersecting faces";
108  comma = true;
109  }
110  if ((state & vtkCellStatus::NoncontiguousEdges) == vtkCellStatus::NoncontiguousEdges)
111  {
112  if (comma)
113  {
114  os << ", ";
115  }
116  os << "noncontiguous edges";
117  comma = true;
118  }
119  if ((state & vtkCellStatus::Nonconvex) == vtkCellStatus::Nonconvex)
120  {
121  if (comma)
122  {
123  os << ", ";
124  }
125  os << "nonconvex";
126  comma = true;
127  }
129  vtkCellStatus::FacesAreOrientedIncorrectly)
130  {
131  if (comma)
132  {
133  os << ", ";
134  }
135  os << "misoriented faces";
136  comma = true;
137  }
138  if ((state & vtkCellStatus::NonPlanarFaces) == vtkCellStatus::NonPlanarFaces)
139  {
140  if (comma)
141  {
142  os << ", ";
143  }
144  os << "non-planar faces";
145  }
146  if ((state & vtkCellStatus::DegenerateFaces) == vtkCellStatus::DegenerateFaces)
147  {
148  if (comma)
149  {
150  os << ", ";
151  }
152  os << "degenerate faces";
153  }
154  if ((state & vtkCellStatus::CoincidentPoints) == vtkCellStatus::CoincidentPoints)
155  {
156  if (comma)
157  {
158  os << ", ";
159  }
160  os << "coincident points";
161  }
162  os << ")";
163  }
164  return os;
165 }
166 
167 VTK_ABI_NAMESPACE_END
168 #endif // vtkCellStatus_h
169 // VTK-HeaderTest-Exclude: vtkCellStatus.h
Vertices for a face do not all lie in the same plane.
vtkCellStatus operator&(vtkCellStatus a, vtkCellStatus b)
Definition: vtkCellStatus.h:50
vtkCellStatus & operator|=(vtkCellStatus &a, vtkCellStatus b)
Definition: vtkCellStatus.h:66
bool operator!(const vtkCellStatus &s)
Definition: vtkCellStatus.h:72
vtkCellStatus & operator&=(vtkCellStatus &a, vtkCellStatus b)
Definition: vtkCellStatus.h:60
bool operator==(short a, vtkCellStatus b)
Definition: vtkCellStatus.h:35
std::ostream & operator<<(std::ostream &os, vtkCellStatus state)
Definition: vtkCellStatus.h:77
Faces of a volume self-intersect.
vtkCellStatus
Diagnostic values indicating how well-specified a cell is.
Definition: vtkCellStatus.h:16
All faces should have CCW windings.
A face is collapsed to a line or a point.
The cell has a concavity.
bool operator!=(short a, vtkCellStatus b)
Definition: vtkCellStatus.h:30
A cell is otherwise valid but has coincident points.
Cell is in a good state.
Edges of a face self-intersect.
Edge vertices are not ordered head-to-tail.
vtkCellStatus operator|(vtkCellStatus a, vtkCellStatus b)
Definition: vtkCellStatus.h:55
Lines have <2 points, faces <3.