The source project of this merge request has been removed.
Deprecate ReadPortal().Get pattern.
This begins a process of graceful deprecation of all API calls which lend themselves to the ReadPortal().Get(idx)
pattern. In addition I removed a few more instances from the unit tests so that my grep
s were more legible; the main diff is to CellSetExplicit
.
More important is what I wasn't able to do, which is deprecate the instances of the antipattern in CellSetPermutation
; the main problem being that the natural way to change it is to change the meaning of the call, which can't be done via deprecation warnings.
For example, what we have is
vtkm::UInt8 GetCellShape(vtkm::Id id) const override
{
// Looping over GetCellShape is a performance bug.
return this->FullCellSet.GetCellShape(this->ValidCellIds.ReadPortal().Get(id));
}
// usage:
for (vtkm::Id id = 0; id < imax; ++id) {
auto shape = foo.GetCellShape(id);
}
But what we want the user to do is:
auto ValidCellIdsReadPortal() {
return this->ValidCellIds.ReadPortal();
}
vtkm::UInt8 GetCellShape(vtkm::Id cellIdx) const override
{
return this->FullCellSet.GetCellShape(cellIdx);
}
// usage:
auto portal = foo.ValidCellIdsReadPortal();
for (vtkm::Id id = 0; id < imax; ++id) {
auto shape = foo.GetCellShape(portal.Get(id));
}
which is backwards incompatible behavior.