Skip to content

Commit 9698d6c

Browse files
Upgrade vtk-m dep to [2.0, 2.3] (#453)
`GetCoordinateSystem` no longer returns reference, so some of our API usage had to be changed a bit. Ref: https://gitlab.kitware.com/vtk/vtk-m/-/commit/2d30e6d45a659d64865f7b7db14e0e38a9716245
1 parent 8f957b8 commit 9698d6c

File tree

2 files changed

+20
-24
lines changed

2 files changed

+20
-24
lines changed

layer0/ContourSurf.cpp

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -82,18 +82,12 @@ using ::copysign;
8282

8383
#include <vtkm/Version.h>
8484
#include <vtkm/cont/DataSetBuilderUniform.h>
85-
#include <vtkm/filter/Contour.h>
85+
#include <vtkm/filter/Contour/Contour.h>
8686

8787
#include <cassert>
8888
#include <set>
8989
#include <vector>
9090

91-
#if VTKM_VERSION_MINOR < 6 && VTKM_VERSION_PATCH > 0
92-
// 1.5.1
93-
#define ReadPortal GetPortalConstControl
94-
#define make_ArrayHandleMove(v) make_ArrayHandle(v, vtkm::CopyFlag::Off)
95-
#endif
96-
9791
/**
9892
* Make a copy of a field (with operator()) and expose an array-like data access
9993
* API (operator[], empty(), size()).
@@ -342,13 +336,21 @@ static int ContourSurfVolumeVtkm(PyMOLGlobals* G, Isofield* field, float level,
342336
}
343337
}
344338

345-
auto dataSet = vtkm::cont::DataSetBuilderUniform().Create(pointDimensions);
346-
dataSet.GetCoordinateSystem().SetData(
347-
vtkm::cont::make_ArrayHandleMove(std::move(coorddata)));
348-
dataSet.AddField(vtkm::cont::make_Field(pointFieldName,
349-
vtkm::cont::Field::Association::POINTS, pointdata, vtkm::CopyFlag::Off));
339+
vtkm::cont::CellSetStructured<3> cellSet;
340+
cellSet.SetPointDimensions(pointDimensions);
341+
342+
vtkm::cont::DataSet dataSet;
343+
dataSet.SetCellSet(cellSet);
344+
345+
vtkm::cont::CoordinateSystem coordinateSystem(
346+
"coordinates", vtkm::cont::make_ArrayHandleMove(std::move(coorddata)));
347+
348+
dataSet.AddCoordinateSystem(coordinateSystem);
349+
350+
dataSet.AddField(vtkm::cont::make_Field(pointFieldName,
351+
vtkm::cont::Field::Association::Points, pointdata, vtkm::CopyFlag::Off));
350352

351-
vtkm::filter::Contour filter;
353+
vtkm::filter::contour::Contour filter;
352354
filter.SetIsoValue(level);
353355
filter.SetActiveField(pointFieldName);
354356
filter.SetGenerateNormals(mode == cIsosurfaceMode::triangles_grad_normals ||
@@ -362,12 +364,12 @@ static int ContourSurfVolumeVtkm(PyMOLGlobals* G, Isofield* field, float level,
362364
if (filter.GetGenerateNormals()) {
363365
outputData.GetPointField(filter.GetNormalArrayName())
364366
.GetData()
365-
.CastAndCall(normalscopy);
367+
.CastAndCallForTypes<vtkm::TypeListAll, VTKM_DEFAULT_STORAGE_LIST>(normalscopy);
366368
}
367369

368370
auto const& vertices = outputData.GetCoordinateSystem();
369371
auto const& cellsetsingletype =
370-
outputData.GetCellSet().Cast<vtkm::cont::CellSetSingleType<>>();
372+
outputData.GetCellSet().AsCellSet<vtkm::cont::CellSetSingleType<>>();
371373

372374
side = get_adjusted_side(level, side);
373375

setup.py

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ class options:
220220
parser.add_argument("--use-openmp", type=str2bool, help="Use OpenMP")
221221
parser.add_argument(
222222
"--use-vtkm",
223-
choices=("1.5", "1.6", "1.7", "no"),
223+
choices=("2.0", "2.1", "2.2", "2.3", "no"),
224224
help="Use VTK-m for isosurface generation",
225225
)
226226
parser.add_argument(
@@ -730,17 +730,11 @@ def make_launch_script(self):
730730
vtkm_inc_dir,
731731
vtkm_inc_dir + "/vtkm/thirdparty/diy/vtkmdiy/include",
732732
vtkm_inc_dir + "/vtkm/thirdparty/lcl/vtkmlcl",
733-
] + (options.use_vtkm == "1.5") * [
734-
vtkm_inc_dir + "/vtkm/thirdparty/diy",
735-
vtkm_inc_dir + "/vtkm/thirdparty/taotuple",
736733
]
737734
libs += [
738735
f"vtkm_cont-{options.use_vtkm}",
739-
(
740-
f"vtkm_filter-{options.use_vtkm}"
741-
if options.use_vtkm == "1.5"
742-
else f"vtkm_filter_contour-{options.use_vtkm}"
743-
),
736+
f"vtkm_filter_contour-{options.use_vtkm}",
737+
f"vtkm_filter_core-{options.use_vtkm}",
744738
]
745739

746740
if options.vmd_plugins:

0 commit comments

Comments
 (0)