VTK  9.5.20250718
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
10VTK_ABI_NAMESPACE_BEGIN
11
16enum 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};
28
29inline bool operator!=(short a, vtkCellStatus b)
30{
31 return a != static_cast<short>(b);
32}
33
34inline bool operator==(short a, vtkCellStatus b)
35{
36 return a == static_cast<short>(b);
37}
38
39inline bool operator!=(vtkCellStatus a, short b)
40{
41 return static_cast<short>(a) != b;
42}
43
44inline bool operator==(vtkCellStatus a, short b)
45{
46 return static_cast<short>(a) == b;
47}
48
50{
51 return static_cast<vtkCellStatus>(static_cast<short>(a) & static_cast<short>(b));
52}
53
55{
56 return static_cast<vtkCellStatus>(static_cast<short>(a) | static_cast<short>(b));
57}
58
60{
61 a = static_cast<vtkCellStatus>(static_cast<short>(a) & static_cast<short>(b));
62 return a;
63}
64
66{
67 a = static_cast<vtkCellStatus>(static_cast<short>(a) | static_cast<short>(b));
68 return a;
69}
70
71inline bool operator!(const vtkCellStatus& s)
72{
73 return s != vtkCellStatus::Valid;
74}
75
76inline std::ostream& operator<<(std::ostream& os, vtkCellStatus state)
77{
78 if (state == vtkCellStatus::Valid)
79 {
80 os << "valid";
81 }
82 else
83 {
84 bool comma = false;
85 os << "invalid(";
87 {
88 os << "too few points";
89 comma = true;
90 }
92 {
93 if (comma)
94 {
95 os << ", ";
96 }
97 os << "intersecting edges";
98 comma = true;
99 }
101 {
102 if (comma)
103 {
104 os << ", ";
105 }
106 os << "noncontiguous edges";
107 comma = true;
108 }
110 {
111 if (comma)
112 {
113 os << ", ";
114 }
115 os << "nonconvex";
116 comma = true;
117 }
120 {
121 if (comma)
122 {
123 os << ", ";
124 }
125 os << "misoriented faces";
126 comma = true;
127 }
129 {
130 if (comma)
131 {
132 os << ", ";
133 }
134 os << "non-planar faces";
135 }
136 os << ")";
137 }
138 return os;
139}
140
141VTK_ABI_NAMESPACE_END
142#endif // vtkCellStatus_h
143// VTK-HeaderTest-Exclude: vtkCellStatus.h
vtkCellStatus & operator|=(vtkCellStatus &a, vtkCellStatus b)
bool operator==(short a, vtkCellStatus b)
vtkCellStatus
Diagnostic values indicating how well-specified a cell is.
@ DegenerateFaces
A face is collapsed to a line or a point.
@ IntersectingFaces
Faces of a volume self-intersect.
@ NoncontiguousEdges
Edge vertices are not ordered head-to-tail.
@ Valid
Cell is in a good state.
@ WrongNumberOfPoints
Lines have <2 points, faces <3.
@ Nonconvex
The cell has a concavity.
@ NonPlanarFaces
Vertices for a face do not all lie in the same plane.
@ FacesAreOrientedIncorrectly
All faces should have CCW windings.
@ IntersectingEdges
Edges of a face self-intersect.
bool operator!=(short a, vtkCellStatus b)
vtkCellStatus operator|(vtkCellStatus a, vtkCellStatus b)
vtkCellStatus & operator&=(vtkCellStatus &a, vtkCellStatus b)
bool operator!(const vtkCellStatus &s)
std::ostream & operator<<(std::ostream &os, vtkCellStatus state)
vtkCellStatus operator&(vtkCellStatus a, vtkCellStatus b)