Compare commits

...

8 Commits

Author SHA1 Message Date
Kenneth Moreland
a0cc756522 Merge branch 'benchmark-slowdown' into 'master'
Draft: Play around with contour benchmark configuration

See merge request vtk/vtk-m!3222
2024-07-09 10:26:47 -04:00
Kenneth Moreland
31b9c44fc3 Merge branch 'release-2.2' 2024-07-09 07:11:22 -04:00
Kenneth Moreland
3440dfa9f9 Merge topic 'undeprecate-extract-include-boundary'
012853a73 Un-deprecate extract boundary in ExtractStructured filter

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Vicente Bolea <vicente.bolea@kitware.com>
Merge-request: !3244
2024-07-09 07:11:22 -04:00
Kenneth Moreland
67b0fea23a Merge topic 'undeprecate-extract-include-boundary' into release-2.2
012853a73 Un-deprecate extract boundary in ExtractStructured filter

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Vicente Bolea <vicente.bolea@kitware.com>
Merge-request: !3244
2024-07-09 07:11:22 -04:00
Kenneth Moreland
012853a73b Un-deprecate extract boundary in ExtractStructured filter
This method was deprecated because it was not well explained in the
documentation nor was it used in VTK-m or Ascent. However, it is used in
VTK, and VTK has a bit more documentation on what this feature is
supposed to do. Thus this feature has been un-deprecated so that it will
continue to stick around. Also, additional documentation is provided to
describe the feature, and the testing has been expanded a bit.
2024-07-08 17:51:13 -04:00
Kenneth Moreland
dde6888b1c WIP: Fix issue with cleanup of CUDA arrays 2024-05-14 11:00:46 -06:00
Kenneth Moreland
0723ab473e Use ArrayHandles for flying edges lookup tables
The previous implementation declared a static array and looked up
values in functions. This leaves the compiler to manage to data.
That can have potential advantages such as putting data in
faster constant data. But it could also cause problems if the
compiler has problems managing all the data.

The switch to ArrayHandles simplifies the implementation for
the compiler by managing these static arrays on the host and
using the existing array management to make sure everything
is correct.
2024-05-14 10:25:25 -06:00
Kenneth Moreland
5677811468 Improve constexpr behavior of Vec classes
The implementation of `Vec` made it difficult to use within a `constexpr`
function. For example, the following would not compile.

``` cpp
constexpr vtkm::UInt8 OctFlip(vtkm::UInt8 value)
{
  vtkm::Vec<vtkm::UInt8, 8> flips = { 0, 6, 2, 6, 1, 5, 3, 7 };
  return flips[value];
}
```

The problem was that `flips` could not be initialized in a `constexpr`
function because the constructer was not `constexpr`.

This change fixes this problem by _removing_ the constructor that takes a
`std::initializer_list`. The problem with `std::initializer_list` is that
it cannot be used to directly initialize an array and the loop to do the
initialization cannot be used in a `constexpr`.

With the removal of this constructor, construction with a braced list
should go to the constructor that takes a variadic number of parameters.

Note that it is possible that some initialization of `vtkm::Vec` could
break. You can no longer construct an `std::initializer_list` and pass it
to a `vtkm::Vec` constructor. This seems like a less likely case and can be
gotten around by just copying the data yourself. It is also possible that
putting a braced list in parentheses will stop working. This can be fixed
by just deleting the parentheses.
2024-05-14 06:47:03 -06:00
16 changed files with 729 additions and 503 deletions

@ -0,0 +1,30 @@
# Improve constexpr behavior of `Vec` classes
The implementation of `Vec` made it difficult to use within a `constexpr`
function. For example, the following would not compile.
``` cpp
constexpr vtkm::UInt8 OctFlip(vtkm::UInt8 value)
{
vtkm::Vec<vtkm::UInt8, 8> flips = { 0, 6, 2, 6, 1, 5, 3, 7 };
return flips[value];
}
```
The problem was that `flips` could not be initialized in a `constexpr`
function because the constructer was not `constexpr`.
This change fixes this problem by _removing_ the constructor that takes a
`std::initializer_list`. The problem with `std::initializer_list` is that
it cannot be used to directly initialize an array and the loop to do the
initialization cannot be used in a `constexpr`.
With the removal of this constructor, construction with a braced list
should go to the constructor that takes a variadic number of parameters.
Note that it is possible that some initialization of `vtkm::Vec` could
break. You can no longer construct an `std::initializer_list` and pass it
to a `vtkm::Vec` constructor. This seems like a less likely case and can be
gotten around by just copying the data yourself. It is also possible that
putting a braced list in parentheses will stop working. This can be fixed
by just deleting the parentheses.

