Support deprecated behavior of point locator pointers

`PointLocator`s have changed from being virtual objects to being trivial
objects. Part of this change means that when a worklet gets the
execution object for a point locator, it gets the actual object (or a
reference to it) instead of a pointer to an object. This means that the
new code uses the `.` operator to access the locator's features instead
of the `->` operator.

To support code still using the deprecated functionality, added a
specific `->` operator to the locator execution object to make it behave
as if it were a pointer. However, this operator is marked deprecated to
warn the user that they should modify their code to use the `.` instead.
This commit is contained in:
Kenneth Moreland 2021-02-18 13:11:54 -07:00
parent 8e757e58ad
commit 1822792b85
6 changed files with 15 additions and 10 deletions

@ -122,9 +122,9 @@ public:
}
}
VTKM_DEPRECATED(1.6, "Locators no longer pointers. Use . operator.")
VTKM_DEPRECATED(1.6, "Locators are no longer pointers. Use . operator.")
VTKM_EXEC CellLocatorBoundingIntervalHierarchy* operator->() { return this; }
VTKM_DEPRECATED(1.6, "Locators no longer pointers. Use . operator.")
VTKM_DEPRECATED(1.6, "Locators are no longer pointers. Use . operator.")
VTKM_EXEC const CellLocatorBoundingIntervalHierarchy* operator->() const { return this; }
private:

@ -58,9 +58,9 @@ public:
return this->Locators.CastAndCall(detail::FindCellFunctor{}, point, cellId, parametric);
}
VTKM_DEPRECATED(1.6, "Locators no longer pointers. Use . operator.")
VTKM_DEPRECATED(1.6, "Locators are no longer pointers. Use . operator.")
VTKM_EXEC CellLocatorMultiplexer* operator->() { return this; }
VTKM_DEPRECATED(1.6, "Locators no longer pointers. Use . operator.")
VTKM_DEPRECATED(1.6, "Locators are no longer pointers. Use . operator.")
VTKM_EXEC const CellLocatorMultiplexer* operator->() const { return this; }
};

@ -144,9 +144,9 @@ public:
return vtkm::ErrorCode::Success;
}
VTKM_DEPRECATED(1.6, "Locators no longer pointers. Use . operator.")
VTKM_DEPRECATED(1.6, "Locators are no longer pointers. Use . operator.")
VTKM_EXEC CellLocatorRectilinearGrid* operator->() { return this; }
VTKM_DEPRECATED(1.6, "Locators no longer pointers. Use . operator.")
VTKM_DEPRECATED(1.6, "Locators are no longer pointers. Use . operator.")
VTKM_EXEC const CellLocatorRectilinearGrid* operator->() const { return this; }
private:

@ -200,9 +200,9 @@ public:
return vtkm::ErrorCode::CellNotFound;
}
VTKM_DEPRECATED(1.6, "Locators no longer pointers. Use . operator.")
VTKM_DEPRECATED(1.6, "Locators are no longer pointers. Use . operator.")
VTKM_EXEC CellLocatorTwoLevel* operator->() { return this; }
VTKM_DEPRECATED(1.6, "Locators no longer pointers. Use . operator.")
VTKM_DEPRECATED(1.6, "Locators are no longer pointers. Use . operator.")
VTKM_EXEC const CellLocatorTwoLevel* operator->() const { return this; }
private:

@ -82,9 +82,9 @@ public:
return vtkm::ErrorCode::Success;
}
VTKM_DEPRECATED(1.6, "Locators no longer pointers. Use . operator.")
VTKM_DEPRECATED(1.6, "Locators are no longer pointers. Use . operator.")
VTKM_EXEC CellLocatorUniformGrid* operator->() { return this; }
VTKM_DEPRECATED(1.6, "Locators no longer pointers. Use . operator.")
VTKM_DEPRECATED(1.6, "Locators are no longer pointers. Use . operator.")
VTKM_EXEC const CellLocatorUniformGrid* operator->() const { return this; }
private:

@ -85,6 +85,11 @@ public:
this->FindInBox(queryPoint, ijk, level, nearestNeighborId, distance2);
}
VTKM_DEPRECATED(1.6, "Locators are no longer pointers. Use . operator.")
VTKM_EXEC PointLocatorSparseGrid* operator->() { return this; }
VTKM_DEPRECATED(1.6, "Locators are no longer pointers. Use . operator.")
VTKM_EXEC const PointLocatorSparseGrid* operator->() const { return this; }
private:
vtkm::Vec3f Min;
vtkm::Id3 Dims;