VTK-m  2.0
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 
35 class VTKM_CONT_EXPORT PointLocatorSparseGrid
36  : public vtkm::cont::internal::PointLocatorBase<PointLocatorSparseGrid>
37 {
38  using Superclass = vtkm::cont::internal::PointLocatorBase<PointLocatorSparseGrid>;
39 
40 public:
42 
43  void SetRange(const RangeType& range)
44  {
45  if (this->Range != range)
46  {
47  this->Range = range;
48  this->SetModified();
49  }
50  }
51 
52  const RangeType& GetRange() const { return this->Range; }
53 
55  {
56  if (!this->IsRangeInvalid())
57  {
58  this->Range = { { 0.0, -1.0 } };
59  this->SetModified();
60  }
61  }
62 
63  void SetNumberOfBins(const vtkm::Id3& bins)
64  {
65  if (this->Dims != bins)
66  {
67  this->Dims = bins;
68  this->SetModified();
69  }
70  }
71 
72  const vtkm::Id3& GetNumberOfBins() const { return this->Dims; }
73 
74  VTKM_CONT
76  vtkm::cont::Token& token) const;
77 
78 private:
79  bool IsRangeInvalid() const
80  {
81  return (this->Range[0].Max < this->Range[0].Min) || (this->Range[1].Max < this->Range[1].Min) ||
82  (this->Range[2].Max < this->Range[2].Min);
83  }
84 
85  friend Superclass;
86  VTKM_CONT void Build();
87 
88  RangeType Range = { { 0.0, -1.0 } };
89  vtkm::Id3 Dims = { 32 };
90 
94 };
95 }
96 }
97 #endif //vtk_m_cont_PointLocatorSparseGrid_h
vtkm::exec::PointLocatorSparseGrid
Definition: exec/PointLocatorSparseGrid.h:22
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:92
vtkm::cont::PointLocatorSparseGrid::CellUpper
vtkm::cont::ArrayHandle< vtkm::Id > CellUpper
Definition: cont/PointLocatorSparseGrid.h:93
vtkm::cont::PointLocatorSparseGrid::GetRange
const RangeType & GetRange() const
Definition: cont/PointLocatorSparseGrid.h:52
vtkm::cont::PointLocatorSparseGrid::SetRange
void SetRange(const RangeType &range)
Definition: cont/PointLocatorSparseGrid.h:43
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:91
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
Definition: cont/PointLocatorSparseGrid.h:72
VTKM_CONT
#define VTKM_CONT
Definition: ExportMacros.h:57
vtkm::cont::PointLocatorSparseGrid::Superclass
friend Superclass
Definition: cont/PointLocatorSparseGrid.h:85
vtkm::cont::DeviceAdapterId
Definition: DeviceAdapterTag.h:52
PointLocatorBase.h
vtkm::Vec< vtkm::Range, 3 >
vtkm::Range::Min
vtkm::Float64 Min
Definition: Range.h:33
vtkm::cont::PointLocatorSparseGrid::SetNumberOfBins
void SetNumberOfBins(const vtkm::Id3 &bins)
Definition: cont/PointLocatorSparseGrid.h:63
vtkm::Range::Max
vtkm::Float64 Max
Definition: Range.h:34
vtkm::cont::PointLocatorSparseGrid::SetComputeRangeFromCoordinates
void SetComputeRangeFromCoordinates()
Definition: cont/PointLocatorSparseGrid.h:54
PointLocatorSparseGrid.h
vtkm::cont::PointLocatorSparseGrid::Superclass
vtkm::cont::internal::PointLocatorBase< PointLocatorSparseGrid > Superclass
Definition: cont/PointLocatorSparseGrid.h:38
vtkm::cont::PointLocatorSparseGrid::IsRangeInvalid
bool IsRangeInvalid() const
Definition: cont/PointLocatorSparseGrid.h:79
vtkm::Range
Represent a continuous scalar range of values.
Definition: Range.h:31