VTK-m  2.0
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 
50  : Flags(flags)
51  {
52  }
53 
54  VTKM_EXEC constexpr operator vtkm::UInt8() const { return this->Flags; }
55 };
56 
57 } // namespace vtkm
58 
59 #endif // vtk_m_CellClassification_h
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::Invalid
@ Invalid
Definition: CellClassification.h:41
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::Ghost
@ Ghost
Definition: CellClassification.h:40
vtkm::CellClassification::Unused4
@ Unused4
Definition: CellClassification.h:45
vtkm::CellClassification::Unused3
@ Unused3
Definition: CellClassification.h:44
vtkm::CellClassification::Blanked
@ Blanked
Definition: CellClassification.h:43
vtkm::UInt8
uint8_t UInt8
Definition: Types.h:157
vtkm::CellClassification::Unused0
@ Unused0
Definition: CellClassification.h:42
vtkm::CellClassification::CellClassification
constexpr VTKM_EXEC CellClassification(vtkm::UInt8 flags=vtkm::UInt8{ Normal })
Definition: CellClassification.h:49
vtkm::CellClassification::Normal
@ Normal
Definition: CellClassification.h:39
vtkm::CellClassification::Unused5
@ Unused5
Definition: CellClassification.h:46