VTK  9.7.1
vtkJumpAndWalkCellLocator.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-License-Identifier: BSD-3-Clause
45 #ifndef vtkJumpAndWalkCellLocator_h
46 #define vtkJumpAndWalkCellLocator_h
47 
48 #include "vtkAbstractCellLocator.h"
49 #include "vtkAbstractPointLocator.h" // For vtkAbstractPointLocator
50 #include "vtkCommonDataModelModule.h" // For export macro
51 #include "vtkSMPThreadLocal.h" // For vtkSMPThreadLocal
52 #include "vtkSmartPointer.h" // For vtkSmartPointer
53 
54 #include <unordered_set> // For unordered_set
55 
56 VTK_ABI_NAMESPACE_BEGIN
57 
59 
60 class VTKCOMMONDATAMODEL_EXPORT vtkJumpAndWalkCellLocator : public vtkAbstractCellLocator
61 {
62 public:
64 
68  void PrintSelf(ostream& os, vtkIndent indent) override;
71 
72  // Reuse any superclass signatures that we don't override.
75 
77 
82  vtkSetSmartPointerMacro(PointLocator, vtkAbstractPointLocator);
83  vtkGetSmartPointerMacro(PointLocator, vtkAbstractPointLocator);
85 
87 
93  vtkSetClampMacro(NumberOfClosestPoints, unsigned int, 1, 1000);
94  vtkGetMacro(NumberOfClosestPoints, unsigned int);
96 
107  vtkIdType FindCell(double x[3], double tol2, vtkGenericCell* genCell, int& subId,
108  double pcoords[3], double* weights) override;
109 
131  vtkIdType FindClosestPointWithinRadius(double x[3], double radius, double closestPoint[3],
132  vtkGenericCell* genCell, vtkIdType& cellId, int& subId, double& dist2, int& inside) override;
133 
135 
138  void FreeSearchStructure() override;
139  void BuildLocator() override;
140  void ForceBuildLocator() override;
141  void GenerateRepresentation(int level, vtkPolyData* pd) override;
143 
149  void ShallowCopy(vtkAbstractCellLocator* locator) override;
150 
151 protected:
153  ~vtkJumpAndWalkCellLocator() override;
154 
155  void BuildLocatorInternal() override;
156 
157  void ReportReferences(vtkGarbageCollector*) override;
158 
159 private:
161  void operator=(const vtkJumpAndWalkCellLocator&) = delete;
162 
163  vtkIdType FindCellWalk(vtkIdList* cellIds, double x[3], double tol2, vtkGenericCell* genCell,
164  int& subId, double pcoords[3], double* weights, std::unordered_set<vtkIdType>& visitedCellIds,
165  vtkIdList* ptIds, vtkIdList* neighbors);
166 
167  // Bounding box of the whole dataset
169  VTK_DOUBLE_MAX, VTK_DOUBLE_MIN };
170  unsigned int NumberOfClosestPoints = 1;
171 
172  vtkSmartPointer<vtkAbstractPointLocator> PointLocator = nullptr;
173 
174  struct ThreadLocalData;
176 };
177 VTK_ABI_NAMESPACE_END
178 
179 #endif // vtkJumpAndWalkCellLocator_h
void ReportReferences(vtkGarbageCollector *) override
point locator adaptor to perform cell Location using the jump and walk approach
virtual void BuildLocator()=0
Build the locator from the input dataset.
virtual vtkIdType FindClosestPointWithinRadius(double x[3], double radius, double closestPoint[3], vtkIdType &cellId, int &subId, double &dist2)
Return the closest point within a specified radius and the cell which is closest to the point x...
#define VTK_DOUBLE_MAX
Definition: vtkType.h:202
an abstract base class for locators which find cells
int vtkIdType
Definition: vtkType.h:363
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:71
virtual void FreeSearchStructure()=0
Free the memory required for the spatial data structure.
Detect and break reference loops.
provides thread-safe access to cells
virtual void ShallowCopy(vtkAbstractCellLocator *)
Shallow copy of a vtkAbstractCellLocator.
a simple class to control print indentation
Definition: vtkIndent.h:28
virtual void BuildLocatorInternal()
This function is not pure virtual to maintain backwards compatibility.
Definition: vtkLocator.h:199
abstract class to quickly locate points in 3-space
list of point or cell ids
Definition: vtkIdList.h:25
#define VTK_DOUBLE_MIN
Definition: vtkType.h:201
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...
virtual void GenerateRepresentation(int level, vtkPolyData *pd)=0
Method to build a representation at a particular level.
virtual void ForceBuildLocator()
Build the locator from the input dataset (even if UseExistingSearchStructure is on).
Definition: vtkLocator.h:163
vtkIdType FindCell(double x[3])
Returns the Id of the cell containing the point, returns -1 if no cell found.