Fix CleanGrid when compact point fields is off

There was an error in the CleanGrid filter where if the
CompactPointFields flag was off it would still try to compact the point
coordinates. Add an extra check so that the coordinate systems are just
passed when this flag is off.
This commit is contained in:
Kenneth Moreland 2017-01-19 13:31:15 -07:00
parent 503bebda54
commit 5004e64c3e
2 changed files with 22 additions and 9 deletions

@ -128,11 +128,18 @@ CleanGrid::DoExecute(const vtkm::cont::DataSet &inData,
vtkm::cont::CoordinateSystem coordSystem =
inData.GetCoordinateSystem(coordSystemIndex);
vtkm::filter::ApplyPolicy(coordSystem,
Policy(),
vtkm::filter::FilterTraits<CleanGrid>())
.CastAndCall(detail::CleanCompactPointArrayFunctor<Device>(
outData,coordSystem.GetName(),this));
if (this->GetCompactPointFields())
{
vtkm::filter::ApplyPolicy(coordSystem,
Policy(),
vtkm::filter::FilterTraits<CleanGrid>())
.CastAndCall(detail::CleanCompactPointArrayFunctor<Device>(
outData,coordSystem.GetName(),this));
}
else
{
outData.AddCoordinateSystem(coordSystem);
}
}
return outData;

@ -25,7 +25,7 @@
namespace {
void TestUniformGrid()
void TestUniformGrid(vtkm::filter::CleanGrid clean)
{
std::cout << "Testing 'clean' uniform grid." << std::endl;
@ -33,8 +33,6 @@ void TestUniformGrid()
vtkm::cont::DataSet inData = makeData.Make2DUniformDataSet0();
vtkm::filter::CleanGrid clean;
vtkm::filter::ResultDataSet result = clean.Execute(inData);
VTKM_TEST_ASSERT(result.IsValid(), "Filter failed to execute");
@ -83,7 +81,15 @@ void TestUniformGrid()
void RunTest()
{
TestUniformGrid();
vtkm::filter::CleanGrid clean;
std::cout << "*** Test wqith compact point fields on" << std::endl;
clean.SetCompactPointFields(true);
TestUniformGrid(clean);
std::cout << "*** Test wqith compact point fields off" << std::endl;
clean.SetCompactPointFields(false);
TestUniformGrid(clean);
}
} // anonymous namespace