Commit b544b8e0 authored by Kenneth Moreland's avatar Kenneth Moreland
Browse files

Fix point merge for Marching Cubes with multiple isosurfaces

When the Marching Cubes algorithm merges points together for multiple
isosurfaces, it uses an ArrayHandleZip to combine the isosurface id and
the edge identification. This is to prevent merging points from
different isosurfaces. However, internally this has to do an array copy.

It was doing this copy with `ArrayCopy`. A recent change to that method
made the copy fail for `ArrayHandleZip`. The fix is to change to
`ArrayCopyDevice`.

The reason why this bug was introduced was because there was no test
case for this specific use. A regression test has been updated to test
for this case.
parent e1e3d4af
Pipeline #273236 passed with stage
version https://git-lfs.github.com/spec/v1
oid sha256:dc0d600511b6cecc7b17c6ac39f108b1891b3711ac44166d87958fe361aeb625
size 3358
oid sha256:558028eae0ddb162a3c437b7d12c30857f7b964b3dc9bda601e9750db0813fe5
size 31393
version https://git-lfs.github.com/spec/v1
oid sha256:6080d76845175339023139297f67baca21fa1c09421c566f1b51d145a65f210b
size 4029
oid sha256:a879c39ef99c13722da91b7178e41a70ac0aaa5735e7cd201899639464f2f151
size 35281
......@@ -33,18 +33,15 @@ void TestContourFilterWedge()
vtkm::cont::DataSet dataSet = reader.ReadDataSet();
vtkm::filter::contour::Contour contour;
contour.SetIsoValue(0, 1);
contour.SetIsoValues({ -1, 0, 1 });
contour.SetActiveField("gyroid");
contour.SetFieldsToPass({ "gyroid", "cellvar" });
contour.SetMergeDuplicatePoints(false);
contour.SetMergeDuplicatePoints(true);
auto result = contour.Execute(dataSet);
result.PrintSummary(std::cout);
vtkm::rendering::testing::RenderTestOptions testOptions;
testOptions.Colors = { { 0.20f, 0.80f, 0.20f } };
testOptions.EnableAnnotations = false;
testOptions.DataViewPadding = 0.08;
vtkm::rendering::testing::RenderTest(result, "gyroid", "filter/contour-wedge.png", testOptions);
}
......@@ -60,7 +57,7 @@ void TestContourFilterUniform()
vtkm::filter::contour::Contour contour;
contour.SetGenerateNormals(false);
contour.SetMergeDuplicatePoints(true);
contour.SetIsoValue(0, 100.0);
contour.SetIsoValues({ 50, 100, 150 });
contour.SetActiveField(fieldName);
contour.SetFieldsToPass(fieldName);
vtkm::cont::DataSet result = contour.Execute(inputData);
......@@ -69,8 +66,6 @@ void TestContourFilterUniform()
//Y axis Flying Edge algorithm has subtle differences at a couple of boundaries
vtkm::rendering::testing::RenderTestOptions testOptions;
testOptions.Colors = { { 0.20f, 0.80f, 0.20f } };
testOptions.EnableAnnotations = false;
vtkm::rendering::testing::RenderTest(
result, "pointvar", "filter/contour-uniform.png", testOptions);
}
......
......@@ -18,6 +18,7 @@
#include <vtkm/exec/ParametricCoordinates.h>
#include <vtkm/cont/ArrayCopy.h>
#include <vtkm/cont/ArrayCopyDevice.h>
#include <vtkm/cont/ArrayHandle.h>
#include <vtkm/cont/ArrayHandleIndex.h>
#include <vtkm/cont/ArrayHandleTransform.h>
......@@ -360,7 +361,7 @@ void MergeDuplicates(const vtkm::cont::Invoker& invoker,
vtkm::cont::ArrayHandle<vtkm::Id>& connectivity)
{
vtkm::cont::ArrayHandle<KeyType> input_keys;
vtkm::cont::ArrayCopy(original_keys, input_keys);
vtkm::cont::ArrayCopyDevice(original_keys, input_keys);
vtkm::worklet::Keys<KeyType> keys(input_keys);
input_keys.ReleaseResources();
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment