VTK-m  2.0
GridEvaluatorStatus.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 
11 #ifndef vtk_m_filter_flow_worklet_GridEvaluatorStatus_h
12 #define vtk_m_filter_flow_worklet_GridEvaluatorStatus_h
13 
14 #include <vtkm/Bitset.h>
15 
16 namespace vtkm
17 {
18 namespace worklet
19 {
20 namespace flow
21 {
22 
23 class GridEvaluatorStatus : public vtkm::Bitset<vtkm::UInt8>
24 {
25 public:
27  VTKM_EXEC_CONT GridEvaluatorStatus(bool ok, bool spatial, bool temporal, bool inGhost)
28  {
29  this->set(this->SUCCESS_BIT, ok);
30  this->set(this->SPATIAL_BOUNDS_BIT, spatial);
31  this->set(this->TEMPORAL_BOUNDS_BIT, temporal);
32  this->set(this->IN_GHOST_CELL_BIT, inGhost);
33  };
34 
35  VTKM_EXEC_CONT void SetOk() { this->set(this->SUCCESS_BIT); }
36  VTKM_EXEC_CONT bool CheckOk() const { return this->test(this->SUCCESS_BIT); }
37 
38  VTKM_EXEC_CONT void SetFail() { this->reset(this->SUCCESS_BIT); }
39  VTKM_EXEC_CONT bool CheckFail() const { return !this->test(this->SUCCESS_BIT); }
40 
42  VTKM_EXEC_CONT bool CheckSpatialBounds() const { return this->test(this->SPATIAL_BOUNDS_BIT); }
43 
45  VTKM_EXEC_CONT bool CheckTemporalBounds() const { return this->test(this->TEMPORAL_BOUNDS_BIT); }
46 
48  VTKM_EXEC_CONT bool CheckInGhostCell() const { return this->test(this->IN_GHOST_CELL_BIT); }
49 
50 private:
51  static constexpr vtkm::Id SUCCESS_BIT = 0;
52  static constexpr vtkm::Id SPATIAL_BOUNDS_BIT = 1;
53  static constexpr vtkm::Id TEMPORAL_BOUNDS_BIT = 2;
54  static constexpr vtkm::Id IN_GHOST_CELL_BIT = 3;
55 };
56 
57 }
58 }
59 }
60 
61 #endif // vtk_m_filter_flow_worklet_GridEvaluatorStatus_h
vtkm::Bitset< vtkm::UInt8 >::reset
VTKM_EXEC_CONT void reset(vtkm::Id bitIndex)
Definition: Bitset.h:43
vtkm::worklet::flow::GridEvaluatorStatus::IN_GHOST_CELL_BIT
static constexpr vtkm::Id IN_GHOST_CELL_BIT
Definition: GridEvaluatorStatus.h:54
vtkm::Bitset
A bitmap to serve different needs.
Definition: Bitset.h:28
Bitset.h
vtkm::worklet::flow::GridEvaluatorStatus::CheckSpatialBounds
VTKM_EXEC_CONT bool CheckSpatialBounds() const
Definition: GridEvaluatorStatus.h:42
vtkm
Groups connected points that have the same field value.
Definition: Atomic.h:19
VTKM_EXEC_CONT
#define VTKM_EXEC_CONT
Definition: ExportMacros.h:52
vtkm::Bitset< vtkm::UInt8 >::test
VTKM_EXEC_CONT bool test(vtkm::Id bitIndex) const
Definition: Bitset.h:53
vtkm::worklet::flow::GridEvaluatorStatus::CheckFail
VTKM_EXEC_CONT bool CheckFail() const
Definition: GridEvaluatorStatus.h:39
vtkm::worklet::flow::GridEvaluatorStatus::GridEvaluatorStatus
VTKM_EXEC_CONT GridEvaluatorStatus()
Definition: GridEvaluatorStatus.h:26
vtkm::Id
vtkm::Int32 Id
Represents an ID (index into arrays).
Definition: Types.h:191
vtkm::worklet::flow::GridEvaluatorStatus::CheckOk
VTKM_EXEC_CONT bool CheckOk() const
Definition: GridEvaluatorStatus.h:36
vtkm::worklet::flow::GridEvaluatorStatus::SetFail
VTKM_EXEC_CONT void SetFail()
Definition: GridEvaluatorStatus.h:38
vtkm::worklet::flow::GridEvaluatorStatus::CheckTemporalBounds
VTKM_EXEC_CONT bool CheckTemporalBounds() const
Definition: GridEvaluatorStatus.h:45
vtkm::Bitset< vtkm::UInt8 >::set
VTKM_EXEC_CONT void set(vtkm::Id bitIndex)
Definition: Bitset.h:30
vtkm::worklet::flow::GridEvaluatorStatus::TEMPORAL_BOUNDS_BIT
static constexpr vtkm::Id TEMPORAL_BOUNDS_BIT
Definition: GridEvaluatorStatus.h:53
vtkm::worklet::flow::GridEvaluatorStatus::CheckInGhostCell
VTKM_EXEC_CONT bool CheckInGhostCell() const
Definition: GridEvaluatorStatus.h:48
vtkm::worklet::flow::GridEvaluatorStatus::SetOk
VTKM_EXEC_CONT void SetOk()
Definition: GridEvaluatorStatus.h:35
vtkm::worklet::flow::GridEvaluatorStatus::SetTemporalBounds
VTKM_EXEC_CONT void SetTemporalBounds()
Definition: GridEvaluatorStatus.h:44
vtkm::worklet::flow::GridEvaluatorStatus::SPATIAL_BOUNDS_BIT
static constexpr vtkm::Id SPATIAL_BOUNDS_BIT
Definition: GridEvaluatorStatus.h:52
vtkm::worklet::flow::GridEvaluatorStatus::SetInGhostCell
VTKM_EXEC_CONT void SetInGhostCell()
Definition: GridEvaluatorStatus.h:47
vtkm::worklet::flow::GridEvaluatorStatus::SetSpatialBounds
VTKM_EXEC_CONT void SetSpatialBounds()
Definition: GridEvaluatorStatus.h:41
vtkm::worklet::flow::GridEvaluatorStatus::SUCCESS_BIT
static constexpr vtkm::Id SUCCESS_BIT
Definition: GridEvaluatorStatus.h:51
vtkm::worklet::flow::GridEvaluatorStatus::GridEvaluatorStatus
VTKM_EXEC_CONT GridEvaluatorStatus(bool ok, bool spatial, bool temporal, bool inGhost)
Definition: GridEvaluatorStatus.h:27
vtkm::worklet::flow::GridEvaluatorStatus
Definition: GridEvaluatorStatus.h:23