Fixes kokkos builds. Need to call ReadPortal().

This commit is contained in:
Dave Pugmire 2022-08-10 07:40:53 -04:00
parent 18260c7681
commit 699d84681a
2 changed files with 7 additions and 20 deletions

@ -199,7 +199,6 @@ public:
typename LocatorType::LastCell& lastCell) const
{
vtkm::ErrorCode status = locator.FindCell(point, cellId, pcoords, lastCell);
std::cout << "FindCellWorkletWithLast: " << point << " " << cellId << std::endl;
if (status != vtkm::ErrorCode::Success)
this->RaiseError(vtkm::ErrorString(status));
}
@ -242,42 +241,33 @@ void TestCellLocator(const vtkm::Vec<vtkm::Id, DIMENSIONS>& dim, vtkm::Id number
"Incorrect parameteric coordinates");
}
std::cout << __FILE__ << " " << __LINE__ << std::endl;
//Test the last cell option.
//Call the locator to fill in the lastCell array.
std::vector<vtkm::cont::CellLocatorTwoLevel::LastCell> lastCell(numberOfPoints);
auto lastCellArray = vtkm::cont::make_ArrayHandle(lastCell, vtkm::CopyFlag::On);
auto lastCellArray = vtkm::cont::make_ArrayHandle(lastCell, vtkm::CopyFlag::Off);
//vtkm::cont::printSummary_ArrayHandle(lastCellArray, std::cout);
std::cout << __FILE__ << " " << __LINE__ << std::endl;
invoker(FindCellWorkletWithLastCell{}, points, locator, cellIds, pcoords, lastCellArray);
//Call it again so that it uses the last-cell array. We should get the same results.
std::cout << __FILE__ << " " << __LINE__ << std::endl;
invoker(FindCellWorkletWithLastCell{}, points, locator, cellIds, pcoords, lastCellArray);
//vtkm::exec::CellLocatorTwoLevel<>::LastCell x = lastCell[0].Get();
//using LastCellType = vtkm::exec::CellLocatorTwoLevel<vtkm::exec::ConnectivityStructured<vtkm::TopologyElementTagCell, vtkm::TopologyElementTagPoint, 2>>::LastCell;
//auto x = lastCell[0].Get<LastCellType>();
//std::cout<<"LastCell: "<<x.CellId<<std::endl;
cellIdsPortal = cellIds.ReadPortal();
pcoordsPortal = pcoords.ReadPortal();
for (vtkm::Id i = 0; i < numberOfPoints; ++i)
{
if (cellIdsPortal.Get(i) != expCellIdsPortal.Get(i))
std::cout << "Error at: " << i << " " << points.ReadPortal().Get(i) << " "
<< cellIdsPortal.Get(i) << " " << expCellIdsPortal.Get(i) << std::endl;
VTKM_TEST_ASSERT(cellIdsPortal.Get(i) == expCellIdsPortal.Get(i), "Incorrect cell ids");
VTKM_TEST_ASSERT(test_equal(pcoordsPortal.Get(i), expPCoordsPortal.Get(i), 1e-3),
"Incorrect parameteric coordinates");
}
std::cout << __FILE__ << " " << __LINE__ << std::endl;
//Test with uninitialized lastCell objects.
vtkm::cont::ArrayHandle<vtkm::cont::CellLocatorTwoLevel::LastCell> lastCell2;
lastCell2.Allocate(numberOfPoints);
invoker(FindCellWorkletWithLastCell{}, points, locator, cellIds, pcoords, lastCell2);
std::cout << __FILE__ << " " << __LINE__ << std::endl;
cellIdsPortal = cellIds.ReadPortal();
pcoordsPortal = pcoords.ReadPortal();
for (vtkm::Id i = 0; i < numberOfPoints; ++i)
{
VTKM_TEST_ASSERT(cellIdsPortal.Get(i) == expCellIdsPortal.Get(i), "Incorrect cell ids");
@ -292,8 +282,8 @@ void TestingCellLocatorTwoLevel()
std::cout << "Seed: " << seed << std::endl;
RandomGenerator.seed(seed);
TestCellLocator(vtkm::Id3(8), 8); // 3D dataset
TestCellLocator(vtkm::Id2(18), 8); // 2D dataset
TestCellLocator(vtkm::Id3(8), 512); // 3D dataset
TestCellLocator(vtkm::Id2(18), 512); // 2D dataset
}
} // anonymous

@ -284,9 +284,6 @@ private:
{
lastCell.CellId = cellId;
lastCell.LeafIdx = leafIdx;
std::cout << " ::FindCell(" << point << ") lastCell= " << lastCell.CellId << " "
<< lastCell.LeafIdx << std::endl;
return vtkm::ErrorCode::Success;
}
}