VTK-m  2.0
Threshold.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_entity_extraction_Threshold_h
12 #define vtk_m_filter_entity_extraction_Threshold_h
13 
15 #include <vtkm/filter/entity_extraction/vtkm_filter_entity_extraction_export.h>
16 
17 namespace vtkm
18 {
19 namespace filter
20 {
21 namespace entity_extraction
22 {
29 class VTKM_FILTER_ENTITY_EXTRACTION_EXPORT Threshold : public vtkm::filter::FilterField
30 {
31 public:
32  VTKM_CONT
33  void SetLowerThreshold(vtkm::Float64 value) { this->LowerValue = value; }
34  VTKM_CONT
35  void SetUpperThreshold(vtkm::Float64 value) { this->UpperValue = value; }
36 
37  VTKM_CONT
38  vtkm::Float64 GetLowerThreshold() const { return this->LowerValue; }
39  VTKM_CONT
40  vtkm::Float64 GetUpperThreshold() const { return this->UpperValue; }
41 
43  VTKM_CONT
44  void SetThresholdBelow(vtkm::Float64 value);
45 
47  VTKM_CONT
48  void SetThresholdAbove(vtkm::Float64 value);
49 
51  VTKM_CONT
52  void SetThresholdBetween(vtkm::Float64 value1, vtkm::Float64 value2);
53 
57  VTKM_CONT
59  {
60  this->ComponentMode = Component::Selected;
61  this->SelectedComponent = component;
62  }
63  VTKM_CONT
64  void SetComponentToTestToAny() { this->ComponentMode = Component::Any; }
65  VTKM_CONT
66  void SetComponentToTestToAll() { this->ComponentMode = Component::All; }
68 
72  VTKM_CONT
73  void SetAllInRange(bool value) { this->AllInRange = value; }
74  VTKM_CONT
75  bool GetAllInRange() const { return this->AllInRange; }
76 
80  VTKM_CONT
81  void SetInvert(bool value) { this->Invert = value; }
82  VTKM_CONT
83  bool GetInvert() const { return this->Invert; }
84 
85 private:
86  VTKM_CONT
87  vtkm::cont::DataSet DoExecute(const vtkm::cont::DataSet& input) override;
88 
89  double LowerValue = 0;
90  double UpperValue = 0;
91 
92  enum struct Component
93  {
94  Any,
95  All,
96  Selected
97  };
98 
99  Component ComponentMode = Component::Selected;
100  vtkm::IdComponent SelectedComponent = 0;
101 
102  bool AllInRange = false;
103  bool Invert = false;
104 };
105 } // namespace entity_extraction
106 } // namespace filter
107 } // namespace vtkm
108 
109 #endif // vtk_m_filter_entity_extraction_Threshold_h
vtkm::filter::entity_extraction::Threshold::GetUpperThreshold
VTKM_CONT vtkm::Float64 GetUpperThreshold() const
Definition: Threshold.h:40
vtkm::filter::entity_extraction::Threshold::GetAllInRange
VTKM_CONT bool GetAllInRange() const
Definition: Threshold.h:75
vtkm::filter::entity_extraction::Threshold::SetInvert
VTKM_CONT void SetInvert(bool value)
Invert the threshold result, i.e.
Definition: Threshold.h:81
vtkm
Groups connected points that have the same field value.
Definition: Atomic.h:19
vtkm::IdComponent
vtkm::Int32 IdComponent
Represents a component ID (index of component in a vector).
Definition: Types.h:168
vtkm::filter::entity_extraction::Threshold::SetComponentToTest
VTKM_CONT void SetComponentToTest(vtkm::IdComponent component)
For multi-component fields, select how to apply the threshold criterion. The default is to test the 0...
Definition: Threshold.h:58
vtkm::cont::DataSet
Definition: DataSet.h:34
vtkm::filter::entity_extraction::Threshold::SetLowerThreshold
VTKM_CONT void SetLowerThreshold(vtkm::Float64 value)
Definition: Threshold.h:33
vtkm::filter::entity_extraction::Threshold::SetComponentToTestToAny
VTKM_CONT void SetComponentToTestToAny()
For multi-component fields, select how to apply the threshold criterion. The default is to test the 0...
Definition: Threshold.h:64
vtkm::filter::entity_extraction::Threshold::GetLowerThreshold
VTKM_CONT vtkm::Float64 GetLowerThreshold() const
Definition: Threshold.h:38
vtkm::filter::entity_extraction::Threshold::SetComponentToTestToAll
VTKM_CONT void SetComponentToTestToAll()
For multi-component fields, select how to apply the threshold criterion. The default is to test the 0...
Definition: Threshold.h:66
FilterField.h
vtkm::filter::FilterField
Definition: FilterField.h:21
vtkm::filter::entity_extraction::Threshold
Extracts cells which satisfy threshold criterion.
Definition: Threshold.h:29
vtkm::filter::entity_extraction::Threshold::GetInvert
VTKM_CONT bool GetInvert() const
Definition: Threshold.h:83
VTKM_CONT
#define VTKM_CONT
Definition: ExportMacros.h:57
vtkm::filter::entity_extraction::Threshold::SetUpperThreshold
VTKM_CONT void SetUpperThreshold(vtkm::Float64 value)
Definition: Threshold.h:35
vtkm::filter::entity_extraction::Threshold::SetAllInRange
VTKM_CONT void SetAllInRange(bool value)
If using field from point data, all values for all points in a cell must satisfy the threshold criter...
Definition: Threshold.h:73
vtkm::filter::entity_extraction::Threshold::Component
Component
Definition: Threshold.h:92
vtkm::Float64
double Float64
Definition: Types.h:155