VTK-m  2.3
cont/PointLocatorSparseGrid.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 #ifndef vtk_m_cont_PointLocatorSparseGrid_h
11 #define vtk_m_cont_PointLocatorSparseGrid_h
12 
15 
16 namespace vtkm
17 {
18 namespace cont
19 {
20 
36 {
37 public:
39 
44  void SetRange(const RangeType& range)
45  {
46  if (this->Range != range)
47  {
48  this->Range = range;
49  this->SetModified();
50  }
51  }
53  const RangeType& GetRange() const { return this->Range; }
54 
56  {
57  if (!this->IsRangeInvalid())
58  {
59  this->Range = { { 0.0, -1.0 } };
60  this->SetModified();
61  }
62  }
63 
72  void SetNumberOfBins(const vtkm::Id3& bins)
73  {
74  if (this->Dims != bins)
75  {
76  this->Dims = bins;
77  this->SetModified();
78  }
79  }
81  const vtkm::Id3& GetNumberOfBins() const { return this->Dims; }
82 
83  VTKM_CONT
85  vtkm::cont::Token& token) const;
86 
87 private:
88  bool IsRangeInvalid() const
89  {
90  return (this->Range[0].Max < this->Range[0].Min) || (this->Range[1].Max < this->Range[1].Min) ||
91  (this->Range[2].Max < this->Range[2].Min);
92  }
93 
94  VTKM_CONT void Build() override;
95 
96  RangeType Range = { { 0.0, -1.0 } };
97  vtkm::Id3 Dims = { 32 };
98 
102 };
103 }
104 }
105 #endif //vtk_m_cont_PointLocatorSparseGrid_h
vtkm::exec::PointLocatorSparseGrid
Structure for locating point.
Definition: exec/PointLocatorSparseGrid.h:28
vtkm::cont::ArrayHandle< vtkm::Id >
vtkm
Groups connected points that have the same field value.
Definition: Atomic.h:19
vtkm::cont::PointLocatorSparseGrid::CellLower
vtkm::cont::ArrayHandle< vtkm::Id > CellLower
Definition: cont/PointLocatorSparseGrid.h:100
vtkm::cont::PointLocatorSparseGrid::CellUpper
vtkm::cont::ArrayHandle< vtkm::Id > CellUpper
Definition: cont/PointLocatorSparseGrid.h:101
vtkm::cont::PointLocatorSparseGrid::GetRange
const RangeType & GetRange() const
Specify the bounds of the space to search for points.
Definition: cont/PointLocatorSparseGrid.h:53
vtkm::cont::PointLocatorSparseGrid::SetRange
void SetRange(const RangeType &range)
Specify the bounds of the space to search for points.
Definition: cont/PointLocatorSparseGrid.h:44
vtkm::cont::PointLocatorBase
Base class for all PointLocator classes.
Definition: PointLocatorBase.h:33
vtkm::cont::PointLocatorSparseGrid
A locator that bins points in a sparsely stored grid.
Definition: cont/PointLocatorSparseGrid.h:35
vtkm::cont::PointLocatorSparseGrid::PointIds
vtkm::cont::ArrayHandle< vtkm::Id > PointIds
Definition: cont/PointLocatorSparseGrid.h:99
vtkm::cont::Token
A token to hold the scope of an ArrayHandle or other object.
Definition: Token.h:35
vtkm::cont::PointLocatorSparseGrid::GetNumberOfBins
const vtkm::Id3 & GetNumberOfBins() const
Specify the number of bins used in the sparse grid to be searched.
Definition: cont/PointLocatorSparseGrid.h:81
VTKM_CONT_EXPORT
#define VTKM_CONT_EXPORT
Definition: vtkm_cont_export.h:44
VTKM_CONT
#define VTKM_CONT
Definition: ExportMacros.h:57
vtkm::cont::DeviceAdapterId
An object used to specify a device.
Definition: DeviceAdapterTag.h:58
PointLocatorBase.h
vtkm::Vec< vtkm::Range, 3 >
vtkm::Range::Min
vtkm::Float64 Min
The minumum value of the range (inclusive).
Definition: Range.h:34
vtkm::cont::PointLocatorSparseGrid::SetNumberOfBins
void SetNumberOfBins(const vtkm::Id3 &bins)
Specify the number of bins used in the sparse grid to be searched.
Definition: cont/PointLocatorSparseGrid.h:72
vtkm::Range::Max
vtkm::Float64 Max
Tha maximum value of the range (inclusive).
Definition: Range.h:36
vtkm::cont::PointLocatorSparseGrid::SetComputeRangeFromCoordinates
void SetComputeRangeFromCoordinates()
Definition: cont/PointLocatorSparseGrid.h:55
PointLocatorSparseGrid.h
vtkm::cont::PointLocatorSparseGrid::IsRangeInvalid
bool IsRangeInvalid() const
Definition: cont/PointLocatorSparseGrid.h:88
vtkm::Range
Represent a continuous scalar range of values.
Definition: Range.h:31