@ -587,7 +587,6 @@ public:
const ComponentType* GetPointer() const { return &this->Component(0); } const ComponentType* GetPointer() const { return &this->Component(0); }
}; };
/// Base implementation of all Vec classes. /// Base implementation of all Vec classes.
/// ///
template <typename T, vtkm::IdComponent Size, typename DerivedClass> template <typename T, vtkm::IdComponent Size, typename DerivedClass>
@ -601,7 +600,6 @@ public:
// The enable_if predicate will disable this constructor for Size=1 so that // The enable_if predicate will disable this constructor for Size=1 so that
// the variadic constructor constexpr VecBase(T, Ts&&...) is called instead. // the variadic constructor constexpr VecBase(T, Ts&&...) is called instead.
VTKM_SUPPRESS_EXEC_WARNINGS
template <vtkm::IdComponent Size2 = Size, typename std::enable_if<Size2 != 1, int>::type = 0> template <vtkm::IdComponent Size2 = Size, typename std::enable_if<Size2 != 1, int>::type = 0>
VTKM_EXEC_CONT explicit VecBase(const ComponentType& value) VTKM_EXEC_CONT explicit VecBase(const ComponentType& value)
{ {
@ -611,37 +609,74 @@ public:
} }
} }
VTKM_SUPPRESS_EXEC_WARNINGS private:
VTKM_EXEC_CONT constexpr ComponentType&& ConvertOrForward(ComponentType&& x)
{
return std::move(x);
}
VTKM_EXEC_CONT constexpr const ComponentType& ConvertOrForward(const ComponentType& x)
{
return x;
}
template <typename OtherT>
VTKM_EXEC_CONT constexpr auto ConvertOrForward(const OtherT& x)
{
return static_cast<ComponentType>(x);
}
public:
// Note that this constructor assumes that all the arguments are of type `ComponentType`.
// If they are not, this might suppress a type-conversion warning.
// It could also raise an error if the type is incompatible with `ComponentType`.
template <typename... Ts> template <typename... Ts>
VTKM_EXEC_CONT constexpr VecBase(ComponentType value0, Ts&&... values) VTKM_EXEC_CONT constexpr VecBase(ComponentType value0, Ts&&... values)
: Components{ value0, values... } : Components{ value0, this->ConvertOrForward(std::forward<Ts>(values))... }
{ {
VTKM_STATIC_ASSERT(sizeof...(Ts) + 1 == Size); VTKM_STATIC_ASSERT(sizeof...(Ts) + 1 == Size);
} }
VTKM_SUPPRESS_EXEC_WARNINGS // Ideally, we want to initialize `Vec`s with brace initialization (e.g.,
VTKM_EXEC_CONT // `Vec<...> v = { x, y, z, ... };`) with the constructor above. This allows
VecBase(std::initializer_list<ComponentType> values) // the constructor to be `constexpr` without any iterators for setting the values.
// However, the above constructor fails for nested `Vec` types (e.g.,
// `Vec<Vec<...>, N> v = { { x, y }, { z, w }, ... };`) because the type for
// the internal brace initialization cannot be determined. In this case, we fall
// back to using `std::initializer_list`, which cannot be made constexpr.
//
// Note that we don't create a constructor with a basic
// 'std::initializer_list<ComponentType>` because that would take precidence over
// the constructor that we usually want.
template <typename SubT>
VTKM_EXEC_CONT VecBase(const std::initializer_list<std::initializer_list<SubT>>& values)
{ {
VTKM_ASSERT((values.size() == NUM_COMPONENTS) &&
"Vec object initialized wrong number of components.");
ComponentType* dest = this->Components; ComponentType* dest = this->Components;
auto src = values.begin(); for (auto&& src : values)
if (values.size() == 1)
{ {
for (vtkm::IdComponent i = 0; i < Size; ++i) VTKM_ASSERT((src.size() == ComponentType::NUM_COMPONENTS) &&
"Vec component objects initialized wrong number of components.");
vtkm::IdComponent cIndex = 0;
for (auto&& srcComponent : src)
{ {
this->Components[i] = *src; (*dest)[cIndex] = static_cast<typename ComponentType::ComponentType>(srcComponent);
++dest; ++cIndex;
} }
++dest;
} }
else }
// Make sure triply nested or more also works.
template <typename SubT>
VTKM_EXEC_CONT VecBase(
const std::initializer_list<std::initializer_list<std::initializer_list<SubT>>>& values)
{
VTKM_ASSERT((values.size() == NUM_COMPONENTS) &&
"Vec object initialized wrong number of components.");
ComponentType* dest = this->Components;
for (auto&& src : values)
{ {
VTKM_ASSERT((values.size() == NUM_COMPONENTS) && *dest = ComponentType{ src };
"Vec object initialized wrong number of components."); ++dest;
for (; src != values.end(); ++src)
{
*dest = *src;
++dest;
}
} }
} }
@ -682,7 +717,7 @@ public:
return this->Components[idx]; return this->Components[idx];
} }
inline VTKM_EXEC_CONT ComponentType& operator[](vtkm::IdComponent idx) inline VTKM_EXEC_CONT constexpr ComponentType& operator[](vtkm::IdComponent idx)
{ {
VTKM_ASSERT(idx >= 0); VTKM_ASSERT(idx >= 0);
VTKM_ASSERT(idx < NUM_COMPONENTS); VTKM_ASSERT(idx < NUM_COMPONENTS);

@ -233,33 +233,56 @@ vtkm::cont::DataSet MakeTestDataSet::Make3DUniformDataSet1()
constexpr vtkm::Id nVerts = 125; constexpr vtkm::Id nVerts = 125;
constexpr vtkm::Id nCells = 64; constexpr vtkm::Id nCells = 64;
constexpr vtkm::Float32 pointvar[nVerts] = { constexpr vtkm::Float32 pointvar[nVerts] = {
0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, // 0-4, 0, 0
0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, // 0-4, 1, 0
0.0f, 0.0f, 0.0f, 0.0f, 0.0f, // 0-4, 2, 0
0.0f, 0.0f, 0.0f, 0.0f, 0.0f, // 0-4, 3, 0
0.0f, 0.0f, 0.0f, 0.0f, 0.0f, // 0-4, 4, 0
0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 99.0f, 90.0f, 85.0f, 0.0f, 0.0f, 95.0f, 80.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, // 0-4, 0, 1
95.0f, 0.0f, 0.0f, 85.0f, 90.0f, 99.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 99.0f, 90.0f, 85.0f, 0.0f, // 0-4, 1, 1
0.0f, 95.0f, 80.0f, 95.0f, 0.0f, // 0-4, 2, 1
0.0f, 85.0f, 90.0f, 99.0f, 0.0f, // 0-4, 3, 1
0.0f, 0.0f, 0.0f, 0.0f, 0.0f, // 0-4, 4, 1
0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 75.0f, 50.0f, 65.0f, 0.0f, 0.0f, 55.0f, 15.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, // 0-4, 0, 2
45.0f, 0.0f, 0.0f, 60.0f, 40.0f, 70.0f,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0f, 3.0f, // 0-3, 0, 0
8.0f, 9.0f, 10.0f, 11.0f, 12.0f, 13.0f, 14.0f, 15.0f, 4.0f, 5.0f, 6.0f, 7.0f, // 0-3, 1, 0
8.0f, 9.0f, 10.0f, 11.0f, // 0-3, 2, 0
12.0f, 13.0f, 14.0f, 15.0f, // 0-3, 3, 0
16.0f, 17.0f, 18.0f, 19.0f, 20.0f, 21.0f, 22.0f, 23.0f, 16.0f, 17.0f, 18.0f, 19.0f, // 0-3, 0, 1
24.0f, 25.0f, 26.0f, 27.0f, 28.0f, 29.0f, 30.0f, 31.0f, 20.0f, 21.0f, 22.0f, 23.0f, // 0-3, 1, 1
24.0f, 25.0f, 26.0f, 27.0f, // 0-3, 2, 1
28.0f, 29.0f, 30.0f, 31.0f, // 0-3, 3, 1
32.0f, 33.0f, 34.0f, 35.0f, 36.0f, 37.0f, 38.0f, 39.0f, 32.0f, 33.0f, 34.0f, 35.0f, // 0-3, 0, 2
40.0f, 41.0f, 42.0f, 43.0f, 44.0f, 45.0f, 46.0f, 47.0f, 36.0f, 37.0f, 38.0f, 39.0f, // 0-3, 1, 2
40.0f, 41.0f, 42.0f, 43.0f, // 0-3, 2, 2
44.0f, 45.0f, 46.0f, 47.0f, // 0-3, 3, 2
48.0f, 49.0f, 50.0f, 51.0f, 52.0f, 53.0f, 54.0f, 55.0f, 48.0f, 49.0f, 50.0f, 51.0f, // 0-3, 0, 3
56.0f, 57.0f, 58.0f, 59.0f, 60.0f, 61.0f, 62.0f, 63.0f 52.0f, 53.0f, 54.0f, 55.0f, // 0-3, 1, 3
56.0f, 57.0f, 58.0f, 59.0f, // 0-3, 2, 3
60.0f, 61.0f, 62.0f, 63.0f // 0-3, 3, 3
}; };
dataSet.AddPointField("pointvar", pointvar, nVerts); dataSet.AddPointField("pointvar", pointvar, nVerts);

@ -28,6 +28,7 @@ set(contour_sources_device
MIRFilter.cxx MIRFilter.cxx
Slice.cxx Slice.cxx
SliceMultiple.cxx SliceMultiple.cxx
worklet/contour/FlyingEdgesTables.cxx
) )
set(contour_sources set(contour_sources

@ -127,7 +127,8 @@ vtkm::cont::CellSetSingleType<> execute(
metaDataMin, metaDataMin,
metaDataMax, metaDataMax,
metaDataNumTris, metaDataNumTris,
edgeCases); edgeCases,
data::FlyingEdgesTablesExecObject{});
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------

@ -16,6 +16,8 @@
#include <vtkm/filter/contour/worklet/contour/FlyingEdgesHelpers.h> #include <vtkm/filter/contour/worklet/contour/FlyingEdgesHelpers.h>
#include <vtkm/filter/contour/worklet/contour/FlyingEdgesTables.h> #include <vtkm/filter/contour/worklet/contour/FlyingEdgesTables.h>
#include <vtkm/worklet/WorkletMapTopology.h>
namespace vtkm namespace vtkm
{ {
namespace worklet namespace worklet
@ -38,8 +40,9 @@ struct ComputePass2 : public vtkm::worklet::WorkletVisitCellsWithPoints
FieldInPoint axis_mins, FieldInPoint axis_mins,
FieldInPoint axis_maxs, FieldInPoint axis_maxs,
FieldOutCell cell_tri_count, FieldOutCell cell_tri_count,
WholeArrayIn edgeData); WholeArrayIn edgeData,
using ExecutionSignature = void(ThreadIndices, _2, _3, _4, _5, _6, Device); ExecObject tables);
using ExecutionSignature = void(ThreadIndices, _2, _3, _4, _5, _6, _7, Device);
using InputDomain = _1; using InputDomain = _1;
template <typename ThreadIndices, template <typename ThreadIndices,
@ -53,6 +56,7 @@ struct ComputePass2 : public vtkm::worklet::WorkletVisitCellsWithPoints
const FieldInPointId& axis_maxs, const FieldInPointId& axis_maxs,
vtkm::Int32& cell_tri_count, vtkm::Int32& cell_tri_count,
const WholeEdgeField& edges, const WholeEdgeField& edges,
const data::FlyingEdgesTables& tables,
Device) const Device) const
{ {
using AxisToSum = typename select_AxisToSum<Device>::type; using AxisToSum = typename select_AxisToSum<Device>::type;
@ -95,7 +99,7 @@ struct ComputePass2 : public vtkm::worklet::WorkletVisitCellsWithPoints
for (vtkm::Id i = left; i < right; ++i) // run along the trimmed voxels for (vtkm::Id i = left; i < right; ++i) // run along the trimmed voxels
{ {
vtkm::UInt8 edgeCase = getEdgeCase(edges, startPos, (axis_inc * i)); vtkm::UInt8 edgeCase = getEdgeCase(edges, startPos, (axis_inc * i));
vtkm::UInt8 numTris = data::GetNumberOfPrimitives(edgeCase); vtkm::UInt8 numTris = tables.GetNumberOfPrimitives(edgeCase);
if (numTris > 0) if (numTris > 0)
{ {
cell_tri_count += numTris; cell_tri_count += numTris;
@ -103,7 +107,7 @@ struct ComputePass2 : public vtkm::worklet::WorkletVisitCellsWithPoints
// Count the number of y- and z-points to be generated. Pass# 1 counted // Count the number of y- and z-points to be generated. Pass# 1 counted
// the number of x-intersections along the x-edges. Now we count all // the number of x-intersections along the x-edges. Now we count all
// intersections on the y- and z-voxel axes. // intersections on the y- and z-voxel axes.
auto* edgeUses = data::GetEdgeUses(edgeCase); const vtkm::Vec<vtkm::UInt8, 12>& edgeUses = tables.GetEdgeUses(edgeCase);
onBoundary[AxisToSum::xindex] = (i >= (pdims[AxisToSum::xindex] - 2)); onBoundary[AxisToSum::xindex] = (i >= (pdims[AxisToSum::xindex] - 2));
@ -140,7 +144,7 @@ struct ComputePass2 : public vtkm::worklet::WorkletVisitCellsWithPoints
template <typename AxisToSum> template <typename AxisToSum>
VTKM_EXEC inline void CountBoundaryEdgeUses(AxisToSum, VTKM_EXEC inline void CountBoundaryEdgeUses(AxisToSum,
vtkm::Vec<bool, 3> onBoundary, vtkm::Vec<bool, 3> onBoundary,
vtkm::UInt8 const* const edgeUses, const vtkm::Vec<vtkm::UInt8, 12>& edgeUses,
vtkm::Id3& sums, vtkm::Id3& sums,
vtkm::Id3& adj_row_sum, vtkm::Id3& adj_row_sum,
vtkm::Id3& adj_col_sum) const vtkm::Id3& adj_col_sum) const

@ -13,6 +13,7 @@
#ifndef vtk_m_worklet_contour_flyingedges_pass4_h #ifndef vtk_m_worklet_contour_flyingedges_pass4_h
#define vtk_m_worklet_contour_flyingedges_pass4_h #define vtk_m_worklet_contour_flyingedges_pass4_h
#include <vtkm/filter/contour/worklet/contour/CommonState.h>
#include <vtkm/filter/contour/worklet/contour/FlyingEdgesPass4Common.h> #include <vtkm/filter/contour/worklet/contour/FlyingEdgesPass4Common.h>
#include <vtkm/filter/contour/worklet/contour/FlyingEdgesPass4X.h> #include <vtkm/filter/contour/worklet/contour/FlyingEdgesPass4X.h>
#include <vtkm/filter/contour/worklet/contour/FlyingEdgesPass4XWithNormals.h> #include <vtkm/filter/contour/worklet/contour/FlyingEdgesPass4XWithNormals.h>
@ -79,6 +80,7 @@ struct launchComputePass4
edgeCases, edgeCases,
coordinateSystem, coordinateSystem,
inputField, inputField,
data::FlyingEdgesTablesExecObject{},
triangle_topology, triangle_topology,
sharedState.InterpolationEdgeIds, sharedState.InterpolationEdgeIds,
sharedState.InterpolationWeights, sharedState.InterpolationWeights,
@ -99,6 +101,7 @@ struct launchComputePass4
edgeCases, edgeCases,
coordinateSystem, coordinateSystem,
inputField, inputField,
data::FlyingEdgesTablesExecObject{},
triangle_topology, triangle_topology,
sharedState.InterpolationEdgeIds, sharedState.InterpolationEdgeIds,
sharedState.InterpolationWeights, sharedState.InterpolationWeights,
@ -145,6 +148,7 @@ struct launchComputePass4
metaDataNumTris, metaDataNumTris,
edgeCases, edgeCases,
inputField, inputField,
data::FlyingEdgesTablesExecObject{},
triangle_topology, triangle_topology,
sharedState.InterpolationEdgeIds, sharedState.InterpolationEdgeIds,
sharedState.InterpolationWeights, sharedState.InterpolationWeights,

@ -43,7 +43,7 @@ VTKM_EXEC inline constexpr vtkm::Id increment_cellId(SumYAxis,
return cellId + ((y_point_axis_inc - 1) * numToIncrement); return cellId + ((y_point_axis_inc - 1) * numToIncrement);
} }
VTKM_EXEC inline bool case_includes_axes(vtkm::UInt8 const* const edgeUses) VTKM_EXEC inline bool case_includes_axes(const vtkm::Vec<vtkm::UInt8, 12>& edgeUses)
{ {
return (edgeUses[0] != 0 || edgeUses[4] != 0 || edgeUses[8] != 0); return (edgeUses[0] != 0 || edgeUses[4] != 0 || edgeUses[8] != 0);
} }
@ -54,11 +54,12 @@ VTKM_EXEC inline void generate_tris(vtkm::Id inputCellId,
vtkm::UInt8 numTris, vtkm::UInt8 numTris,
vtkm::Id* edgeIds, vtkm::Id* edgeIds,
vtkm::Id& triId, vtkm::Id& triId,
const data::FlyingEdgesTables& tables,
const WholeConnField& conn, const WholeConnField& conn,
const WholeCellIdField& cellIds) const WholeCellIdField& cellIds)
{ {
auto* edges = data::GetTriEdgeCases(edgeCase); const vtkm::Vec<vtkm::UInt8, 16>& edges = tables.GetTriEdgeCases(edgeCase);
vtkm::Id edgeIndex = 1; vtkm::IdComponent edgeIndex = 1;
vtkm::Id index = static_cast<vtkm::Id>(triId) * 3; vtkm::Id index = static_cast<vtkm::Id>(triId) * 3;
for (vtkm::UInt8 i = 0; i < numTris; ++i) for (vtkm::UInt8 i = 0; i < numTris; ++i)
{ {
@ -85,9 +86,10 @@ VTKM_EXEC inline void init_voxelIds(AxisToSum,
vtkm::Id writeOffset, vtkm::Id writeOffset,
vtkm::UInt8 edgeCase, vtkm::UInt8 edgeCase,
const FieldInPointId3& axis_sums, const FieldInPointId3& axis_sums,
const data::FlyingEdgesTables& tables,
vtkm::Id* edgeIds) vtkm::Id* edgeIds)
{ {
auto* edgeUses = data::GetEdgeUses(edgeCase); const vtkm::Vec<vtkm::UInt8, 12>& edgeUses = tables.GetEdgeUses(edgeCase);
edgeIds[0] = writeOffset + axis_sums[0][AxisToSum::xindex]; // x-edges edgeIds[0] = writeOffset + axis_sums[0][AxisToSum::xindex]; // x-edges
edgeIds[1] = writeOffset + axis_sums[1][AxisToSum::xindex]; edgeIds[1] = writeOffset + axis_sums[1][AxisToSum::xindex];
edgeIds[2] = writeOffset + axis_sums[3][AxisToSum::xindex]; edgeIds[2] = writeOffset + axis_sums[3][AxisToSum::xindex];
@ -104,7 +106,8 @@ VTKM_EXEC inline void init_voxelIds(AxisToSum,
// Helper function to advance the point ids along voxel rows. // Helper function to advance the point ids along voxel rows.
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
VTKM_EXEC inline void advance_voxelIds(vtkm::UInt8 const* const edgeUses, vtkm::Id* edgeIds) VTKM_EXEC inline void advance_voxelIds(const vtkm::Vec<vtkm::UInt8, 12>& edgeUses,
vtkm::Id* edgeIds)
{ {
edgeIds[0] += edgeUses[0]; // x-edges edgeIds[0] += edgeUses[0]; // x-edges
edgeIds[1] += edgeUses[1]; edgeIds[1] += edgeUses[1];

@ -57,13 +57,14 @@ struct ComputePass4X : public vtkm::worklet::WorkletVisitCellsWithPoints
WholeArrayIn edgeData, WholeArrayIn edgeData,
WholeArrayIn coords, WholeArrayIn coords,
WholeArrayIn data, WholeArrayIn data,
ExecObject tables,
WholeArrayOut connectivity, WholeArrayOut connectivity,
WholeArrayOut edgeIds, WholeArrayOut edgeIds,
WholeArrayOut weights, WholeArrayOut weights,
WholeArrayOut inputCellIds, WholeArrayOut inputCellIds,
WholeArrayOut points); WholeArrayOut points);
using ExecutionSignature = using ExecutionSignature =
void(ThreadIndices, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, WorkIndex); void(ThreadIndices, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, WorkIndex);
template <typename ThreadIndices, template <typename ThreadIndices,
typename FieldInPointId3, typename FieldInPointId3,
@ -85,6 +86,7 @@ struct ComputePass4X : public vtkm::worklet::WorkletVisitCellsWithPoints
const WholeEdgeField& edges, const WholeEdgeField& edges,
const WholeCoordsField& coords, const WholeCoordsField& coords,
const WholeDataField& field, const WholeDataField& field,
const data::FlyingEdgesTables& tables,
const WholeConnField& conn, const WholeConnField& conn,
const WholeEdgeIdField& interpolatedEdgeIds, const WholeEdgeIdField& interpolatedEdgeIds,
const WholeWeightField& weights, const WholeWeightField& weights,
@ -116,20 +118,20 @@ struct ComputePass4X : public vtkm::worklet::WorkletVisitCellsWithPoints
vtkm::Id edgeIds[12]; vtkm::Id edgeIds[12];
auto edgeCase = getEdgeCase(edges, state.startPos, (state.axis_inc * state.left)); auto edgeCase = getEdgeCase(edges, state.startPos, (state.axis_inc * state.left));
init_voxelIds(AxisToSum{}, this->PointWriteOffset, edgeCase, axis_sums, edgeIds); init_voxelIds(AxisToSum{}, this->PointWriteOffset, edgeCase, axis_sums, tables, edgeIds);
for (vtkm::Id i = state.left; i < state.right; ++i) // run along the trimmed voxels for (vtkm::Id i = state.left; i < state.right; ++i) // run along the trimmed voxels
{ {
edgeCase = getEdgeCase(edges, state.startPos, (state.axis_inc * i)); edgeCase = getEdgeCase(edges, state.startPos, (state.axis_inc * i));
vtkm::UInt8 numTris = data::GetNumberOfPrimitives(edgeCase); vtkm::UInt8 numTris = tables.GetNumberOfPrimitives(edgeCase);
if (numTris > 0) if (numTris > 0)
{ {
// Start by generating triangles for this case // Start by generating triangles for this case
generate_tris( generate_tris(
state.cellId, edgeCase, numTris, edgeIds, cell_tri_offset, conn, inputCellIds); state.cellId, edgeCase, numTris, edgeIds, cell_tri_offset, tables, conn, inputCellIds);
// Now generate edgeIds and weights along voxel axes if needed. Remember to take // Now generate edgeIds and weights along voxel axes if needed. Remember to take
// boundary into account. // boundary into account.
auto* edgeUses = data::GetEdgeUses(edgeCase); const vtkm::Vec<vtkm::UInt8, 12>& edgeUses = tables.GetEdgeUses(edgeCase);
if (!fully_interior(state.boundaryStatus) || case_includes_axes(edgeUses)) if (!fully_interior(state.boundaryStatus) || case_includes_axes(edgeUses))
{ {
this->Generate(state.boundaryStatus, this->Generate(state.boundaryStatus,
@ -143,6 +145,7 @@ struct ComputePass4X : public vtkm::worklet::WorkletVisitCellsWithPoints
increments, increments,
(state.axis_inc * i), (state.axis_inc * i),
edgeUses, edgeUses,
tables,
edgeIds); edgeIds);
} }
advance_voxelIds(edgeUses, edgeIds); advance_voxelIds(edgeUses, edgeIds);
@ -167,7 +170,8 @@ struct ComputePass4X : public vtkm::worklet::WorkletVisitCellsWithPoints
const vtkm::Id4& startPos, const vtkm::Id4& startPos,
const vtkm::Id3& incs, const vtkm::Id3& incs,
vtkm::Id offset, vtkm::Id offset,
vtkm::UInt8 const* const edgeUses, const vtkm::Vec<vtkm::UInt8, 12>& edgeUses,
const data::FlyingEdgesTables& tables,
vtkm::Id* edgeIds) const vtkm::Id* edgeIds) const
{ {
using AxisToSum = SumXAxis; using AxisToSum = SumXAxis;
@ -230,30 +234,30 @@ struct ComputePass4X : public vtkm::worklet::WorkletVisitCellsWithPoints
const bool onZ = boundaryStatus[AxisToSum::zindex] & FlyingEdges3D::MaxBoundary; const bool onZ = boundaryStatus[AxisToSum::zindex] & FlyingEdges3D::MaxBoundary;
if (onX) //+x boundary if (onX) //+x boundary
{ {
this->InterpolateEdge(ijk, pos[0], incs, 5, edgeUses, edgeIds, field, interpolatedEdgeIds, weights, coords, points); this->InterpolateEdge(ijk, pos[0], incs, 5, edgeUses, edgeIds, field, interpolatedEdgeIds, weights, coords, points, tables);
this->InterpolateEdge(ijk, pos[0], incs, 9, edgeUses, edgeIds, field, interpolatedEdgeIds, weights, coords, points); this->InterpolateEdge(ijk, pos[0], incs, 9, edgeUses, edgeIds, field, interpolatedEdgeIds, weights, coords, points, tables);
if (onY) //+x +y if (onY) //+x +y
{ {
this->InterpolateEdge(ijk, pos[0], incs, 11, edgeUses, edgeIds, field, interpolatedEdgeIds, weights, coords, points); this->InterpolateEdge(ijk, pos[0], incs, 11, edgeUses, edgeIds, field, interpolatedEdgeIds, weights, coords, points, tables);
} }
if (onZ) //+x +z if (onZ) //+x +z
{ {
this->InterpolateEdge(ijk, pos[0], incs, 7, edgeUses, edgeIds, field, interpolatedEdgeIds, weights, coords, points); this->InterpolateEdge(ijk, pos[0], incs, 7, edgeUses, edgeIds, field, interpolatedEdgeIds, weights, coords, points, tables);
} }
} }
if (onY) //+y boundary if (onY) //+y boundary
{ {
this->InterpolateEdge(ijk, pos[0], incs, 1, edgeUses, edgeIds, field, interpolatedEdgeIds, weights, coords, points); this->InterpolateEdge(ijk, pos[0], incs, 1, edgeUses, edgeIds, field, interpolatedEdgeIds, weights, coords, points, tables);
this->InterpolateEdge(ijk, pos[0], incs, 10, edgeUses, edgeIds, field, interpolatedEdgeIds, weights, coords, points); this->InterpolateEdge(ijk, pos[0], incs, 10, edgeUses, edgeIds, field, interpolatedEdgeIds, weights, coords, points, tables);
if (onZ) //+y +z boundary if (onZ) //+y +z boundary
{ {
this->InterpolateEdge(ijk, pos[0], incs, 3, edgeUses, edgeIds, field, interpolatedEdgeIds, weights, coords, points); this->InterpolateEdge(ijk, pos[0], incs, 3, edgeUses, edgeIds, field, interpolatedEdgeIds, weights, coords, points, tables);
} }
} }
if (onZ) //+z boundary if (onZ) //+z boundary
{ {
this->InterpolateEdge(ijk, pos[0], incs, 2, edgeUses, edgeIds, field, interpolatedEdgeIds, weights, coords, points); this->InterpolateEdge(ijk, pos[0], incs, 2, edgeUses, edgeIds, field, interpolatedEdgeIds, weights, coords, points, tables);
this->InterpolateEdge(ijk, pos[0], incs, 6, edgeUses, edgeIds, field, interpolatedEdgeIds, weights, coords, points); this->InterpolateEdge(ijk, pos[0], incs, 6, edgeUses, edgeIds, field, interpolatedEdgeIds, weights, coords, points, tables);
} }
// clang-format on // clang-format on
} }
@ -268,14 +272,15 @@ struct ComputePass4X : public vtkm::worklet::WorkletVisitCellsWithPoints
VTKM_EXEC inline void InterpolateEdge(const vtkm::Id3& ijk, VTKM_EXEC inline void InterpolateEdge(const vtkm::Id3& ijk,
vtkm::Id currentIdx, vtkm::Id currentIdx,
const vtkm::Id3& incs, const vtkm::Id3& incs,
vtkm::Id edgeNum, vtkm::IdComponent edgeNum,
vtkm::UInt8 const* const edgeUses, const vtkm::Vec<vtkm::UInt8, 12>& edgeUses,
vtkm::Id* edgeIds, vtkm::Id* edgeIds,
const WholeField& field, const WholeField& field,
const WholeIEdgeField& interpolatedEdgeIds, const WholeIEdgeField& interpolatedEdgeIds,
const WholeWeightField& weights, const WholeWeightField& weights,
const WholeCoordsField& coords, const WholeCoordsField& coords,
const WholePointField& points) const const WholePointField& points,
const data::FlyingEdgesTables& tables) const
{ {
using AxisToSum = SumXAxis; using AxisToSum = SumXAxis;
@ -287,10 +292,10 @@ struct ComputePass4X : public vtkm::worklet::WorkletVisitCellsWithPoints
const vtkm::Id writeIndex = edgeIds[edgeNum]; const vtkm::Id writeIndex = edgeIds[edgeNum];
// build the edge information // build the edge information
vtkm::Vec<vtkm::UInt8, 2> verts = data::GetVertMap(edgeNum); vtkm::Vec2ui_8 verts = tables.GetVertMap(edgeNum);
vtkm::Id3 offsets1 = data::GetVertOffsets(AxisToSum{}, verts[0]); vtkm::Id3 offsets1 = tables.GetVertOffsets(AxisToSum{}, verts[0]);
vtkm::Id3 offsets2 = data::GetVertOffsets(AxisToSum{}, verts[1]); vtkm::Id3 offsets2 = tables.GetVertOffsets(AxisToSum{}, verts[1]);
vtkm::Id2 iEdge(currentIdx + vtkm::Dot(offsets1, incs), currentIdx + vtkm::Dot(offsets2, incs)); vtkm::Id2 iEdge(currentIdx + vtkm::Dot(offsets1, incs), currentIdx + vtkm::Dot(offsets2, incs));

@ -56,6 +56,7 @@ struct ComputePass4XWithNormals : public vtkm::worklet::WorkletVisitCellsWithPoi
WholeArrayIn edgeData, WholeArrayIn edgeData,
WholeArrayIn coords, WholeArrayIn coords,
WholeArrayIn data, WholeArrayIn data,
ExecObject tables,
WholeArrayOut connectivity, WholeArrayOut connectivity,
WholeArrayOut edgeIds, WholeArrayOut edgeIds,
WholeArrayOut weights, WholeArrayOut weights,
@ -63,7 +64,7 @@ struct ComputePass4XWithNormals : public vtkm::worklet::WorkletVisitCellsWithPoi
WholeArrayOut points, WholeArrayOut points,
WholeArrayOut normals); WholeArrayOut normals);
using ExecutionSignature = using ExecutionSignature =
void(ThreadIndices, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, WorkIndex); void(ThreadIndices, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, WorkIndex);
template <typename ThreadIndices, template <typename ThreadIndices,
typename FieldInPointId3, typename FieldInPointId3,
@ -86,6 +87,7 @@ struct ComputePass4XWithNormals : public vtkm::worklet::WorkletVisitCellsWithPoi
const WholeEdgeField& edges, const WholeEdgeField& edges,
const WholeCoordsField& coords, const WholeCoordsField& coords,
const WholeDataField& field, const WholeDataField& field,
const data::FlyingEdgesTables& tables,
const WholeConnField& conn, const WholeConnField& conn,
const WholeEdgeIdField& interpolatedEdgeIds, const WholeEdgeIdField& interpolatedEdgeIds,
const WholeWeightField& weights, const WholeWeightField& weights,
@ -118,21 +120,21 @@ struct ComputePass4XWithNormals : public vtkm::worklet::WorkletVisitCellsWithPoi
vtkm::Id edgeIds[12]; vtkm::Id edgeIds[12];
auto edgeCase = getEdgeCase(edges, state.startPos, (state.axis_inc * state.left)); auto edgeCase = getEdgeCase(edges, state.startPos, (state.axis_inc * state.left));
init_voxelIds(AxisToSum{}, this->PointWriteOffset, edgeCase, axis_sums, edgeIds); init_voxelIds(AxisToSum{}, this->PointWriteOffset, edgeCase, axis_sums, tables, edgeIds);
for (vtkm::Id i = state.left; i < state.right; ++i) // run along the trimmed voxels for (vtkm::Id i = state.left; i < state.right; ++i) // run along the trimmed voxels
{ {
edgeCase = getEdgeCase(edges, state.startPos, (state.axis_inc * i)); edgeCase = getEdgeCase(edges, state.startPos, (state.axis_inc * i));
vtkm::UInt8 numTris = data::GetNumberOfPrimitives(edgeCase); vtkm::UInt8 numTris = tables.GetNumberOfPrimitives(edgeCase);
if (numTris > 0) if (numTris > 0)
{ {
// Start by generating triangles for this case // Start by generating triangles for this case
generate_tris( generate_tris(
state.cellId, edgeCase, numTris, edgeIds, cell_tri_offset, conn, inputCellIds); state.cellId, edgeCase, numTris, edgeIds, cell_tri_offset, tables, conn, inputCellIds);
// Now generate edgeIds and weights along voxel axes if needed. Remember to take // Now generate edgeIds and weights along voxel axes if needed. Remember to take
// boundary into account. // boundary into account.
auto* edgeUses = data::GetEdgeUses(edgeCase); const vtkm::Vec<vtkm::UInt8, 12>& edgeUses = tables.GetEdgeUses(edgeCase);
if (!fully_interior(state.boundaryStatus) || case_includes_axes(edgeUses)) if (!fully_interior(state.boundaryStatus) || case_includes_axes(edgeUses))
{ {
this->Generate(state.boundaryStatus, this->Generate(state.boundaryStatus,
@ -147,6 +149,7 @@ struct ComputePass4XWithNormals : public vtkm::worklet::WorkletVisitCellsWithPoi
increments, increments,
(state.axis_inc * i), (state.axis_inc * i),
edgeUses, edgeUses,
tables,
edgeIds); edgeIds);
} }
advance_voxelIds(edgeUses, edgeIds); advance_voxelIds(edgeUses, edgeIds);
@ -173,7 +176,8 @@ struct ComputePass4XWithNormals : public vtkm::worklet::WorkletVisitCellsWithPoi
const vtkm::Id4& startPos, const vtkm::Id4& startPos,
const vtkm::Id3& incs, const vtkm::Id3& incs,
vtkm::Id offset, vtkm::Id offset,
vtkm::UInt8 const* const edgeUses, const vtkm::Vec<vtkm::UInt8, 12>& edgeUses,
const data::FlyingEdgesTables& tables,
vtkm::Id* edgeIds) const vtkm::Id* edgeIds) const
{ {
using AxisToSum = SumXAxis; using AxisToSum = SumXAxis;
@ -257,38 +261,38 @@ struct ComputePass4XWithNormals : public vtkm::worklet::WorkletVisitCellsWithPoi
if (onX) //+x boundary if (onX) //+x boundary
{ {
this->InterpolateEdge( this->InterpolateEdge(
fullyInterior, ijk, pos[0], incs, 5, edgeUses, edgeIds, field, interpolatedEdgeIds, weights, coords, points, normals); fullyInterior, ijk, pos[0], incs, 5, edgeUses, edgeIds, field, interpolatedEdgeIds, weights, coords, points, normals, tables);
this->InterpolateEdge( this->InterpolateEdge(
fullyInterior, ijk, pos[0], incs, 9, edgeUses, edgeIds, field, interpolatedEdgeIds, weights, coords, points, normals); fullyInterior, ijk, pos[0], incs, 9, edgeUses, edgeIds, field, interpolatedEdgeIds, weights, coords, points, normals, tables);
if (onY) //+x +y if (onY) //+x +y
{ {
this->InterpolateEdge( this->InterpolateEdge(
fullyInterior, ijk, pos[0], incs, 11, edgeUses, edgeIds, field, interpolatedEdgeIds, weights, coords, points, normals); fullyInterior, ijk, pos[0], incs, 11, edgeUses, edgeIds, field, interpolatedEdgeIds, weights, coords, points, normals, tables);
} }
if (onZ) //+x +z if (onZ) //+x +z
{ {
this->InterpolateEdge( this->InterpolateEdge(
fullyInterior, ijk, pos[0], incs, 7, edgeUses, edgeIds, field, interpolatedEdgeIds, weights, coords, points, normals); fullyInterior, ijk, pos[0], incs, 7, edgeUses, edgeIds, field, interpolatedEdgeIds, weights, coords, points, normals, tables);
} }
} }
if (onY) //+y boundary if (onY) //+y boundary
{ {
this->InterpolateEdge( this->InterpolateEdge(
fullyInterior, ijk, pos[0], incs, 1, edgeUses, edgeIds, field, interpolatedEdgeIds, weights, coords, points, normals); fullyInterior, ijk, pos[0], incs, 1, edgeUses, edgeIds, field, interpolatedEdgeIds, weights, coords, points, normals, tables);
this->InterpolateEdge( this->InterpolateEdge(
fullyInterior, ijk, pos[0], incs, 10, edgeUses, edgeIds, field, interpolatedEdgeIds, weights, coords, points, normals); fullyInterior, ijk, pos[0], incs, 10, edgeUses, edgeIds, field, interpolatedEdgeIds, weights, coords, points, normals, tables);
if (onZ) //+y +z boundary if (onZ) //+y +z boundary
{ {
this->InterpolateEdge( this->InterpolateEdge(
fullyInterior, ijk, pos[0], incs, 3, edgeUses, edgeIds, field, interpolatedEdgeIds, weights, coords, points, normals); fullyInterior, ijk, pos[0], incs, 3, edgeUses, edgeIds, field, interpolatedEdgeIds, weights, coords, points, normals, tables);
} }
} }
if (onZ) //+z boundary if (onZ) //+z boundary
{ {
this->InterpolateEdge( this->InterpolateEdge(
fullyInterior, ijk, pos[0], incs, 2, edgeUses, edgeIds, field, interpolatedEdgeIds, weights, coords, points, normals); fullyInterior, ijk, pos[0], incs, 2, edgeUses, edgeIds, field, interpolatedEdgeIds, weights, coords, points, normals, tables);
this->InterpolateEdge( this->InterpolateEdge(
fullyInterior, ijk, pos[0], incs, 6, edgeUses, edgeIds, field, interpolatedEdgeIds, weights, coords, points, normals); fullyInterior, ijk, pos[0], incs, 6, edgeUses, edgeIds, field, interpolatedEdgeIds, weights, coords, points, normals, tables);
} }
// clang-format on // clang-format on
} }
@ -305,15 +309,16 @@ struct ComputePass4XWithNormals : public vtkm::worklet::WorkletVisitCellsWithPoi
const vtkm::Id3& ijk, const vtkm::Id3& ijk,
vtkm::Id currentIdx, vtkm::Id currentIdx,
const vtkm::Id3& incs, const vtkm::Id3& incs,
vtkm::Id edgeNum, vtkm::IdComponent edgeNum,
vtkm::UInt8 const* const edgeUses, const vtkm::Vec<vtkm::UInt8, 12>& edgeUses,
vtkm::Id* edgeIds, vtkm::Id* edgeIds,
const WholeField& field, const WholeField& field,
const WholeIEdgeField& interpolatedEdgeIds, const WholeIEdgeField& interpolatedEdgeIds,
const WholeWeightField& weights, const WholeWeightField& weights,
const WholeCoordsField& coords, const WholeCoordsField& coords,
const WholePointField& points, const WholePointField& points,
const WholeNormalField& normals) const const WholeNormalField& normals,
const data::FlyingEdgesTables& tables) const
{ {
using AxisToSum = SumXAxis; using AxisToSum = SumXAxis;
@ -325,10 +330,10 @@ struct ComputePass4XWithNormals : public vtkm::worklet::WorkletVisitCellsWithPoi
const vtkm::Id writeIndex = edgeIds[edgeNum]; const vtkm::Id writeIndex = edgeIds[edgeNum];
// build the edge information // build the edge information
vtkm::Vec<vtkm::UInt8, 2> verts = data::GetVertMap(edgeNum); vtkm::Vec2ui_8 verts = tables.GetVertMap(edgeNum);
vtkm::Id3 offsets1 = data::GetVertOffsets(AxisToSum{}, verts[0]); vtkm::Id3 offsets1 = tables.GetVertOffsets(AxisToSum{}, verts[0]);
vtkm::Id3 offsets2 = data::GetVertOffsets(AxisToSum{}, verts[1]); vtkm::Id3 offsets2 = tables.GetVertOffsets(AxisToSum{}, verts[1]);
vtkm::Id2 iEdge(currentIdx + vtkm::Dot(offsets1, incs), currentIdx + vtkm::Dot(offsets2, incs)); vtkm::Id2 iEdge(currentIdx + vtkm::Dot(offsets1, incs), currentIdx + vtkm::Dot(offsets2, incs));

@ -15,10 +15,12 @@
#include <vtkm/filter/contour/worklet/contour/FlyingEdgesHelpers.h> #include <vtkm/filter/contour/worklet/contour/FlyingEdgesHelpers.h>
#include <vtkm/filter/contour/worklet/contour/FlyingEdgesPass4Common.h>
#include <vtkm/filter/contour/worklet/contour/FlyingEdgesTables.h> #include <vtkm/filter/contour/worklet/contour/FlyingEdgesTables.h>
#include <vtkm/VectorAnalysis.h> #include <vtkm/VectorAnalysis.h>
#include <vtkm/filter/vector_analysis/worklet/gradient/StructuredPointGradient.h> #include <vtkm/filter/vector_analysis/worklet/gradient/StructuredPointGradient.h>
#include <vtkm/worklet/WorkletMapTopology.h>
namespace vtkm namespace vtkm
{ {
@ -58,12 +60,13 @@ struct ComputePass4Y : public vtkm::worklet::WorkletVisitCellsWithPoints
WholeArrayIn cell_tri_count, WholeArrayIn cell_tri_count,
WholeArrayIn edgeData, WholeArrayIn edgeData,
WholeArrayIn data, WholeArrayIn data,
ExecObject tables,
WholeArrayOut connectivity, WholeArrayOut connectivity,
WholeArrayOut edgeIds, WholeArrayOut edgeIds,
WholeArrayOut weights, WholeArrayOut weights,
WholeArrayOut inputCellIds); WholeArrayOut inputCellIds);
using ExecutionSignature = using ExecutionSignature =
void(ThreadIndices, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, WorkIndex); void(ThreadIndices, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, WorkIndex);
template <typename ThreadIndices, template <typename ThreadIndices,
typename FieldInPointId3, typename FieldInPointId3,
@ -82,6 +85,7 @@ struct ComputePass4Y : public vtkm::worklet::WorkletVisitCellsWithPoints
const WholeTriField& cellTriCount, const WholeTriField& cellTriCount,
const WholeEdgeField& edges, const WholeEdgeField& edges,
const WholeDataField& field, const WholeDataField& field,
const data::FlyingEdgesTables& tables,
const WholeConnField& conn, const WholeConnField& conn,
const WholeEdgeIdField& interpolatedEdgeIds, const WholeEdgeIdField& interpolatedEdgeIds,
const WholeWeightField& weights, const WholeWeightField& weights,
@ -112,20 +116,20 @@ struct ComputePass4Y : public vtkm::worklet::WorkletVisitCellsWithPoints
vtkm::Id edgeIds[12]; vtkm::Id edgeIds[12];
auto edgeCase = getEdgeCase(edges, state.startPos, (state.axis_inc * state.left)); auto edgeCase = getEdgeCase(edges, state.startPos, (state.axis_inc * state.left));
init_voxelIds(AxisToSum{}, this->PointWriteOffset, edgeCase, axis_sums, edgeIds); init_voxelIds(AxisToSum{}, this->PointWriteOffset, edgeCase, axis_sums, tables, edgeIds);
for (vtkm::Id i = state.left; i < state.right; ++i) // run along the trimmed voxels for (vtkm::Id i = state.left; i < state.right; ++i) // run along the trimmed voxels
{ {
edgeCase = getEdgeCase(edges, state.startPos, (state.axis_inc * i)); edgeCase = getEdgeCase(edges, state.startPos, (state.axis_inc * i));
vtkm::UInt8 numTris = data::GetNumberOfPrimitives(edgeCase); vtkm::UInt8 numTris = tables.GetNumberOfPrimitives(edgeCase);
if (numTris > 0) if (numTris > 0)
{ {
// Start by generating triangles for this case // Start by generating triangles for this case
generate_tris( generate_tris(
state.cellId, edgeCase, numTris, edgeIds, cell_tri_offset, conn, inputCellIds); state.cellId, edgeCase, numTris, edgeIds, cell_tri_offset, tables, conn, inputCellIds);
// Now generate edgeIds and weights along voxel axes if needed. Remember to take // Now generate edgeIds and weights along voxel axes if needed. Remember to take
// boundary into account. // boundary into account.
auto* edgeUses = data::GetEdgeUses(edgeCase); const vtkm::Vec<vtkm::UInt8, 12>& edgeUses = tables.GetEdgeUses(edgeCase);
if (!fully_interior(state.boundaryStatus) || case_includes_axes(edgeUses)) if (!fully_interior(state.boundaryStatus) || case_includes_axes(edgeUses))
{ {
this->Generate(state.boundaryStatus, this->Generate(state.boundaryStatus,
@ -136,6 +140,7 @@ struct ComputePass4Y : public vtkm::worklet::WorkletVisitCellsWithPoints
increments, increments,
(state.axis_inc * i), (state.axis_inc * i),
edgeUses, edgeUses,
tables,
edgeIds); edgeIds);
} }
advance_voxelIds(edgeUses, edgeIds); advance_voxelIds(edgeUses, edgeIds);
@ -153,7 +158,8 @@ struct ComputePass4Y : public vtkm::worklet::WorkletVisitCellsWithPoints
const vtkm::Id4& startPos, const vtkm::Id4& startPos,
const vtkm::Id3& incs, const vtkm::Id3& incs,
vtkm::Id offset, vtkm::Id offset,
vtkm::UInt8 const* const edgeUses, const vtkm::Vec<vtkm::UInt8, 12>& edgeUses,
const data::FlyingEdgesTables& tables,
vtkm::Id* edgeIds) const vtkm::Id* edgeIds) const
{ {
using AxisToSum = SumYAxis; using AxisToSum = SumYAxis;
@ -207,30 +213,30 @@ struct ComputePass4Y : public vtkm::worklet::WorkletVisitCellsWithPoints
const bool onZ = boundaryStatus[AxisToSum::zindex] & FlyingEdges3D::MaxBoundary; const bool onZ = boundaryStatus[AxisToSum::zindex] & FlyingEdges3D::MaxBoundary;
if (onX) //+x boundary if (onX) //+x boundary
{ {
this->InterpolateEdge(pos[0], incs, 5, edgeUses, edgeIds, field, interpolatedEdgeIds, weights); this->InterpolateEdge(pos[0], incs, 5, edgeUses, edgeIds, field, interpolatedEdgeIds, weights, tables);
this->InterpolateEdge(pos[0], incs, 9, edgeUses, edgeIds, field, interpolatedEdgeIds, weights); this->InterpolateEdge(pos[0], incs, 9, edgeUses, edgeIds, field, interpolatedEdgeIds, weights, tables);
if (onY) //+x +y if (onY) //+x +y
{ {
this->InterpolateEdge(pos[0], incs, 11, edgeUses, edgeIds, field, interpolatedEdgeIds, weights); this->InterpolateEdge(pos[0], incs, 11, edgeUses, edgeIds, field, interpolatedEdgeIds, weights, tables);
} }
if (onZ) //+x +z if (onZ) //+x +z
{ {
this->InterpolateEdge(pos[0], incs, 7, edgeUses, edgeIds, field, interpolatedEdgeIds, weights); this->InterpolateEdge(pos[0], incs, 7, edgeUses, edgeIds, field, interpolatedEdgeIds, weights, tables);
} }
} }
if (onY) //+y boundary if (onY) //+y boundary
{ {
this->InterpolateEdge(pos[0], incs, 1, edgeUses, edgeIds, field, interpolatedEdgeIds, weights); this->InterpolateEdge(pos[0], incs, 1, edgeUses, edgeIds, field, interpolatedEdgeIds, weights, tables);
this->InterpolateEdge(pos[0], incs, 10, edgeUses, edgeIds, field, interpolatedEdgeIds, weights); this->InterpolateEdge(pos[0], incs, 10, edgeUses, edgeIds, field, interpolatedEdgeIds, weights, tables);
if (onZ) //+y +z boundary if (onZ) //+y +z boundary
{ {
this->InterpolateEdge(pos[0], incs, 3, edgeUses, edgeIds, field, interpolatedEdgeIds, weights); this->InterpolateEdge(pos[0], incs, 3, edgeUses, edgeIds, field, interpolatedEdgeIds, weights, tables);
} }
} }
if (onZ) //+z boundary if (onZ) //+z boundary
{ {
this->InterpolateEdge(pos[0], incs, 2, edgeUses, edgeIds, field, interpolatedEdgeIds, weights); this->InterpolateEdge(pos[0], incs, 2, edgeUses, edgeIds, field, interpolatedEdgeIds, weights, tables);
this->InterpolateEdge(pos[0], incs, 6, edgeUses, edgeIds, field, interpolatedEdgeIds, weights); this->InterpolateEdge(pos[0], incs, 6, edgeUses, edgeIds, field, interpolatedEdgeIds, weights, tables);
} }
// clang-format on // clang-format on
} }
@ -240,12 +246,13 @@ struct ComputePass4Y : public vtkm::worklet::WorkletVisitCellsWithPoints
template <typename WholeField, typename WholeIEdgeField, typename WholeWeightField> template <typename WholeField, typename WholeIEdgeField, typename WholeWeightField>
VTKM_EXEC inline void InterpolateEdge(vtkm::Id currentIdx, VTKM_EXEC inline void InterpolateEdge(vtkm::Id currentIdx,
const vtkm::Id3& incs, const vtkm::Id3& incs,
vtkm::Id edgeNum, vtkm::IdComponent edgeNum,
vtkm::UInt8 const* const edgeUses, const vtkm::Vec<vtkm::UInt8, 12>& edgeUses,
vtkm::Id* edgeIds, vtkm::Id* edgeIds,
const WholeField& field, const WholeField& field,
const WholeIEdgeField& interpolatedEdgeIds, const WholeIEdgeField& interpolatedEdgeIds,
const WholeWeightField& weights) const const WholeWeightField& weights,
const data::FlyingEdgesTables& tables) const
{ {
using AxisToSum = SumYAxis; using AxisToSum = SumYAxis;
@ -257,10 +264,10 @@ struct ComputePass4Y : public vtkm::worklet::WorkletVisitCellsWithPoints
const vtkm::Id writeIndex = edgeIds[edgeNum]; const vtkm::Id writeIndex = edgeIds[edgeNum];
// build the edge information // build the edge information
vtkm::Vec<vtkm::UInt8, 2> verts = data::GetVertMap(edgeNum); vtkm::Vec2ui_8 verts = tables.GetVertMap(edgeNum);
vtkm::Id3 offsets1 = data::GetVertOffsets(AxisToSum{}, verts[0]); vtkm::Id3 offsets1 = tables.GetVertOffsets(AxisToSum{}, verts[0]);
vtkm::Id3 offsets2 = data::GetVertOffsets(AxisToSum{}, verts[1]); vtkm::Id3 offsets2 = tables.GetVertOffsets(AxisToSum{}, verts[1]);
vtkm::Id2 iEdge(currentIdx + vtkm::Dot(offsets1, incs), currentIdx + vtkm::Dot(offsets2, incs)); vtkm::Id2 iEdge(currentIdx + vtkm::Dot(offsets1, incs), currentIdx + vtkm::Dot(offsets2, incs));

@ -0,0 +1,416 @@
//============================================================================
// Copyright (c) Kitware, Inc.
// All rights reserved.
// See LICENSE.txt for details.
//
// This software is distributed WITHOUT ANY WARRANTY; without even
// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
// PURPOSE. See the above copyright notice for more information.
//============================================================================
#include <vtkm/filter/contour/worklet/contour/FlyingEdgesTables.h>
namespace vtkm
{
namespace worklet
{
namespace flying_edges
{
namespace data
{
VTKM_CONT vtkm::cont::ArrayHandleBasic<vtkm::UInt8> GetNumberOfPrimitivesTable()
{
static vtkm::UInt8 numTris[256] = {
0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 2, 1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 3,
1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 3, 2, 3, 3, 2, 3, 4, 4, 3, 3, 4, 4, 3, 4, 5, 5, 2,
1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 3, 2, 3, 3, 4, 3, 2, 4, 3, 3, 4, 4, 5, 4, 3, 5, 2,
2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 4, 3, 4, 4, 3, 4, 3, 5, 2, 4, 5, 5, 4, 5, 4, 2, 1,
1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 3, 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 4,
2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 2, 3, 4, 5, 3, 2, 3, 4, 4, 3, 4, 5, 5, 4, 4, 5, 3, 2, 5, 2, 4, 1,
2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 2, 3, 3, 2, 3, 4, 4, 5, 4, 3, 5, 4, 4, 5, 5, 2, 3, 2, 4, 1,
3, 4, 4, 5, 4, 5, 5, 2, 4, 5, 3, 4, 3, 4, 2, 1, 2, 3, 3, 2, 3, 2, 4, 1, 3, 4, 2, 1, 2, 1, 1, 0
};
return vtkm::cont::make_ArrayHandle(numTris, 256, vtkm::CopyFlag::Off);
}
VTKM_CONT vtkm::cont::ArrayHandleBasic<vtkm::Vec<vtkm::UInt8, 12>> GetEdgeUsesTable()
{
static vtkm::Vec<vtkm::UInt8, 12> edgeUses[128] = {
// This is [128][12] as idx 0 == idx 254, idx 1 == 253...
//
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0 },
{ 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0 }, { 0, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0 },
{ 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0 }, { 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0 },
{ 1, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0 }, { 0, 1, 0, 0, 0, 1, 0, 0, 1, 1, 1, 0 },
{ 0, 1, 0, 0, 0, 1, 0, 0, 0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, 0, 0, 1, 1, 1, 1, 0 }, { 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0 },
{ 1, 0, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0 }, { 0, 0, 0, 1, 1, 1, 0, 1, 0, 0, 1, 0 },
{ 0, 1, 0, 1, 1, 0, 0, 1, 1, 1, 0, 0 }, { 1, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0 },
{ 1, 1, 0, 1, 1, 1, 0, 1, 1, 0, 0, 0 }, { 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0 },
{ 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1 }, { 1, 1, 0, 1, 1, 1, 0, 1, 0, 1, 1, 1 },
{ 1, 1, 0, 1, 0, 0, 0, 1, 1, 0, 1, 1 }, { 0, 1, 0, 1, 1, 0, 0, 1, 0, 0, 1, 1 },
{ 0, 0, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1 }, { 1, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1 },
{ 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1 }, { 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1 },
};
return vtkm::cont::make_ArrayHandle(edgeUses, 128, vtkm::CopyFlag::Off);
}
VTKM_CONT vtkm::cont::ArrayHandleBasic<vtkm::Vec<vtkm::UInt8, 16>> GetTriEdgeCasesTable()
{
static vtkm::Vec<vtkm::UInt8, 16> edgeCases[256] = {
// I expect we have some form on symmetry in this table
// that we can exploit to make it smaller
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
{ 1, 0, 4, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
{ 1, 0, 9, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
{ 2, 5, 4, 8, 9, 5, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
{ 1, 4, 1, 10, 0, 0,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 3, 7 },
};
return vtkm::cont::make_ArrayHandle(vertMap, 12, vtkm::CopyFlag::Off);
}
VTKM_CONT vtkm::cont::ArrayHandleBasic<vtkm::Id3> GetVertOffsetsXAxisTable()
{
static vtkm::Id3 offsetMap[8] = {
{ 0, 0, 0 }, { 1, 0, 0 }, { 0, 1, 0 }, { 1, 1, 0 },
{ 0, 0, 1 }, { 1, 0, 1 }, { 0, 1, 1 }, { 1, 1, 1 },
};
return vtkm::cont::make_ArrayHandle(offsetMap, 8, vtkm::CopyFlag::Off);
}
VTKM_CONT vtkm::cont::ArrayHandleBasic<vtkm::Id3> GetVertOffsetsYAxisTable()
{
vtkm::Id3 offsetMap[8] = {
{ 0, 0, 0 }, { 0, 1, 0 }, { 1, 0, 0 }, { 1, 1, 0 },
{ 0, 0, 1 }, { 0, 1, 1 }, { 1, 0, 1 }, { 1, 1, 1 },
};
return vtkm::cont::make_ArrayHandle(offsetMap, 8, vtkm::CopyFlag::Off);
}
VTKM_CONT FlyingEdgesTables::FlyingEdgesTables(vtkm::cont::DeviceAdapterId device,
vtkm::cont::Token& token)
: NumberOfPrimitivesTable(GetNumberOfPrimitivesTable().PrepareForInput(device, token))
, EdgeUsesTable(GetEdgeUsesTable().PrepareForInput(device, token))
, TriEdgesCaseTable(GetTriEdgeCasesTable().PrepareForInput(device, token))
, VertMapTable(GetVertMapTable().PrepareForInput(device, token))
, VertOffsetsXAxisTable(GetVertOffsetsXAxisTable().PrepareForInput(device, token))
, VertOffsetsYAxisTable(GetVertOffsetsYAxisTable().PrepareForInput(device, token))
{
}
} // namespace data
} // namespace flying_edges
} // namespace worklet
} // namespace vtkm

@ -1,4 +1,3 @@
//============================================================================ //============================================================================
// Copyright (c) Kitware, Inc. // Copyright (c) Kitware, Inc.
// All rights reserved. // All rights reserved.
@ -14,6 +13,9 @@
#include <vtkm/filter/contour/worklet/contour/FlyingEdgesHelpers.h> #include <vtkm/filter/contour/worklet/contour/FlyingEdgesHelpers.h>
#include <vtkm/cont/ArrayHandleBasic.h>
#include <vtkm/cont/ExecutionObjectBase.h>
namespace vtkm namespace vtkm
{ {
namespace worklet namespace worklet
@ -23,388 +25,68 @@ namespace flying_edges
namespace data namespace data
{ {
VTKM_EXEC inline vtkm::UInt8 GetNumberOfPrimitives(vtkm::UInt8 edgecase) VTKM_CONT vtkm::cont::ArrayHandleBasic<vtkm::UInt8> GetNumberOfPrimitivesTable();
{
VTKM_STATIC_CONSTEXPR_ARRAY vtkm::UInt8 numTris[256] = {
0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 2, 1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 3,
1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 3, 2, 3, 3, 2, 3, 4, 4, 3, 3, 4, 4, 3, 4, 5, 5, 2,
1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 3, 2, 3, 3, 4, 3, 2, 4, 3, 3, 4, 4, 5, 4, 3, 5, 2,
2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 4, 3, 4, 4, 3, 4, 3, 5, 2, 4, 5, 5, 4, 5, 4, 2, 1,
1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 3, 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 4,
2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 2, 3, 4, 5, 3, 2, 3, 4, 4, 3, 4, 5, 5, 4, 4, 5, 3, 2, 5, 2, 4, 1,
2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 2, 3, 3, 2, 3, 4, 4, 5, 4, 3, 5, 4, 4, 5, 5, 2, 3, 2, 4, 1,
3, 4, 4, 5, 4, 5, 5, 2, 4, 5, 3, 4, 3, 4, 2, 1, 2, 3, 3, 2, 3, 2, 4, 1, 3, 4, 2, 1, 2, 1, 1, 0
};
return numTris[edgecase]; VTKM_CONT vtkm::cont::ArrayHandleBasic<vtkm::Vec<vtkm::UInt8, 12>> GetEdgeUsesTable();
}
VTKM_EXEC inline vtkm::UInt8 const* GetEdgeUses(vtkm::UInt8 edgecase) VTKM_CONT vtkm::cont::ArrayHandleBasic<vtkm::Vec<vtkm::UInt8, 16>> GetTriEdgeCasesTable();
{
VTKM_STATIC_CONSTEXPR_ARRAY vtkm::UInt8 edgeUses[128][12] = {
// This is [128][12] as idx 0 == idx 254, idx 1 == 253...
//
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0 },
{ 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0 }, { 0, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0 },
{ 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0 }, { 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0 },
{ 1, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0 }, { 0, 1, 0, 0, 0, 1, 0, 0, 1, 1, 1, 0 },
{ 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1 }, { 1, 1, 0, 0, 1, 1, 0, 0, 1, 0, 0, 1 },
{ 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1 }, { 0, 1, 0, 0, 1, 0, 0, 0, 1, 1, 0, 1 },
{ 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1 }, { 1, 0, 0, 0, 0, 1, 0, 0, 1, 0, 1, 1 },
{ 1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 1 }, { 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1 },
{ 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0 }, { 1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0 },
{ 1, 0, 1, 0, 0, 1, 1, 0, 1, 1, 0, 0 }, { 0, 0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, 1 }, { 0, 1, 0, 1, 1, 0, 0, 1, 0, 0, 1, 1 },
{ 0, 0, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1 }, { 1, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1 },
{ 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1 }, { 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1 },
};
return edgecase < 128 ? edgeUses[edgecase] : edgeUses[127 - (edgecase - 128)]; VTKM_CONT vtkm::cont::ArrayHandleBasic<vtkm::Vec2ui_8> GetVertMapTable();
}
VTKM_EXEC inline vtkm::UInt8 const* GetTriEdgeCases(vtkm::UInt8 edgecase) VTKM_CONT vtkm::cont::ArrayHandleBasic<vtkm::Id3> GetVertOffsetsXAxisTable();
{ VTKM_CONT vtkm::cont::ArrayHandleBasic<vtkm::Id3> GetVertOffsetsYAxisTable();
VTKM_STATIC_CONSTEXPR_ARRAY vtkm::UInt8 edgeCases[256][16] = {
// I expect we have some form on symmetry in this table
// that we can exploit to make it smaller
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
{ 1, 0, 4, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
{ 1, 0, 9, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
{ 2, 5, 4, 8, 9, 5, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
{ 1, 4, 1, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
{ 2, 0, 1, 10, 8, 0, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
{ 2, 5, 0, 9, 1, 10, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
{ 3, 5, 1, 10, 5, 10, 9, 9, 10, 8, 0, 0, 0, 0, 0, 0 },
{ 1, 5, 11, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
{ 2, 0, 4, 8, 5, 11,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0, 0, 0, 0, 0 },
{ 4, 1, 8, 4, 1, 11, 8, 0, 8, 5, 5, 8, 11, 0, 0, 0 },
{ 1, 5, 1, 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
{ 3, 5, 10, 1, 5, 9, 10, 9, 8, 10, 0, 0, 0, 0, 0, 0 },
{ 4, 4, 9, 0, 4, 10, 9, 5, 9, 1, 1, 9, 10, 0, 0, 0 },
{ 2, 0, 10, 1, 8, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
{ 1, 4, 10, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
{ 2, 5, 8, 4, 9, 8, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
{ 1, 0, 5, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
{ 1, 0, 8, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
};
return edgeCases[edgecase];
}
VTKM_EXEC inline vtkm::Vec<vtkm::UInt8, 2> GetVertMap(vtkm::Id index) class FlyingEdgesTables
{ {
VTKM_STATIC_CONSTEXPR_ARRAY vtkm::Vec<vtkm::UInt8, 2> vertMap[12] = { template <typename ComponentType>
{ 0, 1 }, { 2, 3 }, { 4, 5 }, { 6, 7 }, { 0, 2 }, { 1, 3 }, using PortalType = typename vtkm::cont::ArrayHandle<ComponentType>::ReadPortalType;
{ 4, 6 }, { 5, 7 }, { 0, 4 }, { 1, 5 }, { 2, 6 }, { 3, 7 }, PortalType<vtkm::UInt8> NumberOfPrimitivesTable;
}; PortalType<vtkm::Vec<vtkm::UInt8, 12>> EdgeUsesTable;
return vertMap[index]; PortalType<vtkm::Vec<vtkm::UInt8, 16>> TriEdgesCaseTable;
} PortalType<vtkm::Vec2ui_8> VertMapTable;
PortalType<vtkm::Id3> VertOffsetsXAxisTable;
PortalType<vtkm::Id3> VertOffsetsYAxisTable;
//x-axis public:
VTKM_EXEC inline vtkm::Id3 GetVertOffsets(SumXAxis, vtkm::UInt8 index) VTKM_CONT FlyingEdgesTables(vtkm::cont::DeviceAdapterId device, vtkm::cont::Token& token);
VTKM_EXEC vtkm::UInt8 GetNumberOfPrimitives(vtkm::UInt8 edgecase) const
{
return this->NumberOfPrimitivesTable.Get(edgecase);
}
VTKM_EXEC const vtkm::Vec<vtkm::UInt8, 12>& GetEdgeUses(vtkm::UInt8 edgecase) const
{
// Get the pointer to return a reference to make sure we are not copying all values.
const vtkm::UInt8 index = (edgecase < 128) ? edgecase : (255 - edgecase);
return *(this->EdgeUsesTable.GetIteratorBegin() + index);
}
VTKM_EXEC const vtkm::Vec<vtkm::UInt8, 16>& GetTriEdgeCases(vtkm::UInt8 edgecase) const
{
// Get the pointer to return a reference to make sure we are not copying all values.
return *(this->TriEdgesCaseTable.GetIteratorBegin() + edgecase);
}
VTKM_EXEC vtkm::Vec2ui_8 GetVertMap(vtkm::Id index) const
{
return this->VertMapTable.Get(index);
}
VTKM_EXEC vtkm::Id3 GetVertOffsets(SumXAxis, vtkm::UInt8 index) const
{
return this->VertOffsetsXAxisTable.Get(index);
}
VTKM_EXEC vtkm::Id3 GetVertOffsets(SumYAxis, vtkm::UInt8 index) const
{
return this->VertOffsetsXAxisTable.Get(index);
}
};
struct FlyingEdgesTablesExecObject : vtkm::cont::ExecutionObjectBase
{ {
VTKM_STATIC_CONSTEXPR_ARRAY vtkm::Id3 offsetMap[8] = { VTKM_CONT FlyingEdgesTables PrepareForExecution(vtkm::cont::DeviceAdapterId device,
{ 0, 0, 0 }, { 1, 0, 0 }, { 0, 1, 0 }, { 1, 1, 0 }, vtkm::cont::Token& token) const
{ 0, 0, 1 }, { 1, 0, 1 }, { 0, 1, 1 }, { 1, 1, 1 }, {
}; return FlyingEdgesTables{ device, token };
return offsetMap[index]; }
} };
//y-axis
VTKM_EXEC inline vtkm::Id3 GetVertOffsets(SumYAxis, vtkm::UInt8 index)
{
VTKM_STATIC_CONSTEXPR_ARRAY vtkm::Id3 offsetMap[8] = {
{ 0, 0, 0 }, { 0, 1, 0 }, { 1, 0, 0 }, { 1, 1, 0 },
{ 0, 0, 1 }, { 0, 1, 1 }, { 1, 0, 1 }, { 1, 1, 1 },
};
return offsetMap[index];
}
} // namespace data } // namespace data
} }

@ -85,17 +85,23 @@ public:
VTKM_CONT VTKM_CONT
void SetSampleRate(vtkm::Id3 sampleRate) { this->SampleRate = sampleRate; } void SetSampleRate(vtkm::Id3 sampleRate) { this->SampleRate = sampleRate; }
// Get if we should include the outer boundary on a subsample /// @brief Specifies if the outer boundary should always be included.
// (NOTE: This method is deprecated because it is not clear from either ///
// the documentation or the source code what the intention of this feature /// When a subsample rate is specified, it is possible that some of the
// is. If your are using this method somewhere and think it should remain, /// boundary samples will not be included in the sampling. If this is the
// please open a merge request to "de-deprecate" it and add a test and /// case and `IncludeBoundary` is set to true, then an extra sample is
// documentation of the expected behavior.) /// set in the output and the values on the boundary are included. For example,
VTKM_DEPRECATED(2.2) /// say the input has resolution (5, 5, 1) (and the VOI matches), and the sample
/// rate is set to (3, 3, 1). If `IncludeBoundary` is false, then the output will
/// have the 4 points that correspond to the 3D indices (0, 0, 0), (3, 0, 0),
/// (0, 3, 0), and (3, 3, 0) of the input. This misses the outer boundary at
/// index 4 in the x and y directions. If `IncludeBoundary is set to true, then
/// the output will have the 9 points that correspond to the 3D indices (0, 0, 0),
/// (3, 0, 0), (4, 0, 0), (0, 3, 0), (3, 3, 0), (4, 3, 0), (0, 4, 0), (3, 4, 0),
/// and (4, 4, 0) to capture this outer boundary.
VTKM_CONT VTKM_CONT
bool GetIncludeBoundary() const { return this->IncludeBoundary; } bool GetIncludeBoundary() const { return this->IncludeBoundary; }
// Set if we should include the outer boundary on a subsample /// @copydoc GetIncludeBoundary
VTKM_DEPRECATED(2.2)
VTKM_CONT VTKM_CONT
void SetIncludeBoundary(bool value) { this->IncludeBoundary = value; } void SetIncludeBoundary(bool value) { this->IncludeBoundary = value; }

@ -341,7 +341,7 @@ public:
static void TestUniform3D7() static void TestUniform3D7()
{ {
std::cout << "Testing extract structured uniform" << std::endl; std::cout << "Testing extract structured uniform, exclude boundary" << std::endl;
vtkm::cont::DataSet dataset = MakeTestDataSet().Make3DUniformDataSet1(); vtkm::cont::DataSet dataset = MakeTestDataSet().Make3DUniformDataSet1();
vtkm::filter::entity_extraction::ExtractStructured extract; vtkm::filter::entity_extraction::ExtractStructured extract;
@ -351,6 +351,7 @@ public:
vtkm::Id3 sample(3, 3, 2); vtkm::Id3 sample(3, 3, 2);
extract.SetVOI(range); extract.SetVOI(range);
extract.SetSampleRate(sample); extract.SetSampleRate(sample);
extract.SetIncludeBoundary(false); // default
extract.SetFieldsToPass({ "pointvar", "cellvar" }); extract.SetFieldsToPass({ "pointvar", "cellvar" });
vtkm::cont::DataSet output = extract.Execute(dataset); vtkm::cont::DataSet output = extract.Execute(dataset);
@ -371,16 +372,16 @@ public:
"Data/Geometry mismatch for ExtractStructured filter"); "Data/Geometry mismatch for ExtractStructured filter");
VTKM_TEST_ASSERT(outPointData.ReadPortal().Get(0) == 0.0f, "Wrong point field data"); VTKM_TEST_ASSERT(outPointData.ReadPortal().Get(0) == 0.0f, "Wrong point field data");
VTKM_TEST_ASSERT(outPointData.ReadPortal().Get(3) == 99.0f, "Wrong point field data");
VTKM_TEST_ASSERT(outPointData.ReadPortal().Get(4) == 0.0f, "Wrong point field data");
VTKM_TEST_ASSERT(outPointData.ReadPortal().Get(7) == 97.0f, "Wrong point field data"); VTKM_TEST_ASSERT(outPointData.ReadPortal().Get(7) == 97.0f, "Wrong point field data");
VTKM_TEST_ASSERT(outCellData.ReadPortal().Get(0) == 16.0f, "Wrong cell field data"); VTKM_TEST_ASSERT(outCellData.ReadPortal().Get(0) == 16.0f, "Wrong cell field data");
} }
VTKM_DEPRECATED_SUPPRESS_BEGIN
// This test repeates TestUniform3D7 but uses deprecated behavior.
static void TestUniform3D8() static void TestUniform3D8()
{ {
std::cout << "Testing extract structured uniform" << std::endl; std::cout << "Testing extract structured uniform, include boundary" << std::endl;
vtkm::cont::DataSet dataset = MakeTestDataSet().Make3DUniformDataSet1(); vtkm::cont::DataSet dataset = MakeTestDataSet().Make3DUniformDataSet1();
vtkm::filter::entity_extraction::ExtractStructured extract; vtkm::filter::entity_extraction::ExtractStructured extract;
@ -411,12 +412,15 @@ public:
VTKM_TEST_ASSERT(outPointData.ReadPortal().Get(0) == 0.0f, "Wrong point field data"); VTKM_TEST_ASSERT(outPointData.ReadPortal().Get(0) == 0.0f, "Wrong point field data");
VTKM_TEST_ASSERT(outPointData.ReadPortal().Get(4) == 99.0f, "Wrong point field data"); VTKM_TEST_ASSERT(outPointData.ReadPortal().Get(4) == 99.0f, "Wrong point field data");
VTKM_TEST_ASSERT(outPointData.ReadPortal().Get(5) == 0.0f, "Wrong point field data");
VTKM_TEST_ASSERT(outPointData.ReadPortal().Get(7) == 0.0f, "Wrong point field data");
VTKM_TEST_ASSERT(outPointData.ReadPortal().Get(13) == 97.0f, "Wrong point field data"); VTKM_TEST_ASSERT(outPointData.ReadPortal().Get(13) == 97.0f, "Wrong point field data");
VTKM_TEST_ASSERT(outCellData.ReadPortal().Get(0) == 16.0f, "Wrong cell field data"); VTKM_TEST_ASSERT(outCellData.ReadPortal().Get(0) == 16.0f, "Wrong cell field data");
VTKM_TEST_ASSERT(outCellData.ReadPortal().Get(1) == 19.0f, "Wrong cell field data");
VTKM_TEST_ASSERT(outCellData.ReadPortal().Get(2) == 28.0f, "Wrong cell field data");
VTKM_TEST_ASSERT(outCellData.ReadPortal().Get(3) == 31.0f, "Wrong cell field data"); VTKM_TEST_ASSERT(outCellData.ReadPortal().Get(3) == 31.0f, "Wrong cell field data");
} }
VTKM_DEPRECATED_SUPPRESS_END
static void TestRectilinear2D() static void TestRectilinear2D()
{ {

@ -700,7 +700,7 @@ void TypeTest(const vtkm::Vec<Scalar, 6>&)
VTKM_TEST_ASSERT(test_equal(braceVec, madeVec), "constexpr Vec6 failed equality test."); VTKM_TEST_ASSERT(test_equal(braceVec, madeVec), "constexpr Vec6 failed equality test.");
// Check fill constructor. // Check fill constructor.
Vector fillVec1 = { Scalar(8) }; Vector fillVec1{ Scalar(8) };
Vector fillVec2 = Vector(Scalar(8), Scalar(8), Scalar(8), Scalar(8), Scalar(8), Scalar(8)); Vector fillVec2 = Vector(Scalar(8), Scalar(8), Scalar(8), Scalar(8), Scalar(8), Scalar(8));
VTKM_TEST_ASSERT(test_equal(fillVec1, fillVec2), "fill ctor Vec6 failed equality test."); VTKM_TEST_ASSERT(test_equal(fillVec1, fillVec2), "fill ctor Vec6 failed equality test.");
} }