VTK-m  2.0
IntegratorStatus.h
Go to the documentation of this file.
1 //=============================================================================
2 //
3 // Copyright (c) Kitware, Inc.
4 // All rights reserved.
5 // See LICENSE.txt for details.
6 //
7 // This software is distributed WITHOUT ANY WARRANTY; without even
8 // the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
9 // PURPOSE. See the above copyright notice for more information.
10 //
11 //=============================================================================
12 
13 #ifndef vtk_m_filter_flow_worklet_IntegratorStatus_h
14 #define vtk_m_filter_flow_worklet_IntegratorStatus_h
15 
16 #include <iomanip>
17 #include <limits>
18 
19 #include <vtkm/Bitset.h>
20 #include <vtkm/TypeTraits.h>
21 #include <vtkm/Types.h>
22 #include <vtkm/VectorAnalysis.h>
23 
25 
26 namespace vtkm
27 {
28 namespace worklet
29 {
30 namespace flow
31 {
32 
33 class IntegratorStatus : public vtkm::Bitset<vtkm::UInt8>
34 {
35 public:
37 
39  const bool& spatial,
40  const bool& temporal,
41  const bool& inGhost,
42  const bool& isZero)
43  {
44  this->set(this->SUCCESS_BIT, ok);
45  this->set(this->SPATIAL_BOUNDS_BIT, spatial);
46  this->set(this->TEMPORAL_BOUNDS_BIT, temporal);
47  this->set(this->IN_GHOST_CELL_BIT, inGhost);
48  this->set(this->ZERO_VELOCITY_BIT, isZero);
49  }
50 
53  es.CheckSpatialBounds(),
55  es.CheckInGhostCell(),
56  isZero)
57  {
58  }
59 
60  VTKM_EXEC_CONT void SetOk() { this->set(this->SUCCESS_BIT); }
61  VTKM_EXEC_CONT bool CheckOk() const { return this->test(this->SUCCESS_BIT); }
62 
63  VTKM_EXEC_CONT void SetFail() { this->reset(this->SUCCESS_BIT); }
64  VTKM_EXEC_CONT bool CheckFail() const { return !this->test(this->SUCCESS_BIT); }
65 
67  VTKM_EXEC_CONT bool CheckSpatialBounds() const { return this->test(this->SPATIAL_BOUNDS_BIT); }
68 
70  VTKM_EXEC_CONT bool CheckTemporalBounds() const { return this->test(this->TEMPORAL_BOUNDS_BIT); }
71 
73  VTKM_EXEC_CONT bool CheckInGhostCell() const { return this->test(this->IN_GHOST_CELL_BIT); }
75  VTKM_EXEC_CONT bool CheckZeroVelocity() const { return this->test(this->ZERO_VELOCITY_BIT); }
76 
77 private:
78  static constexpr vtkm::Id SUCCESS_BIT = 0;
79  static constexpr vtkm::Id SPATIAL_BOUNDS_BIT = 1;
80  static constexpr vtkm::Id TEMPORAL_BOUNDS_BIT = 2;
81  static constexpr vtkm::Id IN_GHOST_CELL_BIT = 3;
82  static constexpr vtkm::Id ZERO_VELOCITY_BIT = 4;
83 };
84 
85 inline VTKM_CONT std::ostream& operator<<(std::ostream& s, const IntegratorStatus& status)
86 {
87  s << "[ok= " << status.CheckOk() << " sp= " << status.CheckSpatialBounds()
88  << " tm= " << status.CheckTemporalBounds() << " gc= " << status.CheckInGhostCell()
89  << "zero= " << status.CheckZeroVelocity() << " ]";
90  return s;
91 }
92 
93 }
94 }
95 } //vtkm::worklet::flow
96 
97 #endif // vtk_m_filter_flow_worklet_IntegratorStatus_h
vtkm::Bitset< vtkm::UInt8 >::reset
VTKM_EXEC_CONT void reset(vtkm::Id bitIndex)
Definition: Bitset.h:43
vtkm::Bitset
A bitmap to serve different needs.
Definition: Bitset.h:28
Bitset.h
vtkm::worklet::flow::IntegratorStatus::SetZeroVelocity
VTKM_EXEC_CONT void SetZeroVelocity()
Definition: IntegratorStatus.h:74
vtkm::worklet::flow::IntegratorStatus::CheckZeroVelocity
VTKM_EXEC_CONT bool CheckZeroVelocity() const
Definition: IntegratorStatus.h:75
vtkm::worklet::flow::IntegratorStatus::IntegratorStatus
VTKM_EXEC_CONT IntegratorStatus()
Definition: IntegratorStatus.h:36
vtkm
Groups connected points that have the same field value.
Definition: Atomic.h:19
Types.h
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
GridEvaluatorStatus.h
vtkm::worklet::flow::IntegratorStatus::SetOk
VTKM_EXEC_CONT void SetOk()
Definition: IntegratorStatus.h:60
vtkm::worklet::flow::IntegratorStatus::SPATIAL_BOUNDS_BIT
static constexpr vtkm::Id SPATIAL_BOUNDS_BIT
Definition: IntegratorStatus.h:79
vtkm::worklet::flow::IntegratorStatus::CheckSpatialBounds
VTKM_EXEC_CONT bool CheckSpatialBounds() const
Definition: IntegratorStatus.h:67
vtkm::worklet::flow::IntegratorStatus::ZERO_VELOCITY_BIT
static constexpr vtkm::Id ZERO_VELOCITY_BIT
Definition: IntegratorStatus.h:82
vtkm::worklet::flow::IntegratorStatus::SetFail
VTKM_EXEC_CONT void SetFail()
Definition: IntegratorStatus.h:63
vtkm::Id
vtkm::Int32 Id
Represents an ID (index into arrays).
Definition: Types.h:191
VectorAnalysis.h
TypeTraits.h
vtkm::worklet::flow::IntegratorStatus::CheckFail
VTKM_EXEC_CONT bool CheckFail() const
Definition: IntegratorStatus.h:64
vtkm::worklet::flow::IntegratorStatus
Definition: IntegratorStatus.h:33
vtkm::worklet::flow::IntegratorStatus::CheckInGhostCell
VTKM_EXEC_CONT bool CheckInGhostCell() const
Definition: IntegratorStatus.h:73
vtkm::worklet::flow::IntegratorStatus::SetInGhostCell
VTKM_EXEC_CONT void SetInGhostCell()
Definition: IntegratorStatus.h:72
VTKM_CONT
#define VTKM_CONT
Definition: ExportMacros.h:57
vtkm::worklet::flow::IntegratorStatus::SetSpatialBounds
VTKM_EXEC_CONT void SetSpatialBounds()
Definition: IntegratorStatus.h:66
vtkm::worklet::flow::IntegratorStatus::SetTemporalBounds
VTKM_EXEC_CONT void SetTemporalBounds()
Definition: IntegratorStatus.h:69
vtkm::worklet::flow::IntegratorStatus::IntegratorStatus
VTKM_EXEC_CONT IntegratorStatus(const bool &ok, const bool &spatial, const bool &temporal, const bool &inGhost, const bool &isZero)
Definition: IntegratorStatus.h:38
vtkm::worklet::flow::IntegratorStatus::CheckOk
VTKM_EXEC_CONT bool CheckOk() const
Definition: IntegratorStatus.h:61
vtkm::Bitset< vtkm::UInt8 >::set
VTKM_EXEC_CONT void set(vtkm::Id bitIndex)
Definition: Bitset.h:30
vtkm::worklet::flow::IntegratorStatus::CheckTemporalBounds
VTKM_EXEC_CONT bool CheckTemporalBounds() const
Definition: IntegratorStatus.h:70
vtkm::worklet::flow::operator<<
VTKM_CONT std::ostream & operator<<(std::ostream &s, const IntegratorStatus &status)
Definition: IntegratorStatus.h:85
vtkm::worklet::flow::IntegratorStatus::SUCCESS_BIT
static constexpr vtkm::Id SUCCESS_BIT
Definition: IntegratorStatus.h:78
vtkm::worklet::flow::IntegratorStatus::IN_GHOST_CELL_BIT
static constexpr vtkm::Id IN_GHOST_CELL_BIT
Definition: IntegratorStatus.h:81
vtkm::worklet::flow::IntegratorStatus::TEMPORAL_BOUNDS_BIT
static constexpr vtkm::Id TEMPORAL_BOUNDS_BIT
Definition: IntegratorStatus.h:80
vtkm::worklet::flow::IntegratorStatus::IntegratorStatus
VTKM_EXEC_CONT IntegratorStatus(const GridEvaluatorStatus &es, bool isZero)
Definition: IntegratorStatus.h:51
vtkm::worklet::flow::GridEvaluatorStatus
Definition: GridEvaluatorStatus.h:23