VTK-m  2.2
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 
40  void SetRange(const RangeType& range)
41  {
42  if (this->Range != range)
43  {
44  this->Range = range;
45  this->SetModified();
46  }
47  }
48 
49  const RangeType& GetRange() const { return this->Range; }
50 
52  {
53  if (!this->IsRangeInvalid())
54  {
55  this->Range = { { 0.0, -1.0 } };
56  this->SetModified();
57  }
58  }
59 
60  void SetNumberOfBins(const vtkm::Id3& bins)
61  {
62  if (this->Dims != bins)
63  {
64  this->Dims = bins;
65  this->SetModified();
66  }
67  }
68 
69  const vtkm::Id3& GetNumberOfBins() const { return this->Dims; }
70 
71  VTKM_CONT
73  vtkm::cont::Token& token) const;
74 
75 private:
76  bool IsRangeInvalid() const
77  {
78  return (this->Range[0].Max < this->Range[0].Min) || (this->Range[1].Max < this->Range[1].Min) ||
79  (this->Range[2].Max < this->Range[2].Min);
80  }
81 
82  VTKM_CONT void Build() override;
83 
84  RangeType Range = { { 0.0, -1.0 } };
85  vtkm::Id3 Dims = { 32 };
86 
90 };
91 }
92 }
93 #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:88
vtkm::cont::PointLocatorSparseGrid::CellUpper
vtkm::cont::ArrayHandle< vtkm::Id > CellUpper
Definition: cont/PointLocatorSparseGrid.h:89
vtkm::cont::PointLocatorSparseGrid::GetRange
const RangeType & GetRange() const
Definition: cont/PointLocatorSparseGrid.h:49
vtkm::cont::PointLocatorSparseGrid::SetRange
void SetRange(const RangeType &range)
Definition: cont/PointLocatorSparseGrid.h:40
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:87
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:69
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)
Definition: cont/PointLocatorSparseGrid.h:60
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:51
PointLocatorSparseGrid.h
vtkm::cont::PointLocatorSparseGrid::IsRangeInvalid
bool IsRangeInvalid() const
Definition: cont/PointLocatorSparseGrid.h:76
vtkm::Range
Represent a continuous scalar range of values.
Definition: Range.h:31