mirror of
https://gitlab.kitware.com/vtk/vtk-m
synced 2024-09-16 17:22:55 +00:00
Fix MarchingCell for Wedge
Fixed error in one entry of number_of_triangles table for MarchineCells that results in missing triangles for wedge cell type as reported by issue #496.
This commit is contained in:
parent
f7741be0e1
commit
52f0d5b2d5
3
data/data/unstructured/box-with-errors.vtk
Normal file
3
data/data/unstructured/box-with-errors.vtk
Normal file
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:1e415c5dfd711901fdb0abb4dab2606b41c032938867200bdceebc13414b3bc8
|
||||
size 4045
|
@ -10,19 +10,21 @@
|
||||
|
||||
#include <vtkm/Math.h>
|
||||
#include <vtkm/cont/DataSet.h>
|
||||
#include <vtkm/cont/DataSetBuilderUniform.h>
|
||||
#include <vtkm/cont/DataSetFieldAdd.h>
|
||||
#include <vtkm/cont/testing/Testing.h>
|
||||
#include <vtkm/filter/CleanGrid.h>
|
||||
|
||||
#include <vtkm/filter/Contour.h>
|
||||
#include <vtkm/io/reader/VTKDataSetReader.h>
|
||||
#include <vtkm/source/Tangle.h>
|
||||
|
||||
namespace vtkm_ut_mc_filter
|
||||
namespace
|
||||
{
|
||||
|
||||
void TestContourUniformGrid()
|
||||
class TestContourFilter
|
||||
{
|
||||
public:
|
||||
void TestContourUniformGrid() const
|
||||
{
|
||||
std::cout << "Testing Contour filter on a uniform grid" << std::endl;
|
||||
|
||||
vtkm::Id3 dims(4, 4, 4);
|
||||
@ -86,11 +88,43 @@ void TestContourUniformGrid()
|
||||
const CellSetType& cells = dcells.Cast<CellSetType>();
|
||||
VTKM_TEST_ASSERT(cells.GetNumberOfCells() == 160, "");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void TestContourWedges() const
|
||||
{
|
||||
auto pathname =
|
||||
vtkm::cont::testing::Testing::GetTestDataBasePath() + "/unstructured/box-with-errors.vtk";
|
||||
vtkm::io::reader::VTKDataSetReader reader(pathname);
|
||||
|
||||
vtkm::cont::DataSet dataSet = reader.ReadDataSet();
|
||||
|
||||
vtkm::cont::CellSetExplicit<> cellSet;
|
||||
dataSet.GetCellSet().CopyTo(cellSet);
|
||||
|
||||
vtkm::cont::ArrayHandle<vtkm::Float32> fieldArray;
|
||||
dataSet.GetPointField("gyroid").GetData().CopyTo(fieldArray);
|
||||
|
||||
vtkm::worklet::Contour isosurfaceFilter;
|
||||
isosurfaceFilter.SetMergeDuplicatePoints(false);
|
||||
|
||||
vtkm::cont::ArrayHandle<vtkm::Vec3f_32> verticesArray;
|
||||
vtkm::cont::ArrayHandle<vtkm::Vec3f_32> normalsArray;
|
||||
|
||||
auto result = isosurfaceFilter.Run(
|
||||
{ 0.0f }, cellSet, dataSet.GetCoordinateSystem(), fieldArray, verticesArray, normalsArray);
|
||||
VTKM_TEST_ASSERT(result.GetNumberOfCells() == 52);
|
||||
}
|
||||
|
||||
void operator()() const
|
||||
{
|
||||
this->TestContourUniformGrid();
|
||||
this->TestContourWedges();
|
||||
}
|
||||
|
||||
}; // class TestContourFilter
|
||||
} // namespace
|
||||
|
||||
int UnitTestContourFilter(int argc, char* argv[])
|
||||
{
|
||||
return vtkm::cont::testing::Testing::Run(vtkm_ut_mc_filter::TestContourUniformGrid, argc, argv);
|
||||
return vtkm::cont::testing::Testing::Run(TestContourFilter{}, argc, argv);
|
||||
}
|
||||
|
@ -81,7 +81,7 @@ VTKM_STATIC_CONSTEXPR_ARRAY vtkm::IdComponent NumTrianglesTable[] = {
|
||||
3, 4, 4, 5, 4, 5, 3, 4, 4, 5, 5, 2, 3, 4, 2, 1,
|
||||
2, 3, 3, 2, 3, 4, 2, 1, 3, 2, 4, 1, 2, 1, 1, 0,
|
||||
// CELL_SHAPE_WEDGE, case 0 - 63
|
||||
0, 1, 1, 2, 1, 2, 1, 1, 1, 2, 2, 3, 2, 3, 3, 2,
|
||||
0, 1, 1, 2, 1, 2, 2, 1, 1, 2, 2, 3, 2, 3, 3, 2,
|
||||
1, 2, 2, 3, 2, 3, 3, 2, 2, 3, 3, 2, 3, 4, 4, 1,
|
||||
1, 2, 2, 3, 2, 3, 3, 2, 2, 3, 3, 4, 3, 2, 4, 1,
|
||||
2, 3, 3, 4, 3, 4, 2, 1, 1, 2, 2, 1, 2, 1, 1, 0,
|
||||
|
Loading…
Reference in New Issue
Block a user