Viskores  1.0
cont/PointLocatorSparseGrid.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_cont_PointLocatorSparseGrid_h
19 #define viskores_cont_PointLocatorSparseGrid_h
20 
23 
24 namespace viskores
25 {
26 namespace cont
27 {
28 
43 class VISKORES_CONT_EXPORT PointLocatorSparseGrid : public viskores::cont::PointLocatorBase
44 {
45 public:
47 
52  void SetRange(const RangeType& range)
53  {
54  if (this->Range != range)
55  {
56  this->Range = range;
57  this->SetModified();
58  }
59  }
61  const RangeType& GetRange() const { return this->Range; }
62 
64  {
65  if (!this->IsRangeInvalid())
66  {
67  this->Range = { { 0.0, -1.0 } };
68  this->SetModified();
69  }
70  }
71 
80  void SetNumberOfBins(const viskores::Id3& bins)
81  {
82  if (this->Dims != bins)
83  {
84  this->Dims = bins;
85  this->SetModified();
86  }
87  }
89  const viskores::Id3& GetNumberOfBins() const { return this->Dims; }
90 
93  viskores::cont::Token& token) const;
94 
95 private:
96  bool IsRangeInvalid() const
97  {
98  return (this->Range[0].Max < this->Range[0].Min) || (this->Range[1].Max < this->Range[1].Min) ||
99  (this->Range[2].Max < this->Range[2].Min);
100  }
101 
102  VISKORES_CONT void Build() override;
103 
104  RangeType Range = { { 0.0, -1.0 } };
105  viskores::Id3 Dims = { 32 };
106 
110 };
111 }
112 }
113 #endif //viskores_cont_PointLocatorSparseGrid_h
viskores::cont::PointLocatorSparseGrid::SetComputeRangeFromCoordinates
void SetComputeRangeFromCoordinates()
Definition: cont/PointLocatorSparseGrid.h:63
viskores::Range::Min
viskores::Float64 Min
The minumum value of the range (inclusive).
Definition: Range.h:42
viskores::cont::PointLocatorBase
Base class for all PointLocator classes.
Definition: PointLocatorBase.h:41
viskores::cont::PointLocatorSparseGrid::CellLower
viskores::cont::ArrayHandle< viskores::Id > CellLower
Definition: cont/PointLocatorSparseGrid.h:108
viskores::cont::ArrayHandle< viskores::Id >
viskores::cont::PointLocatorSparseGrid::SetRange
void SetRange(const RangeType &range)
Specify the bounds of the space to search for points.
Definition: cont/PointLocatorSparseGrid.h:52
viskores::cont::PointLocatorSparseGrid::PointIds
viskores::cont::ArrayHandle< viskores::Id > PointIds
Definition: cont/PointLocatorSparseGrid.h:107
viskores::cont::PointLocatorSparseGrid::GetRange
const RangeType & GetRange() const
Specify the bounds of the space to search for points.
Definition: cont/PointLocatorSparseGrid.h:61
viskores::Range::Max
viskores::Float64 Max
Tha maximum value of the range (inclusive).
Definition: Range.h:44
viskores::cont::PointLocatorSparseGrid::CellUpper
viskores::cont::ArrayHandle< viskores::Id > CellUpper
Definition: cont/PointLocatorSparseGrid.h:109
VISKORES_CONT
#define VISKORES_CONT
Definition: ExportMacros.h:65
viskores
Groups connected points that have the same field value.
Definition: Atomic.h:27
viskores::cont::PointLocatorSparseGrid::SetNumberOfBins
void SetNumberOfBins(const viskores::Id3 &bins)
Specify the number of bins used in the sparse grid to be searched.
Definition: cont/PointLocatorSparseGrid.h:80
viskores::cont::DeviceAdapterId
An object used to specify a device.
Definition: DeviceAdapterTag.h:66
viskores::Range
Represent a continuous scalar range of values.
Definition: Range.h:39
PointLocatorBase.h
viskores::exec::PointLocatorSparseGrid
Structure for locating point.
Definition: exec/PointLocatorSparseGrid.h:36
viskores::cont::PointLocatorSparseGrid::IsRangeInvalid
bool IsRangeInvalid() const
Definition: cont/PointLocatorSparseGrid.h:96
viskores::cont::PointLocatorSparseGrid
A locator that bins points in a sparsely stored grid.
Definition: cont/PointLocatorSparseGrid.h:43
viskores::Vec< viskores::Range, 3 >
viskores::cont::Token
A token to hold the scope of an ArrayHandle or other object.
Definition: Token.h:43
viskores::cont::PointLocatorSparseGrid::GetNumberOfBins
const viskores::Id3 & GetNumberOfBins() const
Specify the number of bins used in the sparse grid to be searched.
Definition: cont/PointLocatorSparseGrid.h:89
PointLocatorSparseGrid.h