Viskores  1.0
CellClassification.h
Go to the documentation of this file.
1 //============================================================================
2 // The contents of this file are covered by the Viskores license. See
3 // LICENSE.txt for details.
4 //
5 // By contributing to this file, all contributors agree to the Developer
6 // Certificate of Origin Version 1.1 (DCO 1.1) as stated in DCO.txt.
7 //============================================================================
8 
9 //============================================================================
10 // Copyright (c) Kitware, Inc.
11 // All rights reserved.
12 // See LICENSE.txt for details.
13 //
14 // This software is distributed WITHOUT ANY WARRANTY; without even
15 // the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
16 // PURPOSE. See the above copyright notice for more information.
17 //============================================================================
18 #ifndef viskores_CellClassification_h
19 #define viskores_CellClassification_h
20 
21 #include <viskores/Types.h>
22 
23 namespace viskores
24 {
25 
33 {
34  // Implementation note: An enum would be a natural representation for these flags.
35  // However, a non-scoped enum leaks the names into the broader namespace and a
36  // scoped enum is too difficult to convert to the `viskores::UInt8` we really want to
37  // treat it as. Thus, use constexpr to define the `viskores::UInt8`s.
39 
40 public:
41  // Use an unscoped enum here, where it will be properly scoped in the class.
42  // Using unscoped enums in this way is sort of obsolete, but prior to C++17
43  // a `static constexpr` may require a definition in a .cxx file, and that is
44  // not really possible for this particular class (which could be used on a GPU).
45  enum : viskores::UInt8
46  {
47  Normal = 0, //Valid cell
48  Ghost = 1 << 0, //Ghost cell
49  Invalid = 1 << 1, //Cell is invalid
50  Unused0 = 1 << 2,
51  Blanked = 1 << 3, //Blanked cell in AMR
52  Unused3 = 1 << 4,
53  Unused4 = 1 << 5,
54  Unused5 = 1 << 6,
55  };
56 
62 
70 
73 
82 
84  : Flags(flags)
85  {
86  }
87 
88  VISKORES_EXEC constexpr operator viskores::UInt8() const { return this->Flags; }
89 };
90 
91 } // namespace viskores
92 
93 #endif // viskores_CellClassification_h
viskores::CellClassification::Unused4
@ Unused4
Definition: CellClassification.h:53
Types.h
viskores::CellClassification::CellClassification
constexpr CellClassification(viskores::UInt8 flags=viskores::UInt8{ Normal })
Definition: CellClassification.h:83
viskores
Groups connected points that have the same field value.
Definition: Atomic.h:27
viskores::CellClassification
Bit flags used in ghost arrays to identify what type a cell is.
Definition: CellClassification.h:32
viskores::CellClassification::Normal
@ Normal
Value used for a normal cell.
Definition: CellClassification.h:47
viskores::CellClassification::Invalid
@ Invalid
Flag used for an invalid cell.
Definition: CellClassification.h:49
viskores::UInt8
uint8_t UInt8
Base type to use for 8-bit unsigned integer numbers.
Definition: Types.h:177
viskores::CellClassification::Flags
viskores::UInt8 Flags
Definition: CellClassification.h:38
viskores::CellClassification::Unused0
@ Unused0
Definition: CellClassification.h:50
viskores::CellClassification::Blanked
@ Blanked
Flag used for a cell that should not be considered part of the data.
Definition: CellClassification.h:51
viskores::CellClassification::Ghost
@ Ghost
Flag used for a ghost cell.
Definition: CellClassification.h:48
viskores::CellClassification::Unused3
@ Unused3
Definition: CellClassification.h:52
viskores::CellClassification::Unused5
@ Unused5
Definition: CellClassification.h:54
VISKORES_EXEC
#define VISKORES_EXEC
Definition: ExportMacros.h:59