VTK-m  2.2
CellClassification.h
Go to the documentation of this file.
1 //============================================================================
2 // Copyright (c) Kitware, Inc.
3 // All rights reserved.
4 // See LICENSE.txt for details.
5 //
6 // This software is distributed WITHOUT ANY WARRANTY; without even
7 // the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
8 // PURPOSE. See the above copyright notice for more information.
9 //============================================================================
10 #ifndef vtk_m_CellClassification_h
11 #define vtk_m_CellClassification_h
12 
13 #include <vtkm/Types.h>
14 
15 namespace vtkm
16 {
17 
25 {
26  // Implementation note: An enum would be a natural representation for these flags.
27  // However, a non-scoped enum leaks the names into the broader namespace and a
28  // scoped enum is too difficult to convert to the `vtkm::UInt8` we really want to
29  // treat it as. Thus, use constexpr to define the `vtkm::UInt8`s.
31 
32 public:
33  // Use an unscoped enum here, where it will be properly scoped in the class.
34  // Using unscoped enums in this way is sort of obsolete, but prior to C++17
35  // a `static constexpr` may require a definition in a .cxx file, and that is
36  // not really possible for this particular class (which could be used on a GPU).
37  enum : vtkm::UInt8
38  {
39  Normal = 0, //Valid cell
40  Ghost = 1 << 0, //Ghost cell
41  Invalid = 1 << 1, //Cell is invalid
42  Unused0 = 1 << 2,
43  Blanked = 1 << 3, //Blanked cell in AMR
44  Unused3 = 1 << 4,
45  Unused4 = 1 << 5,
46  Unused5 = 1 << 6,
47  };
48 
54 
62 
65 
74 
76  : Flags(flags)
77  {
78  }
79 
80  VTKM_EXEC constexpr operator vtkm::UInt8() const { return this->Flags; }
81 };
82 
83 } // namespace vtkm
84 
85 #endif // vtk_m_CellClassification_h
vtkm::CellClassification::Invalid
@ Invalid
Flag used for an invalid cell.
Definition: CellClassification.h:41
VTKM_EXEC
#define VTKM_EXEC
Definition: ExportMacros.h:51
vtkm
Groups connected points that have the same field value.
Definition: Atomic.h:19
Types.h
vtkm::CellClassification::Blanked
@ Blanked
Flag used for a cell that should not be considered part of the data.
Definition: CellClassification.h:43
vtkm::CellClassification
Bit flags used in ghost arrays to identify what type a cell is.
Definition: CellClassification.h:24
vtkm::CellClassification::Flags
vtkm::UInt8 Flags
Definition: CellClassification.h:30
vtkm::CellClassification::Unused4
@ Unused4
Definition: CellClassification.h:45
vtkm::CellClassification::Unused3
@ Unused3
Definition: CellClassification.h:44
vtkm::CellClassification::Normal
@ Normal
Value used for a normal cell.
Definition: CellClassification.h:39
vtkm::UInt8
uint8_t UInt8
Base type to use for 8-bit unsigned integer numbers.
Definition: Types.h:169
vtkm::CellClassification::Ghost
@ Ghost
Flag used for a ghost cell.
Definition: CellClassification.h:40
vtkm::CellClassification::Unused0
@ Unused0
Definition: CellClassification.h:42
vtkm::CellClassification::Unused5
@ Unused5
Definition: CellClassification.h:46
vtkm::CellClassification::CellClassification
constexpr CellClassification(vtkm::UInt8 flags=vtkm::UInt8{ Normal })
Definition: CellClassification.h:75