VTK  9.7.1
vtkFindCellStrategy.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
36 #ifndef vtkFindCellStrategy_h
37 #define vtkFindCellStrategy_h
38 
39 #include "vtkCommonDataModelModule.h" // For export macro
40 #include "vtkObject.h"
41 
42 VTK_ABI_NAMESPACE_BEGIN
43 class vtkCell;
44 class vtkGenericCell;
46 class vtkPointSet;
47 
48 class VTKCOMMONDATAMODEL_EXPORT vtkFindCellStrategy : public vtkObject
49 {
50 public:
52 
56  void PrintSelf(ostream& os, vtkIndent indent) override;
58 
64  virtual vtkSmartPointer<vtkAbstractCellLocator> ConvertToCellLocator() = 0;
65 
73  virtual int Initialize(vtkPointSet* ps);
74 
83  virtual vtkIdType FindCell(double x[3], vtkCell* cell, vtkGenericCell* gencell, vtkIdType cellId,
84  double tol2, int& subId, double pcoords[3], double* weights) = 0;
85 
102  virtual vtkIdType FindClosestPointWithinRadius(double x[3], double radius, double closestPoint[3],
103  vtkGenericCell* cell, vtkIdType& cellId, int& subId, double& dist2, int& inside) = 0;
104 
108  virtual bool InsideCellBounds(double x[3], vtkIdType cellId) = 0;
109 
118  virtual void CopyParameters(vtkFindCellStrategy* from);
119 
120 protected:
122  ~vtkFindCellStrategy() override;
123 
124  // You may ask why this OwnsLocator rigamarole. The reason is that the reference counting garbage
125  // collector gets confused when the (cell/point) locator, point set, and strategy are all mixed
126  // together; resulting in memory leaks etc, So this defines if the locator specified or taken from
127  // another strategy instance or the dataset.
129  // IsACopy is needed to ensure the point-set's locator is up-to-date
130  // otherwise thread-safety issue can arise.
131  bool IsACopy;
132  vtkPointSet* PointSet; // vtkPointSet which this strategy is associated with
133  double Bounds[6]; // bounding box of vtkPointSet
134 
135  vtkTimeStamp InitializeTime; // time at which strategy was initialized
136 
137 private:
138  vtkFindCellStrategy(const vtkFindCellStrategy&) = delete;
139  void operator=(const vtkFindCellStrategy&) = delete;
140 };
141 
142 VTK_ABI_NAMESPACE_END
143 #endif
abstract base class for most VTK objects
Definition: vtkObject.h:52
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
record modification and/or execution time
Definition: vtkTimeStamp.h:24
an abstract base class for locators which find cells
concrete class for storing a set of points
Definition: vtkPointSet.h:58
int vtkIdType
Definition: vtkType.h:363
provides thread-safe access to cells
helper class to manage the vtkPointSet::FindCell() method
abstract class to specify cell behavior
Definition: vtkCell.h:50
a simple class to control print indentation
Definition: vtkIndent.h:28