Viskores  1.0
HistSampling.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_filter_resampling_HistSampling_h
19 #define viskores_filter_resampling_HistSampling_h
20 
21 #include <viskores/filter/Filter.h>
23 
24 #include <viskores/Deprecated.h>
25 
26 namespace viskores
27 {
28 namespace filter
29 {
30 namespace resampling
31 {
32 
48 class VISKORES_FILTER_RESAMPLING_EXPORT HistSampling : public viskores::filter::Filter
49 {
50 public:
56  {
57  this->NumberOfBins = numberOfBins;
58  }
60  VISKORES_CONT viskores::Id GetNumberOfBins() { return this->NumberOfBins; }
61 
68  {
69  this->SampleFraction = fraction;
70  }
72  VISKORES_CONT viskores::FloatDefault GetSampleFraction() const { return this->SampleFraction; }
73 
74  VISKORES_DEPRECATED(2.2, "Use SetSampleFraction().")
75  VISKORES_CONT void SetSamplePercent(viskores::FloatDefault samplePercent)
76  {
77  this->SetSampleFraction(samplePercent);
78  }
79  VISKORES_DEPRECATED(2.2, "Use GetSampleFraction().")
80  VISKORES_CONT viskores::FloatDefault GetSamplePercent() const
81  {
82  return this->GetSampleFraction();
83  }
84 
89  VISKORES_CONT void SetSeed(viskores::UInt32 seed) { this->Seed = seed; }
91  VISKORES_CONT viskores::UInt32 GetSeed() { return this->Seed; }
92 
93 private:
94  VISKORES_CONT viskores::cont::DataSet DoExecute(const viskores::cont::DataSet& input) override;
95  viskores::Id NumberOfBins = 10;
96  viskores::FloatDefault SampleFraction = 0.1f;
97  viskores::UInt32 Seed = 0;
98 };
99 
100 } // namespace resampling
101 } // namespace filter
102 } // namespace viskores
103 
104 #endif // viskores_filter_resampling_HistSampling_h
viskores::cont::DataSet
Contains and manages the geometric data structures that Viskores operates on.
Definition: DataSet.h:66
viskores::filter::resampling::HistSampling::GetNumberOfBins
viskores::Id GetNumberOfBins()
Specify the number of bins used when computing the histogram.
Definition: HistSampling.h:60
viskores::filter::Filter
Base class for all filters.
Definition: Filter.h:171
viskores::filter::resampling::HistSampling::GetSeed
viskores::UInt32 GetSeed()
Specify the seed used for random number generation.
Definition: HistSampling.h:91
viskores::Id
viskores::Int64 Id
Base type to use to index arrays.
Definition: Types.h:235
VISKORES_CONT
#define VISKORES_CONT
Definition: ExportMacros.h:65
viskores
Groups connected points that have the same field value.
Definition: Atomic.h:27
VISKORES_DEPRECATED
#define VISKORES_DEPRECATED(...)
Definition: Deprecated.h:156
viskores_filter_resampling_export.h
viskores::filter::resampling::HistSampling::SetSampleFraction
void SetSampleFraction(viskores::FloatDefault fraction)
Specify the fraction of points to create in the sampled data.
Definition: HistSampling.h:67
viskores::FloatDefault
viskores::Float32 FloatDefault
The floating point type to use when no other precision is specified.
Definition: Types.h:244
Deprecated.h
viskores::filter::resampling::HistSampling::SetNumberOfBins
void SetNumberOfBins(viskores::Id numberOfBins)
Specify the number of bins used when computing the histogram.
Definition: HistSampling.h:55
viskores::filter::resampling::HistSampling::GetSampleFraction
viskores::FloatDefault GetSampleFraction() const
Specify the fraction of points to create in the sampled data.
Definition: HistSampling.h:72
viskores::filter::resampling::HistSampling
Adaptively sample points to preserve tail features.
Definition: HistSampling.h:48
viskores::UInt32
uint32_t UInt32
Base type to use for 32-bit unsigned integer numbers.
Definition: Types.h:193
viskores::filter::resampling::HistSampling::SetSeed
void SetSeed(viskores::UInt32 seed)
Specify the seed used for random number generation.
Definition: HistSampling.h:89
Filter.h