Viskores  1.0
Threshold.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 
19 #ifndef viskores_filter_entity_extraction_Threshold_h
20 #define viskores_filter_entity_extraction_Threshold_h
21 
22 #include <viskores/filter/Filter.h>
24 
25 namespace viskores
26 {
27 namespace filter
28 {
29 namespace entity_extraction
30 {
31 
48 class VISKORES_FILTER_ENTITY_EXTRACTION_EXPORT Threshold : public viskores::filter::Filter
49 {
50 public:
53  VISKORES_CONT void SetLowerThreshold(viskores::Float64 value) { this->LowerValue = value; }
56  VISKORES_CONT void SetUpperThreshold(viskores::Float64 value) { this->UpperValue = value; }
57 
59  VISKORES_CONT viskores::Float64 GetLowerThreshold() const { return this->LowerValue; }
61  VISKORES_CONT viskores::Float64 GetUpperThreshold() const { return this->UpperValue; }
62 
64  VISKORES_CONT void SetThresholdBelow(viskores::Float64 value);
65 
67  VISKORES_CONT void SetThresholdAbove(viskores::Float64 value);
68 
73  VISKORES_CONT void SetThresholdBetween(viskores::Float64 value1, viskores::Float64 value2);
74 
82  {
83  this->ComponentMode = Component::Selected;
84  this->SelectedComponent = component;
85  }
90  VISKORES_CONT void SetComponentToTestToAny() { this->ComponentMode = Component::Any; }
95  VISKORES_CONT void SetComponentToTestToAll() { this->ComponentMode = Component::All; }
96 
104  VISKORES_CONT void SetAllInRange(bool value) { this->AllInRange = value; }
106  VISKORES_CONT bool GetAllInRange() const { return this->AllInRange; }
107 
113  VISKORES_CONT void SetInvert(bool value) { this->Invert = value; }
115  VISKORES_CONT bool GetInvert() const { return this->Invert; }
116 
117 private:
119  viskores::cont::DataSet DoExecute(const viskores::cont::DataSet& input) override;
120 
121  double LowerValue = 0;
122  double UpperValue = 0;
123 
124  enum struct Component
125  {
126  Any,
127  All,
128  Selected
129  };
130 
131  Component ComponentMode = Component::Selected;
132  viskores::IdComponent SelectedComponent = 0;
133 
134  bool AllInRange = false;
135  bool Invert = false;
136 };
137 } // namespace entity_extraction
138 } // namespace filter
139 } // namespace viskores
140 
141 #endif // viskores_filter_entity_extraction_Threshold_h
viskores::filter::entity_extraction::Threshold::GetUpperThreshold
viskores::Float64 GetUpperThreshold() const
Specifies the upper scalar value.
Definition: Threshold.h:61
viskores::cont::DataSet
Contains and manages the geometric data structures that Viskores operates on.
Definition: DataSet.h:66
viskores::filter::entity_extraction::Threshold::SetLowerThreshold
void SetLowerThreshold(viskores::Float64 value)
Specifies the lower scalar value.
Definition: Threshold.h:53
viskores::filter::entity_extraction::Threshold::SetComponentToTestToAny
void SetComponentToTestToAny()
Specifies that the threshold criteria should be applied to a specific vector component.
Definition: Threshold.h:90
viskores::filter::entity_extraction::Threshold::SetComponentToTestToAll
void SetComponentToTestToAll()
Specifies that the threshold criteria should be applied to a specific vector component.
Definition: Threshold.h:95
viskores::filter::Filter
Base class for all filters.
Definition: Filter.h:171
viskores::IdComponent
viskores::Int32 IdComponent
Base type to use to index small lists.
Definition: Types.h:202
VISKORES_CONT
#define VISKORES_CONT
Definition: ExportMacros.h:65
viskores
Groups connected points that have the same field value.
Definition: Atomic.h:27
viskores::filter::entity_extraction::Threshold::SetUpperThreshold
void SetUpperThreshold(viskores::Float64 value)
Specifies the upper scalar value.
Definition: Threshold.h:56
viskores_filter_entity_extraction_export.h
viskores::filter::entity_extraction::Threshold::SetAllInRange
void SetAllInRange(bool value)
Specify criteria for cells that have some points matching.
Definition: Threshold.h:104
viskores::filter::entity_extraction::Threshold
Extracts cells that satisfy a threshold criterion.
Definition: Threshold.h:48
viskores::filter::entity_extraction::Threshold::SetComponentToTest
void SetComponentToTest(viskores::IdComponent component)
Specifies that the threshold criteria should be applied to a specific vector component.
Definition: Threshold.h:81
viskores::filter::entity_extraction::Threshold::Component
Component
Definition: Threshold.h:124
viskores::filter::entity_extraction::Threshold::GetInvert
bool GetInvert() const
Inverts the threshold result.
Definition: Threshold.h:115
viskores::Float64
double Float64
Base type to use for 64-bit floating-point numbers.
Definition: Types.h:169
viskores::filter::entity_extraction::Threshold::GetAllInRange
bool GetAllInRange() const
Specify criteria for cells that have some points matching.
Definition: Threshold.h:106
viskores::filter::entity_extraction::Threshold::GetLowerThreshold
viskores::Float64 GetLowerThreshold() const
Specifies the lower scalar value.
Definition: Threshold.h:59
Filter.h
viskores::filter::entity_extraction::Threshold::SetInvert
void SetInvert(bool value)
Inverts the threshold result.
Definition: Threshold.h:113