Refactor changes to CombinedVectorDifferentFromNext.h

This commit is contained in:
Gunther H. Weber 2021-03-19 15:35:10 -07:00
parent 7ff30cb0c4
commit 84022a02eb

@ -97,17 +97,12 @@ public:
VTKM_EXEC_CONT vtkm::Id operator()(vtkm::Id i) const
{
// When performing an exclusive scan we need to run 1 element extra. But that doesn't matter so just return 0
if (i >= this->OverallSortOrderPortal.GetNumberOfValues() - 1)
{
return vtkm::Id{ 0 };
}
else
{
vtkm::Id currGlobalIdx = this->GetGlobalMeshIndex(this->OverallSortOrderPortal.Get(i));
vtkm::Id nextGlobalIdx = this->GetGlobalMeshIndex(this->OverallSortOrderPortal.Get(i + 1));
return (currGlobalIdx != nextGlobalIdx) ? 1 : 0;
}
vtkm::Id currGlobalIdx = this->GetGlobalMeshIndex(this->OverallSortOrderPortal.Get(i));
// When performing an exclusive scan we need to run 1 element extra. But that doesn't
// matter so just return 0. Emulate this effect by implictly duplicating the last element
vtkm::Id nextI = (i < this->OverallSortOrderPortal.GetNumberOfValues() - 1) ? i + 1 : i;
vtkm::Id nextGlobalIdx = this->GetGlobalMeshIndex(this->OverallSortOrderPortal.Get(nextI));
return (currGlobalIdx != nextGlobalIdx) ? 1 : 0;
}
};