Merge branch 'master' of https://gitlab.kitware.com/vtk/vtk-m into particle_status_merge

This commit is contained in:
Abhishek Yenpure 2019-08-07 13:06:34 -07:00
commit aefc5faca6
178 changed files with 3719 additions and 1247 deletions

@ -115,11 +115,12 @@ if(VTKm_ENABLE_CUDA)
message(FATAL_ERROR "VTK-m CUDA support requires version 9.2+") message(FATAL_ERROR "VTK-m CUDA support requires version 9.2+")
endif() endif()
if (NOT TARGET vtkm_cuda OR NOT TARGET vtkm::cuda) if (NOT TARGET vtkm::cuda)
add_library(vtkm_cuda INTERFACE) add_library(vtkm_cuda INTERFACE)
add_library(vtkm::cuda ALIAS vtkm_cuda)
set_target_properties(vtkm_cuda PROPERTIES EXPORT_NAME vtkm::cuda) set_target_properties(vtkm_cuda PROPERTIES EXPORT_NAME vtkm::cuda)
install(TARGETS vtkm_cuda EXPORT ${VTKm_EXPORT_NAME})
install(TARGETS vtkm_cuda EXPORT ${VTKm_EXPORT_NAME})
# Reserve `INTERFACE_REQUIRES_STATIC_BUILDS` to potential work around issues # Reserve `INTERFACE_REQUIRES_STATIC_BUILDS` to potential work around issues
# where VTK-m doesn't work when building shared as virtual functions fail # where VTK-m doesn't work when building shared as virtual functions fail
# inside device code. We don't want to force BUILD_SHARED_LIBS to a specific # inside device code. We don't want to force BUILD_SHARED_LIBS to a specific
@ -248,11 +249,6 @@ if(VTKm_ENABLE_CUDA)
set_target_properties(vtkm_cuda PROPERTIES INTERFACE_CUDA_Architecture_Flags "${arch_flags}") set_target_properties(vtkm_cuda PROPERTIES INTERFACE_CUDA_Architecture_Flags "${arch_flags}")
endif() endif()
if (NOT TARGET vtkm::cuda)
add_library(vtkm::cuda ALIAS vtkm_cuda)
endif()
endif() endif()
if(NOT TARGET Threads::Threads) if(NOT TARGET Threads::Threads)

@ -62,6 +62,7 @@ VTK-m Requires:
+ Clang 3.3+ + Clang 3.3+
+ XCode 5.0+ + XCode 5.0+
+ MSVC 2015+ + MSVC 2015+
+ Intel 17.0.4+
+ [CMake](http://www.cmake.org/download/) + [CMake](http://www.cmake.org/download/)
+ CMake 3.8+ + CMake 3.8+
+ CMake 3.9+ (for OpenMP support) + CMake 3.9+ (for OpenMP support)
@ -98,7 +99,7 @@ Optional dependencies are:
VTK-m has been tested on the following configurations:c VTK-m has been tested on the following configurations:c
+ On Linux + On Linux
+ GCC 4.8.5, 5.4.0, 6.4.0, 7.3.0, Clang 5.0, 6.0, 7.0, Intel 17.0.4 + GCC 4.8.5, 5.4.0, 6.4.0, 7.3.0, Clang 5.0, 6.0, 7.0, Intel 17.0.4, Intel 19.0.0
+ CMake 3.13.3, 3.14.1 + CMake 3.13.3, 3.14.1
+ CUDA 9.2.148, 10.0.130, 10.1.105 + CUDA 9.2.148, 10.0.130, 10.1.105
+ TBB 4.4 U2, 2017 U7 + TBB 4.4 U2, 2017 U7
@ -120,20 +121,24 @@ to generate all the build rules for the project. The VTK-m source code is
available from the [VTK-m download page] or by directly cloning the [VTK-m available from the [VTK-m download page] or by directly cloning the [VTK-m
git repository]. git repository].
``` The basic procedure for building VTK-m is to unpack the source, create a
$ git clone https://gitlab.kitware.com/vtk/vtk-m.git build directory, run CMake in that build directory (pointing to the source)
and then build. Here are some example *nix commands for the process
(individual commands may vary).
```sh
$ tar xvzf ~/Downloads/vtk-m-v1.4.0.tar.gz
$ mkdir vtkm-build $ mkdir vtkm-build
$ cd vtkm-build $ cd vtkm-build
$ cmake-gui ../vtk-m $ cmake-gui ../vtk-m-v1.4.0
$ make -j<N> $ cmake --build -j . # Runs make (or other build program)
$ make test
``` ```
A more detailed description of building VTK-m is available in the [VTK-m A more detailed description of building VTK-m is available in the [VTK-m
Users Guide]. Users Guide].
## Example## ## Example ##
The VTK-m source distribution includes a number of examples. The goal of the The VTK-m source distribution includes a number of examples. The goal of the
VTK-m examples is to illustrate specific VTK-m concepts in a consistent and VTK-m examples is to illustrate specific VTK-m concepts in a consistent and

@ -17,11 +17,9 @@
#include <vtkm/cont/CellSetStructured.h> #include <vtkm/cont/CellSetStructured.h>
#include <vtkm/cont/ImplicitFunctionHandle.h> #include <vtkm/cont/ImplicitFunctionHandle.h>
#include <vtkm/cont/Initialize.h> #include <vtkm/cont/Initialize.h>
#include <vtkm/cont/Invoker.h>
#include <vtkm/cont/Timer.h> #include <vtkm/cont/Timer.h>
#include <vtkm/worklet/DispatcherMapField.h>
#include <vtkm/worklet/DispatcherMapTopology.h>
#include <vtkm/worklet/Invoker.h>
#include <vtkm/worklet/WorkletMapField.h> #include <vtkm/worklet/WorkletMapField.h>
#include <vtkm/worklet/WorkletMapTopology.h> #include <vtkm/worklet/WorkletMapTopology.h>
@ -189,7 +187,7 @@ public:
} }
}; };
class GenerateEdges : public vtkm::worklet::WorkletMapPointToCell class GenerateEdges : public vtkm::worklet::WorkletVisitCellsWithPoints
{ {
public: public:
using ControlSignature = void(CellSetIn cellset, WholeArrayOut edgeIds); using ControlSignature = void(CellSetIn cellset, WholeArrayOut edgeIds);
@ -529,7 +527,7 @@ private:
Timer timer{ DeviceAdapter() }; Timer timer{ DeviceAdapter() };
timer.Start(); timer.Start();
vtkm::worklet::Invoker invoke(DeviceAdapter{}); vtkm::cont::Invoker invoke(DeviceAdapter{});
invoke(Mag{}, this->InputHandle, tempHandle1); invoke(Mag{}, this->InputHandle, tempHandle1);
invoke(Sin{}, tempHandle1, tempHandle2); invoke(Sin{}, tempHandle1, tempHandle2);
invoke(Square{}, tempHandle2, tempHandle1); invoke(Square{}, tempHandle2, tempHandle1);
@ -567,7 +565,7 @@ private:
Timer timer{ DeviceAdapter() }; Timer timer{ DeviceAdapter() };
timer.Start(); timer.Start();
vtkm::worklet::Invoker invoke(DeviceAdapter{}); vtkm::cont::Invoker invoke(DeviceAdapter{});
invoke(Mag{}, dinput, dtemp1); invoke(Mag{}, dinput, dtemp1);
invoke(Sin{}, dtemp1, dtemp2); invoke(Sin{}, dtemp1, dtemp2);
invoke(Square{}, dtemp2, dtemp1); invoke(Square{}, dtemp2, dtemp1);
@ -595,7 +593,7 @@ private:
Timer timer{ DeviceAdapter() }; Timer timer{ DeviceAdapter() };
timer.Start(); timer.Start();
vtkm::worklet::Invoker invoke(DeviceAdapter{}); vtkm::cont::Invoker invoke(DeviceAdapter{});
invoke(Mag{}, mInput, mTemp1); invoke(Mag{}, mInput, mTemp1);
invoke(Sin{}, mTemp1, mTemp2); invoke(Sin{}, mTemp1, mTemp2);
invoke(Square{}, mTemp2, mTemp1); invoke(Square{}, mTemp2, mTemp1);
@ -632,7 +630,7 @@ private:
Timer timer{ DeviceAdapter() }; Timer timer{ DeviceAdapter() };
timer.Start(); timer.Start();
vtkm::worklet::Invoker invoke(DeviceAdapter{}); vtkm::cont::Invoker invoke(DeviceAdapter{});
invoke(Mag{}, mInput, mTemp1); invoke(Mag{}, mInput, mTemp1);
invoke(Sin{}, mTemp1, mTemp2); invoke(Sin{}, mTemp1, mTemp2);
invoke(Square{}, mTemp2, mTemp1); invoke(Square{}, mTemp2, mTemp1);

@ -655,14 +655,14 @@ class BenchmarkFilters
{ // Why does CastAndCall insist on making the cellset const? { // Why does CastAndCall insist on making the cellset const?
using CellSetT = vtkm::cont::CellSetExplicit<T1, T2, T3, T4>; using CellSetT = vtkm::cont::CellSetExplicit<T1, T2, T3, T4>;
CellSetT& mcellSet = const_cast<CellSetT&>(cellSet); CellSetT& mcellSet = const_cast<CellSetT&>(cellSet);
mcellSet.ResetConnectivity(vtkm::TopologyElementTagCell{}, mcellSet.ResetConnectivity(vtkm::TopologyElementTagPoint{},
vtkm::TopologyElementTagPoint{}); vtkm::TopologyElementTagCell{});
} }
Timer timer{ DeviceAdapter() }; Timer timer{ DeviceAdapter() };
timer.Start(); timer.Start();
cellSet.PrepareForInput( cellSet.PrepareForInput(
DeviceAdapter(), vtkm::TopologyElementTagCell{}, vtkm::TopologyElementTagPoint{}); DeviceAdapter(), vtkm::TopologyElementTagPoint{}, vtkm::TopologyElementTagCell{});
this->Time = timer.GetElapsedTime(); this->Time = timer.GetElapsedTime();
} }
}; };

@ -42,7 +42,7 @@ enum BenchmarkName
ALL = CELL_TO_POINT | POINT_TO_CELL | MC_CLASSIFY ALL = CELL_TO_POINT | POINT_TO_CELL | MC_CLASSIFY
}; };
class AveragePointToCell : public vtkm::worklet::WorkletMapPointToCell class AveragePointToCell : public vtkm::worklet::WorkletVisitCellsWithPoints
{ {
public: public:
using ControlSignature = void(FieldInPoint inPoints, CellSetIn cellset, FieldOutCell outCells); using ControlSignature = void(FieldInPoint inPoints, CellSetIn cellset, FieldOutCell outCells);
@ -64,7 +64,7 @@ public:
} }
}; };
class AverageCellToPoint : public vtkm::worklet::WorkletMapCellToPoint class AverageCellToPoint : public vtkm::worklet::WorkletVisitPointsWithCells
{ {
public: public:
using ControlSignature = void(FieldInCell inCells, CellSetIn topology, FieldOut outPoints); using ControlSignature = void(FieldInCell inCells, CellSetIn topology, FieldOut outPoints);
@ -91,7 +91,7 @@ public:
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
template <typename T> template <typename T>
class Classification : public vtkm::worklet::WorkletMapPointToCell class Classification : public vtkm::worklet::WorkletVisitCellsWithPoints
{ {
public: public:
using ControlSignature = void(FieldInPoint inNodes, CellSetIn cellset, FieldOutCell outCaseId); using ControlSignature = void(FieldInPoint inNodes, CellSetIn cellset, FieldOutCell outCaseId);

@ -0,0 +1,6 @@
# Invoker moved to vtkm::cont
Previously, `Invoker` was located in the `vtkm::worklet` namespace to convey
it was a replacement for using `vtkm::worklet::Dispatcher*`. In actuality
it should be in `vtkm::cont` as it is the proper way to launch worklets
for execution, and that shouldn't exist inside the `worklet` namespace.

@ -0,0 +1,18 @@
# `SurfaceNormals` filter can now orient normals.
The `OrientNormals` worklet has been added to the `SurfaceNormals` filter, and
is enabled by turning on the `AutoOrientNormals` option. This feature ensures
that all normals generated by the filter will point out of the dataset (or
inward if the `FlipNormals` option is true). In addition,
`SurfaceNormals` now has a `Consistency` option that forces all triangle
windings to be consistent with the cell normal direction (the cell points are
specified in counter-clockwise order around the normal).
This functionality is provided by the following new worklets:
* OrientNormals
* RunOrientCellNormals
* RunOrientPointNormals
* RunOrientPointAndCellNormals
* RunFlipNormals
* TriangleWinding

@ -0,0 +1,35 @@
# Refactor topology mappings to clarify meaning.
The `From` and `To` nomenclature for topology mapping has been confusing for
both users and developers, especially at lower levels where the intention of
mapping attributes from one element to another is easily conflated with the
concept of mapping indices (which maps in the exact opposite direction).
These identifiers have been renamed to `VisitTopology` and `IncidentTopology`
to clarify the direction of the mapping. The order in which these template
parameters are specified for `WorkletMapTopology` have also been reversed,
since eventually there may be more than one `IncidentTopology`, and having
`IncidentTopology` at the end will allow us to replace it with a variadic
template parameter pack in the future.
Other implementation details supporting these worklets, include `Fetch` tags,
`Connectivity` classes, and methods on the various `CellSet` classes (such as
`PrepareForInput` have also reversed their template arguments. These will need
to be cautiously updated.
The convenience implementations of `WorkletMapTopology` have been renamed for
clarity as follows:
```
WorkletMapPointToCell --> WorkletVisitCellsWithPoints
WorkletMapCellToPoint --> WorkletVisitPointsWithCells
```
The `ControlSignature` tags have been renamed as follows:
```
FieldInTo --> FieldInVisit
FieldInFrom --> FieldInMap
FromCount --> IncidentElementCount
FromIndices --> IncidentElementIndices
```

@ -0,0 +1,31 @@
# Provide a simplified way to state allowed value types for VTK-m filters
Previously VTK-m filters used a specialization of `vtkm::filter::FilterTraits<>` to control
the acceptable input value types. For example if the `WarpVector` filter want to only allow
`vtkm::Vec3f_32` and `vtkm::Vec3f_64` it would use:
```cpp
namespace vtkm { namespace filter {
template <>
class FilterTraits<WarpVector>
{
public:
// WarpVector can only applies to Float and Double Vec3 arrays
using InputFieldTypeList = vtkm::TypeListTagFieldVec3;
};
}}
```
This increase the complexity of writing filters. To make this easier VTK-m now looks for
a `SupportedTypes` define on the filter when a `vtkm::filter::FilterTraits` specialization
doesn't exist. This allows filters to succinctly specify supported types, such as seen below
for the `WarpVector` filter.
```cpp
class WarpVector : public vtkm::filter::FilterField<WarpVector>
{
public:
using SupportedTypes = vtkm::TypeListTagFieldVec3;
...
};
```

@ -11,7 +11,6 @@
#define vtk_m_examples_histogram_HistogramMPI_h #define vtk_m_examples_histogram_HistogramMPI_h
#include <vtkm/filter/FilterField.h> #include <vtkm/filter/FilterField.h>
#include <vtkm/filter/FilterTraits.h>
namespace example namespace example
{ {
@ -23,6 +22,11 @@ namespace example
class HistogramMPI : public vtkm::filter::FilterField<HistogramMPI> class HistogramMPI : public vtkm::filter::FilterField<HistogramMPI>
{ {
public: public:
//currently the HistogramMPI filter only works on scalar data.
//this mainly has to do with getting the ranges for each bin
//would require returning a more complex value type
using SupportedTypes = vtkm::TypeListTagScalarAll;
//Construct a HistogramMPI with a default of 10 bins //Construct a HistogramMPI with a default of 10 bins
VTKM_CONT VTKM_CONT
HistogramMPI(); HistogramMPI();
@ -82,23 +86,6 @@ private:
}; };
} // namespace example } // namespace example
namespace vtkm
{
namespace filter
{
template <>
class FilterTraits<example::HistogramMPI>
{ //currently the HistogramMPI filter only works on scalar data.
//this mainly has to do with getting the ranges for each bin
//would require returning a more complex value type
public:
using InputFieldTypeList = vtkm::TypeListTagScalarAll;
};
}
} // namespace vtkm::filter
#include "HistogramMPI.hxx" #include "HistogramMPI.hxx"
#endif // vtk_m_filter_Histogram_h #endif // vtk_m_filter_Histogram_h

@ -10,9 +10,7 @@
#ifndef vtk_m_examples_multibackend_MultiDeviceGradient_h #ifndef vtk_m_examples_multibackend_MultiDeviceGradient_h
#define vtk_m_examples_multibackend_MultiDeviceGradient_h #define vtk_m_examples_multibackend_MultiDeviceGradient_h
#include <vtkm/filter/FilterField.h> #include <vtkm/filter/FilterField.h>
#include <vtkm/filter/FilterTraits.h>
#include "TaskQueue.h" #include "TaskQueue.h"
@ -27,6 +25,9 @@ using RuntimeTaskQueue = TaskQueue<std::function<void()>>;
class MultiDeviceGradient : public vtkm::filter::FilterField<MultiDeviceGradient> class MultiDeviceGradient : public vtkm::filter::FilterField<MultiDeviceGradient>
{ {
public: public:
using SupportedTypes =
vtkm::ListTagBase<vtkm::Float32, vtkm::Float64, vtkm::Vec3f_32, vtkm::Vec3f_64>;
//Construct a MultiDeviceGradient and worker pool //Construct a MultiDeviceGradient and worker pool
VTKM_CONT VTKM_CONT
MultiDeviceGradient(); MultiDeviceGradient();
@ -54,25 +55,6 @@ private:
std::vector<std::thread> Workers; std::vector<std::thread> Workers;
}; };
namespace vtkm
{
namespace filter
{
template <>
class FilterTraits<MultiDeviceGradient>
{
public:
struct TypeListTagGradientInputs
: vtkm::ListTagBase<vtkm::Float32, vtkm::Float64, vtkm::Vec3f_32, vtkm::Vec3f_64>
{
};
using InputFieldTypeList = TypeListTagGradientInputs;
};
}
} // namespace vtkm::filter
#ifndef vtk_m_examples_multibackend_MultiDeviceGradient_cxx #ifndef vtk_m_examples_multibackend_MultiDeviceGradient_cxx
extern template vtkm::cont::MultiBlock MultiDeviceGradient::PrepareForExecution< extern template vtkm::cont::MultiBlock MultiDeviceGradient::PrepareForExecution<
vtkm::filter::PolicyDefault>(const vtkm::cont::MultiBlock&, vtkm::filter::PolicyDefault>(const vtkm::cont::MultiBlock&,

@ -11,8 +11,10 @@ cmake_minimum_required(VERSION 3.8...3.14 FATAL_ERROR)
project(PolyLineArchimedeanHelix CXX) project(PolyLineArchimedeanHelix CXX)
find_package(VTKm REQUIRED QUIET) find_package(VTKm REQUIRED QUIET)
add_executable(PolyLineArchimedeanHelix PolyLineArchimedeanHelix.cxx) if (VTKm_ENABLE_RENDERING)
if(TARGET vtkm::cuda) add_executable(PolyLineArchimedeanHelix PolyLineArchimedeanHelix.cxx)
set_source_files_properties(PolyLineArchimedeanHelix.cxx PROPERTIES LANGUAGE "CUDA") if(TARGET vtkm::cuda)
set_source_files_properties(PolyLineArchimedeanHelix.cxx PROPERTIES LANGUAGE "CUDA")
endif()
target_link_libraries(PolyLineArchimedeanHelix PRIVATE vtkm_filter vtkm_cont vtkm_rendering)
endif() endif()
target_link_libraries(PolyLineArchimedeanHelix PRIVATE vtkm_filter vtkm_cont vtkm_rendering)

@ -89,6 +89,7 @@ set(headers
FieldRangeGlobalCompute.h FieldRangeGlobalCompute.h
ImplicitFunctionHandle.h ImplicitFunctionHandle.h
Initialize.h Initialize.h
Invoker.h
Logging.h Logging.h
MultiBlock.h MultiBlock.h
PointLocator.h PointLocator.h

@ -22,9 +22,8 @@
#include <vtkm/cont/DeviceAdapterAlgorithm.h> #include <vtkm/cont/DeviceAdapterAlgorithm.h>
#include <vtkm/cont/ErrorBadDevice.h> #include <vtkm/cont/ErrorBadDevice.h>
#include <vtkm/exec/CellLocatorBoundingIntervalHierarchyExec.h> #include <vtkm/exec/CellLocatorBoundingIntervalHierarchyExec.h>
#include <vtkm/worklet/DispatcherMapField.h>
#include <vtkm/worklet/DispatcherMapTopology.h> #include <vtkm/cont/Invoker.h>
#include <vtkm/worklet/Invoker.h>
#include <vtkm/worklet/WorkletMapField.h> #include <vtkm/worklet/WorkletMapField.h>
#include <vtkm/worklet/WorkletMapTopology.h> #include <vtkm/worklet/WorkletMapTopology.h>
@ -87,7 +86,7 @@ void CalculatePlaneSplitCost(vtkm::IdComponent planeIndex,
vtkm::IdComponent index, vtkm::IdComponent index,
vtkm::IdComponent numTotalPlanes) vtkm::IdComponent numTotalPlanes)
{ {
vtkm::worklet::Invoker invoker; vtkm::cont::Invoker invoker;
// Make candidate split plane array // Make candidate split plane array
vtkm::cont::ArrayHandle<vtkm::FloatDefault> splitPlanes; vtkm::cont::ArrayHandle<vtkm::FloatDefault> splitPlanes;
@ -182,7 +181,7 @@ IdArrayHandle CalculateSplitScatterIndices(const IdArrayHandle& cellIds,
const IdArrayHandle& leqFlags, const IdArrayHandle& leqFlags,
const IdArrayHandle& segmentIds) const IdArrayHandle& segmentIds)
{ {
vtkm::worklet::Invoker invoker; vtkm::cont::Invoker invoker;
// Count total number of true flags preceding in segment // Count total number of true flags preceding in segment
IdArrayHandle trueFlagCounts; IdArrayHandle trueFlagCounts;
@ -230,7 +229,7 @@ CellLocatorBoundingIntervalHierarchy::~CellLocatorBoundingIntervalHierarchy() =
void CellLocatorBoundingIntervalHierarchy::Build() void CellLocatorBoundingIntervalHierarchy::Build()
{ {
vtkm::worklet::Invoker invoker; vtkm::cont::Invoker invoker;
vtkm::cont::DynamicCellSet cellSet = this->GetCellSet(); vtkm::cont::DynamicCellSet cellSet = this->GetCellSet();
vtkm::Id numCells = cellSet.GetNumberOfCells(); vtkm::Id numCells = cellSet.GetNumberOfCells();

@ -14,7 +14,7 @@
#include <vtkm/cont/ArrayHandleConstant.h> #include <vtkm/cont/ArrayHandleConstant.h>
#include <vtkm/cont/ArrayHandleTransform.h> #include <vtkm/cont/ArrayHandleTransform.h>
#include <vtkm/worklet/Invoker.h> #include <vtkm/cont/Invoker.h>
#include <vtkm/worklet/WorkletMapField.h> #include <vtkm/worklet/WorkletMapField.h>
#include <vtkm/worklet/WorkletMapTopology.h> #include <vtkm/worklet/WorkletMapTopology.h>
@ -135,7 +135,7 @@ private:
bool DoneFlag; bool DoneFlag;
}; };
class CountBinsL1 : public vtkm::worklet::WorkletMapPointToCell class CountBinsL1 : public vtkm::worklet::WorkletVisitCellsWithPoints
{ {
public: public:
using ControlSignature = void(CellSetIn cellset, FieldInPoint coords, FieldOutCell bincount); using ControlSignature = void(CellSetIn cellset, FieldInPoint coords, FieldOutCell bincount);
@ -158,7 +158,7 @@ private:
Grid L1Grid; Grid L1Grid;
}; };
class FindBinsL1 : public vtkm::worklet::WorkletMapPointToCell class FindBinsL1 : public vtkm::worklet::WorkletVisitCellsWithPoints
{ {
public: public:
using ControlSignature = void(CellSetIn cellset, using ControlSignature = void(CellSetIn cellset,
@ -218,7 +218,7 @@ private:
vtkm::FloatDefault Density; vtkm::FloatDefault Density;
}; };
class CountBinsL2 : public vtkm::worklet::WorkletMapPointToCell class CountBinsL2 : public vtkm::worklet::WorkletVisitCellsWithPoints
{ {
public: public:
using ControlSignature = void(CellSetIn cellset, using ControlSignature = void(CellSetIn cellset,
@ -253,7 +253,7 @@ private:
Grid L1Grid; Grid L1Grid;
}; };
class FindBinsL2 : public vtkm::worklet::WorkletMapPointToCell class FindBinsL2 : public vtkm::worklet::WorkletVisitCellsWithPoints
{ {
public: public:
using ControlSignature = void(CellSetIn cellset, using ControlSignature = void(CellSetIn cellset,
@ -346,7 +346,7 @@ namespace cont
/// ///
VTKM_CONT void CellLocatorUniformBins::Build() VTKM_CONT void CellLocatorUniformBins::Build()
{ {
vtkm::worklet::Invoker invoke; vtkm::cont::Invoker invoke;
auto cellset = this->GetCellSet(); auto cellset = this->GetCellSet();
const auto& coords = this->GetCoordinates(); const auto& coords = this->GetCoordinates();

@ -99,8 +99,8 @@ private:
using CellSetP2CExecType = using CellSetP2CExecType =
decltype(std::declval<CellSetType>().PrepareForInput(DeviceAdapter{}, decltype(std::declval<CellSetType>().PrepareForInput(DeviceAdapter{},
vtkm::TopologyElementTagPoint{}, vtkm::TopologyElementTagCell{},
vtkm::TopologyElementTagCell{})); vtkm::TopologyElementTagPoint{}));
// TODO: This function may return false positives for non 3D cells as the // TODO: This function may return false positives for non 3D cells as the
// tests are done on the projection of the point on the cell. Extra checks // tests are done on the projection of the point on the cell. Extra checks
@ -140,8 +140,8 @@ public:
, CellCount(cellCount.PrepareForInput(DeviceAdapter{})) , CellCount(cellCount.PrepareForInput(DeviceAdapter{}))
, CellIds(cellIds.PrepareForInput(DeviceAdapter{})) , CellIds(cellIds.PrepareForInput(DeviceAdapter{}))
, CellSet(cellSet.PrepareForInput(DeviceAdapter{}, , CellSet(cellSet.PrepareForInput(DeviceAdapter{},
vtkm::TopologyElementTagPoint{}, vtkm::TopologyElementTagCell{},
vtkm::TopologyElementTagCell{})) vtkm::TopologyElementTagPoint{}))
, Coords(coords.GetData().PrepareForInput(DeviceAdapter{})) , Coords(coords.GetData().PrepareForInput(DeviceAdapter{}))
{ {
} }

@ -28,7 +28,7 @@ namespace cont
namespace detail namespace detail
{ {
template <typename CellSetType, typename FromTopology, typename ToTopology> template <typename CellSetType, typename VisitTopology, typename IncidentTopology>
struct CellSetExplicitConnectivityChooser struct CellSetExplicitConnectivityChooser
{ {
using ConnectivityType = vtkm::cont::internal::ConnectivityExplicitInternals<>; using ConnectivityType = vtkm::cont::internal::ConnectivityExplicitInternals<>;
@ -63,13 +63,13 @@ class VTKM_ALWAYS_EXPORT CellSetExplicit : public CellSet
ConnectivityStorageTag, ConnectivityStorageTag,
OffsetsStorageTag>; OffsetsStorageTag>;
template <typename FromTopology, typename ToTopology> template <typename VisitTopology, typename IncidentTopology>
struct ConnectivityChooser struct ConnectivityChooser
{ {
using ConnectivityType = using ConnectivityType =
typename detail::CellSetExplicitConnectivityChooser<Thisclass, typename detail::CellSetExplicitConnectivityChooser<Thisclass,
FromTopology, VisitTopology,
ToTopology>::ConnectivityType; IncidentTopology>::ConnectivityType;
using ShapeArrayType = typename ConnectivityType::ShapeArrayType; using ShapeArrayType = typename ConnectivityType::ShapeArrayType;
using NumIndicesArrayType = typename ConnectivityType::NumIndicesArrayType; using NumIndicesArrayType = typename ConnectivityType::NumIndicesArrayType;
@ -77,25 +77,26 @@ class VTKM_ALWAYS_EXPORT CellSetExplicit : public CellSet
using IndexOffsetArrayType = typename ConnectivityType::IndexOffsetArrayType; using IndexOffsetArrayType = typename ConnectivityType::IndexOffsetArrayType;
}; };
using PointToCellInternalsType = using VisitCellsWithPointsInternalsType =
typename ConnectivityChooser<vtkm::TopologyElementTagPoint,
vtkm::TopologyElementTagCell>::ConnectivityType;
using CellToPointInternalsType =
typename ConnectivityChooser<vtkm::TopologyElementTagCell, typename ConnectivityChooser<vtkm::TopologyElementTagCell,
vtkm::TopologyElementTagPoint>::ConnectivityType; vtkm::TopologyElementTagPoint>::ConnectivityType;
using VisitPointsWithCellsInternalsType =
typename ConnectivityChooser<vtkm::TopologyElementTagPoint,
vtkm::TopologyElementTagCell>::ConnectivityType;
public: public:
using SchedulingRangeType = vtkm::Id; using SchedulingRangeType = vtkm::Id;
//point to cell is used when iterating cells and asking for point properties //point to cell is used when iterating cells and asking for point properties
using PointToCellConnectivityType = using VisitCellsWithPointsConnectivityType =
ConnectivityChooser<vtkm::TopologyElementTagPoint, vtkm::TopologyElementTagCell>; ConnectivityChooser<vtkm::TopologyElementTagCell, vtkm::TopologyElementTagPoint>;
using ShapeArrayType = typename PointToCellConnectivityType::ShapeArrayType; using ShapeArrayType = typename VisitCellsWithPointsConnectivityType::ShapeArrayType;
using NumIndicesArrayType = typename PointToCellConnectivityType::NumIndicesArrayType; using NumIndicesArrayType = typename VisitCellsWithPointsConnectivityType::NumIndicesArrayType;
using ConnectivityArrayType = typename PointToCellConnectivityType::ConnectivityArrayType; using ConnectivityArrayType =
using IndexOffsetArrayType = typename PointToCellConnectivityType::IndexOffsetArrayType; typename VisitCellsWithPointsConnectivityType::ConnectivityArrayType;
using IndexOffsetArrayType = typename VisitCellsWithPointsConnectivityType::IndexOffsetArrayType;
VTKM_CONT CellSetExplicit(const std::string& name = std::string()); VTKM_CONT CellSetExplicit(const std::string& name = std::string());
VTKM_CONT CellSetExplicit(const Thisclass& src); VTKM_CONT CellSetExplicit(const Thisclass& src);
@ -148,14 +149,14 @@ public:
const vtkm::cont::ArrayHandle<vtkm::Id, OffsetsStorageTag>& offsets = const vtkm::cont::ArrayHandle<vtkm::Id, OffsetsStorageTag>& offsets =
vtkm::cont::ArrayHandle<vtkm::Id, OffsetsStorageTag>()); vtkm::cont::ArrayHandle<vtkm::Id, OffsetsStorageTag>());
template <typename DeviceAdapter, typename FromTopology, typename ToTopology> template <typename DeviceAdapter, typename VisitTopology, typename IncidentTopology>
struct ExecutionTypes struct ExecutionTypes
{ {
VTKM_IS_DEVICE_ADAPTER_TAG(DeviceAdapter); VTKM_IS_DEVICE_ADAPTER_TAG(DeviceAdapter);
VTKM_IS_TOPOLOGY_ELEMENT_TAG(FromTopology); VTKM_IS_TOPOLOGY_ELEMENT_TAG(VisitTopology);
VTKM_IS_TOPOLOGY_ELEMENT_TAG(ToTopology); VTKM_IS_TOPOLOGY_ELEMENT_TAG(IncidentTopology);
using ConnectivityTypes = ConnectivityChooser<FromTopology, ToTopology>; using ConnectivityTypes = ConnectivityChooser<VisitTopology, IncidentTopology>;
using ShapePortalType = typename ConnectivityTypes::ShapeArrayType::template ExecutionTypes< using ShapePortalType = typename ConnectivityTypes::ShapeArrayType::template ExecutionTypes<
DeviceAdapter>::PortalConst; DeviceAdapter>::PortalConst;
@ -175,82 +176,85 @@ public:
IndexOffsetPortalType>; IndexOffsetPortalType>;
}; };
template <typename Device, typename FromTopology, typename ToTopology> template <typename Device, typename VisitTopology, typename IncidentTopology>
typename ExecutionTypes<Device, FromTopology, ToTopology>::ExecObjectType typename ExecutionTypes<Device, VisitTopology, IncidentTopology>::ExecObjectType
PrepareForInput(Device, FromTopology, ToTopology) const; PrepareForInput(Device, VisitTopology, IncidentTopology) const;
template <typename FromTopology, typename ToTopology> template <typename VisitTopology, typename IncidentTopology>
VTKM_CONT const typename ConnectivityChooser<FromTopology, ToTopology>::ShapeArrayType& VTKM_CONT const typename ConnectivityChooser<VisitTopology, IncidentTopology>::ShapeArrayType&
GetShapesArray(FromTopology, ToTopology) const; GetShapesArray(VisitTopology, IncidentTopology) const;
template <typename FromTopology, typename ToTopology> template <typename VisitTopology, typename IncidentTopology>
VTKM_CONT const typename ConnectivityChooser<FromTopology, ToTopology>::NumIndicesArrayType& VTKM_CONT const typename ConnectivityChooser<VisitTopology,
GetNumIndicesArray(FromTopology, ToTopology) const; IncidentTopology>::NumIndicesArrayType&
GetNumIndicesArray(VisitTopology, IncidentTopology) const;
template <typename FromTopology, typename ToTopology> template <typename VisitTopology, typename IncidentTopology>
VTKM_CONT const typename ConnectivityChooser<FromTopology, ToTopology>::ConnectivityArrayType& VTKM_CONT const typename ConnectivityChooser<VisitTopology,
GetConnectivityArray(FromTopology, ToTopology) const; IncidentTopology>::ConnectivityArrayType&
GetConnectivityArray(VisitTopology, IncidentTopology) const;
template <typename FromTopology, typename ToTopology> template <typename VisitTopology, typename IncidentTopology>
VTKM_CONT const typename ConnectivityChooser<FromTopology, ToTopology>::IndexOffsetArrayType& VTKM_CONT const typename ConnectivityChooser<VisitTopology,
GetIndexOffsetArray(FromTopology, ToTopology) const; IncidentTopology>::IndexOffsetArrayType&
GetIndexOffsetArray(VisitTopology, IncidentTopology) const;
// Can be used to check if e.g. CellToPoint table is built. // Can be used to check if e.g. CellToPoint table is built.
template <typename FromTopology, typename ToTopology> template <typename VisitTopology, typename IncidentTopology>
VTKM_CONT bool HasConnectivity(FromTopology from, ToTopology to) const VTKM_CONT bool HasConnectivity(VisitTopology from, IncidentTopology to) const
{ {
return this->HasConnectivityImpl(from, to); return this->HasConnectivityImpl(from, to);
} }
// Can be used to reset a connectivity table, mostly useful for benchmarking. // Can be used to reset a connectivity table, mostly useful for benchmarking.
template <typename FromTopology, typename ToTopology> template <typename VisitTopology, typename IncidentTopology>
VTKM_CONT void ResetConnectivity(FromTopology from, ToTopology to) VTKM_CONT void ResetConnectivity(VisitTopology from, IncidentTopology to)
{ {
this->ResetConnectivityImpl(from, to); this->ResetConnectivityImpl(from, to);
} }
protected: protected:
VTKM_CONT void BuildConnectivity(vtkm::cont::DeviceAdapterId,
vtkm::TopologyElementTagPoint,
vtkm::TopologyElementTagCell) const;
VTKM_CONT void BuildConnectivity(vtkm::cont::DeviceAdapterId, VTKM_CONT void BuildConnectivity(vtkm::cont::DeviceAdapterId,
vtkm::TopologyElementTagCell, vtkm::TopologyElementTagCell,
vtkm::TopologyElementTagPoint) const; vtkm::TopologyElementTagPoint) const;
VTKM_CONT bool HasConnectivityImpl(vtkm::TopologyElementTagPoint, VTKM_CONT void BuildConnectivity(vtkm::cont::DeviceAdapterId,
vtkm::TopologyElementTagCell) const vtkm::TopologyElementTagPoint,
{ vtkm::TopologyElementTagCell) const;
return this->Data->PointToCell.ElementsValid;
}
VTKM_CONT bool HasConnectivityImpl(vtkm::TopologyElementTagCell, VTKM_CONT bool HasConnectivityImpl(vtkm::TopologyElementTagCell,
vtkm::TopologyElementTagPoint) const vtkm::TopologyElementTagPoint) const
{ {
return this->Data->CellToPoint.ElementsValid; return this->Data->VisitCellsWithPoints.ElementsValid;
} }
VTKM_CONT void ResetConnectivityImpl(vtkm::TopologyElementTagPoint, vtkm::TopologyElementTagCell) VTKM_CONT bool HasConnectivityImpl(vtkm::TopologyElementTagPoint,
vtkm::TopologyElementTagCell) const
{
return this->Data->VisitPointsWithCells.ElementsValid;
}
VTKM_CONT void ResetConnectivityImpl(vtkm::TopologyElementTagCell, vtkm::TopologyElementTagPoint)
{ {
// Reset entire cell set // Reset entire cell set
this->Data->PointToCell = PointToCellInternalsType{}; this->Data->VisitCellsWithPoints = VisitCellsWithPointsInternalsType{};
this->Data->CellToPoint = CellToPointInternalsType{}; this->Data->VisitPointsWithCells = VisitPointsWithCellsInternalsType{};
this->Data->ConnectivityAdded = -1; this->Data->ConnectivityAdded = -1;
this->Data->NumberOfCellsAdded = -1; this->Data->NumberOfCellsAdded = -1;
this->Data->NumberOfPoints = 0; this->Data->NumberOfPoints = 0;
} }
VTKM_CONT void ResetConnectivityImpl(vtkm::TopologyElementTagCell, vtkm::TopologyElementTagPoint) VTKM_CONT void ResetConnectivityImpl(vtkm::TopologyElementTagPoint, vtkm::TopologyElementTagCell)
{ {
this->Data->CellToPoint = CellToPointInternalsType{}; this->Data->VisitPointsWithCells = VisitPointsWithCellsInternalsType{};
} }
// Store internals in a shared pointer so shallow copies stay consistent. // Store internals in a shared pointer so shallow copies stay consistent.
// See #2268. // See #2268.
struct Internals struct Internals
{ {
PointToCellInternalsType PointToCell; VisitCellsWithPointsInternalsType VisitCellsWithPoints;
CellToPointInternalsType CellToPoint; VisitPointsWithCellsInternalsType VisitPointsWithCells;
// These are used in the AddCell and related methods to incrementally add // These are used in the AddCell and related methods to incrementally add
// cells. They need to be protected as subclasses of CellSetExplicit // cells. They need to be protected as subclasses of CellSetExplicit
@ -271,28 +275,28 @@ protected:
std::shared_ptr<Internals> Data; std::shared_ptr<Internals> Data;
private: private:
const PointToCellInternalsType& GetConnectivity(vtkm::TopologyElementTagPoint, const VisitCellsWithPointsInternalsType& GetConnectivity(vtkm::TopologyElementTagCell,
vtkm::TopologyElementTagCell) const vtkm::TopologyElementTagPoint) const
{ {
return this->Data->PointToCell; return this->Data->VisitCellsWithPoints;
} }
const PointToCellInternalsType& GetConnectivity(vtkm::TopologyElementTagPoint, const VisitCellsWithPointsInternalsType& GetConnectivity(vtkm::TopologyElementTagCell,
vtkm::TopologyElementTagCell) vtkm::TopologyElementTagPoint)
{ {
return this->Data->PointToCell; return this->Data->VisitCellsWithPoints;
} }
const CellToPointInternalsType& GetConnectivity(vtkm::TopologyElementTagCell, const VisitPointsWithCellsInternalsType& GetConnectivity(vtkm::TopologyElementTagPoint,
vtkm::TopologyElementTagPoint) const vtkm::TopologyElementTagCell) const
{ {
return this->Data->CellToPoint; return this->Data->VisitPointsWithCells;
} }
const CellToPointInternalsType& GetConnectivity(vtkm::TopologyElementTagCell, const VisitPointsWithCellsInternalsType& GetConnectivity(vtkm::TopologyElementTagPoint,
vtkm::TopologyElementTagPoint) vtkm::TopologyElementTagCell)
{ {
return this->Data->CellToPoint; return this->Data->VisitPointsWithCells;
} }
}; };
@ -302,8 +306,8 @@ namespace detail
template <typename Storage1, typename Storage2, typename Storage3, typename Storage4> template <typename Storage1, typename Storage2, typename Storage3, typename Storage4>
struct CellSetExplicitConnectivityChooser< struct CellSetExplicitConnectivityChooser<
vtkm::cont::CellSetExplicit<Storage1, Storage2, Storage3, Storage4>, vtkm::cont::CellSetExplicit<Storage1, Storage2, Storage3, Storage4>,
vtkm::TopologyElementTagPoint, vtkm::TopologyElementTagCell,
vtkm::TopologyElementTagCell> vtkm::TopologyElementTagPoint>
{ {
using ConnectivityType = using ConnectivityType =
vtkm::cont::internal::ConnectivityExplicitInternals<Storage1, Storage2, Storage3, Storage4>; vtkm::cont::internal::ConnectivityExplicitInternals<Storage1, Storage2, Storage3, Storage4>;
@ -311,8 +315,8 @@ struct CellSetExplicitConnectivityChooser<
template <typename CellSetType> template <typename CellSetType>
struct CellSetExplicitConnectivityChooser<CellSetType, struct CellSetExplicitConnectivityChooser<CellSetType,
vtkm::TopologyElementTagCell, vtkm::TopologyElementTagPoint,
vtkm::TopologyElementTagPoint> vtkm::TopologyElementTagCell>
{ {
//only specify the shape type as it will be constant as everything //only specify the shape type as it will be constant as everything
//is a vertex. otherwise use the defaults. //is a vertex. otherwise use the defaults.
@ -376,13 +380,13 @@ public:
vtkmdiy::save(bb, cs.GetName()); vtkmdiy::save(bb, cs.GetName());
vtkmdiy::save(bb, cs.GetNumberOfPoints()); vtkmdiy::save(bb, cs.GetNumberOfPoints());
vtkmdiy::save( vtkmdiy::save(
bb, cs.GetShapesArray(vtkm::TopologyElementTagPoint{}, vtkm::TopologyElementTagCell{})); bb, cs.GetShapesArray(vtkm::TopologyElementTagCell{}, vtkm::TopologyElementTagPoint{}));
vtkmdiy::save( vtkmdiy::save(
bb, cs.GetNumIndicesArray(vtkm::TopologyElementTagPoint{}, vtkm::TopologyElementTagCell{})); bb, cs.GetNumIndicesArray(vtkm::TopologyElementTagCell{}, vtkm::TopologyElementTagPoint{}));
vtkmdiy::save( vtkmdiy::save(
bb, cs.GetConnectivityArray(vtkm::TopologyElementTagPoint{}, vtkm::TopologyElementTagCell{})); bb, cs.GetConnectivityArray(vtkm::TopologyElementTagCell{}, vtkm::TopologyElementTagPoint{}));
vtkmdiy::save( vtkmdiy::save(
bb, cs.GetIndexOffsetArray(vtkm::TopologyElementTagPoint{}, vtkm::TopologyElementTagCell{})); bb, cs.GetIndexOffsetArray(vtkm::TopologyElementTagCell{}, vtkm::TopologyElementTagPoint{}));
} }
static VTKM_CONT void load(BinaryBuffer& bb, Type& cs) static VTKM_CONT void load(BinaryBuffer& bb, Type& cs)

@ -104,10 +104,10 @@ void CellSetExplicit<ShapeStorageTag,
OffsetsStorageTag>::PrintSummary(std::ostream& out) const OffsetsStorageTag>::PrintSummary(std::ostream& out) const
{ {
out << " ExplicitCellSet: " << this->Name << std::endl; out << " ExplicitCellSet: " << this->Name << std::endl;
out << " PointToCell: " << std::endl; out << " VisitCellsWithPoints: " << std::endl;
this->Data->PointToCell.PrintSummary(out); this->Data->VisitCellsWithPoints.PrintSummary(out);
out << " CellToPoint: " << std::endl; out << " VisitPointsWithCells: " << std::endl;
this->Data->CellToPoint.PrintSummary(out); this->Data->VisitPointsWithCells.PrintSummary(out);
} }
template <typename ShapeStorageTag, template <typename ShapeStorageTag,
@ -119,8 +119,8 @@ void CellSetExplicit<ShapeStorageTag,
ConnectivityStorageTag, ConnectivityStorageTag,
OffsetStorageTag>::ReleaseResourcesExecution() OffsetStorageTag>::ReleaseResourcesExecution()
{ {
this->Data->PointToCell.ReleaseResourcesExecution(); this->Data->VisitCellsWithPoints.ReleaseResourcesExecution();
this->Data->CellToPoint.ReleaseResourcesExecution(); this->Data->VisitPointsWithCells.ReleaseResourcesExecution();
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@ -134,7 +134,7 @@ vtkm::Id CellSetExplicit<ShapeStorageTag,
ConnectivityStorageTag, ConnectivityStorageTag,
OffsetsStorageTag>::GetNumberOfCells() const OffsetsStorageTag>::GetNumberOfCells() const
{ {
return this->Data->PointToCell.GetNumberOfElements(); return this->Data->VisitCellsWithPoints.GetNumberOfElements();
} }
template <typename ShapeStorageTag, template <typename ShapeStorageTag,
@ -224,7 +224,7 @@ VTKM_CONT vtkm::IdComponent
CellSetExplicit<ShapeStorageTag, NumIndicesStorageTag, ConnectivityStorageTag, OffsetsStorageTag>:: CellSetExplicit<ShapeStorageTag, NumIndicesStorageTag, ConnectivityStorageTag, OffsetsStorageTag>::
GetNumberOfPointsInCell(vtkm::Id cellIndex) const GetNumberOfPointsInCell(vtkm::Id cellIndex) const
{ {
return this->Data->PointToCell.NumIndices.GetPortalConstControl().Get(cellIndex); return this->Data->VisitCellsWithPoints.NumIndices.GetPortalConstControl().Get(cellIndex);
} }
template <typename ShapeStorageTag, template <typename ShapeStorageTag,
@ -236,7 +236,7 @@ VTKM_CONT vtkm::UInt8 CellSetExplicit<ShapeStorageTag,
ConnectivityStorageTag, ConnectivityStorageTag,
OffsetsStorageTag>::GetCellShape(vtkm::Id cellIndex) const OffsetsStorageTag>::GetCellShape(vtkm::Id cellIndex) const
{ {
return this->Data->PointToCell.Shapes.GetPortalConstControl().Get(cellIndex); return this->Data->VisitCellsWithPoints.Shapes.GetPortalConstControl().Get(cellIndex);
} }
template <typename ShapeStorageTag, template <typename ShapeStorageTag,
@ -248,12 +248,12 @@ VTKM_CONT void
CellSetExplicit<ShapeStorageTag, NumIndicesStorageTag, ConnectivityStorageTag, OffsetsStorageTag>:: CellSetExplicit<ShapeStorageTag, NumIndicesStorageTag, ConnectivityStorageTag, OffsetsStorageTag>::
GetIndices(vtkm::Id index, vtkm::Vec<vtkm::Id, ItemTupleLength>& ids) const GetIndices(vtkm::Id index, vtkm::Vec<vtkm::Id, ItemTupleLength>& ids) const
{ {
this->Data->PointToCell.BuildIndexOffsets(vtkm::cont::DeviceAdapterTagAny{}); this->Data->VisitCellsWithPoints.BuildIndexOffsets(vtkm::cont::DeviceAdapterTagAny{});
vtkm::IdComponent numIndices = this->GetNumberOfPointsInCell(index); vtkm::IdComponent numIndices = this->GetNumberOfPointsInCell(index);
vtkm::Id start = this->Data->PointToCell.IndexOffsets.GetPortalConstControl().Get(index); vtkm::Id start = this->Data->VisitCellsWithPoints.IndexOffsets.GetPortalConstControl().Get(index);
for (vtkm::IdComponent i = 0; i < numIndices && i < ItemTupleLength; i++) for (vtkm::IdComponent i = 0; i < numIndices && i < ItemTupleLength; i++)
{ {
ids[i] = this->Data->PointToCell.Connectivity.GetPortalConstControl().Get(start + i); ids[i] = this->Data->VisitCellsWithPoints.Connectivity.GetPortalConstControl().Get(start + i);
} }
} }
@ -265,15 +265,17 @@ VTKM_CONT void
CellSetExplicit<ShapeStorageTag, NumIndicesStorageTag, ConnectivityStorageTag, OffsetsStorageTag>:: CellSetExplicit<ShapeStorageTag, NumIndicesStorageTag, ConnectivityStorageTag, OffsetsStorageTag>::
GetIndices(vtkm::Id index, vtkm::cont::ArrayHandle<vtkm::Id>& ids) const GetIndices(vtkm::Id index, vtkm::cont::ArrayHandle<vtkm::Id>& ids) const
{ {
this->Data->PointToCell.BuildIndexOffsets(vtkm::cont::DeviceAdapterTagAny{}); this->Data->VisitCellsWithPoints.BuildIndexOffsets(vtkm::cont::DeviceAdapterTagAny{});
vtkm::IdComponent numIndices = this->GetNumberOfPointsInCell(index); vtkm::IdComponent numIndices = this->GetNumberOfPointsInCell(index);
ids.Allocate(numIndices); ids.Allocate(numIndices);
vtkm::Id start = this->Data->PointToCell.IndexOffsets.GetPortalConstControl().Get(index); vtkm::Id start = this->Data->VisitCellsWithPoints.IndexOffsets.GetPortalConstControl().Get(index);
vtkm::cont::ArrayHandle<vtkm::Id>::PortalControl idPortal = ids.GetPortalControl(); vtkm::cont::ArrayHandle<vtkm::Id>::PortalControl idPortal = ids.GetPortalControl();
auto PtCellPortal = this->Data->PointToCell.Connectivity.GetPortalConstControl(); auto PtCellPortal = this->Data->VisitCellsWithPoints.Connectivity.GetPortalConstControl();
for (vtkm::IdComponent i = 0; i < numIndices && i < numIndices; i++) for (vtkm::IdComponent i = 0; i < numIndices && i < numIndices; i++)
{
idPortal.Set(i, PtCellPortal.Get(start + i)); idPortal.Set(i, PtCellPortal.Get(start + i));
}
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@ -288,10 +290,10 @@ VTKM_CONT void CellSetExplicit<ShapeStorageTag,
OffsetsStorageTag>::PrepareToAddCells(vtkm::Id numCells, OffsetsStorageTag>::PrepareToAddCells(vtkm::Id numCells,
vtkm::Id connectivityMaxLen) vtkm::Id connectivityMaxLen)
{ {
this->Data->PointToCell.Shapes.Allocate(numCells); this->Data->VisitCellsWithPoints.Shapes.Allocate(numCells);
this->Data->PointToCell.NumIndices.Allocate(numCells); this->Data->VisitCellsWithPoints.NumIndices.Allocate(numCells);
this->Data->PointToCell.Connectivity.Allocate(connectivityMaxLen); this->Data->VisitCellsWithPoints.Connectivity.Allocate(connectivityMaxLen);
this->Data->PointToCell.IndexOffsets.Allocate(numCells); this->Data->VisitCellsWithPoints.IndexOffsets.Allocate(numCells);
this->Data->NumberOfCellsAdded = 0; this->Data->NumberOfCellsAdded = 0;
this->Data->ConnectivityAdded = 0; this->Data->ConnectivityAdded = 0;
} }
@ -314,27 +316,28 @@ CellSetExplicit<ShapeStorageTag, NumIndicesStorageTag, ConnectivityStorageTag, O
throw vtkm::cont::ErrorBadValue("Not enough indices given to CellSetSingleType::AddCell."); throw vtkm::cont::ErrorBadValue("Not enough indices given to CellSetSingleType::AddCell.");
} }
if (this->Data->NumberOfCellsAdded >= this->Data->PointToCell.Shapes.GetNumberOfValues()) if (this->Data->NumberOfCellsAdded >= this->Data->VisitCellsWithPoints.Shapes.GetNumberOfValues())
{ {
throw vtkm::cont::ErrorBadValue("Added more cells then expected."); throw vtkm::cont::ErrorBadValue("Added more cells then expected.");
} }
if (this->Data->ConnectivityAdded + numVertices > if (this->Data->ConnectivityAdded + numVertices >
this->Data->PointToCell.Connectivity.GetNumberOfValues()) this->Data->VisitCellsWithPoints.Connectivity.GetNumberOfValues())
{ {
throw vtkm::cont::ErrorBadValue( throw vtkm::cont::ErrorBadValue(
"Connectivity increased passed estimated maximum connectivity."); "Connectivity increased passed estimated maximum connectivity.");
} }
this->Data->PointToCell.Shapes.GetPortalControl().Set(this->Data->NumberOfCellsAdded, cellType); this->Data->VisitCellsWithPoints.Shapes.GetPortalControl().Set(this->Data->NumberOfCellsAdded,
this->Data->PointToCell.NumIndices.GetPortalControl().Set(this->Data->NumberOfCellsAdded, cellType);
numVertices); this->Data->VisitCellsWithPoints.NumIndices.GetPortalControl().Set(this->Data->NumberOfCellsAdded,
numVertices);
for (vtkm::IdComponent iVec = 0; iVec < numVertices; ++iVec) for (vtkm::IdComponent iVec = 0; iVec < numVertices; ++iVec)
{ {
this->Data->PointToCell.Connectivity.GetPortalControl().Set( this->Data->VisitCellsWithPoints.Connectivity.GetPortalControl().Set(
this->Data->ConnectivityAdded + iVec, Traits::GetComponent(ids, iVec)); this->Data->ConnectivityAdded + iVec, Traits::GetComponent(ids, iVec));
} }
this->Data->PointToCell.IndexOffsets.GetPortalControl().Set(this->Data->NumberOfCellsAdded, this->Data->VisitCellsWithPoints.IndexOffsets.GetPortalControl().Set(
this->Data->ConnectivityAdded); this->Data->NumberOfCellsAdded, this->Data->ConnectivityAdded);
this->Data->NumberOfCellsAdded++; this->Data->NumberOfCellsAdded++;
this->Data->ConnectivityAdded += numVertices; this->Data->ConnectivityAdded += numVertices;
} }
@ -349,9 +352,9 @@ VTKM_CONT void CellSetExplicit<ShapeStorageTag,
OffsetsStorageTag>::CompleteAddingCells(vtkm::Id numPoints) OffsetsStorageTag>::CompleteAddingCells(vtkm::Id numPoints)
{ {
this->Data->NumberOfPoints = numPoints; this->Data->NumberOfPoints = numPoints;
this->Data->PointToCell.Connectivity.Shrink(this->Data->ConnectivityAdded); this->Data->VisitCellsWithPoints.Connectivity.Shrink(this->Data->ConnectivityAdded);
this->Data->PointToCell.ElementsValid = true; this->Data->VisitCellsWithPoints.ElementsValid = true;
this->Data->PointToCell.IndexOffsetsValid = true; this->Data->VisitCellsWithPoints.IndexOffsetsValid = true;
if (this->Data->NumberOfCellsAdded != this->GetNumberOfCells()) if (this->Data->NumberOfCellsAdded != this->GetNumberOfCells())
{ {
@ -377,20 +380,20 @@ CellSetExplicit<ShapeStorageTag, NumIndicesStorageTag, ConnectivityStorageTag, O
const vtkm::cont::ArrayHandle<vtkm::Id, OffsetsStorageTag>& offsets) const vtkm::cont::ArrayHandle<vtkm::Id, OffsetsStorageTag>& offsets)
{ {
this->Data->NumberOfPoints = numPoints; this->Data->NumberOfPoints = numPoints;
this->Data->PointToCell.Shapes = cellTypes; this->Data->VisitCellsWithPoints.Shapes = cellTypes;
this->Data->PointToCell.NumIndices = numIndices; this->Data->VisitCellsWithPoints.NumIndices = numIndices;
this->Data->PointToCell.Connectivity = connectivity; this->Data->VisitCellsWithPoints.Connectivity = connectivity;
this->Data->PointToCell.ElementsValid = true; this->Data->VisitCellsWithPoints.ElementsValid = true;
if (offsets.GetNumberOfValues() == cellTypes.GetNumberOfValues()) if (offsets.GetNumberOfValues() == cellTypes.GetNumberOfValues())
{ {
this->Data->PointToCell.IndexOffsets = offsets; this->Data->VisitCellsWithPoints.IndexOffsets = offsets;
this->Data->PointToCell.IndexOffsetsValid = true; this->Data->VisitCellsWithPoints.IndexOffsetsValid = true;
} }
else else
{ {
this->Data->PointToCell.IndexOffsetsValid = false; this->Data->VisitCellsWithPoints.IndexOffsetsValid = false;
if (offsets.GetNumberOfValues() != 0) if (offsets.GetNumberOfValues() != 0)
{ {
throw vtkm::cont::ErrorBadValue("Explicit cell offsets array unexpected size. " throw vtkm::cont::ErrorBadValue("Explicit cell offsets array unexpected size. "
@ -398,7 +401,7 @@ CellSetExplicit<ShapeStorageTag, NumIndicesStorageTag, ConnectivityStorageTag, O
} }
} }
this->ResetConnectivity(TopologyElementTagCell{}, TopologyElementTagPoint{}); this->ResetConnectivity(TopologyElementTagPoint{}, TopologyElementTagCell{});
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@ -407,19 +410,22 @@ template <typename ShapeStorageTag,
typename NumIndicesStorageTag, typename NumIndicesStorageTag,
typename ConnectivityStorageTag, typename ConnectivityStorageTag,
typename OffsetsStorageTag> typename OffsetsStorageTag>
template <typename Device, typename FromTopology, typename ToTopology> template <typename Device, typename VisitTopology, typename IncidentTopology>
auto CellSetExplicit<ShapeStorageTag, auto CellSetExplicit<ShapeStorageTag,
NumIndicesStorageTag, NumIndicesStorageTag,
ConnectivityStorageTag, ConnectivityStorageTag,
OffsetsStorageTag>::PrepareForInput(Device, FromTopology, ToTopology) const -> OffsetsStorageTag>::PrepareForInput(Device,
typename ExecutionTypes<Device, FromTopology, ToTopology>::ExecObjectType VisitTopology,
IncidentTopology) const ->
typename ExecutionTypes<Device, VisitTopology, IncidentTopology>::ExecObjectType
{ {
this->BuildConnectivity(Device{}, FromTopology(), ToTopology()); this->BuildConnectivity(Device{}, VisitTopology(), IncidentTopology());
const auto& connectivity = this->GetConnectivity(FromTopology(), ToTopology()); const auto& connectivity = this->GetConnectivity(VisitTopology(), IncidentTopology());
VTKM_ASSERT(connectivity.ElementsValid); VTKM_ASSERT(connectivity.ElementsValid);
using ExecObjType = typename ExecutionTypes<Device, FromTopology, ToTopology>::ExecObjectType; using ExecObjType =
typename ExecutionTypes<Device, VisitTopology, IncidentTopology>::ExecObjectType;
return ExecObjType(connectivity.Shapes.PrepareForInput(Device()), return ExecObjType(connectivity.Shapes.PrepareForInput(Device()),
connectivity.NumIndices.PrepareForInput(Device()), connectivity.NumIndices.PrepareForInput(Device()),
connectivity.Connectivity.PrepareForInput(Device()), connectivity.Connectivity.PrepareForInput(Device()),
@ -432,63 +438,64 @@ template <typename ShapeStorageTag,
typename NumIndicesStorageTag, typename NumIndicesStorageTag,
typename ConnectivityStorageTag, typename ConnectivityStorageTag,
typename OffsetsStorageTag> typename OffsetsStorageTag>
template <typename FromTopology, typename ToTopology> template <typename VisitTopology, typename IncidentTopology>
VTKM_CONT auto CellSetExplicit<ShapeStorageTag, VTKM_CONT auto CellSetExplicit<ShapeStorageTag,
NumIndicesStorageTag, NumIndicesStorageTag,
ConnectivityStorageTag, ConnectivityStorageTag,
OffsetsStorageTag>::GetShapesArray(FromTopology, ToTopology) const OffsetsStorageTag>::GetShapesArray(VisitTopology,
-> const typename ConnectivityChooser<FromTopology, ToTopology>::ShapeArrayType& IncidentTopology) const -> const
typename ConnectivityChooser<VisitTopology, IncidentTopology>::ShapeArrayType&
{ {
this->BuildConnectivity(vtkm::cont::DeviceAdapterTagAny{}, FromTopology(), ToTopology()); this->BuildConnectivity(vtkm::cont::DeviceAdapterTagAny{}, VisitTopology(), IncidentTopology());
return this->GetConnectivity(FromTopology(), ToTopology()).Shapes; return this->GetConnectivity(VisitTopology(), IncidentTopology()).Shapes;
} }
template <typename ShapeStorageTag, template <typename ShapeStorageTag,
typename NumIndicesStorageTag, typename NumIndicesStorageTag,
typename ConnectivityStorageTag, typename ConnectivityStorageTag,
typename OffsetsStorageTag> typename OffsetsStorageTag>
template <typename FromTopology, typename ToTopology> template <typename VisitTopology, typename IncidentTopology>
VTKM_CONT auto CellSetExplicit<ShapeStorageTag, VTKM_CONT auto CellSetExplicit<ShapeStorageTag,
NumIndicesStorageTag, NumIndicesStorageTag,
ConnectivityStorageTag, ConnectivityStorageTag,
OffsetsStorageTag>::GetNumIndicesArray(FromTopology, OffsetsStorageTag>::GetNumIndicesArray(VisitTopology,
ToTopology) const -> const IncidentTopology) const
typename ConnectivityChooser<FromTopology, ToTopology>::NumIndicesArrayType& -> const typename ConnectivityChooser<VisitTopology, IncidentTopology>::NumIndicesArrayType&
{ {
this->BuildConnectivity(vtkm::cont::DeviceAdapterTagAny{}, FromTopology(), ToTopology()); this->BuildConnectivity(vtkm::cont::DeviceAdapterTagAny{}, VisitTopology(), IncidentTopology());
return this->GetConnectivity(FromTopology(), ToTopology()).NumIndices; return this->GetConnectivity(VisitTopology(), IncidentTopology()).NumIndices;
} }
template <typename ShapeStorageTag, template <typename ShapeStorageTag,
typename NumIndicesStorageTag, typename NumIndicesStorageTag,
typename ConnectivityStorageTag, typename ConnectivityStorageTag,
typename OffsetsStorageTag> typename OffsetsStorageTag>
template <typename FromTopology, typename ToTopology> template <typename VisitTopology, typename IncidentTopology>
VTKM_CONT auto CellSetExplicit<ShapeStorageTag, VTKM_CONT auto CellSetExplicit<ShapeStorageTag,
NumIndicesStorageTag, NumIndicesStorageTag,
ConnectivityStorageTag, ConnectivityStorageTag,
OffsetsStorageTag>::GetConnectivityArray(FromTopology, OffsetsStorageTag>::GetConnectivityArray(VisitTopology,
ToTopology) const -> const IncidentTopology) const
typename ConnectivityChooser<FromTopology, ToTopology>::ConnectivityArrayType& -> const typename ConnectivityChooser<VisitTopology, IncidentTopology>::ConnectivityArrayType&
{ {
this->BuildConnectivity(vtkm::cont::DeviceAdapterTagAny{}, FromTopology(), ToTopology()); this->BuildConnectivity(vtkm::cont::DeviceAdapterTagAny{}, VisitTopology(), IncidentTopology());
return this->GetConnectivity(FromTopology(), ToTopology()).Connectivity; return this->GetConnectivity(VisitTopology(), IncidentTopology()).Connectivity;
} }
template <typename ShapeStorageTag, template <typename ShapeStorageTag,
typename NumIndicesStorageTag, typename NumIndicesStorageTag,
typename ConnectivityStorageTag, typename ConnectivityStorageTag,
typename OffsetsStorageTag> typename OffsetsStorageTag>
template <typename FromTopology, typename ToTopology> template <typename VisitTopology, typename IncidentTopology>
VTKM_CONT auto CellSetExplicit<ShapeStorageTag, VTKM_CONT auto CellSetExplicit<ShapeStorageTag,
NumIndicesStorageTag, NumIndicesStorageTag,
ConnectivityStorageTag, ConnectivityStorageTag,
OffsetsStorageTag>::GetIndexOffsetArray(FromTopology, OffsetsStorageTag>::GetIndexOffsetArray(VisitTopology,
ToTopology) const -> const IncidentTopology) const
typename ConnectivityChooser<FromTopology, ToTopology>::IndexOffsetArrayType& -> const typename ConnectivityChooser<VisitTopology, IncidentTopology>::IndexOffsetArrayType&
{ {
this->BuildConnectivity(vtkm::cont::DeviceAdapterTagAny{}, FromTopology(), ToTopology()); this->BuildConnectivity(vtkm::cont::DeviceAdapterTagAny{}, VisitTopology(), IncidentTopology());
return this->GetConnectivity(FromTopology(), ToTopology()).IndexOffsets; return this->GetConnectivity(VisitTopology(), IncidentTopology()).IndexOffsets;
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@ -521,13 +528,13 @@ void CellSetExplicit<ShapeStorageTag,
} }
// TODO: implement actual deep-copy of the arrays // TODO: implement actual deep-copy of the arrays
auto pt = vtkm::TopologyElementTagPoint{};
auto ct = vtkm::TopologyElementTagCell{}; auto ct = vtkm::TopologyElementTagCell{};
auto pt = vtkm::TopologyElementTagPoint{};
this->Fill(other->GetNumberOfPoints(), this->Fill(other->GetNumberOfPoints(),
other->GetShapesArray(pt, ct), other->GetShapesArray(ct, pt),
other->GetNumIndicesArray(pt, ct), other->GetNumIndicesArray(ct, pt),
other->GetConnectivityArray(pt, ct), other->GetConnectivityArray(ct, pt),
other->GetIndexOffsetArray(pt, ct)); other->GetIndexOffsetArray(ct, pt));
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@ -535,32 +542,33 @@ void CellSetExplicit<ShapeStorageTag,
namespace detail namespace detail
{ {
template <typename PointToCellConnectivity> template <typename VisitCellsWithPointsConnectivity>
struct BuildPointToCellConnectivityFunctor struct BuildVisitCellsWithPointsConnectivityFunctor
{ {
explicit BuildPointToCellConnectivityFunctor(PointToCellConnectivity& pointToCell) explicit BuildVisitCellsWithPointsConnectivityFunctor(VisitCellsWithPointsConnectivity& obj)
: PointToCell(&pointToCell) : VisitCellsWithPoints(&obj)
{ {
} }
template <typename Device> template <typename Device>
bool operator()(Device) const bool operator()(Device) const
{ {
this->PointToCell->BuildIndexOffsets(Device()); this->VisitCellsWithPoints->BuildIndexOffsets(Device());
return true; return true;
} }
PointToCellConnectivity* PointToCell; VisitCellsWithPointsConnectivity* VisitCellsWithPoints;
}; };
template <typename PointToCellConnectivity, typename CellToPointConnectivity> template <typename VisitCellsWithPointsConnectivity, typename VisitPointsWithCellsConnectivity>
struct BuildCellToPointConnectivityFunctor struct BuildVisitPointsWithCellsConnectivityFunctor
{ {
BuildCellToPointConnectivityFunctor(PointToCellConnectivity& pointToCell, BuildVisitPointsWithCellsConnectivityFunctor(
CellToPointConnectivity& cellToPoint, VisitCellsWithPointsConnectivity& visitCellsWithPoints,
vtkm::Id numberOfPoints) VisitPointsWithCellsConnectivity& visitPointsWithCells,
: PointToCell(&pointToCell) vtkm::Id numberOfPoints)
, CellToPoint(&cellToPoint) : VisitCellsWithPoints(&visitCellsWithPoints)
, VisitPointsWithCells(&visitPointsWithCells)
, NumberOfPoints(numberOfPoints) , NumberOfPoints(numberOfPoints)
{ {
} }
@ -568,15 +576,15 @@ struct BuildCellToPointConnectivityFunctor
template <typename Device> template <typename Device>
bool operator()(Device) const bool operator()(Device) const
{ {
this->PointToCell->BuildIndexOffsets(Device()); this->VisitCellsWithPoints->BuildIndexOffsets(Device());
internal::ComputeCellToPointConnectivity( internal::ComputeVisitPointsWithCellsConnectivity(
*this->CellToPoint, *this->PointToCell, this->NumberOfPoints, Device()); *this->VisitPointsWithCells, *this->VisitCellsWithPoints, this->NumberOfPoints, Device());
this->CellToPoint->BuildIndexOffsets(Device()); this->VisitPointsWithCells->BuildIndexOffsets(Device());
return true; return true;
} }
PointToCellConnectivity* PointToCell; VisitCellsWithPointsConnectivity* VisitCellsWithPoints;
CellToPointConnectivity* CellToPoint; VisitPointsWithCellsConnectivity* VisitPointsWithCells;
vtkm::Id NumberOfPoints; vtkm::Id NumberOfPoints;
}; };
@ -589,19 +597,20 @@ template <typename ShapeStorageTag,
VTKM_CONT void VTKM_CONT void
CellSetExplicit<ShapeStorageTag, NumIndicesStorageTag, ConnectivityStorageTag, OffsetsStorageTag>:: CellSetExplicit<ShapeStorageTag, NumIndicesStorageTag, ConnectivityStorageTag, OffsetsStorageTag>::
BuildConnectivity(vtkm::cont::DeviceAdapterId device, BuildConnectivity(vtkm::cont::DeviceAdapterId device,
vtkm::TopologyElementTagPoint, vtkm::TopologyElementTagCell,
vtkm::TopologyElementTagCell) const vtkm::TopologyElementTagPoint) const
{ {
using PointToCellConnectivity = using VisitCellsWithPointsConnectivity =
typename ConnectivityChooser<vtkm::TopologyElementTagPoint, typename ConnectivityChooser<vtkm::TopologyElementTagCell,
vtkm::TopologyElementTagCell>::ConnectivityType; vtkm::TopologyElementTagPoint>::ConnectivityType;
VTKM_ASSERT(this->Data->PointToCell.ElementsValid); VTKM_ASSERT(this->Data->VisitCellsWithPoints.ElementsValid);
if (!this->Data->PointToCell.IndexOffsetsValid) if (!this->Data->VisitCellsWithPoints.IndexOffsetsValid)
{ {
auto self = const_cast<Thisclass*>(this); auto self = const_cast<Thisclass*>(this);
auto functor = auto functor =
detail::BuildPointToCellConnectivityFunctor<PointToCellConnectivity>(self->Data->PointToCell); detail::BuildVisitCellsWithPointsConnectivityFunctor<VisitCellsWithPointsConnectivity>(
self->Data->VisitCellsWithPoints);
if (!vtkm::cont::TryExecuteOnDevice(device, functor)) if (!vtkm::cont::TryExecuteOnDevice(device, functor))
{ {
throw vtkm::cont::ErrorExecution("Failed to run BuildConnectivity."); throw vtkm::cont::ErrorExecution("Failed to run BuildConnectivity.");
@ -616,22 +625,26 @@ template <typename ShapeStorageTag,
VTKM_CONT void VTKM_CONT void
CellSetExplicit<ShapeStorageTag, NumIndicesStorageTag, ConnectivityStorageTag, OffsetsStorageTag>:: CellSetExplicit<ShapeStorageTag, NumIndicesStorageTag, ConnectivityStorageTag, OffsetsStorageTag>::
BuildConnectivity(vtkm::cont::DeviceAdapterId device, BuildConnectivity(vtkm::cont::DeviceAdapterId device,
vtkm::TopologyElementTagCell, vtkm::TopologyElementTagPoint,
vtkm::TopologyElementTagPoint) const vtkm::TopologyElementTagCell) const
{ {
using PointToCellConnectivity = using VisitCellsWithPointsConnectivity =
typename ConnectivityChooser<vtkm::TopologyElementTagPoint,
vtkm::TopologyElementTagCell>::ConnectivityType;
using CellToPointConnectivity =
typename ConnectivityChooser<vtkm::TopologyElementTagCell, typename ConnectivityChooser<vtkm::TopologyElementTagCell,
vtkm::TopologyElementTagPoint>::ConnectivityType; vtkm::TopologyElementTagPoint>::ConnectivityType;
using VisitPointsWithCellsConnectivity =
typename ConnectivityChooser<vtkm::TopologyElementTagPoint,
vtkm::TopologyElementTagCell>::ConnectivityType;
if (!this->Data->CellToPoint.ElementsValid || !this->Data->CellToPoint.IndexOffsetsValid) if (!this->Data->VisitPointsWithCells.ElementsValid ||
!this->Data->VisitPointsWithCells.IndexOffsetsValid)
{ {
auto self = const_cast<Thisclass*>(this); auto self = const_cast<Thisclass*>(this);
auto functor = auto functor =
detail::BuildCellToPointConnectivityFunctor<PointToCellConnectivity, CellToPointConnectivity>( detail::BuildVisitPointsWithCellsConnectivityFunctor<VisitCellsWithPointsConnectivity,
self->Data->PointToCell, self->Data->CellToPoint, this->Data->NumberOfPoints); VisitPointsWithCellsConnectivity>(
self->Data->VisitCellsWithPoints,
self->Data->VisitPointsWithCells,
this->Data->NumberOfPoints);
if (!vtkm::cont::TryExecuteOnDevice(device, functor)) if (!vtkm::cont::TryExecuteOnDevice(device, functor))
{ {
throw vtkm::cont::ErrorExecution("Failed to run BuildConnectivity."); throw vtkm::cont::ErrorExecution("Failed to run BuildConnectivity.");

@ -95,8 +95,8 @@ vtkm::IdComponent CellSetExtrude::GetNumberOfPointsInCell(vtkm::Id) const
void CellSetExtrude::GetCellPointIds(vtkm::Id id, vtkm::Id* ptids) const void CellSetExtrude::GetCellPointIds(vtkm::Id id, vtkm::Id* ptids) const
{ {
auto conn = this->PrepareForInput(vtkm::cont::DeviceAdapterTagSerial{}, auto conn = this->PrepareForInput(vtkm::cont::DeviceAdapterTagSerial{},
vtkm::TopologyElementTagPoint{}, vtkm::TopologyElementTagCell{},
vtkm::TopologyElementTagCell{}); vtkm::TopologyElementTagPoint{});
auto indices = conn.GetIndices(id); auto indices = conn.GetIndices(id);
for (int i = 0; i < 6; ++i) for (int i = 0; i < 6; ++i)
{ {

@ -16,9 +16,9 @@
#include <vtkm/cont/ArrayHandleCounting.h> #include <vtkm/cont/ArrayHandleCounting.h>
#include <vtkm/cont/ArrayHandleExtrudeCoords.h> #include <vtkm/cont/ArrayHandleExtrudeCoords.h>
#include <vtkm/cont/CellSet.h> #include <vtkm/cont/CellSet.h>
#include <vtkm/cont/Invoker.h>
#include <vtkm/exec/ConnectivityExtrude.h> #include <vtkm/exec/ConnectivityExtrude.h>
#include <vtkm/exec/arg/ThreadIndicesExtrude.h> #include <vtkm/exec/arg/ThreadIndicesExtrude.h>
#include <vtkm/worklet/Invoker.h>
#include <vtkm/worklet/WorkletMapField.h> #include <vtkm/worklet/WorkletMapField.h>
namespace vtkm namespace vtkm
@ -68,30 +68,30 @@ public:
template <typename DeviceAdapter> template <typename DeviceAdapter>
using ConnectivityC2P = vtkm::exec::ReverseConnectivityExtrude<DeviceAdapter>; using ConnectivityC2P = vtkm::exec::ReverseConnectivityExtrude<DeviceAdapter>;
template <typename DeviceAdapter, typename FromTopology, typename ToTopology> template <typename DeviceAdapter, typename VisitTopology, typename IncidentTopology>
struct ExecutionTypes; struct ExecutionTypes;
template <typename DeviceAdapter> template <typename DeviceAdapter>
struct ExecutionTypes<DeviceAdapter, vtkm::TopologyElementTagPoint, vtkm::TopologyElementTagCell> struct ExecutionTypes<DeviceAdapter, vtkm::TopologyElementTagCell, vtkm::TopologyElementTagPoint>
{ {
using ExecObjectType = ConnectivityP2C<DeviceAdapter>; using ExecObjectType = ConnectivityP2C<DeviceAdapter>;
}; };
template <typename DeviceAdapter> template <typename DeviceAdapter>
struct ExecutionTypes<DeviceAdapter, vtkm::TopologyElementTagCell, vtkm::TopologyElementTagPoint> struct ExecutionTypes<DeviceAdapter, vtkm::TopologyElementTagPoint, vtkm::TopologyElementTagCell>
{ {
using ExecObjectType = ConnectivityC2P<DeviceAdapter>; using ExecObjectType = ConnectivityC2P<DeviceAdapter>;
}; };
template <typename Device> template <typename Device>
ConnectivityP2C<Device> PrepareForInput(Device, ConnectivityP2C<Device> PrepareForInput(Device,
vtkm::TopologyElementTagPoint, vtkm::TopologyElementTagCell,
vtkm::TopologyElementTagCell) const; vtkm::TopologyElementTagPoint) const;
template <typename Device> template <typename Device>
ConnectivityC2P<Device> PrepareForInput(Device, ConnectivityC2P<Device> PrepareForInput(Device,
vtkm::TopologyElementTagCell, vtkm::TopologyElementTagPoint,
vtkm::TopologyElementTagPoint) const; vtkm::TopologyElementTagCell) const;
private: private:
template <typename Device> template <typename Device>

@ -50,7 +50,7 @@ namespace cont
template <typename Device> template <typename Device>
VTKM_CONT void CellSetExtrude::BuildReverseConnectivity(Device) VTKM_CONT void CellSetExtrude::BuildReverseConnectivity(Device)
{ {
vtkm::worklet::Invoker invoke(Device{}); vtkm::cont::Invoker invoke(Device{});
// create a mapping of where each key is the point id and the value // create a mapping of where each key is the point id and the value
// is the cell id. We // is the cell id. We
@ -87,8 +87,8 @@ VTKM_CONT void CellSetExtrude::BuildReverseConnectivity(Device)
template <typename Device> template <typename Device>
CellSetExtrude::ConnectivityP2C<Device> CellSetExtrude::PrepareForInput( CellSetExtrude::ConnectivityP2C<Device> CellSetExtrude::PrepareForInput(
Device, Device,
vtkm::TopologyElementTagPoint, vtkm::TopologyElementTagCell,
vtkm::TopologyElementTagCell) const vtkm::TopologyElementTagPoint) const
{ {
return ConnectivityP2C<Device>(this->Connectivity.PrepareForInput(Device{}), return ConnectivityP2C<Device>(this->Connectivity.PrepareForInput(Device{}),
this->NextNode.PrepareForInput(Device{}), this->NextNode.PrepareForInput(Device{}),
@ -102,8 +102,8 @@ CellSetExtrude::ConnectivityP2C<Device> CellSetExtrude::PrepareForInput(
template <typename Device> template <typename Device>
VTKM_CONT CellSetExtrude::ConnectivityC2P<Device> CellSetExtrude::PrepareForInput( VTKM_CONT CellSetExtrude::ConnectivityC2P<Device> CellSetExtrude::PrepareForInput(
Device, Device,
vtkm::TopologyElementTagCell, vtkm::TopologyElementTagPoint,
vtkm::TopologyElementTagPoint) const vtkm::TopologyElementTagCell) const
{ {
if (!this->ReverseConnectivityBuilt) if (!this->ReverseConnectivityBuilt)
{ {

@ -35,10 +35,10 @@ namespace cont
namespace internal namespace internal
{ {
class CellSetPermutationPointToCellHelpers class CellSetPermutationVisitCellsWithPointsHelpers
{ {
public: public:
struct WriteNumIndices : public vtkm::worklet::WorkletMapPointToCell struct WriteNumIndices : public vtkm::worklet::WorkletVisitCellsWithPoints
{ {
using ControlSignature = void(CellSetIn cellset, FieldOutCell numIndices); using ControlSignature = void(CellSetIn cellset, FieldOutCell numIndices);
using ExecutionSignature = void(PointCount, _2); using ExecutionSignature = void(PointCount, _2);
@ -50,7 +50,7 @@ public:
} }
}; };
struct WriteConnectivity : public vtkm::worklet::WorkletMapPointToCell struct WriteConnectivity : public vtkm::worklet::WorkletVisitCellsWithPoints
{ {
using ControlSignature = void(CellSetIn cellset, FieldOutCell connectivity); using ControlSignature = void(CellSetIn cellset, FieldOutCell connectivity);
using ExecutionSignature = void(PointCount, PointIndices, _2); using ExecutionSignature = void(PointCount, PointIndices, _2);
@ -112,7 +112,7 @@ public:
// default for CellSetPermutations of any cell type // default for CellSetPermutations of any cell type
template <typename CellSetPermutationType> template <typename CellSetPermutationType>
class CellSetPermutationPointToCell class CellSetPermutationVisitCellsWithPoints
{ {
public: public:
using ConnectivityArrays = vtkm::cont::internal::ConnectivityExplicitInternals<>; using ConnectivityArrays = vtkm::cont::internal::ConnectivityExplicitInternals<>;
@ -123,10 +123,11 @@ public:
ConnectivityArrays conn; ConnectivityArrays conn;
vtkm::Id connectivityLength = 0; vtkm::Id connectivityLength = 0;
conn.NumIndices = CellSetPermutationPointToCellHelpers::GetNumIndicesArray(cellset, Device{}); conn.NumIndices =
conn.IndexOffsets = CellSetPermutationPointToCellHelpers::GetIndexOffsetsArray( CellSetPermutationVisitCellsWithPointsHelpers::GetNumIndicesArray(cellset, Device{});
conn.IndexOffsets = CellSetPermutationVisitCellsWithPointsHelpers::GetIndexOffsetsArray(
conn.NumIndices, connectivityLength, Device{}); conn.NumIndices, connectivityLength, Device{});
conn.Connectivity = CellSetPermutationPointToCellHelpers::GetConnectivityArray( conn.Connectivity = CellSetPermutationVisitCellsWithPointsHelpers::GetConnectivityArray(
cellset, conn.IndexOffsets, connectivityLength, Device{}); cellset, conn.IndexOffsets, connectivityLength, Device{});
return conn; return conn;
@ -135,7 +136,7 @@ public:
// Specialization for CellSetExplicit/CellSetSingleType // Specialization for CellSetExplicit/CellSetSingleType
template <typename S1, typename S2, typename S3, typename S4, typename PermutationArrayHandleType> template <typename S1, typename S2, typename S3, typename S4, typename PermutationArrayHandleType>
class CellSetPermutationPointToCell< class CellSetPermutationVisitCellsWithPoints<
CellSetPermutation<CellSetExplicit<S1, S2, S3, S4>, PermutationArrayHandleType>> CellSetPermutation<CellSetExplicit<S1, S2, S3, S4>, PermutationArrayHandleType>>
{ {
private: private:
@ -160,10 +161,10 @@ public:
conn.NumIndices = conn.NumIndices =
NumIndicesArrayType(cellset.GetValidCellIds(), NumIndicesArrayType(cellset.GetValidCellIds(),
cellset.GetFullCellSet().GetNumIndicesArray( cellset.GetFullCellSet().GetNumIndicesArray(
vtkm::TopologyElementTagPoint(), vtkm::TopologyElementTagCell())); vtkm::TopologyElementTagCell(), vtkm::TopologyElementTagPoint()));
conn.IndexOffsets = CellSetPermutationPointToCellHelpers::GetIndexOffsetsArray( conn.IndexOffsets = CellSetPermutationVisitCellsWithPointsHelpers::GetIndexOffsetsArray(
conn.NumIndices, connectivityLength, Device{}); conn.NumIndices, connectivityLength, Device{});
conn.Connectivity = CellSetPermutationPointToCellHelpers::GetConnectivityArray( conn.Connectivity = CellSetPermutationVisitCellsWithPointsHelpers::GetConnectivityArray(
cellset, conn.IndexOffsets, connectivityLength, Device{}); cellset, conn.IndexOffsets, connectivityLength, Device{});
return conn; return conn;
@ -172,7 +173,7 @@ public:
// Specialization for CellSetStructured // Specialization for CellSetStructured
template <vtkm::IdComponent DIMENSION, typename PermutationArrayHandleType> template <vtkm::IdComponent DIMENSION, typename PermutationArrayHandleType>
class CellSetPermutationPointToCell< class CellSetPermutationVisitCellsWithPoints<
CellSetPermutation<CellSetStructured<DIMENSION>, PermutationArrayHandleType>> CellSetPermutation<CellSetStructured<DIMENSION>, PermutationArrayHandleType>>
{ {
private: private:
@ -197,7 +198,7 @@ public:
ConnectivityArrays conn; ConnectivityArrays conn;
conn.NumIndices = make_ArrayHandleConstant(numPointsInCell, numberOfCells); conn.NumIndices = make_ArrayHandleConstant(numPointsInCell, numberOfCells);
conn.IndexOffsets = ArrayHandleCounting<vtkm::Id>(0, numPointsInCell, numberOfCells); conn.IndexOffsets = ArrayHandleCounting<vtkm::Id>(0, numPointsInCell, numberOfCells);
conn.Connectivity = CellSetPermutationPointToCellHelpers::GetConnectivityArray( conn.Connectivity = CellSetPermutationVisitCellsWithPointsHelpers::GetConnectivityArray(
cellset, conn.IndexOffsets, connectivityLength, Device{}); cellset, conn.IndexOffsets, connectivityLength, Device{});
return conn; return conn;
@ -281,7 +282,7 @@ public:
{ {
this->ValidCellIds.ReleaseResourcesExecution(); this->ValidCellIds.ReleaseResourcesExecution();
this->FullCellSet.ReleaseResourcesExecution(); this->FullCellSet.ReleaseResourcesExecution();
this->CellToPoint.ReleaseResourcesExecution(); this->VisitPointsWithCells.ReleaseResourcesExecution();
} }
VTKM_CONT VTKM_CONT
@ -337,11 +338,11 @@ public:
return this->FullCellSet.GetNumberOfPoints(); return this->FullCellSet.GetNumberOfPoints();
} }
template <typename Device, typename FromTopology, typename ToTopology> template <typename Device, typename VisitTopology, typename IncidentTopology>
struct ExecutionTypes; struct ExecutionTypes;
template <typename Device> template <typename Device>
struct ExecutionTypes<Device, vtkm::TopologyElementTagPoint, vtkm::TopologyElementTagCell> struct ExecutionTypes<Device, vtkm::TopologyElementTagCell, vtkm::TopologyElementTagPoint>
{ {
VTKM_IS_DEVICE_ADAPTER_TAG(Device); VTKM_IS_DEVICE_ADAPTER_TAG(Device);
@ -349,15 +350,15 @@ public:
typename PermutationArrayHandleType::template ExecutionTypes<Device>::PortalConst; typename PermutationArrayHandleType::template ExecutionTypes<Device>::PortalConst;
using OrigExecObjectType = typename OriginalCellSetType::template ExecutionTypes< using OrigExecObjectType = typename OriginalCellSetType::template ExecutionTypes<
Device, Device,
vtkm::TopologyElementTagPoint, vtkm::TopologyElementTagCell,
vtkm::TopologyElementTagCell>::ExecObjectType; vtkm::TopologyElementTagPoint>::ExecObjectType;
using ExecObjectType = using ExecObjectType =
vtkm::exec::ConnectivityPermutedPointToCell<ExecPortalType, OrigExecObjectType>; vtkm::exec::ConnectivityPermutedVisitCellsWithPoints<ExecPortalType, OrigExecObjectType>;
}; };
template <typename Device> template <typename Device>
struct ExecutionTypes<Device, vtkm::TopologyElementTagCell, vtkm::TopologyElementTagPoint> struct ExecutionTypes<Device, vtkm::TopologyElementTagPoint, vtkm::TopologyElementTagCell>
{ {
VTKM_IS_DEVICE_ADAPTER_TAG(Device); VTKM_IS_DEVICE_ADAPTER_TAG(Device);
@ -368,47 +369,48 @@ public:
using IndexOffsetPortalType = using IndexOffsetPortalType =
typename vtkm::cont::ArrayHandle<vtkm::Id>::template ExecutionTypes<Device>::PortalConst; typename vtkm::cont::ArrayHandle<vtkm::Id>::template ExecutionTypes<Device>::PortalConst;
using ExecObjectType = vtkm::exec::ConnectivityPermutedCellToPoint<ConnectiviyPortalType, using ExecObjectType =
NumIndicesPortalType, vtkm::exec::ConnectivityPermutedVisitPointsWithCells<ConnectiviyPortalType,
IndexOffsetPortalType>; NumIndicesPortalType,
IndexOffsetPortalType>;
}; };
template <typename Device> template <typename Device>
VTKM_CONT typename ExecutionTypes<Device, VTKM_CONT typename ExecutionTypes<Device,
vtkm::TopologyElementTagPoint, vtkm::TopologyElementTagCell,
vtkm::TopologyElementTagCell>::ExecObjectType vtkm::TopologyElementTagPoint>::ExecObjectType
PrepareForInput(Device device, PrepareForInput(Device device,
vtkm::TopologyElementTagPoint from, vtkm::TopologyElementTagCell from,
vtkm::TopologyElementTagCell to) const vtkm::TopologyElementTagPoint to) const
{ {
using ConnectivityType = typename ExecutionTypes<Device, using ConnectivityType = typename ExecutionTypes<Device,
vtkm::TopologyElementTagPoint, vtkm::TopologyElementTagCell,
vtkm::TopologyElementTagCell>::ExecObjectType; vtkm::TopologyElementTagPoint>::ExecObjectType;
return ConnectivityType(this->ValidCellIds.PrepareForInput(device), return ConnectivityType(this->ValidCellIds.PrepareForInput(device),
this->FullCellSet.PrepareForInput(device, from, to)); this->FullCellSet.PrepareForInput(device, from, to));
} }
template <typename Device> template <typename Device>
VTKM_CONT typename ExecutionTypes<Device, VTKM_CONT typename ExecutionTypes<Device,
vtkm::TopologyElementTagCell, vtkm::TopologyElementTagPoint,
vtkm::TopologyElementTagPoint>::ExecObjectType vtkm::TopologyElementTagCell>::ExecObjectType
PrepareForInput(Device device, vtkm::TopologyElementTagCell, vtkm::TopologyElementTagPoint) const PrepareForInput(Device device, vtkm::TopologyElementTagPoint, vtkm::TopologyElementTagCell) const
{ {
if (!this->CellToPoint.ElementsValid) if (!this->VisitPointsWithCells.ElementsValid)
{ {
auto pointToCell = auto pointToCell =
internal::CellSetPermutationPointToCell<CellSetPermutation>::Get(*this, device); internal::CellSetPermutationVisitCellsWithPoints<CellSetPermutation>::Get(*this, device);
internal::ComputeCellToPointConnectivity( internal::ComputeVisitPointsWithCellsConnectivity(
this->CellToPoint, pointToCell, this->GetNumberOfPoints(), device); this->VisitPointsWithCells, pointToCell, this->GetNumberOfPoints(), device);
this->CellToPoint.BuildIndexOffsets(device); this->VisitPointsWithCells.BuildIndexOffsets(device);
} }
using ConnectivityType = typename ExecutionTypes<Device, using ConnectivityType = typename ExecutionTypes<Device,
vtkm::TopologyElementTagCell, vtkm::TopologyElementTagPoint,
vtkm::TopologyElementTagPoint>::ExecObjectType; vtkm::TopologyElementTagCell>::ExecObjectType;
return ConnectivityType(this->CellToPoint.Connectivity.PrepareForInput(device), return ConnectivityType(this->VisitPointsWithCells.Connectivity.PrepareForInput(device),
this->CellToPoint.NumIndices.PrepareForInput(device), this->VisitPointsWithCells.NumIndices.PrepareForInput(device),
this->CellToPoint.IndexOffsets.PrepareForInput(device)); this->VisitPointsWithCells.IndexOffsets.PrepareForInput(device));
} }
VTKM_CONT VTKM_CONT
@ -421,12 +423,12 @@ public:
} }
private: private:
using CellToPointConnectivity = vtkm::cont::internal::ConnectivityExplicitInternals< using VisitPointsWithCellsConnectivity = vtkm::cont::internal::ConnectivityExplicitInternals<
typename ArrayHandleConstant<vtkm::UInt8>::StorageTag>; typename ArrayHandleConstant<vtkm::UInt8>::StorageTag>;
PermutationArrayHandleType ValidCellIds; PermutationArrayHandleType ValidCellIds;
OriginalCellSetType FullCellSet; OriginalCellSetType FullCellSet;
mutable CellToPointConnectivity CellToPoint; mutable VisitPointsWithCellsConnectivity VisitPointsWithCells;
}; };
template <typename CellSetType, template <typename CellSetType,

@ -80,7 +80,7 @@ public:
{ {
this->CellShapeAsId = vtkm::CELL_SHAPE_EMPTY; this->CellShapeAsId = vtkm::CELL_SHAPE_EMPTY;
this->Data->PointToCell.Connectivity.Allocate(connectivityMaxLen); this->Data->VisitCellsWithPoints.Connectivity.Allocate(connectivityMaxLen);
this->Data->NumberOfCellsAdded = 0; this->Data->NumberOfCellsAdded = 0;
this->Data->ConnectivityAdded = 0; this->Data->ConnectivityAdded = 0;
@ -101,7 +101,7 @@ public:
} }
if (this->Data->ConnectivityAdded + numVertices > if (this->Data->ConnectivityAdded + numVertices >
this->Data->PointToCell.Connectivity.GetNumberOfValues()) this->Data->VisitCellsWithPoints.Connectivity.GetNumberOfValues())
{ {
throw vtkm::cont::ErrorBadValue( throw vtkm::cont::ErrorBadValue(
"Connectivity increased passed estimated maximum connectivity."); "Connectivity increased passed estimated maximum connectivity.");
@ -131,7 +131,7 @@ public:
} }
for (vtkm::IdComponent iVert = 0; iVert < numVertices; ++iVert) for (vtkm::IdComponent iVert = 0; iVert < numVertices; ++iVert)
{ {
this->Data->PointToCell.Connectivity.GetPortalControl().Set( this->Data->VisitCellsWithPoints.Connectivity.GetPortalControl().Set(
this->Data->ConnectivityAdded + iVert, Traits::GetComponent(ids, iVert)); this->Data->ConnectivityAdded + iVert, Traits::GetComponent(ids, iVert));
} }
this->Data->NumberOfCellsAdded++; this->Data->NumberOfCellsAdded++;
@ -143,19 +143,19 @@ public:
void CompleteAddingCells(vtkm::Id numPoints) void CompleteAddingCells(vtkm::Id numPoints)
{ {
this->Data->NumberOfPoints = numPoints; this->Data->NumberOfPoints = numPoints;
this->PointToCell.Connectivity.Shrink(this->ConnectivityAdded); this->VisitCellsWithPoints.Connectivity.Shrink(this->ConnectivityAdded);
vtkm::Id numCells = this->NumberOfCellsAdded; vtkm::Id numCells = this->NumberOfCellsAdded;
this->PointToCell.Shapes = this->VisitCellsWithPoints.Shapes =
vtkm::cont::make_ArrayHandleConstant(this->GetCellShape(0), numCells); vtkm::cont::make_ArrayHandleConstant(this->GetCellShape(0), numCells);
this->PointToCell.NumIndices = this->VisitCellsWithPoints.NumIndices =
vtkm::cont::make_ArrayHandleConstant(this->NumberOfPointsPerCell, numCells); vtkm::cont::make_ArrayHandleConstant(this->NumberOfPointsPerCell, numCells);
this->PointToCell.IndexOffsets = vtkm::cont::make_ArrayHandleCounting( this->VisitCellsWithPoints.IndexOffsets = vtkm::cont::make_ArrayHandleCounting(
vtkm::Id(0), static_cast<vtkm::Id>(this->NumberOfPointsPerCell), numCells); vtkm::Id(0), static_cast<vtkm::Id>(this->NumberOfPointsPerCell), numCells);
this->PointToCell.ElementsValid = true; this->VisitCellsWithPoints.ElementsValid = true;
this->PointToCell.IndexOffsetsValid = true; this->VisitCellsWithPoints.IndexOffsetsValid = true;
if (this->ExpectedNumberOfCellsAdded != this->GetNumberOfCells()) if (this->ExpectedNumberOfCellsAdded != this->GetNumberOfCells())
{ {
@ -179,17 +179,18 @@ public:
this->CheckNumberOfPointsPerCell(numberOfPointsPerCell); this->CheckNumberOfPointsPerCell(numberOfPointsPerCell);
const vtkm::Id numCells = connectivity.GetNumberOfValues() / numberOfPointsPerCell; const vtkm::Id numCells = connectivity.GetNumberOfValues() / numberOfPointsPerCell;
VTKM_ASSERT((connectivity.GetNumberOfValues() % numberOfPointsPerCell) == 0); VTKM_ASSERT((connectivity.GetNumberOfValues() % numberOfPointsPerCell) == 0);
this->Data->PointToCell.Shapes = vtkm::cont::make_ArrayHandleConstant(shapeId, numCells); this->Data->VisitCellsWithPoints.Shapes =
this->Data->PointToCell.NumIndices = vtkm::cont::make_ArrayHandleConstant(shapeId, numCells);
this->Data->VisitCellsWithPoints.NumIndices =
vtkm::cont::make_ArrayHandleConstant(numberOfPointsPerCell, numCells); vtkm::cont::make_ArrayHandleConstant(numberOfPointsPerCell, numCells);
this->Data->PointToCell.IndexOffsets = vtkm::cont::make_ArrayHandleCounting( this->Data->VisitCellsWithPoints.IndexOffsets = vtkm::cont::make_ArrayHandleCounting(
vtkm::Id(0), static_cast<vtkm::Id>(numberOfPointsPerCell), numCells); vtkm::Id(0), static_cast<vtkm::Id>(numberOfPointsPerCell), numCells);
this->Data->PointToCell.Connectivity = connectivity; this->Data->VisitCellsWithPoints.Connectivity = connectivity;
this->Data->PointToCell.ElementsValid = true; this->Data->VisitCellsWithPoints.ElementsValid = true;
this->Data->PointToCell.IndexOffsetsValid = true; this->Data->VisitCellsWithPoints.IndexOffsetsValid = true;
this->ResetConnectivity(TopologyElementTagCell{}, TopologyElementTagPoint{}); this->ResetConnectivity(TopologyElementTagPoint{}, TopologyElementTagCell{});
} }
VTKM_CONT VTKM_CONT
@ -224,10 +225,10 @@ public:
virtual void PrintSummary(std::ostream& out) const override virtual void PrintSummary(std::ostream& out) const override
{ {
out << " CellSetSingleType: " << this->Name << " Type " << this->CellShapeAsId << std::endl; out << " CellSetSingleType: " << this->Name << " Type " << this->CellShapeAsId << std::endl;
out << " PointToCell: " << std::endl; out << " VisitCellsWithPoints: " << std::endl;
this->Data->PointToCell.PrintSummary(out); this->Data->VisitCellsWithPoints.PrintSummary(out);
out << " CellToPoint: " << std::endl; out << " VisitPointsWithCells: " << std::endl;
this->Data->CellToPoint.PrintSummary(out); this->Data->VisitPointsWithCells.PrintSummary(out);
} }
private: private:
@ -308,7 +309,7 @@ public:
vtkmdiy::save(bb, cs.GetCellShape(0)); vtkmdiy::save(bb, cs.GetCellShape(0));
vtkmdiy::save(bb, cs.GetNumberOfPointsInCell(0)); vtkmdiy::save(bb, cs.GetNumberOfPointsInCell(0));
vtkmdiy::save( vtkmdiy::save(
bb, cs.GetConnectivityArray(vtkm::TopologyElementTagPoint{}, vtkm::TopologyElementTagCell{})); bb, cs.GetConnectivityArray(vtkm::TopologyElementTagCell{}, vtkm::TopologyElementTagPoint{}));
} }
static VTKM_CONT void load(BinaryBuffer& bb, Type& cs) static VTKM_CONT void load(BinaryBuffer& bb, Type& cs)

@ -115,18 +115,19 @@ public:
template <typename TopologyElement> template <typename TopologyElement>
SchedulingRangeType GetSchedulingRange(TopologyElement) const; SchedulingRangeType GetSchedulingRange(TopologyElement) const;
template <typename DeviceAdapter, typename FromTopology, typename ToTopology> template <typename DeviceAdapter, typename VisitTopology, typename IncidentTopology>
struct ExecutionTypes struct ExecutionTypes
{ {
VTKM_IS_DEVICE_ADAPTER_TAG(DeviceAdapter); VTKM_IS_DEVICE_ADAPTER_TAG(DeviceAdapter);
VTKM_IS_TOPOLOGY_ELEMENT_TAG(FromTopology); VTKM_IS_TOPOLOGY_ELEMENT_TAG(VisitTopology);
VTKM_IS_TOPOLOGY_ELEMENT_TAG(ToTopology); VTKM_IS_TOPOLOGY_ELEMENT_TAG(IncidentTopology);
using ExecObjectType = vtkm::exec::ConnectivityStructured<FromTopology, ToTopology, Dimension>; using ExecObjectType =
vtkm::exec::ConnectivityStructured<VisitTopology, IncidentTopology, Dimension>;
}; };
template <typename DeviceAdapter, typename FromTopology, typename ToTopology> template <typename DeviceAdapter, typename VisitTopology, typename IncidentTopology>
typename ExecutionTypes<DeviceAdapter, FromTopology, ToTopology>::ExecObjectType typename ExecutionTypes<DeviceAdapter, VisitTopology, IncidentTopology>::ExecObjectType
PrepareForInput(DeviceAdapter, FromTopology, ToTopology) const; PrepareForInput(DeviceAdapter, VisitTopology, IncidentTopology) const;
void PrintSummary(std::ostream& out) const override; void PrintSummary(std::ostream& out) const override;

@ -57,13 +57,16 @@ typename CellSetStructured<DIMENSION>::SchedulingRangeType
} }
template <vtkm::IdComponent DIMENSION> template <vtkm::IdComponent DIMENSION>
template <typename DeviceAdapter, typename FromTopology, typename ToTopology> template <typename DeviceAdapter, typename VisitTopology, typename IncidentTopology>
typename CellSetStructured< typename CellSetStructured<DIMENSION>::template ExecutionTypes<DeviceAdapter,
DIMENSION>::template ExecutionTypes<DeviceAdapter, FromTopology, ToTopology>::ExecObjectType VisitTopology,
CellSetStructured<DIMENSION>::PrepareForInput(DeviceAdapter, FromTopology, ToTopology) const IncidentTopology>::ExecObjectType
CellSetStructured<DIMENSION>::PrepareForInput(DeviceAdapter,
VisitTopology,
IncidentTopology) const
{ {
using ConnectivityType = using ConnectivityType =
typename ExecutionTypes<DeviceAdapter, FromTopology, ToTopology>::ExecObjectType; typename ExecutionTypes<DeviceAdapter, VisitTopology, IncidentTopology>::ExecObjectType;
return ConnectivityType(this->Structure); return ConnectivityType(this->Structure);
} }

@ -15,7 +15,7 @@
#include <vtkm/cont/TryExecute.h> #include <vtkm/cont/TryExecute.h>
#include <vtkm/cont/VirtualObjectHandle.h> #include <vtkm/cont/VirtualObjectHandle.h>
#include <vtkm/worklet/Invoker.h> #include <vtkm/cont/Invoker.h>
#include <vtkm/worklet/colorconversion/LookupTable.h> #include <vtkm/worklet/colorconversion/LookupTable.h>
#include <vtkm/worklet/colorconversion/Portals.h> #include <vtkm/worklet/colorconversion/Portals.h>
#include <vtkm/worklet/colorconversion/TransferFunction.h> #include <vtkm/worklet/colorconversion/TransferFunction.h>
@ -79,7 +79,7 @@ struct map_color_table
inline bool operator()(DeviceAdapter device, ColorTable&& colors, Args&&... args) const inline bool operator()(DeviceAdapter device, ColorTable&& colors, Args&&... args) const
{ {
vtkm::worklet::colorconversion::TransferFunction transfer(colors->PrepareForExecution(device)); vtkm::worklet::colorconversion::TransferFunction transfer(colors->PrepareForExecution(device));
vtkm::worklet::Invoker invoke(device); vtkm::cont::Invoker invoke(device);
invoke(transfer, std::forward<Args>(args)...); invoke(transfer, std::forward<Args>(args)...);
return true; return true;
} }
@ -97,7 +97,7 @@ bool ColorTable::Map(const vtkm::cont::ArrayHandle<T, S>& values,
return false; return false;
} }
vtkm::worklet::colorconversion::LookupTable lookupTable(samples); vtkm::worklet::colorconversion::LookupTable lookupTable(samples);
vtkm::worklet::Invoker invoke(vtkm::cont::DeviceAdapterTagAny{}); vtkm::cont::Invoker invoke(vtkm::cont::DeviceAdapterTagAny{});
invoke(lookupTable, values, samples.Samples, rgbaOut); invoke(lookupTable, values, samples.Samples, rgbaOut);
return true; return true;
} }
@ -112,7 +112,7 @@ bool ColorTable::Map(const vtkm::cont::ArrayHandle<T, S>& values,
return false; return false;
} }
vtkm::worklet::colorconversion::LookupTable lookupTable(samples); vtkm::worklet::colorconversion::LookupTable lookupTable(samples);
vtkm::worklet::Invoker invoke(vtkm::cont::DeviceAdapterTagAny{}); vtkm::cont::Invoker invoke(vtkm::cont::DeviceAdapterTagAny{});
invoke(lookupTable, values, samples.Samples, rgbOut); invoke(lookupTable, values, samples.Samples, rgbOut);
return true; return true;
} }

@ -7,8 +7,8 @@
// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR // the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
// PURPOSE. See the above copyright notice for more information. // PURPOSE. See the above copyright notice for more information.
//============================================================================ //============================================================================
#ifndef vtk_m_worklet_Invoker_h #ifndef vtk_m_cont_Invoker_h
#define vtk_m_worklet_Invoker_h #define vtk_m_cont_Invoker_h
#include <vtkm/worklet/DispatcherMapField.h> #include <vtkm/worklet/DispatcherMapField.h>
#include <vtkm/worklet/DispatcherMapTopology.h> #include <vtkm/worklet/DispatcherMapTopology.h>
@ -19,7 +19,7 @@
namespace vtkm namespace vtkm
{ {
namespace worklet namespace cont
{ {
@ -56,15 +56,16 @@ struct Invoker
/// Optional second parameter is the scatter type associated with the worklet. /// Optional second parameter is the scatter type associated with the worklet.
/// Any additional parameters are the ControlSignature arguments for the worklet. /// Any additional parameters are the ControlSignature arguments for the worklet.
/// ///
template <typename Worklet, template <
typename T, typename Worklet,
typename... Args, typename T,
typename std::enable_if< typename... Args,
std::is_base_of<internal::ScatterBase, internal::detail::remove_cvref<T>>::value, typename std::enable_if<std::is_base_of<worklet::internal::ScatterBase,
int>::type* = nullptr> worklet::internal::detail::remove_cvref<T>>::value,
int>::type* = nullptr>
inline void operator()(Worklet&& worklet, T&& scatter, Args&&... args) const inline void operator()(Worklet&& worklet, T&& scatter, Args&&... args) const
{ {
using WorkletType = internal::detail::remove_cvref<Worklet>; using WorkletType = worklet::internal::detail::remove_cvref<Worklet>;
using DispatcherType = typename WorkletType::template Dispatcher<WorkletType>; using DispatcherType = typename WorkletType::template Dispatcher<WorkletType>;
DispatcherType dispatcher(worklet, scatter); DispatcherType dispatcher(worklet, scatter);
@ -76,15 +77,16 @@ struct Invoker
/// Optional second parameter is the scatter type associated with the worklet. /// Optional second parameter is the scatter type associated with the worklet.
/// Any additional parameters are the ControlSignature arguments for the worklet. /// Any additional parameters are the ControlSignature arguments for the worklet.
/// ///
template <typename Worklet, template <
typename T, typename Worklet,
typename... Args, typename T,
typename std::enable_if< typename... Args,
!std::is_base_of<internal::ScatterBase, internal::detail::remove_cvref<T>>::value, typename std::enable_if<!std::is_base_of<worklet::internal::ScatterBase,
int>::type* = nullptr> worklet::internal::detail::remove_cvref<T>>::value,
int>::type* = nullptr>
inline void operator()(Worklet&& worklet, T&& t, Args&&... args) const inline void operator()(Worklet&& worklet, T&& t, Args&&... args) const
{ {
using WorkletType = internal::detail::remove_cvref<Worklet>; using WorkletType = worklet::internal::detail::remove_cvref<Worklet>;
using DispatcherType = typename WorkletType::template Dispatcher<WorkletType>; using DispatcherType = typename WorkletType::template Dispatcher<WorkletType>;
DispatcherType dispatcher(worklet); DispatcherType dispatcher(worklet);

@ -28,26 +28,29 @@ namespace arg
/// \c TransportTagCellSetIn is a tag used with the \c Transport class to /// \c TransportTagCellSetIn is a tag used with the \c Transport class to
/// transport topology objects for input data. /// transport topology objects for input data.
/// ///
template <typename FromTopology, typename ToTopology> template <typename VisitTopology, typename IncidentTopology>
struct TransportTagCellSetIn struct TransportTagCellSetIn
{ {
}; };
template <typename FromTopology, typename ToTopology, typename ContObjectType, typename Device> template <typename VisitTopology,
struct Transport<vtkm::cont::arg::TransportTagCellSetIn<FromTopology, ToTopology>, typename IncidentTopology,
typename ContObjectType,
typename Device>
struct Transport<vtkm::cont::arg::TransportTagCellSetIn<VisitTopology, IncidentTopology>,
ContObjectType, ContObjectType,
Device> Device>
{ {
VTKM_IS_CELL_SET(ContObjectType); VTKM_IS_CELL_SET(ContObjectType);
using ExecObjectType = decltype( using ExecObjectType = decltype(
std::declval<ContObjectType>().PrepareForInput(Device(), FromTopology(), ToTopology())); std::declval<ContObjectType>().PrepareForInput(Device(), VisitTopology(), IncidentTopology()));
template <typename InputDomainType> template <typename InputDomainType>
VTKM_CONT ExecObjectType VTKM_CONT ExecObjectType
operator()(const ContObjectType& object, const InputDomainType&, vtkm::Id, vtkm::Id) const operator()(const ContObjectType& object, const InputDomainType&, vtkm::Id, vtkm::Id) const
{ {
return object.PrepareForInput(Device(), FromTopology(), ToTopology()); return object.PrepareForInput(Device(), VisitTopology(), IncidentTopology());
} }
}; };
} }

@ -59,17 +59,16 @@ void TransportWholeCellSetIn(Device)
contObject.AddCell(vtkm::CELL_SHAPE_QUAD, 4, vtkm::make_Vec<vtkm::Id>(2, 1, 3, 4)); contObject.AddCell(vtkm::CELL_SHAPE_QUAD, 4, vtkm::make_Vec<vtkm::Id>(2, 1, 3, 4));
contObject.CompleteAddingCells(nVerts); contObject.CompleteAddingCells(nVerts);
using FromType = vtkm::TopologyElementTagPoint; using IncidentTopology = vtkm::TopologyElementTagPoint;
using ToType = vtkm::TopologyElementTagCell; using VisitTopology = vtkm::TopologyElementTagCell;
using ExecObjectType = using ExecObjectType = typename vtkm::cont::CellSetExplicit<>::
typename vtkm::cont::CellSetExplicit<>::template ExecutionTypes<Device, template ExecutionTypes<Device, VisitTopology, IncidentTopology>::ExecObjectType;
FromType,
ToType>::ExecObjectType;
vtkm::cont::arg::Transport<vtkm::cont::arg::TransportTagCellSetIn<FromType, ToType>, vtkm::cont::arg::Transport<
vtkm::cont::CellSetExplicit<>, vtkm::cont::arg::TransportTagCellSetIn<VisitTopology, IncidentTopology>,
Device> vtkm::cont::CellSetExplicit<>,
Device>
transport; transport;
TestKernel<ExecObjectType> kernel; TestKernel<ExecObjectType> kernel;

@ -320,7 +320,11 @@ private:
vtkm::Int32 rVal = this->LocalPopCount; vtkm::Int32 rVal = this->LocalPopCount;
for (int delta = 1; delta < activeSize; delta *= 2) for (int delta = 1; delta < activeSize; delta *= 2)
{ {
rVal += activeLanes.shfl_down(rVal, delta); const vtkm::Int32 shflVal = activeLanes.shfl_down(rVal, delta);
if (activeRank + delta < activeSize)
{
rVal += shflVal;
}
} }
if (activeRank == 0) if (activeRank == 0)
@ -511,7 +515,11 @@ private:
vtkm::Int32 rVal = this->LocalPopCount; vtkm::Int32 rVal = this->LocalPopCount;
for (int delta = 1; delta < activeSize; delta *= 2) for (int delta = 1; delta < activeSize; delta *= 2)
{ {
rVal += activeLanes.shfl_down(rVal, delta); const vtkm::Int32 shflVal = activeLanes.shfl_down(rVal, delta);
if (activeRank + delta < activeSize)
{
rVal += shflVal;
}
} }
if (activeRank == 0) if (activeRank == 0)

@ -225,11 +225,11 @@ struct ConnIdxToCellIdCalcSingleType
vtkm::Id operator()(vtkm::Id inIdx) const { return inIdx / this->CellSize; } vtkm::Id operator()(vtkm::Id inIdx) const { return inIdx / this->CellSize; }
}; };
template <typename PointToCell, typename CellToPoint, typename Device> template <typename VisitCellsWithPoints, typename VisitPointsWithCells, typename Device>
void ComputeCellToPointConnectivity(CellToPoint& cell2Point, void ComputeVisitPointsWithCellsConnectivity(VisitPointsWithCells& cell2Point,
const PointToCell& point2Cell, const VisitCellsWithPoints& point2Cell,
vtkm::Id numberOfPoints, vtkm::Id numberOfPoints,
Device) Device)
{ {
if (cell2Point.ElementsValid) if (cell2Point.ElementsValid)
{ {
@ -258,7 +258,7 @@ void ComputeCellToPointConnectivity(CellToPoint& cell2Point,
rConnSize, rConnSize,
Device()); Device());
// Set the CellToPoint information // Set the VisitPointsWithCells information
cell2Point.Shapes = vtkm::cont::make_ArrayHandleConstant( cell2Point.Shapes = vtkm::cont::make_ArrayHandleConstant(
static_cast<vtkm::UInt8>(CELL_SHAPE_VERTEX), numberOfPoints); static_cast<vtkm::UInt8>(CELL_SHAPE_VERTEX), numberOfPoints);
cell2Point.ElementsValid = true; cell2Point.ElementsValid = true;
@ -269,10 +269,10 @@ void ComputeCellToPointConnectivity(CellToPoint& cell2Point,
template <typename ShapeStorageTag, template <typename ShapeStorageTag,
typename ConnectivityStorageTag, typename ConnectivityStorageTag,
typename IndexOffsetStorageTag, typename IndexOffsetStorageTag,
typename CellToPoint, typename VisitPointsWithCells,
typename Device> typename Device>
void ComputeCellToPointConnectivity( void ComputeVisitPointsWithCellsConnectivity(
CellToPoint& cell2Point, VisitPointsWithCells& cell2Point,
const ConnectivityExplicitInternals< const ConnectivityExplicitInternals<
ShapeStorageTag, ShapeStorageTag,
vtkm::cont::ArrayHandleConstant<vtkm::IdComponent>::StorageTag, // nIndices vtkm::cont::ArrayHandleConstant<vtkm::IdComponent>::StorageTag, // nIndices
@ -309,7 +309,7 @@ void ComputeCellToPointConnectivity(
rConnSize, rConnSize,
Device()); Device());
// Set the CellToPoint information // Set the VisitPointsWithCells information
cell2Point.Shapes = vtkm::cont::make_ArrayHandleConstant( cell2Point.Shapes = vtkm::cont::make_ArrayHandleConstant(
static_cast<vtkm::UInt8>(CELL_SHAPE_VERTEX), numberOfPoints); static_cast<vtkm::UInt8>(CELL_SHAPE_VERTEX), numberOfPoints);
cell2Point.ElementsValid = true; cell2Point.ElementsValid = true;

@ -235,8 +235,8 @@ struct TestEqualCellSet
const vtkm::cont::CellSetExplicit<ShapeST, CountST, ConnectivityST, OffsetST>& cs2, const vtkm::cont::CellSetExplicit<ShapeST, CountST, ConnectivityST, OffsetST>& cs2,
TestEqualResult& result) const TestEqualResult& result) const
{ {
vtkm::TopologyElementTagPoint p2cFrom{}; vtkm::TopologyElementTagCell visitTopo{};
vtkm::TopologyElementTagCell p2cTo{}; vtkm::TopologyElementTagPoint incidentTopo{};
if (cs1.GetName() != cs2.GetName()) if (cs1.GetName() != cs2.GetName())
{ {
@ -249,30 +249,30 @@ struct TestEqualCellSet
return; return;
} }
result = test_equal_ArrayHandles(cs1.GetShapesArray(p2cFrom, p2cTo), result = test_equal_ArrayHandles(cs1.GetShapesArray(visitTopo, incidentTopo),
cs2.GetShapesArray(p2cFrom, p2cTo)); cs2.GetShapesArray(visitTopo, incidentTopo));
if (!result) if (!result)
{ {
result.PushMessage("shapes arrays don't match"); result.PushMessage("shapes arrays don't match");
return; return;
} }
result = test_equal_ArrayHandles(cs1.GetNumIndicesArray(p2cFrom, p2cTo), result = test_equal_ArrayHandles(cs1.GetNumIndicesArray(visitTopo, incidentTopo),
cs2.GetNumIndicesArray(p2cFrom, p2cTo)); cs2.GetNumIndicesArray(visitTopo, incidentTopo));
if (!result) if (!result)
{ {
result.PushMessage("counts arrays don't match"); result.PushMessage("counts arrays don't match");
return; return;
} }
result = test_equal_ArrayHandles(cs1.GetConnectivityArray(p2cFrom, p2cTo), result = test_equal_ArrayHandles(cs1.GetConnectivityArray(visitTopo, incidentTopo),
cs2.GetConnectivityArray(p2cFrom, p2cTo)); cs2.GetConnectivityArray(visitTopo, incidentTopo));
if (!result) if (!result)
{ {
result.PushMessage("connectivity arrays don't match"); result.PushMessage("connectivity arrays don't match");
return; return;
} }
result = test_equal_ArrayHandles(cs1.GetIndexOffsetArray(p2cFrom, p2cTo), result = test_equal_ArrayHandles(cs1.GetIndexOffsetArray(visitTopo, incidentTopo),
cs2.GetIndexOffsetArray(p2cFrom, p2cTo)); cs2.GetIndexOffsetArray(visitTopo, incidentTopo));
if (!result) if (!result)
{ {
result.PushMessage("offsets arrays don't match"); result.PushMessage("offsets arrays don't match");

@ -14,14 +14,13 @@
#include <vtkm/cont/ArrayHandleCounting.h> #include <vtkm/cont/ArrayHandleCounting.h>
#include <vtkm/cont/BitField.h> #include <vtkm/cont/BitField.h>
#include <vtkm/cont/DeviceAdapterAlgorithm.h> #include <vtkm/cont/DeviceAdapterAlgorithm.h>
#include <vtkm/cont/Invoker.h>
#include <vtkm/cont/RuntimeDeviceTracker.h> #include <vtkm/cont/RuntimeDeviceTracker.h>
#include <vtkm/cont/testing/Testing.h> #include <vtkm/cont/testing/Testing.h>
#include <vtkm/exec/FunctorBase.h> #include <vtkm/exec/FunctorBase.h>
#include <vtkm/worklet/Invoker.h>
#include <cstdio> #include <cstdio>
#define DEVICE_ASSERT_MSG(cond, message) \ #define DEVICE_ASSERT_MSG(cond, message) \
@ -599,7 +598,7 @@ struct TestingBitField
auto falseArray = vtkm::cont::make_ArrayHandleCounting<vtkm::Id>(13, 2, NUM_BITS); auto falseArray = vtkm::cont::make_ArrayHandleCounting<vtkm::Id>(13, 2, NUM_BITS);
vtkm::cont::ArrayHandle<vtkm::Id> output; vtkm::cont::ArrayHandle<vtkm::Id> output;
vtkm::worklet::Invoker invoke; vtkm::cont::Invoker invoke;
invoke(ConditionalMergeWorklet{}, condArray, trueArray, falseArray, output); invoke(ConditionalMergeWorklet{}, condArray, trueArray, falseArray, output);
auto condVals = condArray.GetPortalConstControl(); auto condVals = condArray.GetPortalConstControl();
@ -625,7 +624,7 @@ struct TestingBitField
auto falseArray = vtkm::cont::make_ArrayHandleCounting<vtkm::Id>(13, 2, NUM_BITS); auto falseArray = vtkm::cont::make_ArrayHandleCounting<vtkm::Id>(13, 2, NUM_BITS);
vtkm::cont::ArrayHandle<vtkm::Id> output; vtkm::cont::ArrayHandle<vtkm::Id> output;
vtkm::worklet::Invoker invoke; vtkm::cont::Invoker invoke;
invoke(ConditionalMergeWorklet2{}, condBits, trueArray, falseArray, output); invoke(ConditionalMergeWorklet2{}, condBits, trueArray, falseArray, output);
auto condVals = condBits.GetPortalConstControl(); auto condVals = condBits.GetPortalConstControl();

@ -37,7 +37,7 @@ using PointType = vtkm::Vec3f;
std::default_random_engine RandomGenerator; std::default_random_engine RandomGenerator;
class ParametricToWorldCoordinates : public vtkm::worklet::WorkletMapPointToCell class ParametricToWorldCoordinates : public vtkm::worklet::WorkletVisitCellsWithPoints
{ {
public: public:
using ControlSignature = void(CellSetIn cellset, using ControlSignature = void(CellSetIn cellset,

@ -103,11 +103,11 @@ private:
vtkm::Id correctConnectivity[] = { 0, 0, 1, 0, 1, 1, 1 }; vtkm::Id correctConnectivity[] = { 0, 0, 1, 0, 1, 1, 1 };
vtkm::cont::ArrayHandleConstant<vtkm::UInt8> shapes = vtkm::cont::ArrayHandleConstant<vtkm::UInt8> shapes =
cellset.GetShapesArray(vtkm::TopologyElementTagCell(), vtkm::TopologyElementTagPoint()); cellset.GetShapesArray(vtkm::TopologyElementTagPoint(), vtkm::TopologyElementTagCell());
vtkm::cont::ArrayHandle<vtkm::IdComponent> numIndices = vtkm::cont::ArrayHandle<vtkm::IdComponent> numIndices =
cellset.GetNumIndicesArray(vtkm::TopologyElementTagCell(), vtkm::TopologyElementTagPoint()); cellset.GetNumIndicesArray(vtkm::TopologyElementTagPoint(), vtkm::TopologyElementTagCell());
vtkm::cont::ArrayHandle<vtkm::Id> conn = vtkm::cont::ArrayHandle<vtkm::Id> conn =
cellset.GetConnectivityArray(vtkm::TopologyElementTagCell(), vtkm::TopologyElementTagPoint()); cellset.GetConnectivityArray(vtkm::TopologyElementTagPoint(), vtkm::TopologyElementTagCell());
VTKM_TEST_ASSERT(TestArrayHandle(shapes, correctShapes, numPoints), "Got incorrect shapes"); VTKM_TEST_ASSERT(TestArrayHandle(shapes, correctShapes, numPoints), "Got incorrect shapes");
VTKM_TEST_ASSERT(TestArrayHandle(numIndices, correctNumIndices, numPoints), VTKM_TEST_ASSERT(TestArrayHandle(numIndices, correctNumIndices, numPoints),

@ -104,11 +104,11 @@ private:
//verify that the point to cell connectivity types are correct //verify that the point to cell connectivity types are correct
vtkm::cont::ArrayHandleConstant<vtkm::UInt8> shapesPointToCell = vtkm::cont::ArrayHandleConstant<vtkm::UInt8> shapesPointToCell =
cellset.GetShapesArray(vtkm::TopologyElementTagPoint(), vtkm::TopologyElementTagCell()); cellset.GetShapesArray(vtkm::TopologyElementTagCell(), vtkm::TopologyElementTagPoint());
vtkm::cont::ArrayHandleConstant<vtkm::IdComponent> numIndicesPointToCell = vtkm::cont::ArrayHandleConstant<vtkm::IdComponent> numIndicesPointToCell =
cellset.GetNumIndicesArray(vtkm::TopologyElementTagPoint(), vtkm::TopologyElementTagCell()); cellset.GetNumIndicesArray(vtkm::TopologyElementTagCell(), vtkm::TopologyElementTagPoint());
vtkm::cont::ArrayHandle<vtkm::Id> connPointToCell = vtkm::cont::ArrayHandle<vtkm::Id> connPointToCell =
cellset.GetConnectivityArray(vtkm::TopologyElementTagPoint(), vtkm::TopologyElementTagCell()); cellset.GetConnectivityArray(vtkm::TopologyElementTagCell(), vtkm::TopologyElementTagPoint());
VTKM_TEST_ASSERT(shapesPointToCell.GetNumberOfValues() == 3, "Wrong number of shapes"); VTKM_TEST_ASSERT(shapesPointToCell.GetNumberOfValues() == 3, "Wrong number of shapes");
VTKM_TEST_ASSERT(numIndicesPointToCell.GetNumberOfValues() == 3, "Wrong number of indices"); VTKM_TEST_ASSERT(numIndicesPointToCell.GetNumberOfValues() == 3, "Wrong number of indices");
@ -117,11 +117,11 @@ private:
//verify that the cell to point connectivity types are correct //verify that the cell to point connectivity types are correct
//note the handle storage types differ compared to point to cell //note the handle storage types differ compared to point to cell
vtkm::cont::ArrayHandleConstant<vtkm::UInt8> shapesCellToPoint = vtkm::cont::ArrayHandleConstant<vtkm::UInt8> shapesCellToPoint =
cellset.GetShapesArray(vtkm::TopologyElementTagCell(), vtkm::TopologyElementTagPoint()); cellset.GetShapesArray(vtkm::TopologyElementTagPoint(), vtkm::TopologyElementTagCell());
vtkm::cont::ArrayHandle<vtkm::IdComponent> numIndicesCellToPoint = vtkm::cont::ArrayHandle<vtkm::IdComponent> numIndicesCellToPoint =
cellset.GetNumIndicesArray(vtkm::TopologyElementTagCell(), vtkm::TopologyElementTagPoint()); cellset.GetNumIndicesArray(vtkm::TopologyElementTagPoint(), vtkm::TopologyElementTagCell());
vtkm::cont::ArrayHandle<vtkm::Id> connCellToPoint = vtkm::cont::ArrayHandle<vtkm::Id> connCellToPoint =
cellset.GetConnectivityArray(vtkm::TopologyElementTagCell(), vtkm::TopologyElementTagPoint()); cellset.GetConnectivityArray(vtkm::TopologyElementTagPoint(), vtkm::TopologyElementTagCell());
VTKM_TEST_ASSERT(shapesCellToPoint.GetNumberOfValues() == 5, "Wrong number of shapes"); VTKM_TEST_ASSERT(shapesCellToPoint.GetNumberOfValues() == 5, "Wrong number of shapes");
VTKM_TEST_ASSERT(numIndicesCellToPoint.GetNumberOfValues() == 5, "Wrong number of indices"); VTKM_TEST_ASSERT(numIndicesCellToPoint.GetNumberOfValues() == 5, "Wrong number of indices");

@ -2483,6 +2483,17 @@ private:
testRandomMask(0xffffffff); testRandomMask(0xffffffff);
testRandomMask(0x1c0fd395); testRandomMask(0x1c0fd395);
testRandomMask(0xdeadbeef); testRandomMask(0xdeadbeef);
// This case was causing issues on CUDA:
{
BitField bits;
Algorithm::Fill(bits, false, 32 * 32);
auto portal = bits.GetPortalControl();
portal.SetWord(2, 0x00100000ul);
portal.SetWord(8, 0x00100010ul);
portal.SetWord(11, 0x10000000ul);
testIndexArray(bits);
}
} }
static VTKM_CONT void TestCountSetBits() static VTKM_CONT void TestCountSetBits()
@ -2562,6 +2573,17 @@ private:
testRandomMask(0xffffffff); testRandomMask(0xffffffff);
testRandomMask(0x1c0fd395); testRandomMask(0x1c0fd395);
testRandomMask(0xdeadbeef); testRandomMask(0xdeadbeef);
// This case was causing issues on CUDA:
{
BitField bits;
Algorithm::Fill(bits, false, 32 * 32);
auto portal = bits.GetPortalControl();
portal.SetWord(2, 0x00100000ul);
portal.SetWord(8, 0x00100010ul);
portal.SetWord(11, 0x10000000ul);
verifyPopCount(bits);
}
} }
template <typename WordType> template <typename WordType>

@ -82,7 +82,7 @@ vtkm::cont::DataSet MakeTestDataSetCurvilinear()
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
class ParametricToWorldCoordinates : public vtkm::worklet::WorkletMapPointToCell class ParametricToWorldCoordinates : public vtkm::worklet::WorkletVisitCellsWithPoints
{ {
public: public:
using ControlSignature = void(CellSetIn cellset, using ControlSignature = void(CellSetIn cellset,

@ -65,7 +65,7 @@ vtkm::cont::CellSetExplicit<> MakeTestCellSet2()
return cs; return cs;
} }
struct WorkletPointToCell : public vtkm::worklet::WorkletMapPointToCell struct WorkletPointToCell : public vtkm::worklet::WorkletVisitCellsWithPoints
{ {
using ControlSignature = void(CellSetIn cellset, FieldOutCell numPoints); using ControlSignature = void(CellSetIn cellset, FieldOutCell numPoints);
using ExecutionSignature = void(PointIndices, _2); using ExecutionSignature = void(PointIndices, _2);
@ -78,7 +78,7 @@ struct WorkletPointToCell : public vtkm::worklet::WorkletMapPointToCell
} }
}; };
struct WorkletCellToPoint : public vtkm::worklet::WorkletMapCellToPoint struct WorkletCellToPoint : public vtkm::worklet::WorkletVisitPointsWithCells
{ {
using ControlSignature = void(CellSetIn cellset, FieldOutPoint numCells); using ControlSignature = void(CellSetIn cellset, FieldOutPoint numCells);
using ExecutionSignature = void(CellIndices, _2); using ExecutionSignature = void(CellIndices, _2);
@ -159,24 +159,24 @@ void TestCellSetExplicit()
std::cout << "\tTesting CellToPoint table caching\n"; std::cout << "\tTesting CellToPoint table caching\n";
cellset = MakeTestCellSet2(); cellset = MakeTestCellSet2();
VTKM_TEST_ASSERT(VTKM_PASS_COMMAS(cellset.HasConnectivity(PointTag{}, CellTag{})), VTKM_TEST_ASSERT(VTKM_PASS_COMMAS(cellset.HasConnectivity(CellTag{}, PointTag{})),
"PointToCell table missing."); "PointToCell table missing.");
VTKM_TEST_ASSERT(VTKM_PASS_COMMAS(!cellset.HasConnectivity(CellTag{}, PointTag{})), VTKM_TEST_ASSERT(VTKM_PASS_COMMAS(!cellset.HasConnectivity(PointTag{}, CellTag{})),
"CellToPoint table exists before PrepareForInput."); "CellToPoint table exists before PrepareForInput.");
// Test a raw PrepareForInput call: // Test a raw PrepareForInput call:
cellset.PrepareForInput(vtkm::cont::DeviceAdapterTagSerial{}, CellTag{}, PointTag{}); cellset.PrepareForInput(vtkm::cont::DeviceAdapterTagSerial{}, PointTag{}, CellTag{});
VTKM_TEST_ASSERT(VTKM_PASS_COMMAS(cellset.HasConnectivity(CellTag{}, PointTag{})), VTKM_TEST_ASSERT(VTKM_PASS_COMMAS(cellset.HasConnectivity(PointTag{}, CellTag{})),
"CellToPoint table missing after PrepareForInput."); "CellToPoint table missing after PrepareForInput.");
cellset.ResetConnectivity(CellTag{}, PointTag{}); cellset.ResetConnectivity(PointTag{}, CellTag{});
VTKM_TEST_ASSERT(VTKM_PASS_COMMAS(!cellset.HasConnectivity(CellTag{}, PointTag{})), VTKM_TEST_ASSERT(VTKM_PASS_COMMAS(!cellset.HasConnectivity(PointTag{}, CellTag{})),
"CellToPoint table exists after resetting."); "CellToPoint table exists after resetting.");
// Test a PrepareForInput wrapped inside a dispatch (See #268) // Test a PrepareForInput wrapped inside a dispatch (See #268)
vtkm::worklet::DispatcherMapTopology<WorkletCellToPoint>().Invoke(cellset, result); vtkm::worklet::DispatcherMapTopology<WorkletCellToPoint>().Invoke(cellset, result);
VTKM_TEST_ASSERT(VTKM_PASS_COMMAS(cellset.HasConnectivity(CellTag{}, PointTag{})), VTKM_TEST_ASSERT(VTKM_PASS_COMMAS(cellset.HasConnectivity(PointTag{}, CellTag{})),
"CellToPoint table missing after CellToPoint worklet exec."); "CellToPoint table missing after CellToPoint worklet exec.");
} }

@ -25,7 +25,7 @@ std::vector<int> topology = { 0, 2, 1 };
std::vector<int> nextNode = { 0, 1, 2 }; std::vector<int> nextNode = { 0, 1, 2 };
struct CopyTopo : public vtkm::worklet::WorkletMapPointToCell struct CopyTopo : public vtkm::worklet::WorkletVisitCellsWithPoints
{ {
typedef void ControlSignature(CellSetIn, FieldOutCell); typedef void ControlSignature(CellSetIn, FieldOutCell);
typedef _2 ExecutionSignature(CellShape, PointIndices); typedef _2 ExecutionSignature(CellShape, PointIndices);
@ -36,7 +36,7 @@ struct CopyTopo : public vtkm::worklet::WorkletMapPointToCell
} }
}; };
struct CopyReverseCellCount : public vtkm::worklet::WorkletMapCellToPoint struct CopyReverseCellCount : public vtkm::worklet::WorkletVisitPointsWithCells
{ {
typedef void ControlSignature(CellSetIn, FieldOutPoint); typedef void ControlSignature(CellSetIn, FieldOutPoint);
typedef _2 ExecutionSignature(CellShape, CellCount, CellIndices); typedef _2 ExecutionSignature(CellShape, CellCount, CellIndices);

@ -20,7 +20,7 @@
namespace namespace
{ {
struct WorkletPointToCell : public vtkm::worklet::WorkletMapPointToCell struct WorkletPointToCell : public vtkm::worklet::WorkletVisitCellsWithPoints
{ {
using ControlSignature = void(CellSetIn cellset, FieldOutCell numPoints); using ControlSignature = void(CellSetIn cellset, FieldOutCell numPoints);
using ExecutionSignature = void(PointIndices, _2); using ExecutionSignature = void(PointIndices, _2);
@ -33,7 +33,7 @@ struct WorkletPointToCell : public vtkm::worklet::WorkletMapPointToCell
} }
}; };
struct WorkletCellToPoint : public vtkm::worklet::WorkletMapCellToPoint struct WorkletCellToPoint : public vtkm::worklet::WorkletVisitPointsWithCells
{ {
using ControlSignature = void(CellSetIn cellset, FieldOutPoint numCells); using ControlSignature = void(CellSetIn cellset, FieldOutPoint numCells);
using ExecutionSignature = void(CellIndices, _2); using ExecutionSignature = void(CellIndices, _2);
@ -46,7 +46,7 @@ struct WorkletCellToPoint : public vtkm::worklet::WorkletMapCellToPoint
} }
}; };
struct CellsOfPoint : public vtkm::worklet::WorkletMapCellToPoint struct CellsOfPoint : public vtkm::worklet::WorkletVisitPointsWithCells
{ {
using ControlSignature = void(CellSetIn cellset, FieldInPoint offset, WholeArrayOut cellIds); using ControlSignature = void(CellSetIn cellset, FieldInPoint offset, WholeArrayOut cellIds);
using ExecutionSignature = void(CellIndices, _2, _3); using ExecutionSignature = void(CellIndices, _2, _3);

@ -105,13 +105,13 @@ void TestDataSet_Explicit()
subset.PrintSummary(std::cout); subset.PrintSummary(std::cout);
using ExecObjectType = SubsetType::ExecutionTypes<vtkm::cont::DeviceAdapterTagSerial, using ExecObjectType = SubsetType::ExecutionTypes<vtkm::cont::DeviceAdapterTagSerial,
vtkm::TopologyElementTagPoint, vtkm::TopologyElementTagCell,
vtkm::TopologyElementTagCell>::ExecObjectType; vtkm::TopologyElementTagPoint>::ExecObjectType;
ExecObjectType execConnectivity; ExecObjectType execConnectivity;
execConnectivity = subset.PrepareForInput(vtkm::cont::DeviceAdapterTagSerial(), execConnectivity = subset.PrepareForInput(vtkm::cont::DeviceAdapterTagSerial(),
vtkm::TopologyElementTagPoint(), vtkm::TopologyElementTagCell(),
vtkm::TopologyElementTagCell()); vtkm::TopologyElementTagPoint());
//run a basic for-each topology algorithm on this //run a basic for-each topology algorithm on this
vtkm::cont::ArrayHandle<vtkm::Float32> result; vtkm::cont::ArrayHandle<vtkm::Float32> result;
@ -154,7 +154,7 @@ void TestDataSet_Structured2D()
//verify that PrepareForInput exists //verify that PrepareForInput exists
subset.PrepareForInput( subset.PrepareForInput(
DeviceAdapterTag(), vtkm::TopologyElementTagPoint(), vtkm::TopologyElementTagCell()); DeviceAdapterTag(), vtkm::TopologyElementTagCell(), vtkm::TopologyElementTagPoint());
//run a basic for-each topology algorithm on this //run a basic for-each topology algorithm on this
vtkm::cont::ArrayHandle<vtkm::Float32> result; vtkm::cont::ArrayHandle<vtkm::Float32> result;
@ -193,8 +193,8 @@ void TestDataSet_Structured3D()
//verify that PrepareForInput exists //verify that PrepareForInput exists
subset.PrepareForInput(vtkm::cont::DeviceAdapterTagSerial(), subset.PrepareForInput(vtkm::cont::DeviceAdapterTagSerial(),
vtkm::TopologyElementTagPoint(), vtkm::TopologyElementTagCell(),
vtkm::TopologyElementTagCell()); vtkm::TopologyElementTagPoint());
//run a basic for-each topology algorithm on this //run a basic for-each topology algorithm on this
vtkm::cont::ArrayHandle<vtkm::Float32> result; vtkm::cont::ArrayHandle<vtkm::Float32> result;

@ -77,14 +77,14 @@ static void TwoDimRectilinearTest()
VTKM_TEST_ASSERT(shape == vtkm::CELL_SHAPE_QUAD, "Incorrect element type."); VTKM_TEST_ASSERT(shape == vtkm::CELL_SHAPE_QUAD, "Incorrect element type.");
} }
vtkm::exec::ConnectivityStructured<vtkm::TopologyElementTagPoint, vtkm::TopologyElementTagCell, 2>
pointToCell = cellSet.PrepareForInput(vtkm::cont::DeviceAdapterTagSerial(),
vtkm::TopologyElementTagPoint(),
vtkm::TopologyElementTagCell());
vtkm::exec::ConnectivityStructured<vtkm::TopologyElementTagCell, vtkm::TopologyElementTagPoint, 2> vtkm::exec::ConnectivityStructured<vtkm::TopologyElementTagCell, vtkm::TopologyElementTagPoint, 2>
cellToPoint = cellSet.PrepareForInput(vtkm::cont::DeviceAdapterTagSerial(), pointToCell = cellSet.PrepareForInput(vtkm::cont::DeviceAdapterTagSerial(),
vtkm::TopologyElementTagCell(), vtkm::TopologyElementTagCell(),
vtkm::TopologyElementTagPoint()); vtkm::TopologyElementTagPoint());
vtkm::exec::ConnectivityStructured<vtkm::TopologyElementTagPoint, vtkm::TopologyElementTagCell, 2>
cellToPoint = cellSet.PrepareForInput(vtkm::cont::DeviceAdapterTagSerial(),
vtkm::TopologyElementTagPoint(),
vtkm::TopologyElementTagCell());
vtkm::Id cells[2][4] = { { 0, 1, 4, 3 }, { 1, 2, 5, 4 } }; vtkm::Id cells[2][4] = { { 0, 1, 4, 3 }, { 1, 2, 5, 4 } };
for (vtkm::Id cellIndex = 0; cellIndex < 2; cellIndex++) for (vtkm::Id cellIndex = 0; cellIndex < 2; cellIndex++)
@ -164,10 +164,10 @@ static void ThreeDimRectilinearTest()
} }
//Test regular connectivity. //Test regular connectivity.
vtkm::exec::ConnectivityStructured<vtkm::TopologyElementTagPoint, vtkm::TopologyElementTagCell, 3> vtkm::exec::ConnectivityStructured<vtkm::TopologyElementTagCell, vtkm::TopologyElementTagPoint, 3>
pointToCell = cellSet.PrepareForInput(vtkm::cont::DeviceAdapterTagSerial(), pointToCell = cellSet.PrepareForInput(vtkm::cont::DeviceAdapterTagSerial(),
vtkm::TopologyElementTagPoint(), vtkm::TopologyElementTagCell(),
vtkm::TopologyElementTagCell()); vtkm::TopologyElementTagPoint());
vtkm::Id expectedPointIds[8] = { 0, 1, 4, 3, 6, 7, 10, 9 }; vtkm::Id expectedPointIds[8] = { 0, 1, 4, 3, 6, 7, 10, 9 };
vtkm::Vec<vtkm::Id, 8> retrievedPointIds = pointToCell.GetIndices(vtkm::Id3(0)); vtkm::Vec<vtkm::Id, 8> retrievedPointIds = pointToCell.GetIndices(vtkm::Id3(0));
for (vtkm::IdComponent localPointIndex = 0; localPointIndex < 8; localPointIndex++) for (vtkm::IdComponent localPointIndex = 0; localPointIndex < 8; localPointIndex++)
@ -176,10 +176,10 @@ static void ThreeDimRectilinearTest()
"Incorrect point ID for cell"); "Incorrect point ID for cell");
} }
vtkm::exec::ConnectivityStructured<vtkm::TopologyElementTagCell, vtkm::TopologyElementTagPoint, 3> vtkm::exec::ConnectivityStructured<vtkm::TopologyElementTagPoint, vtkm::TopologyElementTagCell, 3>
cellToPoint = cellSet.PrepareForInput(vtkm::cont::DeviceAdapterTagSerial(), cellToPoint = cellSet.PrepareForInput(vtkm::cont::DeviceAdapterTagSerial(),
vtkm::TopologyElementTagCell(), vtkm::TopologyElementTagPoint(),
vtkm::TopologyElementTagPoint()); vtkm::TopologyElementTagCell());
vtkm::Id retrievedCellIds[6] = { 0, -1, -1, -1, -1, -1 }; vtkm::Id retrievedCellIds[6] = { 0, -1, -1, -1, -1, -1 };
vtkm::VecVariable<vtkm::Id, 6> expectedCellIds = cellToPoint.GetIndices(vtkm::Id3(0)); vtkm::VecVariable<vtkm::Id, 6> expectedCellIds = cellToPoint.GetIndices(vtkm::Id3(0));
VTKM_TEST_ASSERT(expectedCellIds.GetNumberOfComponents() <= 6, VTKM_TEST_ASSERT(expectedCellIds.GetNumberOfComponents() <= 6,

@ -80,14 +80,14 @@ static void TwoDimUniformTest()
VTKM_TEST_ASSERT(shape == vtkm::CELL_SHAPE_QUAD, "Incorrect element type."); VTKM_TEST_ASSERT(shape == vtkm::CELL_SHAPE_QUAD, "Incorrect element type.");
} }
vtkm::exec::ConnectivityStructured<vtkm::TopologyElementTagPoint, vtkm::TopologyElementTagCell, 2>
pointToCell = cellSet.PrepareForInput(vtkm::cont::DeviceAdapterTagSerial(),
vtkm::TopologyElementTagPoint(),
vtkm::TopologyElementTagCell());
vtkm::exec::ConnectivityStructured<vtkm::TopologyElementTagCell, vtkm::TopologyElementTagPoint, 2> vtkm::exec::ConnectivityStructured<vtkm::TopologyElementTagCell, vtkm::TopologyElementTagPoint, 2>
cellToPoint = cellSet.PrepareForInput(vtkm::cont::DeviceAdapterTagSerial(), pointToCell = cellSet.PrepareForInput(vtkm::cont::DeviceAdapterTagSerial(),
vtkm::TopologyElementTagCell(), vtkm::TopologyElementTagCell(),
vtkm::TopologyElementTagPoint()); vtkm::TopologyElementTagPoint());
vtkm::exec::ConnectivityStructured<vtkm::TopologyElementTagPoint, vtkm::TopologyElementTagCell, 2>
cellToPoint = cellSet.PrepareForInput(vtkm::cont::DeviceAdapterTagSerial(),
vtkm::TopologyElementTagPoint(),
vtkm::TopologyElementTagCell());
vtkm::Id cells[2][4] = { { 0, 1, 4, 3 }, { 1, 2, 5, 4 } }; vtkm::Id cells[2][4] = { { 0, 1, 4, 3 }, { 1, 2, 5, 4 } };
for (vtkm::Id cellIndex = 0; cellIndex < 2; cellIndex++) for (vtkm::Id cellIndex = 0; cellIndex < 2; cellIndex++)
@ -174,10 +174,10 @@ static void ThreeDimUniformTest()
} }
//Test uniform connectivity. //Test uniform connectivity.
vtkm::exec::ConnectivityStructured<vtkm::TopologyElementTagPoint, vtkm::TopologyElementTagCell, 3> vtkm::exec::ConnectivityStructured<vtkm::TopologyElementTagCell, vtkm::TopologyElementTagPoint, 3>
pointToCell = cellSet.PrepareForInput(vtkm::cont::DeviceAdapterTagSerial(), pointToCell = cellSet.PrepareForInput(vtkm::cont::DeviceAdapterTagSerial(),
vtkm::TopologyElementTagPoint(), vtkm::TopologyElementTagCell(),
vtkm::TopologyElementTagCell()); vtkm::TopologyElementTagPoint());
vtkm::Id expectedPointIds[8] = { 0, 1, 4, 3, 6, 7, 10, 9 }; vtkm::Id expectedPointIds[8] = { 0, 1, 4, 3, 6, 7, 10, 9 };
vtkm::Vec<vtkm::Id, 8> retrievedPointIds = pointToCell.GetIndices(vtkm::Id3(0)); vtkm::Vec<vtkm::Id, 8> retrievedPointIds = pointToCell.GetIndices(vtkm::Id3(0));
for (vtkm::IdComponent localPointIndex = 0; localPointIndex < 8; localPointIndex++) for (vtkm::IdComponent localPointIndex = 0; localPointIndex < 8; localPointIndex++)
@ -186,10 +186,10 @@ static void ThreeDimUniformTest()
"Incorrect point ID for cell"); "Incorrect point ID for cell");
} }
vtkm::exec::ConnectivityStructured<vtkm::TopologyElementTagCell, vtkm::TopologyElementTagPoint, 3> vtkm::exec::ConnectivityStructured<vtkm::TopologyElementTagPoint, vtkm::TopologyElementTagCell, 3>
cellToPoint = cellSet.PrepareForInput(vtkm::cont::DeviceAdapterTagSerial(), cellToPoint = cellSet.PrepareForInput(vtkm::cont::DeviceAdapterTagSerial(),
vtkm::TopologyElementTagCell(), vtkm::TopologyElementTagPoint(),
vtkm::TopologyElementTagPoint()); vtkm::TopologyElementTagCell());
vtkm::Id retrievedCellIds[6] = { 0, -1, -1, -1, -1, -1 }; vtkm::Id retrievedCellIds[6] = { 0, -1, -1, -1, -1, -1 };
vtkm::VecVariable<vtkm::Id, 6> expectedCellIds = cellToPoint.GetIndices(vtkm::Id3(0)); vtkm::VecVariable<vtkm::Id, 6> expectedCellIds = cellToPoint.GetIndices(vtkm::Id3(0));
VTKM_TEST_ASSERT(expectedCellIds.GetNumberOfComponents() <= 6, VTKM_TEST_ASSERT(expectedCellIds.GetNumberOfComponents() <= 6,

@ -71,7 +71,7 @@ public:
DeviceAdapter) DeviceAdapter)
: Nodes(nodes.PrepareForInput(DeviceAdapter())) : Nodes(nodes.PrepareForInput(DeviceAdapter()))
, CellIds(cellIds.PrepareForInput(DeviceAdapter())) , CellIds(cellIds.PrepareForInput(DeviceAdapter()))
, CellSet(cellSet.PrepareForInput(DeviceAdapter(), FromType(), ToType())) , CellSet(cellSet.PrepareForInput(DeviceAdapter(), VisitType(), IncidentType()))
, Coords(coords.PrepareForInput(DeviceAdapter())) , Coords(coords.PrepareForInput(DeviceAdapter()))
{ {
} }
@ -243,13 +243,14 @@ private:
return success && vtkm::exec::CellInside(parametric, cellShape); return success && vtkm::exec::CellInside(parametric, cellShape);
} }
using FromType = vtkm::TopologyElementTagPoint; using VisitType = vtkm::TopologyElementTagCell;
using ToType = vtkm::TopologyElementTagCell; using IncidentType = vtkm::TopologyElementTagPoint;
using NodePortal = typename NodeArrayHandle::template ExecutionTypes<DeviceAdapter>::PortalConst; using NodePortal = typename NodeArrayHandle::template ExecutionTypes<DeviceAdapter>::PortalConst;
using CellIdPortal = using CellIdPortal =
typename CellIdArrayHandle::template ExecutionTypes<DeviceAdapter>::PortalConst; typename CellIdArrayHandle::template ExecutionTypes<DeviceAdapter>::PortalConst;
using CellSetPortal = using CellSetPortal = typename CellSetType::template ExecutionTypes<DeviceAdapter,
typename CellSetType::template ExecutionTypes<DeviceAdapter, FromType, ToType>::ExecObjectType; VisitType,
IncidentType>::ExecObjectType;
using CoordsPortal = typename vtkm::cont::ArrayHandleVirtualCoordinates::template ExecutionTypes< using CoordsPortal = typename vtkm::cont::ArrayHandleVirtualCoordinates::template ExecutionTypes<
DeviceAdapter>::PortalConst; DeviceAdapter>::PortalConst;

@ -32,11 +32,10 @@ template <typename DeviceAdapter, vtkm::IdComponent dimensions>
class VTKM_ALWAYS_EXPORT CellLocatorRectilinearGrid final : public vtkm::exec::CellLocator class VTKM_ALWAYS_EXPORT CellLocatorRectilinearGrid final : public vtkm::exec::CellLocator
{ {
private: private:
using FromType = vtkm::TopologyElementTagPoint; using VisitType = vtkm::TopologyElementTagCell;
using ToType = vtkm::TopologyElementTagCell; using IncidentType = vtkm::TopologyElementTagPoint;
using CellSetPortal = vtkm::exec::ConnectivityStructured<vtkm::TopologyElementTagPoint, using CellSetPortal = vtkm::exec::ConnectivityStructured<VisitType, IncidentType, dimensions>;
vtkm::TopologyElementTagCell,
dimensions>;
using AxisHandle = vtkm::cont::ArrayHandle<vtkm::FloatDefault>; using AxisHandle = vtkm::cont::ArrayHandle<vtkm::FloatDefault>;
using RectilinearType = using RectilinearType =
vtkm::cont::ArrayHandleCartesianProduct<AxisHandle, AxisHandle, AxisHandle>; vtkm::cont::ArrayHandleCartesianProduct<AxisHandle, AxisHandle, AxisHandle>;
@ -53,7 +52,7 @@ public:
DeviceAdapter) DeviceAdapter)
: PlaneSize(planeSize) : PlaneSize(planeSize)
, RowSize(rowSize) , RowSize(rowSize)
, CellSet(cellSet.PrepareForInput(DeviceAdapter(), FromType(), ToType())) , CellSet(cellSet.PrepareForInput(DeviceAdapter(), VisitType(), IncidentType()))
, Coords(coords.PrepareForInput(DeviceAdapter())) , Coords(coords.PrepareForInput(DeviceAdapter()))
, PointDimensions(cellSet.GetPointDimensions()) , PointDimensions(cellSet.GetPointDimensions())
{ {

@ -31,11 +31,9 @@ template <typename DeviceAdapter, vtkm::IdComponent dimensions>
class VTKM_ALWAYS_EXPORT CellLocatorUniformGrid final : public vtkm::exec::CellLocator class VTKM_ALWAYS_EXPORT CellLocatorUniformGrid final : public vtkm::exec::CellLocator
{ {
private: private:
using FromType = vtkm::TopologyElementTagPoint; using VisitType = vtkm::TopologyElementTagCell;
using ToType = vtkm::TopologyElementTagCell; using IncidentType = vtkm::TopologyElementTagPoint;
using CellSetPortal = vtkm::exec::ConnectivityStructured<vtkm::TopologyElementTagPoint, using CellSetPortal = vtkm::exec::ConnectivityStructured<VisitType, IncidentType, dimensions>;
vtkm::TopologyElementTagCell,
dimensions>;
using CoordsPortal = typename vtkm::cont::ArrayHandleVirtualCoordinates::template ExecutionTypes< using CoordsPortal = typename vtkm::cont::ArrayHandleVirtualCoordinates::template ExecutionTypes<
DeviceAdapter>::PortalConst; DeviceAdapter>::PortalConst;

@ -22,28 +22,29 @@ namespace exec
{ {
template <typename PermutationPortal, typename OriginalConnectivity> template <typename PermutationPortal, typename OriginalConnectivity>
class ConnectivityPermutedPointToCell class ConnectivityPermutedVisitCellsWithPoints
{ {
public: public:
using SchedulingRangeType = typename OriginalConnectivity::SchedulingRangeType; using SchedulingRangeType = typename OriginalConnectivity::SchedulingRangeType;
VTKM_SUPPRESS_EXEC_WARNINGS VTKM_SUPPRESS_EXEC_WARNINGS
VTKM_EXEC_CONT VTKM_EXEC_CONT
ConnectivityPermutedPointToCell() ConnectivityPermutedVisitCellsWithPoints()
: Portal() : Portal()
, Connectivity() , Connectivity()
{ {
} }
VTKM_EXEC_CONT VTKM_EXEC_CONT
ConnectivityPermutedPointToCell(const PermutationPortal& portal, const OriginalConnectivity& src) ConnectivityPermutedVisitCellsWithPoints(const PermutationPortal& portal,
const OriginalConnectivity& src)
: Portal(portal) : Portal(portal)
, Connectivity(src) , Connectivity(src)
{ {
} }
VTKM_EXEC_CONT VTKM_EXEC_CONT
ConnectivityPermutedPointToCell(const ConnectivityPermutedPointToCell& src) ConnectivityPermutedVisitCellsWithPoints(const ConnectivityPermutedVisitCellsWithPoints& src)
: Portal(src.Portal) : Portal(src.Portal)
, Connectivity(src.Connectivity) , Connectivity(src.Connectivity)
{ {
@ -82,18 +83,18 @@ public:
template <typename ConnectivityPortalType, template <typename ConnectivityPortalType,
typename NumIndicesPortalType, typename NumIndicesPortalType,
typename IndexOffsetPortalType> typename IndexOffsetPortalType>
class ConnectivityPermutedCellToPoint class ConnectivityPermutedVisitPointsWithCells
{ {
public: public:
using SchedulingRangeType = vtkm::Id; using SchedulingRangeType = vtkm::Id;
using IndicesType = vtkm::VecFromPortal<ConnectivityPortalType>; using IndicesType = vtkm::VecFromPortal<ConnectivityPortalType>;
using CellShapeTag = vtkm::CellShapeTagVertex; using CellShapeTag = vtkm::CellShapeTagVertex;
ConnectivityPermutedCellToPoint() = default; ConnectivityPermutedVisitPointsWithCells() = default;
ConnectivityPermutedCellToPoint(const ConnectivityPortalType& connectivity, ConnectivityPermutedVisitPointsWithCells(const ConnectivityPortalType& connectivity,
const NumIndicesPortalType& numIndices, const NumIndicesPortalType& numIndices,
const IndexOffsetPortalType& indexOffset) const IndexOffsetPortalType& indexOffset)
: Connectivity(connectivity) : Connectivity(connectivity)
, NumIndices(numIndices) , NumIndices(numIndices)
, IndexOffset(indexOffset) , IndexOffset(indexOffset)

@ -20,16 +20,16 @@ namespace vtkm
namespace exec namespace exec
{ {
template <typename FromTopology, typename ToTopology, vtkm::IdComponent Dimension> template <typename VisitTopology, typename IncidentTopology, vtkm::IdComponent Dimension>
class ConnectivityStructured class ConnectivityStructured
{ {
VTKM_IS_TOPOLOGY_ELEMENT_TAG(FromTopology); VTKM_IS_TOPOLOGY_ELEMENT_TAG(VisitTopology);
VTKM_IS_TOPOLOGY_ELEMENT_TAG(ToTopology); VTKM_IS_TOPOLOGY_ELEMENT_TAG(IncidentTopology);
using InternalsType = vtkm::internal::ConnectivityStructuredInternals<Dimension>; using InternalsType = vtkm::internal::ConnectivityStructuredInternals<Dimension>;
using Helper = using Helper =
vtkm::internal::ConnectivityStructuredIndexHelper<FromTopology, ToTopology, Dimension>; vtkm::internal::ConnectivityStructuredIndexHelper<VisitTopology, IncidentTopology, Dimension>;
public: public:
using SchedulingRangeType = typename InternalsType::SchedulingRangeType; using SchedulingRangeType = typename InternalsType::SchedulingRangeType;
@ -53,7 +53,8 @@ public:
} }
VTKM_EXEC_CONT VTKM_EXEC_CONT
ConnectivityStructured(const ConnectivityStructured<ToTopology, FromTopology, Dimension>& src) ConnectivityStructured(
const ConnectivityStructured<IncidentTopology, VisitTopology, Dimension>& src)
: Internals(src.Internals) : Internals(src.Internals)
{ {
} }
@ -115,7 +116,7 @@ public:
return this->Internals.GetGlobalPointIndexStart(); return this->Internals.GetGlobalPointIndexStart();
} }
friend class ConnectivityStructured<ToTopology, FromTopology, Dimension>; friend class ConnectivityStructured<IncidentTopology, VisitTopology, Dimension>;
private: private:
InternalsType Internals; InternalsType Internals;

@ -27,7 +27,7 @@ namespace exec
/// This class contains a public method named RaiseError that can be called in /// This class contains a public method named RaiseError that can be called in
/// the execution environment to signal a problem. /// the execution environment to signal a problem.
/// ///
class VTKM_NEVER_EXPORT FunctorBase class VTKM_ALWAYS_EXPORT FunctorBase
{ {
public: public:
VTKM_EXEC_CONT VTKM_EXEC_CONT

@ -25,8 +25,8 @@ set(headers
FetchTagCellSetIn.h FetchTagCellSetIn.h
FetchTagKeysIn.h FetchTagKeysIn.h
FetchTagWholeCellSetIn.h FetchTagWholeCellSetIn.h
FromCount.h IncidentElementCount.h
FromIndices.h IncidentElementIndices.h
InputIndex.h InputIndex.h
OutputIndex.h OutputIndex.h
ThreadIndices.h ThreadIndices.h

@ -13,7 +13,7 @@
#include <vtkm/exec/ConnectivityExtrude.h> #include <vtkm/exec/ConnectivityExtrude.h>
#include <vtkm/exec/arg/FetchTagArrayDirectIn.h> #include <vtkm/exec/arg/FetchTagArrayDirectIn.h>
#include <vtkm/exec/arg/FetchTagArrayTopologyMapIn.h> #include <vtkm/exec/arg/FetchTagArrayTopologyMapIn.h>
#include <vtkm/exec/arg/FromIndices.h> #include <vtkm/exec/arg/IncidentElementIndices.h>
//optimized fetches for ArrayPortalExtrude for //optimized fetches for ArrayPortalExtrude for
// - 3D Scheduling // - 3D Scheduling
@ -28,7 +28,7 @@ namespace arg
//Optimized fetch for point ids when iterating the cells ConnectivityExtrude //Optimized fetch for point ids when iterating the cells ConnectivityExtrude
template <typename FetchType, typename Device, typename ExecObjectType> template <typename FetchType, typename Device, typename ExecObjectType>
struct Fetch<FetchType, struct Fetch<FetchType,
vtkm::exec::arg::AspectTagFromIndices, vtkm::exec::arg::AspectTagIncidentElementIndices,
vtkm::exec::arg::ThreadIndicesTopologyMap<vtkm::exec::ConnectivityExtrude<Device>>, vtkm::exec::arg::ThreadIndicesTopologyMap<vtkm::exec::ConnectivityExtrude<Device>>,
ExecObjectType> ExecObjectType>
{ {
@ -42,7 +42,7 @@ struct Fetch<FetchType,
ValueType Load(const ThreadIndicesType& indices, const ExecObjectType&) const ValueType Load(const ThreadIndicesType& indices, const ExecObjectType&) const
{ {
// std::cout << "opimized fetch for point ids" << std::endl; // std::cout << "opimized fetch for point ids" << std::endl;
const auto& xgcidx = indices.GetIndicesFrom(); const auto& xgcidx = indices.GetIndicesIncident();
const vtkm::Id offset1 = (xgcidx.Planes[0] * xgcidx.NumberOfPointsPerPlane); const vtkm::Id offset1 = (xgcidx.Planes[0] * xgcidx.NumberOfPointsPerPlane);
const vtkm::Id offset2 = (xgcidx.Planes[1] * xgcidx.NumberOfPointsPerPlane); const vtkm::Id offset2 = (xgcidx.Planes[1] * xgcidx.NumberOfPointsPerPlane);
ValueType result; ValueType result;
@ -78,7 +78,7 @@ struct Fetch<vtkm::exec::arg::FetchTagArrayTopologyMapIn,
ValueType Load(const ThreadIndicesType& indices, const PortalType& portal) ValueType Load(const ThreadIndicesType& indices, const PortalType& portal)
{ {
// std::cout << "opimized fetch for point values" << std::endl; // std::cout << "opimized fetch for point values" << std::endl;
const auto& xgcidx = indices.GetIndicesFrom(); const auto& xgcidx = indices.GetIndicesIncident();
const vtkm::Id offset1 = (xgcidx.Planes[0] * xgcidx.NumberOfPointsPerPlane); const vtkm::Id offset1 = (xgcidx.Planes[0] * xgcidx.NumberOfPointsPerPlane);
const vtkm::Id offset2 = (xgcidx.Planes[1] * xgcidx.NumberOfPointsPerPlane); const vtkm::Id offset2 = (xgcidx.Planes[1] * xgcidx.NumberOfPointsPerPlane);
ValueType result; ValueType result;
@ -115,7 +115,7 @@ struct Fetch<vtkm::exec::arg::FetchTagArrayTopologyMapIn,
ValueType Load(const ThreadIndicesType& indices, const vtkm::exec::ArrayPortalExtrude<T>& points) ValueType Load(const ThreadIndicesType& indices, const vtkm::exec::ArrayPortalExtrude<T>& points)
{ {
// std::cout << "opimized fetch for point coordinates" << std::endl; // std::cout << "opimized fetch for point coordinates" << std::endl;
return points.GetWedge(indices.GetIndicesFrom()); return points.GetWedge(indices.GetIndicesIncident());
} }
VTKM_EXEC VTKM_EXEC
@ -144,7 +144,7 @@ struct Fetch<vtkm::exec::arg::FetchTagArrayTopologyMapIn,
const vtkm::exec::ArrayPortalExtrudePlane<T>& portal) const vtkm::exec::ArrayPortalExtrudePlane<T>& portal)
{ {
// std::cout << "opimized fetch for point coordinates" << std::endl; // std::cout << "opimized fetch for point coordinates" << std::endl;
return portal.GetWedge(indices.GetIndicesFrom()); return portal.GetWedge(indices.GetIndicesIncident());
} }
VTKM_EXEC VTKM_EXEC

@ -56,9 +56,9 @@ struct FetchArrayTopologyMapInImplementation
{ {
using ThreadIndicesType = vtkm::exec::arg::ThreadIndicesTopologyMap<ConnectivityType>; using ThreadIndicesType = vtkm::exec::arg::ThreadIndicesTopologyMap<ConnectivityType>;
// ThreadIndicesTopologyMap has special "from" indices that are stored in a // ThreadIndicesTopologyMap has special incident element indices that are
// Vec-like object. // stored in a Vec-like object.
using IndexVecType = typename ThreadIndicesType::IndicesFromType; using IndexVecType = typename ThreadIndicesType::IndicesIncidentType;
// The FieldExecObjectType is expected to behave like an ArrayPortal. // The FieldExecObjectType is expected to behave like an ArrayPortal.
using PortalType = FieldExecObjectType; using PortalType = FieldExecObjectType;
@ -73,7 +73,7 @@ struct FetchArrayTopologyMapInImplementation
// pointer that will stay around during the time the Vec is valid. Thus, we // pointer that will stay around during the time the Vec is valid. Thus, we
// should make sure that indices is a reference that goes up the stack at // should make sure that indices is a reference that goes up the stack at
// least as far as the returned VecFromPortalPermute is used. // least as far as the returned VecFromPortalPermute is used.
return ValueType(indices.GetIndicesFromPointer(), field); return ValueType(indices.GetIndicesIncidentPointer(), field);
} }
VTKM_SUPPRESS_EXEC_WARNINGS VTKM_SUPPRESS_EXEC_WARNINGS
@ -84,7 +84,7 @@ struct FetchArrayTopologyMapInImplementation
// pointer that will stay around during the time the Vec is valid. Thus, we // pointer that will stay around during the time the Vec is valid. Thus, we
// should make sure that indices is a reference that goes up the stack at // should make sure that indices is a reference that goes up the stack at
// least as far as the returned VecFromPortalPermute is used. // least as far as the returned VecFromPortalPermute is used.
return ValueType(indices.GetIndicesFromPointer(), field); return ValueType(indices.GetIndicesIncidentPointer(), field);
} }
}; };
@ -130,14 +130,14 @@ static inline VTKM_EXEC vtkm::VecAxisAlignedPointCoordinates<3> make_VecAxisAlig
template <vtkm::IdComponent NumDimensions> template <vtkm::IdComponent NumDimensions>
struct FetchArrayTopologyMapInImplementation< struct FetchArrayTopologyMapInImplementation<
vtkm::exec::ConnectivityStructured<vtkm::TopologyElementTagPoint, vtkm::exec::ConnectivityStructured<vtkm::TopologyElementTagCell,
vtkm::TopologyElementTagCell, vtkm::TopologyElementTagPoint,
NumDimensions>, NumDimensions>,
vtkm::internal::ArrayPortalUniformPointCoordinates> vtkm::internal::ArrayPortalUniformPointCoordinates>
{ {
using ConnectivityType = vtkm::exec::ConnectivityStructured<vtkm::TopologyElementTagPoint, using ConnectivityType = vtkm::exec::ConnectivityStructured<vtkm::TopologyElementTagCell,
vtkm::TopologyElementTagCell, vtkm::TopologyElementTagPoint,
NumDimensions>; NumDimensions>;
using ThreadIndicesType = vtkm::exec::arg::ThreadIndicesTopologyMap<ConnectivityType>; using ThreadIndicesType = vtkm::exec::arg::ThreadIndicesTopologyMap<ConnectivityType>;
@ -157,18 +157,18 @@ struct FetchArrayTopologyMapInImplementation<
template <typename PermutationPortal, vtkm::IdComponent NumDimensions> template <typename PermutationPortal, vtkm::IdComponent NumDimensions>
struct FetchArrayTopologyMapInImplementation< struct FetchArrayTopologyMapInImplementation<
vtkm::exec::ConnectivityPermutedPointToCell< vtkm::exec::ConnectivityPermutedVisitCellsWithPoints<
PermutationPortal, PermutationPortal,
vtkm::exec::ConnectivityStructured<vtkm::TopologyElementTagPoint, vtkm::exec::ConnectivityStructured<vtkm::TopologyElementTagCell,
vtkm::TopologyElementTagCell, vtkm::TopologyElementTagPoint,
NumDimensions>>, NumDimensions>>,
vtkm::internal::ArrayPortalUniformPointCoordinates> vtkm::internal::ArrayPortalUniformPointCoordinates>
{ {
using ConnectivityType = vtkm::exec::ConnectivityPermutedPointToCell< using ConnectivityType = vtkm::exec::ConnectivityPermutedVisitCellsWithPoints<
PermutationPortal, PermutationPortal,
vtkm::exec::ConnectivityStructured<vtkm::TopologyElementTagPoint, vtkm::exec::ConnectivityStructured<vtkm::TopologyElementTagCell,
vtkm::TopologyElementTagCell, vtkm::TopologyElementTagPoint,
NumDimensions>>; NumDimensions>>;
using ThreadIndicesType = vtkm::exec::arg::ThreadIndicesTopologyMap<ConnectivityType>; using ThreadIndicesType = vtkm::exec::arg::ThreadIndicesTopologyMap<ConnectivityType>;

@ -7,8 +7,8 @@
// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR // the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
// PURPOSE. See the above copyright notice for more information. // PURPOSE. See the above copyright notice for more information.
//============================================================================ //============================================================================
#ifndef vtk_m_exec_arg_FromCount_h #ifndef vtk_m_exec_arg_IncidentElementCount_h
#define vtk_m_exec_arg_FromCount_h #define vtk_m_exec_arg_IncidentElementCount_h
#include <vtkm/exec/arg/ExecutionSignatureTagBase.h> #include <vtkm/exec/arg/ExecutionSignatureTagBase.h>
#include <vtkm/exec/arg/Fetch.h> #include <vtkm/exec/arg/Fetch.h>
@ -21,32 +21,32 @@ namespace exec
namespace arg namespace arg
{ {
/// \brief Aspect tag to use for getting the from count. /// \brief Aspect tag to use for getting the incident element count.
/// ///
/// The \c AspectTagFromCount aspect tag causes the \c Fetch class to obtain /// The \c AspectTagIncidentElementCount aspect tag causes the \c Fetch class to
/// the number of indices that map to the current topology element. /// obtain the number of indices that map to the current topology element.
/// ///
struct AspectTagFromCount struct AspectTagIncidentElementCount
{ {
}; };
/// \brief The \c ExecutionSignature tag to get the number of from elements. /// \brief The \c ExecutionSignature tag to get the number of incident elements.
/// ///
/// In a topology map, there are \em from and \em to topology elements /// In a topology map, there are \em visited and \em incident topology elements
/// specified. The scheduling occurs on the \em to elements, and for each \em /// specified. The scheduling occurs on the \em visited elements, and for each
/// to element there is some number of incident \em from elements that are /// \em visited element there is some number of incident \em incident elements
/// accessible. This \c ExecutionSignature tag provides the number of these \em /// that are accessible. This \c ExecutionSignature tag provides the number of
/// from elements that are accessible. /// these \em incident elements that are accessible.
/// ///
struct FromCount : vtkm::exec::arg::ExecutionSignatureTagBase struct IncidentElementCount : vtkm::exec::arg::ExecutionSignatureTagBase
{ {
static constexpr vtkm::IdComponent INDEX = 1; static constexpr vtkm::IdComponent INDEX = 1;
using AspectTag = vtkm::exec::arg::AspectTagFromCount; using AspectTag = vtkm::exec::arg::AspectTagIncidentElementCount;
}; };
template <typename FetchTag, typename ConnectivityType, typename ExecObjectType> template <typename FetchTag, typename ConnectivityType, typename ExecObjectType>
struct Fetch<FetchTag, struct Fetch<FetchTag,
vtkm::exec::arg::AspectTagFromCount, vtkm::exec::arg::AspectTagIncidentElementCount,
vtkm::exec::arg::ThreadIndicesTopologyMap<ConnectivityType>, vtkm::exec::arg::ThreadIndicesTopologyMap<ConnectivityType>,
ExecObjectType> ExecObjectType>
{ {
@ -58,7 +58,7 @@ struct Fetch<FetchTag,
VTKM_EXEC VTKM_EXEC
ValueType Load(const ThreadIndicesType& indices, const ExecObjectType&) const ValueType Load(const ThreadIndicesType& indices, const ExecObjectType&) const
{ {
return indices.GetIndicesFrom().GetNumberOfComponents(); return indices.GetIndicesIncident().GetNumberOfComponents();
} }
VTKM_EXEC VTKM_EXEC
@ -71,4 +71,4 @@ struct Fetch<FetchTag,
} }
} // namespace vtkm::exec::arg } // namespace vtkm::exec::arg
#endif //vtk_m_exec_arg_FromCount_h #endif //vtk_m_exec_arg_IncidentElementCount_h

@ -7,8 +7,8 @@
// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR // the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
// PURPOSE. See the above copyright notice for more information. // PURPOSE. See the above copyright notice for more information.
//============================================================================ //============================================================================
#ifndef vtk_m_exec_arg_FromIndices_h #ifndef vtk_m_exec_arg_IncidentElementIndices_h
#define vtk_m_exec_arg_FromIndices_h #define vtk_m_exec_arg_IncidentElementIndices_h
#include <vtkm/exec/arg/ExecutionSignatureTagBase.h> #include <vtkm/exec/arg/ExecutionSignatureTagBase.h>
#include <vtkm/exec/arg/Fetch.h> #include <vtkm/exec/arg/Fetch.h>
@ -21,44 +21,45 @@ namespace exec
namespace arg namespace arg
{ {
/// \brief Aspect tag to use for getting the from indices. /// \brief Aspect tag to use for getting the visited indices.
/// ///
/// The \c AspectTagFromIndices aspect tag causes the \c Fetch class to obtain /// The \c AspectTagIncidentElementIndices aspect tag causes the \c Fetch class
/// the indices that map to the current topology element. /// to obtain the indices that map to the current topology element.
/// ///
struct AspectTagFromIndices struct AspectTagIncidentElementIndices
{ {
}; };
/// \brief The \c ExecutionSignature tag to get the indices of from elements. /// \brief The \c ExecutionSignature tag to get the indices of visited elements.
/// ///
/// In a topology map, there are \em from and \em to topology elements /// In a topology map, there are \em visited and \em incident topology elements
/// specified. The scheduling occurs on the \em to elements, and for each \em /// specified. The scheduling occurs on the \em visited elements, and for each
/// to element there is some number of incident \em from elements that are /// \em visited element there is some number of incident \em incident elements
/// accessible. This \c ExecutionSignature tag provides the indices of these /// that are accessible. This \c ExecutionSignature tag provides the indices of
/// \em from elements that are accessible. /// the \em incident elements that are incident to the current \em visited
/// element.
/// ///
struct FromIndices : vtkm::exec::arg::ExecutionSignatureTagBase struct IncidentElementIndices : vtkm::exec::arg::ExecutionSignatureTagBase
{ {
static constexpr vtkm::IdComponent INDEX = 1; static constexpr vtkm::IdComponent INDEX = 1;
using AspectTag = vtkm::exec::arg::AspectTagFromIndices; using AspectTag = vtkm::exec::arg::AspectTagIncidentElementIndices;
}; };
template <typename FetchTag, typename ConnectivityType, typename ExecObjectType> template <typename FetchTag, typename ConnectivityType, typename ExecObjectType>
struct Fetch<FetchTag, struct Fetch<FetchTag,
vtkm::exec::arg::AspectTagFromIndices, vtkm::exec::arg::AspectTagIncidentElementIndices,
vtkm::exec::arg::ThreadIndicesTopologyMap<ConnectivityType>, vtkm::exec::arg::ThreadIndicesTopologyMap<ConnectivityType>,
ExecObjectType> ExecObjectType>
{ {
using ThreadIndicesType = vtkm::exec::arg::ThreadIndicesTopologyMap<ConnectivityType>; using ThreadIndicesType = vtkm::exec::arg::ThreadIndicesTopologyMap<ConnectivityType>;
using ValueType = typename ThreadIndicesType::IndicesFromType; using ValueType = typename ThreadIndicesType::IndicesIncidentType;
VTKM_SUPPRESS_EXEC_WARNINGS VTKM_SUPPRESS_EXEC_WARNINGS
VTKM_EXEC VTKM_EXEC
ValueType Load(const ThreadIndicesType& indices, const ExecObjectType&) const ValueType Load(const ThreadIndicesType& indices, const ExecObjectType&) const
{ {
return indices.GetIndicesFrom(); return indices.GetIndicesIncident();
} }
VTKM_EXEC VTKM_EXEC
@ -71,4 +72,4 @@ struct Fetch<FetchTag,
} }
} // namespace vtkm::exec::arg } // namespace vtkm::exec::arg
#endif //vtk_m_exec_arg_FromIndices_h #endif //vtk_m_exec_arg_IncidentElementIndices_h

@ -29,7 +29,7 @@ class ThreadIndicesTopologyMap<vtkm::exec::ConnectivityExtrude<Device>>
public: public:
using CellShapeTag = typename ConnectivityType::CellShapeTag; using CellShapeTag = typename ConnectivityType::CellShapeTag;
using IndicesFromType = typename ConnectivityType::IndicesType; using IndicesIncidentType = typename ConnectivityType::IndicesType;
using LogicalIndexType = typename ConnectivityType::SchedulingRangeType; using LogicalIndexType = typename ConnectivityType::SchedulingRangeType;
@ -49,7 +49,7 @@ public:
this->OutputIndex = index; this->OutputIndex = index;
this->VisitIndex = 0; this->VisitIndex = 0;
this->LogicalIndex = logicalIndex; this->LogicalIndex = logicalIndex;
this->IndicesFrom = connectivity.GetIndices(logicalIndex); this->IndicesIncident = connectivity.GetIndices(logicalIndex);
//this->CellShape = connectivity.GetCellShape(index); //this->CellShape = connectivity.GetCellShape(index);
this->GlobalThreadIndexOffset = globalThreadIndexOffset; this->GlobalThreadIndexOffset = globalThreadIndexOffset;
} }
@ -70,7 +70,7 @@ public:
this->OutputIndex = index; this->OutputIndex = index;
this->VisitIndex = 0; this->VisitIndex = 0;
this->LogicalIndex = logicalIndex; this->LogicalIndex = logicalIndex;
this->IndicesFrom = connectivity.GetIndices(logicalIndex); this->IndicesIncident = connectivity.GetIndices(logicalIndex);
//this->CellShape = connectivity.GetCellShape(index); //this->CellShape = connectivity.GetCellShape(index);
this->GlobalThreadIndexOffset = globalThreadIndexOffset; this->GlobalThreadIndexOffset = globalThreadIndexOffset;
} }
@ -128,7 +128,7 @@ public:
/// containing the indices to the "from" elements. /// containing the indices to the "from" elements.
/// ///
VTKM_EXEC VTKM_EXEC
const IndicesFromType& GetIndicesFrom() const { return this->IndicesFrom; } const IndicesIncidentType& GetIndicesIncident() const { return this->IndicesIncident; }
/// \brief The input indices of the "from" elements in pointer form. /// \brief The input indices of the "from" elements in pointer form.
/// ///
@ -140,7 +140,7 @@ public:
/// not go out of scope, at which time the returned pointer becomes invalid. /// not go out of scope, at which time the returned pointer becomes invalid.
/// ///
VTKM_EXEC VTKM_EXEC
const IndicesFromType* GetIndicesFromPointer() const { return &this->IndicesFrom; } const IndicesIncidentType* GetIndicesIncidentPointer() const { return &this->IndicesIncident; }
/// \brief The shape of the input cell. /// \brief The shape of the input cell.
/// ///
@ -158,7 +158,7 @@ private:
vtkm::IdComponent VisitIndex; vtkm::IdComponent VisitIndex;
vtkm::Id OutputIndex; vtkm::Id OutputIndex;
LogicalIndexType LogicalIndex; LogicalIndexType LogicalIndex;
IndicesFromType IndicesFrom; IndicesIncidentType IndicesIncident;
//CellShapeTag CellShape; //CellShapeTag CellShape;
vtkm::Id GlobalThreadIndexOffset; vtkm::Id GlobalThreadIndexOffset;
}; };
@ -171,7 +171,7 @@ class ThreadIndicesTopologyMap<vtkm::exec::ReverseConnectivityExtrude<Device>>
public: public:
using CellShapeTag = typename ConnectivityType::CellShapeTag; using CellShapeTag = typename ConnectivityType::CellShapeTag;
using IndicesFromType = typename ConnectivityType::IndicesType; using IndicesIncidentType = typename ConnectivityType::IndicesType;
using LogicalIndexType = typename ConnectivityType::SchedulingRangeType; using LogicalIndexType = typename ConnectivityType::SchedulingRangeType;
VTKM_SUPPRESS_EXEC_WARNINGS VTKM_SUPPRESS_EXEC_WARNINGS
@ -191,7 +191,7 @@ public:
this->OutputIndex = index; this->OutputIndex = index;
this->VisitIndex = 0; this->VisitIndex = 0;
this->LogicalIndex = logicalIndex; this->LogicalIndex = logicalIndex;
this->IndicesFrom = connectivity.GetIndices(logicalIndex); this->IndicesIncident = connectivity.GetIndices(logicalIndex);
//this->CellShape = connectivity.GetCellShape(index); //this->CellShape = connectivity.GetCellShape(index);
this->GlobalThreadIndexOffset = globalThreadIndexOffset; this->GlobalThreadIndexOffset = globalThreadIndexOffset;
} }
@ -209,7 +209,7 @@ public:
this->OutputIndex = index; this->OutputIndex = index;
this->VisitIndex = 0; this->VisitIndex = 0;
this->LogicalIndex = logicalIndex; this->LogicalIndex = logicalIndex;
this->IndicesFrom = connectivity.GetIndices(logicalIndex); this->IndicesIncident = connectivity.GetIndices(logicalIndex);
//this->CellShape = connectivity.GetCellShape(index); //this->CellShape = connectivity.GetCellShape(index);
this->GlobalThreadIndexOffset = globalThreadIndexOffset; this->GlobalThreadIndexOffset = globalThreadIndexOffset;
} }
@ -266,7 +266,7 @@ public:
/// containing the indices to the "from" elements. /// containing the indices to the "from" elements.
/// ///
VTKM_EXEC VTKM_EXEC
const IndicesFromType& GetIndicesFrom() const { return this->IndicesFrom; } const IndicesIncidentType& GetIndicesIncident() const { return this->IndicesIncident; }
/// \brief The input indices of the "from" elements in pointer form. /// \brief The input indices of the "from" elements in pointer form.
/// ///
@ -278,7 +278,7 @@ public:
/// not go out of scope, at which time the returned pointer becomes invalid. /// not go out of scope, at which time the returned pointer becomes invalid.
/// ///
VTKM_EXEC VTKM_EXEC
const IndicesFromType* GetIndicesFromPointer() const { return &this->IndicesFrom; } const IndicesIncidentType* GetIndicesIncidentPointer() const { return &this->IndicesIncident; }
/// \brief The shape of the input cell. /// \brief The shape of the input cell.
/// ///
@ -296,7 +296,7 @@ private:
vtkm::IdComponent VisitIndex; vtkm::IdComponent VisitIndex;
vtkm::Id OutputIndex; vtkm::Id OutputIndex;
LogicalIndexType LogicalIndex; LogicalIndexType LogicalIndex;
IndicesFromType IndicesFrom; IndicesIncidentType IndicesIncident;
//CellShapeTag CellShape; //CellShapeTag CellShape;
vtkm::Id GlobalThreadIndexOffset; vtkm::Id GlobalThreadIndexOffset;
}; };

@ -58,15 +58,15 @@ public:
template <vtkm::IdComponent Dimension> template <vtkm::IdComponent Dimension>
VTKM_EXEC ThreadIndicesPointNeighborhood( VTKM_EXEC ThreadIndicesPointNeighborhood(
const vtkm::Id3& outIndex, const vtkm::Id3& outIndex,
const vtkm::exec::ConnectivityStructured<vtkm::TopologyElementTagCell, const vtkm::exec::ConnectivityStructured<vtkm::TopologyElementTagPoint,
vtkm::TopologyElementTagPoint, vtkm::TopologyElementTagCell,
Dimension>& connectivity, Dimension>& connectivity,
vtkm::Id globalThreadIndexOffset = 0) vtkm::Id globalThreadIndexOffset = 0)
: State(outIndex, detail::To3D(connectivity.GetPointDimensions())) : State(outIndex, detail::To3D(connectivity.GetPointDimensions()))
, GlobalThreadIndexOffset(globalThreadIndexOffset) , GlobalThreadIndexOffset(globalThreadIndexOffset)
{ {
using ConnectivityType = vtkm::exec::ConnectivityStructured<vtkm::TopologyElementTagCell, using ConnectivityType = vtkm::exec::ConnectivityStructured<vtkm::TopologyElementTagPoint,
vtkm::TopologyElementTagPoint, vtkm::TopologyElementTagCell,
Dimension>; Dimension>;
using ConnRangeType = typename ConnectivityType::SchedulingRangeType; using ConnRangeType = typename ConnectivityType::SchedulingRangeType;
const ConnRangeType index = detail::Deflate(outIndex, ConnRangeType()); const ConnRangeType index = detail::Deflate(outIndex, ConnRangeType());
@ -82,8 +82,8 @@ public:
vtkm::Id inputIndex, vtkm::Id inputIndex,
vtkm::IdComponent visitIndex, vtkm::IdComponent visitIndex,
vtkm::Id outputIndex, vtkm::Id outputIndex,
const vtkm::exec::ConnectivityStructured<vtkm::TopologyElementTagCell, const vtkm::exec::ConnectivityStructured<vtkm::TopologyElementTagPoint,
vtkm::TopologyElementTagPoint, vtkm::TopologyElementTagCell,
Dimension>& connectivity, Dimension>& connectivity,
vtkm::Id globalThreadIndexOffset = 0) vtkm::Id globalThreadIndexOffset = 0)
: State(detail::To3D(connectivity.FlatToLogicalToIndex(inputIndex)), : State(detail::To3D(connectivity.FlatToLogicalToIndex(inputIndex)),

@ -73,9 +73,9 @@ static inline VTKM_EXEC vtkm::Id2 Deflate(const vtkm::Id3& index, vtkm::Id2)
/// \brief Container for thread indices in a topology map /// \brief Container for thread indices in a topology map
/// ///
/// This specialization of \c ThreadIndices adds extra indices that deal with /// This specialization of \c ThreadIndices adds extra indices that deal with
/// topology maps. In particular, it saves the indices used to map the "from" /// topology maps. In particular, it saves the incident element indices. The
/// elements in the map. The input and output indices from the superclass are /// input and output indices from the superclass are considered to be indexing
/// considered to be indexing the "to" elements. /// the visited elements.
/// ///
/// This class is templated on the type that stores the connectivity (such /// This class is templated on the type that stores the connectivity (such
/// as \c ConnectivityExplicit or \c ConnectivityStructured). /// as \c ConnectivityExplicit or \c ConnectivityStructured).
@ -86,7 +86,7 @@ class ThreadIndicesTopologyMap : public vtkm::exec::arg::ThreadIndicesBasic
using Superclass = vtkm::exec::arg::ThreadIndicesBasic; using Superclass = vtkm::exec::arg::ThreadIndicesBasic;
public: public:
using IndicesFromType = typename ConnectivityType::IndicesType; using IndicesIncidentType = typename ConnectivityType::IndicesType;
using CellShapeTag = typename ConnectivityType::CellShapeTag; using CellShapeTag = typename ConnectivityType::CellShapeTag;
VTKM_SUPPRESS_EXEC_WARNINGS VTKM_SUPPRESS_EXEC_WARNINGS
@ -102,24 +102,24 @@ public:
// of the domain will match the connectivity type used here. If there is // of the domain will match the connectivity type used here. If there is
// a compile error here about a type mismatch, chances are a worklet has // a compile error here about a type mismatch, chances are a worklet has
// set its input domain incorrectly. // set its input domain incorrectly.
, IndicesFrom(connectivity.GetIndices(inputIndex)) , IndicesIncident(connectivity.GetIndices(inputIndex))
, CellShape(connectivity.GetCellShape(inputIndex)) , CellShape(connectivity.GetCellShape(inputIndex))
{ {
} }
/// \brief The input indices of the "from" elements. /// \brief The indices of the incident elements.
/// ///
/// A topology map has "from" and "to" elements (for example from points to /// A topology map has "visited" and "incident" elements (e.g. points, cells,
/// cells). For each worklet invocation, there is exactly one "to" element, /// etc). For each worklet invocation, there is exactly one visited element,
/// but can be several "from" element. This method returns a Vec-like object /// but there can be several incident elements. This method returns a Vec-like
/// containing the indices to the "from" elements. /// object containing the indices to the incident elements.
/// ///
VTKM_EXEC VTKM_EXEC
const IndicesFromType& GetIndicesFrom() const { return this->IndicesFrom; } const IndicesIncidentType& GetIndicesIncident() const { return this->IndicesIncident; }
/// \brief The input indices of the "from" elements in pointer form. /// \brief The input indices of the incident elements in pointer form.
/// ///
/// Returns the same object as GetIndicesFrom except that it returns a /// Returns the same object as GetIndicesIncident except that it returns a
/// pointer to the internally held object rather than a reference or copy. /// pointer to the internally held object rather than a reference or copy.
/// Since the from indices can be a sizeable Vec (8 entries is common), it is /// Since the from indices can be a sizeable Vec (8 entries is common), it is
/// best not to have a bunch a copies. Thus, you can pass around a pointer /// best not to have a bunch a copies. Thus, you can pass around a pointer
@ -127,7 +127,7 @@ public:
/// not go out of scope, at which time the returned pointer becomes invalid. /// not go out of scope, at which time the returned pointer becomes invalid.
/// ///
VTKM_EXEC VTKM_EXEC
const IndicesFromType* GetIndicesFromPointer() const { return &this->IndicesFrom; } const IndicesIncidentType* GetIndicesIncidentPointer() const { return &this->IndicesIncident; }
/// \brief The shape of the input cell. /// \brief The shape of the input cell.
/// ///
@ -140,19 +140,20 @@ public:
CellShapeTag GetCellShape() const { return this->CellShape; } CellShapeTag GetCellShape() const { return this->CellShape; }
private: private:
IndicesFromType IndicesFrom; IndicesIncidentType IndicesIncident;
CellShapeTag CellShape; CellShapeTag CellShape;
}; };
// Specialization for structured connectivity types. // Specialization for structured connectivity types.
template <typename FromTopology, typename ToTopology, vtkm::IdComponent Dimension> template <typename VisitTopology, typename IncidentTopology, vtkm::IdComponent Dimension>
class ThreadIndicesTopologyMap< class ThreadIndicesTopologyMap<
vtkm::exec::ConnectivityStructured<FromTopology, ToTopology, Dimension>> vtkm::exec::ConnectivityStructured<VisitTopology, IncidentTopology, Dimension>>
{ {
using ConnectivityType = vtkm::exec::ConnectivityStructured<FromTopology, ToTopology, Dimension>; using ConnectivityType =
vtkm::exec::ConnectivityStructured<VisitTopology, IncidentTopology, Dimension>;
public: public:
using IndicesFromType = typename ConnectivityType::IndicesType; using IndicesIncidentType = typename ConnectivityType::IndicesType;
using CellShapeTag = typename ConnectivityType::CellShapeTag; using CellShapeTag = typename ConnectivityType::CellShapeTag;
using LogicalIndexType = typename ConnectivityType::SchedulingRangeType; using LogicalIndexType = typename ConnectivityType::SchedulingRangeType;
@ -168,7 +169,7 @@ public:
this->VisitIndex = visitIndex; this->VisitIndex = visitIndex;
this->OutputIndex = outIndex; this->OutputIndex = outIndex;
this->LogicalIndex = connectivity.FlatToLogicalToIndex(this->InputIndex); this->LogicalIndex = connectivity.FlatToLogicalToIndex(this->InputIndex);
this->IndicesFrom = connectivity.GetIndices(this->LogicalIndex); this->IndicesIncident = connectivity.GetIndices(this->LogicalIndex);
this->CellShape = connectivity.GetCellShape(this->InputIndex); this->CellShape = connectivity.GetCellShape(this->InputIndex);
this->GlobalThreadIndexOffset = globalThreadIndexOffset; this->GlobalThreadIndexOffset = globalThreadIndexOffset;
} }
@ -188,7 +189,7 @@ public:
this->OutputIndex = index; this->OutputIndex = index;
this->VisitIndex = 0; this->VisitIndex = 0;
this->LogicalIndex = logicalIndex; this->LogicalIndex = logicalIndex;
this->IndicesFrom = connectivity.GetIndices(logicalIndex); this->IndicesIncident = connectivity.GetIndices(logicalIndex);
this->CellShape = connectivity.GetCellShape(index); this->CellShape = connectivity.GetCellShape(index);
this->GlobalThreadIndexOffset = globalThreadIndexOffset; this->GlobalThreadIndexOffset = globalThreadIndexOffset;
} }
@ -247,19 +248,19 @@ public:
VTKM_EXEC VTKM_EXEC
vtkm::Id GetGlobalIndex() const { return (this->GlobalThreadIndexOffset + this->OutputIndex); } vtkm::Id GetGlobalIndex() const { return (this->GlobalThreadIndexOffset + this->OutputIndex); }
/// \brief The input indices of the "from" elements. /// \brief The indices of the incident elements.
/// ///
/// A topology map has "from" and "to" elements (for example from points to /// A topology map has "visited" and "incident" elements (e.g. points, cells,
/// cells). For each worklet invocation, there is exactly one "to" element, /// etc). For each worklet invocation, there is exactly one visited element,
/// but can be several "from" element. This method returns a Vec-like object /// but there can be several incident elements. This method returns a
/// containing the indices to the "from" elements. /// Vec-like object containing the indices to the incident elements.
/// ///
VTKM_EXEC VTKM_EXEC
const IndicesFromType& GetIndicesFrom() const { return this->IndicesFrom; } const IndicesIncidentType& GetIndicesIncident() const { return this->IndicesIncident; }
/// \brief The input indices of the "from" elements in pointer form. /// \brief The input indices of the incident elements in pointer form.
/// ///
/// Returns the same object as GetIndicesFrom except that it returns a /// Returns the same object as GetIndicesIncident except that it returns a
/// pointer to the internally held object rather than a reference or copy. /// pointer to the internally held object rather than a reference or copy.
/// Since the from indices can be a sizeable Vec (8 entries is common), it is /// Since the from indices can be a sizeable Vec (8 entries is common), it is
/// best not to have a bunch a copies. Thus, you can pass around a pointer /// best not to have a bunch a copies. Thus, you can pass around a pointer
@ -267,7 +268,7 @@ public:
/// not go out of scope, at which time the returned pointer becomes invalid. /// not go out of scope, at which time the returned pointer becomes invalid.
/// ///
VTKM_EXEC VTKM_EXEC
const IndicesFromType* GetIndicesFromPointer() const { return &this->IndicesFrom; } const IndicesIncidentType* GetIndicesIncidentPointer() const { return &this->IndicesIncident; }
/// \brief The shape of the input cell. /// \brief The shape of the input cell.
/// ///
@ -285,29 +286,29 @@ private:
vtkm::IdComponent VisitIndex; vtkm::IdComponent VisitIndex;
vtkm::Id OutputIndex; vtkm::Id OutputIndex;
LogicalIndexType LogicalIndex; LogicalIndexType LogicalIndex;
IndicesFromType IndicesFrom; IndicesIncidentType IndicesIncident;
CellShapeTag CellShape; CellShapeTag CellShape;
vtkm::Id GlobalThreadIndexOffset; vtkm::Id GlobalThreadIndexOffset;
}; };
// Specialization for permuted structured connectivity types. // Specialization for permuted structured connectivity types.
template <typename PermutationPortal, vtkm::IdComponent Dimension> template <typename PermutationPortal, vtkm::IdComponent Dimension>
class ThreadIndicesTopologyMap<vtkm::exec::ConnectivityPermutedPointToCell< class ThreadIndicesTopologyMap<vtkm::exec::ConnectivityPermutedVisitCellsWithPoints<
PermutationPortal, PermutationPortal,
vtkm::exec:: vtkm::exec::
ConnectivityStructured<vtkm::TopologyElementTagPoint, vtkm::TopologyElementTagCell, Dimension>>> ConnectivityStructured<vtkm::TopologyElementTagCell, vtkm::TopologyElementTagPoint, Dimension>>>
{ {
using PermutedConnectivityType = vtkm::exec::ConnectivityPermutedPointToCell< using PermutedConnectivityType = vtkm::exec::ConnectivityPermutedVisitCellsWithPoints<
PermutationPortal, PermutationPortal,
vtkm::exec::ConnectivityStructured<vtkm::TopologyElementTagPoint, vtkm::exec::ConnectivityStructured<vtkm::TopologyElementTagCell,
vtkm::TopologyElementTagCell, vtkm::TopologyElementTagPoint,
Dimension>>; Dimension>>;
using ConnectivityType = vtkm::exec::ConnectivityStructured<vtkm::TopologyElementTagPoint, using ConnectivityType = vtkm::exec::ConnectivityStructured<vtkm::TopologyElementTagCell,
vtkm::TopologyElementTagCell, vtkm::TopologyElementTagPoint,
Dimension>; Dimension>;
public: public:
using IndicesFromType = typename ConnectivityType::IndicesType; using IndicesIncidentType = typename ConnectivityType::IndicesType;
using CellShapeTag = typename ConnectivityType::CellShapeTag; using CellShapeTag = typename ConnectivityType::CellShapeTag;
using LogicalIndexType = typename ConnectivityType::SchedulingRangeType; using LogicalIndexType = typename ConnectivityType::SchedulingRangeType;
@ -325,7 +326,7 @@ public:
const vtkm::Id permutedIndex = permutation.Portal.Get(this->InputIndex); const vtkm::Id permutedIndex = permutation.Portal.Get(this->InputIndex);
this->LogicalIndex = permutation.Connectivity.FlatToLogicalToIndex(permutedIndex); this->LogicalIndex = permutation.Connectivity.FlatToLogicalToIndex(permutedIndex);
this->IndicesFrom = permutation.Connectivity.GetIndices(this->LogicalIndex); this->IndicesIncident = permutation.Connectivity.GetIndices(this->LogicalIndex);
this->CellShape = permutation.Connectivity.GetCellShape(permutedIndex); this->CellShape = permutation.Connectivity.GetCellShape(permutedIndex);
this->GlobalThreadIndexOffset = globalThreadIndexOffset; this->GlobalThreadIndexOffset = globalThreadIndexOffset;
} }
@ -384,19 +385,19 @@ public:
VTKM_EXEC VTKM_EXEC
vtkm::Id GetGlobalIndex() const { return (this->GlobalThreadIndexOffset + this->OutputIndex); } vtkm::Id GetGlobalIndex() const { return (this->GlobalThreadIndexOffset + this->OutputIndex); }
/// \brief The input indices of the "from" elements. /// \brief The indices of the incident elements.
/// ///
/// A topology map has "from" and "to" elements (for example from points to /// A topology map has "visited" and "incident" elements (e.g. points, cells,
/// cells). For each worklet invocation, there is exactly one "to" element, /// etc). For each worklet invocation, there is exactly one visited element,
/// but can be several "from" element. This method returns a Vec-like object /// but there can be several incident elements. This method returns a
/// containing the indices to the "from" elements. /// Vec-like object containing the indices to the incident elements.
/// ///
VTKM_EXEC VTKM_EXEC
const IndicesFromType& GetIndicesFrom() const { return this->IndicesFrom; } const IndicesIncidentType& GetIndicesIncident() const { return this->IndicesIncident; }
/// \brief The input indices of the "from" elements in pointer form. /// \brief The input indices of the incident elements in pointer form.
/// ///
/// Returns the same object as GetIndicesFrom except that it returns a /// Returns the same object as GetIndicesIncident except that it returns a
/// pointer to the internally held object rather than a reference or copy. /// pointer to the internally held object rather than a reference or copy.
/// Since the from indices can be a sizeable Vec (8 entries is common), it is /// Since the from indices can be a sizeable Vec (8 entries is common), it is
/// best not to have a bunch a copies. Thus, you can pass around a pointer /// best not to have a bunch a copies. Thus, you can pass around a pointer
@ -404,7 +405,7 @@ public:
/// not go out of scope, at which time the returned pointer becomes invalid. /// not go out of scope, at which time the returned pointer becomes invalid.
/// ///
VTKM_EXEC VTKM_EXEC
const IndicesFromType* GetIndicesFromPointer() const { return &this->IndicesFrom; } const IndicesIncidentType* GetIndicesIncidentPointer() const { return &this->IndicesIncident; }
/// \brief The shape of the input cell. /// \brief The shape of the input cell.
/// ///
@ -422,7 +423,7 @@ private:
vtkm::IdComponent VisitIndex; vtkm::IdComponent VisitIndex;
vtkm::Id OutputIndex; vtkm::Id OutputIndex;
LogicalIndexType LogicalIndex; LogicalIndexType LogicalIndex;
IndicesFromType IndicesFrom; IndicesIncidentType IndicesIncident;
CellShapeTag CellShape; CellShapeTag CellShape;
vtkm::Id GlobalThreadIndexOffset; vtkm::Id GlobalThreadIndexOffset;
}; };

@ -105,8 +105,8 @@ struct FetchArrayNeighborhoodInTests
vtkm::internal::ConnectivityStructuredInternals<3> connectivityInternals; vtkm::internal::ConnectivityStructuredInternals<3> connectivityInternals;
connectivityInternals.SetPointDimensions(POINT_DIMS); connectivityInternals.SetPointDimensions(POINT_DIMS);
vtkm::exec::ConnectivityStructured<vtkm::TopologyElementTagCell, vtkm::exec::ConnectivityStructured<vtkm::TopologyElementTagPoint,
vtkm::TopologyElementTagPoint, vtkm::TopologyElementTagCell,
3> 3>
connectivity(connectivityInternals); connectivity(connectivityInternals);

@ -107,8 +107,8 @@ struct FetchArrayTopologyMapInTests
vtkm::internal::ConnectivityStructuredInternals<3> connectivityInternals; vtkm::internal::ConnectivityStructuredInternals<3> connectivityInternals;
connectivityInternals.SetPointDimensions(vtkm::Id3(2, 2, 2)); connectivityInternals.SetPointDimensions(vtkm::Id3(2, 2, 2));
vtkm::exec::ConnectivityStructured<vtkm::TopologyElementTagPoint, vtkm::exec::ConnectivityStructured<vtkm::TopologyElementTagCell,
vtkm::TopologyElementTagCell, vtkm::TopologyElementTagPoint,
3> 3>
connectivity(connectivityInternals); connectivity(connectivityInternals);
@ -182,8 +182,8 @@ void TryStructuredPointCoordinatesInvocation(const Invocation& invocation)
template <vtkm::IdComponent NumDimensions> template <vtkm::IdComponent NumDimensions>
void TryStructuredPointCoordinates( void TryStructuredPointCoordinates(
const vtkm::exec::ConnectivityStructured<vtkm::TopologyElementTagPoint, const vtkm::exec::ConnectivityStructured<vtkm::TopologyElementTagCell,
vtkm::TopologyElementTagCell, vtkm::TopologyElementTagPoint,
NumDimensions>& connectivity, NumDimensions>& connectivity,
const vtkm::internal::ArrayPortalUniformPointCoordinates& coordinates) const vtkm::internal::ArrayPortalUniformPointCoordinates& coordinates)
{ {
@ -221,21 +221,21 @@ void TryStructuredPointCoordinates()
std::cout << "3D" << std::endl; std::cout << "3D" << std::endl;
vtkm::internal::ConnectivityStructuredInternals<3> connectivityInternals3d; vtkm::internal::ConnectivityStructuredInternals<3> connectivityInternals3d;
connectivityInternals3d.SetPointDimensions(vtkm::Id3(3, 2, 2)); connectivityInternals3d.SetPointDimensions(vtkm::Id3(3, 2, 2));
vtkm::exec::ConnectivityStructured<vtkm::TopologyElementTagPoint, vtkm::TopologyElementTagCell, 3> vtkm::exec::ConnectivityStructured<vtkm::TopologyElementTagCell, vtkm::TopologyElementTagPoint, 3>
connectivity3d(connectivityInternals3d); connectivity3d(connectivityInternals3d);
TryStructuredPointCoordinates(connectivity3d, coordinates); TryStructuredPointCoordinates(connectivity3d, coordinates);
std::cout << "2D" << std::endl; std::cout << "2D" << std::endl;
vtkm::internal::ConnectivityStructuredInternals<2> connectivityInternals2d; vtkm::internal::ConnectivityStructuredInternals<2> connectivityInternals2d;
connectivityInternals2d.SetPointDimensions(vtkm::Id2(3, 2)); connectivityInternals2d.SetPointDimensions(vtkm::Id2(3, 2));
vtkm::exec::ConnectivityStructured<vtkm::TopologyElementTagPoint, vtkm::TopologyElementTagCell, 2> vtkm::exec::ConnectivityStructured<vtkm::TopologyElementTagCell, vtkm::TopologyElementTagPoint, 2>
connectivity2d(connectivityInternals2d); connectivity2d(connectivityInternals2d);
TryStructuredPointCoordinates(connectivity2d, coordinates); TryStructuredPointCoordinates(connectivity2d, coordinates);
std::cout << "1D" << std::endl; std::cout << "1D" << std::endl;
vtkm::internal::ConnectivityStructuredInternals<1> connectivityInternals1d; vtkm::internal::ConnectivityStructuredInternals<1> connectivityInternals1d;
connectivityInternals1d.SetPointDimensions(3); connectivityInternals1d.SetPointDimensions(3);
vtkm::exec::ConnectivityStructured<vtkm::TopologyElementTagPoint, vtkm::TopologyElementTagCell, 1> vtkm::exec::ConnectivityStructured<vtkm::TopologyElementTagCell, vtkm::TopologyElementTagPoint, 1>
connectivity1d(connectivityInternals1d); connectivity1d(connectivityInternals1d);
TryStructuredPointCoordinates(connectivity1d, coordinates); TryStructuredPointCoordinates(connectivity1d, coordinates);
} }

@ -30,6 +30,8 @@ template <typename IntegrationType>
class CellMeasures : public vtkm::filter::FilterCell<CellMeasures<IntegrationType>> class CellMeasures : public vtkm::filter::FilterCell<CellMeasures<IntegrationType>>
{ {
public: public:
using SupportedTypes = vtkm::TypeListTagFieldVec3;
VTKM_CONT VTKM_CONT
CellMeasures(); CellMeasures();
@ -44,13 +46,6 @@ public:
const vtkm::filter::FieldMetadata& fieldMeta, const vtkm::filter::FieldMetadata& fieldMeta,
const vtkm::filter::PolicyBase<DerivedPolicy>& policy); const vtkm::filter::PolicyBase<DerivedPolicy>& policy);
}; };
template <typename IntegrationType>
class FilterTraits<CellMeasures<IntegrationType>>
{
public:
using InputFieldTypeList = vtkm::TypeListTagFieldVec3;
};
} }
} // namespace vtkm::filter } // namespace vtkm::filter

@ -22,6 +22,7 @@ namespace filter
class CellSetConnectivity : public vtkm::filter::FilterCell<CellSetConnectivity> class CellSetConnectivity : public vtkm::filter::FilterCell<CellSetConnectivity>
{ {
public: public:
using SupportedTypes = vtkm::TypeListTagScalarAll;
VTKM_CONT CellSetConnectivity(); VTKM_CONT CellSetConnectivity();
template <typename T, typename StorageType, typename DerivedPolicy> template <typename T, typename StorageType, typename DerivedPolicy>
@ -30,15 +31,6 @@ public:
const vtkm::filter::FieldMetadata& fieldMetadata, const vtkm::filter::FieldMetadata& fieldMetadata,
const vtkm::filter::PolicyBase<DerivedPolicy>&); const vtkm::filter::PolicyBase<DerivedPolicy>&);
}; };
template <>
class FilterTraits<vtkm::filter::CellSetConnectivity>
{
public:
struct InputFieldTypeList : vtkm::TypeListTagScalarAll
{
};
};
} }
} }

@ -27,6 +27,8 @@ namespace filter
class ClipWithField : public vtkm::filter::FilterDataSetWithField<ClipWithField> class ClipWithField : public vtkm::filter::FilterDataSetWithField<ClipWithField>
{ {
public: public:
using SupportedTypes = vtkm::TypeListTagScalarAll;
VTKM_CONT VTKM_CONT
ClipWithField(); ClipWithField();
@ -58,13 +60,6 @@ private:
vtkm::worklet::Clip Worklet; vtkm::worklet::Clip Worklet;
bool Invert; bool Invert;
}; };
template <>
class FilterTraits<ClipWithField>
{ //currently the Clip filter only works on scalar data.
public:
using InputFieldTypeList = TypeListTagScalarAll;
};
} }
} // namespace vtkm::filter } // namespace vtkm::filter

@ -73,6 +73,8 @@ namespace filter
class ContourTreeMesh2D : public vtkm::filter::FilterField<ContourTreeMesh2D> class ContourTreeMesh2D : public vtkm::filter::FilterField<ContourTreeMesh2D>
{ {
public: public:
using SupportedTypes = TypeListTagScalarAll;
VTKM_CONT VTKM_CONT
ContourTreeMesh2D(); ContourTreeMesh2D();
@ -84,13 +86,6 @@ public:
const vtkm::filter::PolicyBase<DerivedPolicy>& policy); const vtkm::filter::PolicyBase<DerivedPolicy>& policy);
}; };
template <>
class FilterTraits<ContourTreeMesh2D>
{
public:
using InputFieldTypeList = TypeListTagScalarAll;
};
/// \brief Construct the ContourTree for a 3D Mesh /// \brief Construct the ContourTree for a 3D Mesh
/// ///
/// Output field "saddlePeak" which is pairs of vertex ids indicating saddle and /// Output field "saddlePeak" which is pairs of vertex ids indicating saddle and
@ -100,6 +95,8 @@ public:
class ContourTreeMesh3D : public vtkm::filter::FilterField<ContourTreeMesh3D> class ContourTreeMesh3D : public vtkm::filter::FilterField<ContourTreeMesh3D>
{ {
public: public:
using SupportedTypes = TypeListTagScalarAll;
VTKM_CONT VTKM_CONT
ContourTreeMesh3D(); ContourTreeMesh3D();
@ -110,13 +107,6 @@ public:
const vtkm::filter::FieldMetadata& fieldMeta, const vtkm::filter::FieldMetadata& fieldMeta,
const vtkm::filter::PolicyBase<DerivedPolicy>& policy); const vtkm::filter::PolicyBase<DerivedPolicy>& policy);
}; };
template <>
class FilterTraits<ContourTreeMesh3D>
{
public:
using InputFieldTypeList = TypeListTagScalarAll;
};
} }
} // namespace vtkm::filter } // namespace vtkm::filter

@ -72,6 +72,7 @@ namespace filter
class ContourTreePPP2 : public vtkm::filter::FilterField<ContourTreePPP2> class ContourTreePPP2 : public vtkm::filter::FilterField<ContourTreePPP2>
{ {
public: public:
using SupportedTypes = vtkm::TypeListTagScalarAll;
VTKM_CONT VTKM_CONT
ContourTreePPP2(bool useMarchingCubes = false, bool computeRegularStructure = true); ContourTreePPP2(bool useMarchingCubes = false, bool computeRegularStructure = true);
@ -100,12 +101,6 @@ private:
MeshSortOrder; // Array with the sorted order of the mesh vertices MeshSortOrder; // Array with the sorted order of the mesh vertices
}; };
template <>
class FilterTraits<ContourTreePPP2>
{
public:
typedef TypeListTagScalarAll InputFieldTypeList;
};
// Helper struct to collect sizing information from the dataset // Helper struct to collect sizing information from the dataset
struct GetRowsColsSlices struct GetRowsColsSlices

@ -25,6 +25,8 @@ class CylindricalCoordinateTransform
: public vtkm::filter::FilterField<CylindricalCoordinateTransform> : public vtkm::filter::FilterField<CylindricalCoordinateTransform>
{ {
public: public:
using SupportedTypes = vtkm::TypeListTagFieldVec3;
VTKM_CONT VTKM_CONT
CylindricalCoordinateTransform(); CylindricalCoordinateTransform();
@ -41,17 +43,11 @@ private:
vtkm::worklet::CylindricalCoordinateTransform Worklet; vtkm::worklet::CylindricalCoordinateTransform Worklet;
}; };
template <>
class FilterTraits<CylindricalCoordinateTransform>
{
public:
//Point Elevation can only convert Float and Double Vec3 arrays
using InputFieldTypeList = vtkm::TypeListTagFieldVec3;
};
class SphericalCoordinateTransform : public vtkm::filter::FilterField<SphericalCoordinateTransform> class SphericalCoordinateTransform : public vtkm::filter::FilterField<SphericalCoordinateTransform>
{ {
public: public:
using SupportedTypes = vtkm::TypeListTagFieldVec3;
VTKM_CONT VTKM_CONT
SphericalCoordinateTransform(); SphericalCoordinateTransform();
@ -68,14 +64,6 @@ public:
private: private:
vtkm::worklet::SphericalCoordinateTransform Worklet; vtkm::worklet::SphericalCoordinateTransform Worklet;
}; };
template <>
class FilterTraits<SphericalCoordinateTransform>
{
public:
//CoordinateSystemTransformation can only convert Float and Double Vec3 arrays
using InputFieldTypeList = vtkm::TypeListTagFieldVec3;
};
} }
} // namespace vtkm::filter } // namespace vtkm::filter

@ -22,6 +22,9 @@ namespace filter
class CrossProduct : public vtkm::filter::FilterField<CrossProduct> class CrossProduct : public vtkm::filter::FilterField<CrossProduct>
{ {
public: public:
//currently the DotProduct filter only works on vector data.
using SupportedTypes = TypeListTagVecCommon;
VTKM_CONT VTKM_CONT
CrossProduct(); CrossProduct();
@ -138,13 +141,6 @@ private:
bool UseCoordinateSystemAsSecondaryField; bool UseCoordinateSystemAsSecondaryField;
vtkm::Id SecondaryCoordinateSystemIndex; vtkm::Id SecondaryCoordinateSystemIndex;
}; };
template <>
class FilterTraits<CrossProduct>
{ //currently the CrossProduct filter only works on vector data.
public:
using InputFieldTypeList = TypeListTagVecCommon;
};
} }
} // namespace vtkm::filter } // namespace vtkm::filter

@ -22,6 +22,9 @@ namespace filter
class DotProduct : public vtkm::filter::FilterField<DotProduct> class DotProduct : public vtkm::filter::FilterField<DotProduct>
{ {
public: public:
//currently the DotProduct filter only works on vector data.
using SupportedTypes = TypeListTagVecCommon;
VTKM_CONT VTKM_CONT
DotProduct(); DotProduct();
@ -138,13 +141,6 @@ private:
bool UseCoordinateSystemAsSecondaryField; bool UseCoordinateSystemAsSecondaryField;
vtkm::Id SecondaryCoordinateSystemIndex; vtkm::Id SecondaryCoordinateSystemIndex;
}; };
template <>
class FilterTraits<DotProduct>
{ //currently the DotProduct filter only works on vector data.
public:
using InputFieldTypeList = TypeListTagVecCommon;
};
} }
} // namespace vtkm::filter } // namespace vtkm::filter

@ -25,6 +25,9 @@ namespace filter
class Entropy : public vtkm::filter::FilterField<Entropy> class Entropy : public vtkm::filter::FilterField<Entropy>
{ {
public: public:
//currently the Entropy filter only works on scalar data.
using SupportedTypes = TypeListTagScalarAll;
//Construct a histogram which is used to compute the entropy with a default of 10 bins //Construct a histogram which is used to compute the entropy with a default of 10 bins
VTKM_CONT VTKM_CONT
Entropy(); Entropy();
@ -41,13 +44,6 @@ public:
private: private:
vtkm::Id NumberOfBins; vtkm::Id NumberOfBins;
}; };
template <>
class FilterTraits<Entropy>
{
public:
using InputFieldTypeList = TypeListTagScalarAll;
};
} }
} // namespace vtkm::filter } // namespace vtkm::filter

@ -38,6 +38,9 @@ namespace filter
class ExtractGeometry : public vtkm::filter::FilterDataSet<ExtractGeometry> class ExtractGeometry : public vtkm::filter::FilterDataSet<ExtractGeometry>
{ {
public: public:
//currently the ExtractGeometry filter only works on scalar data.
using SupportedTypes = TypeListTagScalarAll;
VTKM_CONT VTKM_CONT
ExtractGeometry(); ExtractGeometry();
@ -94,13 +97,6 @@ private:
vtkm::cont::ImplicitFunctionHandle Function; vtkm::cont::ImplicitFunctionHandle Function;
vtkm::worklet::ExtractGeometry Worklet; vtkm::worklet::ExtractGeometry Worklet;
}; };
template <>
class FilterTraits<ExtractGeometry>
{ //currently the ExtractGeometry filter only works on scalar data.
public:
using InputFieldTypeList = TypeListTagScalarAll;
};
} }
} // namespace vtkm::filter } // namespace vtkm::filter

@ -173,6 +173,14 @@ public:
VTKM_CONT VTKM_CONT
~Filter(); ~Filter();
//@{
/// \brief Specify which subset of types a filter supports.
///
/// A filter is able to state what subset of types it supports
/// by default. By default we use ListTagUniversal to represent that the
/// filter accepts all types specified by the users provided policy
using SupportedTypes = vtkm::ListTagUniversal;
//@{ //@{
/// \brief Specify which fields get passed from input to output. /// \brief Specify which fields get passed from input to output.
/// ///

@ -18,27 +18,30 @@ namespace vtkm
namespace filter namespace filter
{ {
struct DefaultFieldTag template <typename Derived>
class Filter;
namespace detail
{ {
// template<typename T> vtkm::ListTagBase<T> as_list(T);
vtkm::ListTagUniversal as_list(vtkm::ListTagUniversal);
template <typename... T>
vtkm::ListTagBase<T...> as_list(vtkm::ListTagBase<T...>);
}
template <typename Filter>
struct FilterTraits
{
using InputFieldTypeList =
decltype(detail::as_list(std::declval<typename Filter::SupportedTypes>()));
}; };
template <typename Filter, typename FieldTag = DefaultFieldTag> template <typename DerivedPolicy, typename ListOfTypes>
class FilterTraits
{
public:
// A filter is able to state what subset of types it supports
// by default. By default we use ListTagUniversal to represent that the
// filter accepts all types specified by the users provided policy
using InputFieldTypeList = vtkm::ListTagUniversal;
};
template <typename DerivedPolicy, typename FilterType, typename FieldTag>
struct DeduceFilterFieldTypes struct DeduceFilterFieldTypes
{ {
using FList = typename vtkm::filter::FilterTraits<FilterType, FieldTag>::InputFieldTypeList;
using PList = typename DerivedPolicy::FieldTypeList; using PList = typename DerivedPolicy::FieldTypeList;
using TypeList = vtkm::ListTagIntersect<ListOfTypes, PList>;
using TypeList = vtkm::ListTagIntersect<FList, PList>;
}; };
} }
} }

@ -30,6 +30,9 @@ struct GhostCellRemovePolicy : vtkm::filter::PolicyBase<GhostCellRemovePolicy>
class GhostCellRemove : public vtkm::filter::FilterDataSetWithField<GhostCellRemove> class GhostCellRemove : public vtkm::filter::FilterDataSetWithField<GhostCellRemove>
{ {
public: public:
//currently the GhostCellRemove filter only works on uint8 data.
using SupportedTypes = vtkm::ListTagBase<vtkm::UInt8>;
VTKM_CONT VTKM_CONT
GhostCellRemove(); GhostCellRemove();
@ -82,13 +85,6 @@ private:
VTKM_CONT vtkm::cont::CellSetExplicit<> ConvertOutputToUnstructured( VTKM_CONT vtkm::cont::CellSetExplicit<> ConvertOutputToUnstructured(
vtkm::cont::DynamicCellSet& inCells); vtkm::cont::DynamicCellSet& inCells);
}; };
template <>
class FilterTraits<GhostCellRemove>
{ //currently the GhostCellRemove filter only works on uint8 data.
public:
using InputFieldTypeList = vtkm::ListTagBase<vtkm::UInt8>;
};
} }
} // namespace vtkm::filter } // namespace vtkm::filter

@ -30,6 +30,9 @@ namespace filter
class Gradient : public vtkm::filter::FilterCell<Gradient> class Gradient : public vtkm::filter::FilterCell<Gradient>
{ {
public: public:
using SupportedTypes =
vtkm::ListTagBase<vtkm::Float32, vtkm::Float64, vtkm::Vec3f_32, vtkm::Vec3f_64>;
/// When this flag is on (default is off), the gradient filter will provide a /// When this flag is on (default is off), the gradient filter will provide a
/// point based gradients, which are significantly more costly since for each /// point based gradients, which are significantly more costly since for each
/// point we need to compute the gradient of each cell that uses it. /// point we need to compute the gradient of each cell that uses it.
@ -104,18 +107,6 @@ private:
std::string QCriterionName = "QCriterion"; std::string QCriterionName = "QCriterion";
std::string VorticityName = "Vorticity"; std::string VorticityName = "Vorticity";
}; };
template <>
class FilterTraits<Gradient>
{
public:
struct TypeListTagGradientInputs
: vtkm::ListTagBase<vtkm::Float32, vtkm::Float64, vtkm::Vec3f_32, vtkm::Vec3f_64>
{
};
using InputFieldTypeList = TypeListTagGradientInputs;
};
} }
} // namespace vtkm::filter } // namespace vtkm::filter

@ -25,6 +25,8 @@ namespace filter
class Histogram : public vtkm::filter::FilterField<Histogram> class Histogram : public vtkm::filter::FilterField<Histogram>
{ {
public: public:
using SupportedTypes = vtkm::TypeListTagScalarAll;
//Construct a histogram with a default of 10 bins //Construct a histogram with a default of 10 bins
VTKM_CONT VTKM_CONT
Histogram(); Histogram();
@ -82,15 +84,6 @@ private:
vtkm::Range ComputedRange; vtkm::Range ComputedRange;
vtkm::Range Range; vtkm::Range Range;
}; };
template <>
class FilterTraits<Histogram>
{ //currently the Histogram filter only works on scalar data.
//this mainly has to do with getting the ranges for each bin
//would require returning a more complex value type
public:
using InputFieldTypeList = TypeListTagScalarAll;
};
} }
} // namespace vtkm::filter } // namespace vtkm::filter

@ -21,6 +21,8 @@ namespace filter
class ImageConnectivity : public vtkm::filter::FilterCell<ImageConnectivity> class ImageConnectivity : public vtkm::filter::FilterCell<ImageConnectivity>
{ {
public: public:
using SupportedTypes = vtkm::TypeListTagScalarAll;
VTKM_CONT ImageConnectivity(); VTKM_CONT ImageConnectivity();
template <typename T, typename StorageType, typename DerivedPolicy> template <typename T, typename StorageType, typename DerivedPolicy>
@ -29,15 +31,6 @@ public:
const vtkm::filter::FieldMetadata& fieldMetadata, const vtkm::filter::FieldMetadata& fieldMetadata,
const vtkm::filter::PolicyBase<DerivedPolicy>&); const vtkm::filter::PolicyBase<DerivedPolicy>&);
}; };
template <>
class FilterTraits<vtkm::filter::ImageConnectivity>
{
public:
struct InputFieldTypeList : vtkm::TypeListTagScalarAll
{
};
};
} }
} // namespace vtkm::filter } // namespace vtkm::filter

@ -21,6 +21,8 @@ namespace filter
class Lagrangian : public vtkm::filter::FilterDataSetWithField<Lagrangian> class Lagrangian : public vtkm::filter::FilterDataSetWithField<Lagrangian>
{ {
public: public:
using SupportedTypes = vtkm::TypeListTagFieldVec3;
VTKM_CONT VTKM_CONT
Lagrangian(); Lagrangian();
@ -91,16 +93,6 @@ private:
vtkm::Id3 SeedRes; vtkm::Id3 SeedRes;
vtkm::Id writeFrequency; vtkm::Id writeFrequency;
}; };
template <>
class FilterTraits<Lagrangian>
{
public:
struct TypeListTagLagrangian : vtkm::ListTagBase<vtkm::Vec3f_32, vtkm::Vec3f_64>
{
};
using InputFieldTypeList = TypeListTagLagrangian;
};
} }
} // namespace vtkm::filter } // namespace vtkm::filter

@ -28,6 +28,8 @@ namespace filter
class MarchingCubes : public vtkm::filter::FilterDataSetWithField<MarchingCubes> class MarchingCubes : public vtkm::filter::FilterDataSetWithField<MarchingCubes>
{ {
public: public:
using SupportedTypes = vtkm::ListTagBase<vtkm::UInt8, vtkm::Int8, vtkm::Float32, vtkm::Float64>;
VTKM_CONT VTKM_CONT
MarchingCubes(); MarchingCubes();
@ -117,17 +119,6 @@ private:
std::string NormalArrayName; std::string NormalArrayName;
vtkm::worklet::MarchingCubes Worklet; vtkm::worklet::MarchingCubes Worklet;
}; };
template <>
class FilterTraits<MarchingCubes>
{
public:
struct TypeListTagMCScalars
: vtkm::ListTagBase<vtkm::UInt8, vtkm::Int8, vtkm::Float32, vtkm::Float64>
{
};
using InputFieldTypeList = TypeListTagMCScalars;
};
} }
} // namespace vtkm::filter } // namespace vtkm::filter

@ -66,6 +66,8 @@ enum class CellMetric
class MeshQuality : public vtkm::filter::FilterCell<MeshQuality> class MeshQuality : public vtkm::filter::FilterCell<MeshQuality>
{ {
public: public:
using SupportedTypes = vtkm::TypeListTagFieldVec3;
using ShapeMetricsVecType = std::vector<vtkm::Pair<vtkm::UInt8, CellMetric>>; using ShapeMetricsVecType = std::vector<vtkm::Pair<vtkm::UInt8, CellMetric>>;
VTKM_CONT MeshQuality(const ShapeMetricsVecType& metrics); VTKM_CONT MeshQuality(const ShapeMetricsVecType& metrics);
@ -84,15 +86,6 @@ private:
std::vector<CellMetric> CellTypeMetrics; std::vector<CellMetric> CellTypeMetrics;
}; };
template <>
class FilterTraits<vtkm::filter::MeshQuality>
{
public:
using InputFieldTypeList = vtkm::TypeListTagFieldVec3;
};
} // namespace filter } // namespace filter
} // namespace vtkm } // namespace vtkm

@ -87,7 +87,7 @@ inline VTKM_CONT vtkm::cont::DataSet MeshQuality::DoExecute(
input.GetCellSet(this->GetActiveCellSetIndex()).CopyTo(cellSet); input.GetCellSet(this->GetActiveCellSetIndex()).CopyTo(cellSet);
ShapeHandle cellShapes = ShapeHandle cellShapes =
cellSet.GetShapesArray(vtkm::TopologyElementTagPoint(), vtkm::TopologyElementTagCell()); cellSet.GetShapesArray(vtkm::TopologyElementTagCell(), vtkm::TopologyElementTagPoint());
//Obtain the frequency counts of each cell type in the input dataset //Obtain the frequency counts of each cell type in the input dataset
IdHandle uniqueCellCounts; IdHandle uniqueCellCounts;

@ -27,6 +27,8 @@ namespace filter
class OscillatorSource : public vtkm::filter::FilterField<OscillatorSource> class OscillatorSource : public vtkm::filter::FilterField<OscillatorSource>
{ {
public: public:
using SupportedTypes = vtkm::TypeListTagFieldVec3;
VTKM_CONT VTKM_CONT
OscillatorSource(); OscillatorSource();
@ -66,14 +68,6 @@ public:
private: private:
vtkm::worklet::OscillatorSource Worklet; vtkm::worklet::OscillatorSource Worklet;
}; };
template <>
class FilterTraits<OscillatorSource>
{
public:
//Point Oscillator can only convert Float and Double Vec3 arrays
using InputFieldTypeList = vtkm::TypeListTagFieldVec3;
};
} }
} }

@ -27,6 +27,8 @@ namespace filter
class Pathline : public vtkm::filter::FilterDataSetWithField<Pathline> class Pathline : public vtkm::filter::FilterDataSetWithField<Pathline>
{ {
public: public:
using SupportedTypes = vtkm::TypeListTagFieldVec3;
VTKM_CONT VTKM_CONT
Pathline(); Pathline();
@ -71,16 +73,6 @@ private:
vtkm::Id NumberOfSteps; vtkm::Id NumberOfSteps;
vtkm::cont::ArrayHandle<vtkm::Vec3f> Seeds; vtkm::cont::ArrayHandle<vtkm::Vec3f> Seeds;
}; };
template <>
class FilterTraits<Pathline>
{
public:
struct TypeListTagPathline : vtkm::ListTagBase<vtkm::Vec3f_32, vtkm::Vec3f_64>
{
};
using InputFieldTypeList = TypeListTagPathline;
};
} }
} // namespace vtkm::filter } // namespace vtkm::filter

@ -28,6 +28,8 @@ namespace filter
class PointElevation : public vtkm::filter::FilterField<PointElevation> class PointElevation : public vtkm::filter::FilterField<PointElevation>
{ {
public: public:
using SupportedTypes = vtkm::TypeListTagFieldVec3;
VTKM_CONT VTKM_CONT
PointElevation(); PointElevation();
@ -49,14 +51,6 @@ public:
private: private:
vtkm::worklet::PointElevation Worklet; vtkm::worklet::PointElevation Worklet;
}; };
template <>
class FilterTraits<PointElevation>
{
public:
//Point Elevation can only convert Float and Double Vec3 arrays
using InputFieldTypeList = vtkm::TypeListTagFieldVec3;
};
} }
} // namespace vtkm::filter } // namespace vtkm::filter

@ -25,6 +25,8 @@ template <typename S>
class PointTransform : public vtkm::filter::FilterField<PointTransform<S>> class PointTransform : public vtkm::filter::FilterField<PointTransform<S>>
{ {
public: public:
using SupportedTypes = vtkm::TypeListTagFieldVec3;
VTKM_CONT VTKM_CONT
PointTransform(); PointTransform();
@ -59,14 +61,6 @@ public:
private: private:
vtkm::worklet::PointTransform<S> Worklet; vtkm::worklet::PointTransform<S> Worklet;
}; };
template <typename S>
class FilterTraits<PointTransform<S>>
{
public:
//PointTransformation can only convert Float and Double Vec3 arrays
using InputFieldTypeList = vtkm::TypeListTagFieldVec3;
};
} }
} // namespace vtkm::filter } // namespace vtkm::filter

@ -49,15 +49,30 @@ VTKM_CONT vtkm::cont::VariantArrayHandleBase<typename DerivedPolicy::FieldTypeLi
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
template <typename DerivedPolicy, typename FilterType, typename FieldTag> template <typename DerivedPolicy, typename FilterType>
VTKM_CONT vtkm::cont::VariantArrayHandleBase< VTKM_CONT vtkm::cont::VariantArrayHandleBase<typename vtkm::filter::DeduceFilterFieldTypes<
typename vtkm::filter::DeduceFilterFieldTypes<DerivedPolicy, FilterType, FieldTag>::TypeList> DerivedPolicy,
typename vtkm::filter::FilterTraits<FilterType>::InputFieldTypeList>::TypeList>
ApplyPolicy(const vtkm::cont::Field& field, ApplyPolicy(const vtkm::cont::Field& field,
const vtkm::filter::PolicyBase<DerivedPolicy>&, const vtkm::filter::PolicyBase<DerivedPolicy>&,
const vtkm::filter::FilterTraits<FilterType, FieldTag>&) const vtkm::filter::FilterTraits<FilterType>&)
{
using FilterTypes = typename vtkm::filter::FilterTraits<FilterType>::InputFieldTypeList;
using TypeList =
typename vtkm::filter::DeduceFilterFieldTypes<DerivedPolicy, FilterTypes>::TypeList;
return field.GetData().ResetTypes(TypeList());
}
//-----------------------------------------------------------------------------
template <typename DerivedPolicy, typename ListOfTypes>
VTKM_CONT vtkm::cont::VariantArrayHandleBase<
typename vtkm::filter::DeduceFilterFieldTypes<DerivedPolicy, ListOfTypes>::TypeList>
ApplyPolicy(const vtkm::cont::Field& field,
const vtkm::filter::PolicyBase<DerivedPolicy>&,
const ListOfTypes&)
{ {
using TypeList = using TypeList =
typename vtkm::filter::DeduceFilterFieldTypes<DerivedPolicy, FilterType, FieldTag>::TypeList; typename vtkm::filter::DeduceFilterFieldTypes<DerivedPolicy, ListOfTypes>::TypeList;
return field.GetData().ResetTypes(TypeList()); return field.GetData().ResetTypes(TypeList());
} }

@ -35,6 +35,9 @@ namespace filter
class SplitSharpEdges : public vtkm::filter::FilterDataSetWithField<SplitSharpEdges> class SplitSharpEdges : public vtkm::filter::FilterDataSetWithField<SplitSharpEdges>
{ {
public: public:
// SplitSharpEdges filter needs cell normals to decide split.
using SupportedTypes = vtkm::TypeListTagFieldVec3;
VTKM_CONT VTKM_CONT
SplitSharpEdges(); SplitSharpEdges();
@ -61,13 +64,6 @@ private:
vtkm::FloatDefault FeatureAngle; vtkm::FloatDefault FeatureAngle;
vtkm::worklet::SplitSharpEdges Worklet; vtkm::worklet::SplitSharpEdges Worklet;
}; };
template <>
class FilterTraits<SplitSharpEdges>
{ // SplitSharpEdges filter needs cell normals to decide split.
public:
using InputFieldTypeList = vtkm::TypeListTagFieldVec3;
};
} }
} // namespace vtkm::filter } // namespace vtkm::filter

@ -27,6 +27,8 @@ namespace filter
class Streamline : public vtkm::filter::FilterDataSetWithField<Streamline> class Streamline : public vtkm::filter::FilterDataSetWithField<Streamline>
{ {
public: public:
using SupportedTypes = vtkm::TypeListTagFieldVec3;
VTKM_CONT VTKM_CONT
Streamline(); Streamline();
@ -60,16 +62,6 @@ private:
vtkm::Id NumberOfSteps; vtkm::Id NumberOfSteps;
vtkm::cont::ArrayHandle<vtkm::Vec3f> Seeds; vtkm::cont::ArrayHandle<vtkm::Vec3f> Seeds;
}; };
template <>
class FilterTraits<Streamline>
{
public:
struct TypeListTagStreamline : vtkm::ListTagBase<vtkm::Vec3f_32, vtkm::Vec3f_64>
{
};
using InputFieldTypeList = TypeListTagStreamline;
};
} }
} // namespace vtkm::filter } // namespace vtkm::filter

@ -26,34 +26,72 @@ namespace filter
class SurfaceNormals : public vtkm::filter::FilterCell<SurfaceNormals> class SurfaceNormals : public vtkm::filter::FilterCell<SurfaceNormals>
{ {
public: public:
using SupportedTypes = vtkm::TypeListTagFieldVec3;
/// Create SurfaceNormals filter. This calls /// Create SurfaceNormals filter. This calls
/// this->SetUseCoordinateSystemAsField(true) since that is the most common /// this->SetUseCoordinateSystemAsField(true) since that is the most common
/// use-case for surface normals. /// use-case for surface normals.
SurfaceNormals(); SurfaceNormals();
/// Set/Get if cell normals should be generated. Default is off. /// Set/Get if cell normals should be generated. Default is off.
/// @{
void SetGenerateCellNormals(bool value) { this->GenerateCellNormals = value; } void SetGenerateCellNormals(bool value) { this->GenerateCellNormals = value; }
bool GetGenerateCellNormals() const { return this->GenerateCellNormals; } bool GetGenerateCellNormals() const { return this->GenerateCellNormals; }
/// @}
/// Set/Get if the cell normals should be normalized. Default value is true. /// Set/Get if the cell normals should be normalized. Default value is true.
/// The intended use case of this flag is for faster, approximate point /// The intended use case of this flag is for faster, approximate point
/// normals generation by skipping the normalization of the face normals. /// normals generation by skipping the normalization of the face normals.
/// Note that when set to false, the result cell normals will not be unit /// Note that when set to false, the result cell normals will not be unit
/// length normals and the point normals will be different. /// length normals and the point normals will be different.
/// @{
void SetNormalizeCellNormals(bool value) { this->NormalizeCellNormals = value; } void SetNormalizeCellNormals(bool value) { this->NormalizeCellNormals = value; }
bool GetNormalizeCellNormals() const { return this->NormalizeCellNormals; } bool GetNormalizeCellNormals() const { return this->NormalizeCellNormals; }
/// @}
/// Set/Get if the point normals should be generated. Default is on. /// Set/Get if the point normals should be generated. Default is on.
/// @{
void SetGeneratePointNormals(bool value) { this->GeneratePointNormals = value; } void SetGeneratePointNormals(bool value) { this->GeneratePointNormals = value; }
bool GetGeneratePointNormals() const { return this->GeneratePointNormals; } bool GetGeneratePointNormals() const { return this->GeneratePointNormals; }
/// @}
/// Set/Get the name of the cell normals field. Default is "Normals". /// Set/Get the name of the cell normals field. Default is "Normals".
/// @{
void SetCellNormalsName(const std::string& name) { this->CellNormalsName = name; } void SetCellNormalsName(const std::string& name) { this->CellNormalsName = name; }
const std::string& GetCellNormalsName() const { return this->CellNormalsName; } const std::string& GetCellNormalsName() const { return this->CellNormalsName; }
/// @}
/// Set/Get the name of the point normals field. Default is "Normals". /// Set/Get the name of the point normals field. Default is "Normals".
/// @{
void SetPointNormalsName(const std::string& name) { this->PointNormalsName = name; } void SetPointNormalsName(const std::string& name) { this->PointNormalsName = name; }
const std::string& GetPointNormalsName() const { return this->PointNormalsName; } const std::string& GetPointNormalsName() const { return this->PointNormalsName; }
/// @}
/// If true, the normals will be oriented to face outwards from the surface.
/// This requires a closed manifold surface or the behavior is undefined.
/// This option is expensive but necessary for rendering.
/// To make the normals point inward, set FlipNormals to true.
/// @{
void SetAutoOrientNormals(bool v) { this->AutoOrientNormals = v; }
bool GetAutoOrientNormals() const { return this->AutoOrientNormals; }
/// @}
/// Reverse the normals to point inward when AutoOrientNormals is true.
/// Default is false.
/// @{
void SetFlipNormals(bool v) { this->FlipNormals = v; }
bool GetFlipNormals() const { return this->FlipNormals; }
/// @}
/// Ensure that polygon winding is consistent with normal orientation.
/// Triangles are wound such that their points are counter-clockwise around
/// the generated cell normal. Default is true.
/// @note This currently only affects triangles.
/// @note This is only applied when cell normals are generated.
/// @{
void SetConsistency(bool v) { this->Consistency = v; }
bool GetConsistency() const { return this->Consistency; }
/// @}
template <typename T, typename StorageType, typename DerivedPolicy> template <typename T, typename StorageType, typename DerivedPolicy>
vtkm::cont::DataSet DoExecute(const vtkm::cont::DataSet& input, vtkm::cont::DataSet DoExecute(const vtkm::cont::DataSet& input,
@ -65,17 +103,13 @@ private:
bool GenerateCellNormals; bool GenerateCellNormals;
bool NormalizeCellNormals; bool NormalizeCellNormals;
bool GeneratePointNormals; bool GeneratePointNormals;
bool AutoOrientNormals;
bool FlipNormals;
bool Consistency;
std::string CellNormalsName; std::string CellNormalsName;
std::string PointNormalsName; std::string PointNormalsName;
}; };
template <>
class FilterTraits<SurfaceNormals>
{
public:
using InputFieldTypeList = vtkm::TypeListTagFieldVec3;
};
} }
} // vtkm::filter } // vtkm::filter

@ -8,9 +8,13 @@
// PURPOSE. See the above copyright notice for more information. // PURPOSE. See the above copyright notice for more information.
//============================================================================ //============================================================================
#include <vtkm/filter/SurfaceNormals.h>
#include <vtkm/cont/ErrorFilterExecution.h> #include <vtkm/cont/ErrorFilterExecution.h>
#include <vtkm/filter/internal/CreateResult.h> #include <vtkm/filter/internal/CreateResult.h>
#include <vtkm/worklet/OrientNormals.h>
#include <vtkm/worklet/SurfaceNormals.h> #include <vtkm/worklet/SurfaceNormals.h>
#include <vtkm/worklet/TriangleWinding.h>
namespace vtkm namespace vtkm
{ {
@ -58,6 +62,9 @@ inline SurfaceNormals::SurfaceNormals()
: GenerateCellNormals(false) : GenerateCellNormals(false)
, NormalizeCellNormals(true) , NormalizeCellNormals(true)
, GeneratePointNormals(true) , GeneratePointNormals(true)
, AutoOrientNormals(false)
, FlipNormals(false)
, Consistency(true)
{ {
this->SetUseCoordinateSystemAsField(true); this->SetUseCoordinateSystemAsField(true);
} }
@ -76,19 +83,22 @@ inline vtkm::cont::DataSet SurfaceNormals::DoExecute(
throw vtkm::cont::ErrorFilterExecution("No normals selected."); throw vtkm::cont::ErrorFilterExecution("No normals selected.");
} }
const auto& cellset = input.GetCellSet(this->GetActiveCellSetIndex()); const auto cellset =
vtkm::filter::ApplyPolicyUnstructured(input.GetCellSet(this->GetActiveCellSetIndex()), policy);
const auto& coords = input.GetCoordinateSystem(this->GetActiveCoordinateSystemIndex()).GetData();
vtkm::cont::ArrayHandle<vtkm::Vec3f> faceNormals; vtkm::cont::ArrayHandle<vtkm::Vec3f> faceNormals;
vtkm::worklet::FacetedSurfaceNormals faceted; vtkm::worklet::FacetedSurfaceNormals faceted;
faceted.SetNormalize(this->NormalizeCellNormals); faceted.SetNormalize(this->NormalizeCellNormals);
faceted.Run(vtkm::filter::ApplyPolicy(cellset, policy), points, faceNormals); faceted.Run(cellset, points, faceNormals);
vtkm::cont::DataSet result; vtkm::cont::DataSet result;
vtkm::cont::ArrayHandle<vtkm::Vec3f> pointNormals;
if (this->GeneratePointNormals) if (this->GeneratePointNormals)
{ {
vtkm::cont::ArrayHandle<vtkm::Vec3f> pointNormals;
vtkm::worklet::SmoothSurfaceNormals smooth; vtkm::worklet::SmoothSurfaceNormals smooth;
smooth.Run(vtkm::filter::ApplyPolicy(cellset, policy), faceNormals, pointNormals); smooth.Run(cellset, faceNormals, pointNormals);
result = internal::CreateResult(input, result = internal::CreateResult(input,
pointNormals, pointNormals,
@ -111,6 +121,66 @@ inline vtkm::cont::DataSet SurfaceNormals::DoExecute(
cellset.GetName()); cellset.GetName());
} }
if (this->AutoOrientNormals)
{
using Orient = vtkm::worklet::OrientNormals;
if (this->GenerateCellNormals && this->GeneratePointNormals)
{
Orient::RunPointAndCellNormals(cellset, coords, pointNormals, faceNormals);
}
else if (this->GenerateCellNormals)
{
Orient::RunCellNormals(cellset, coords, faceNormals);
}
else if (this->GeneratePointNormals)
{
Orient::RunPointNormals(cellset, coords, pointNormals);
}
if (this->FlipNormals)
{
if (this->GenerateCellNormals)
{
Orient::RunFlipNormals(faceNormals);
}
if (this->GeneratePointNormals)
{
Orient::RunFlipNormals(pointNormals);
}
}
}
if (this->Consistency && this->GenerateCellNormals)
{
auto newCells = vtkm::worklet::TriangleWinding::Run(cellset, coords, faceNormals);
// Add the new cells into the result:
vtkm::cont::DataSet newResult;
for (vtkm::Id i = 0; i < result.GetNumberOfCoordinateSystems(); ++i)
{
newResult.AddCoordinateSystem(result.GetCoordinateSystem(i));
}
const vtkm::Id activeCells = this->GetActiveCellSetIndex();
for (vtkm::Id i = 0; i < result.GetNumberOfCellSets(); ++i)
{
if (i != activeCells)
{
newResult.AddCellSet(result.GetCellSet(i));
}
else
{
newResult.AddCellSet(newCells);
}
}
for (vtkm::Id i = 0; i < result.GetNumberOfFields(); ++i)
{
newResult.AddField(result.GetField(i));
}
result = newResult;
}
return result; return result;
} }
} }

@ -31,6 +31,8 @@ namespace filter
class Threshold : public vtkm::filter::FilterDataSetWithField<Threshold> class Threshold : public vtkm::filter::FilterDataSetWithField<Threshold>
{ {
public: public:
using SupportedTypes = vtkm::TypeListTagScalarAll;
VTKM_CONT VTKM_CONT
Threshold(); Threshold();
@ -63,13 +65,6 @@ private:
double UpperValue; double UpperValue;
vtkm::worklet::Threshold Worklet; vtkm::worklet::Threshold Worklet;
}; };
template <>
class FilterTraits<Threshold>
{ //currently the threshold filter only works on scalar data.
public:
using InputFieldTypeList = TypeListTagScalarAll;
};
} }
} // namespace vtkm::filter } // namespace vtkm::filter

@ -23,6 +23,8 @@ namespace filter
class ThresholdPoints : public vtkm::filter::FilterDataSetWithField<ThresholdPoints> class ThresholdPoints : public vtkm::filter::FilterDataSetWithField<ThresholdPoints>
{ {
public: public:
using SupportedTypes = vtkm::TypeListTagScalarAll;
VTKM_CONT VTKM_CONT
ThresholdPoints(); ThresholdPoints();
@ -72,13 +74,6 @@ private:
bool CompactPoints; bool CompactPoints;
vtkm::filter::CleanGrid Compactor; vtkm::filter::CleanGrid Compactor;
}; };
template <>
class FilterTraits<ThresholdPoints>
{ //currently the threshold filter only works on scalar data.
public:
using InputFieldTypeList = TypeListTagScalarAll;
};
} }
} // namespace vtkm::filter } // namespace vtkm::filter

@ -22,6 +22,9 @@ namespace filter
class VectorMagnitude : public vtkm::filter::FilterField<VectorMagnitude> class VectorMagnitude : public vtkm::filter::FilterField<VectorMagnitude>
{ {
public: public:
//currently the VectorMagnitude filter only works on vector data.
using SupportedTypes = vtkm::TypeListTagVecCommon;
VTKM_CONT VTKM_CONT
VectorMagnitude(); VectorMagnitude();
@ -34,13 +37,6 @@ public:
private: private:
vtkm::worklet::Magnitude Worklet; vtkm::worklet::Magnitude Worklet;
}; };
template <>
class FilterTraits<VectorMagnitude>
{ //currently the VectorMagnitude filter only works on vector data.
public:
using InputFieldTypeList = TypeListTagVecCommon;
};
} }
} // namespace vtkm::filter } // namespace vtkm::filter

@ -29,6 +29,9 @@ namespace filter
class WarpScalar : public vtkm::filter::FilterField<WarpScalar> class WarpScalar : public vtkm::filter::FilterField<WarpScalar>
{ {
public: public:
// WarpScalar can only applies to Float and Double Vec3 arrays
using SupportedTypes = vtkm::TypeListTagFieldVec3;
VTKM_CONT VTKM_CONT
WarpScalar(vtkm::FloatDefault scaleAmount); WarpScalar(vtkm::FloatDefault scaleAmount);
@ -90,24 +93,6 @@ private:
vtkm::cont::Field::Association ScalarFactorFieldAssociation; vtkm::cont::Field::Association ScalarFactorFieldAssociation;
vtkm::FloatDefault ScaleAmount; vtkm::FloatDefault ScaleAmount;
}; };
template <>
class FilterTraits<WarpScalar>
{
public:
// WarpScalar can only applies to Float and Double Vec3 arrays
using InputFieldTypeList = vtkm::TypeListTagFieldVec3;
};
struct WarpScalarScalarFieldTag
{
};
template <>
struct FilterTraits<WarpScalar, WarpScalarScalarFieldTag>
{
using InputFieldTypeList = vtkm::TypeListTagFieldScalar;
};
} }
} }

@ -46,8 +46,7 @@ inline VTKM_CONT vtkm::cont::DataSet WarpScalar::DoExecute(
this->Worklet.Run( this->Worklet.Run(
field, field,
vtkm::filter::ApplyPolicy(normalF, policy, vtkm::filter::FilterTraits<WarpScalar>()), vtkm::filter::ApplyPolicy(normalF, policy, vtkm::filter::FilterTraits<WarpScalar>()),
vtkm::filter::ApplyPolicy( vtkm::filter::ApplyPolicy(sfF, policy, vtkm::TypeListTagFieldScalar{}),
sfF, policy, vtkm::filter::FilterTraits<WarpScalar, WarpScalarScalarFieldTag>()),
this->ScaleAmount, this->ScaleAmount,
result); result);

@ -29,6 +29,8 @@ namespace filter
class WarpVector : public vtkm::filter::FilterField<WarpVector> class WarpVector : public vtkm::filter::FilterField<WarpVector>
{ {
public: public:
using SupportedTypes = vtkm::TypeListTagFieldVec3;
VTKM_CONT VTKM_CONT
WarpVector(vtkm::FloatDefault scale); WarpVector(vtkm::FloatDefault scale);
@ -65,14 +67,6 @@ private:
vtkm::cont::Field::Association VectorFieldAssociation; vtkm::cont::Field::Association VectorFieldAssociation;
vtkm::FloatDefault Scale; vtkm::FloatDefault Scale;
}; };
template <>
class FilterTraits<WarpVector>
{
public:
// WarpVector can only applies to Float and Double Vec3 arrays
using InputFieldTypeList = vtkm::TypeListTagFieldVec3;
};
} }
} }

@ -27,6 +27,8 @@ namespace filter
class ZFPCompressor1D : public vtkm::filter::FilterField<ZFPCompressor1D> class ZFPCompressor1D : public vtkm::filter::FilterField<ZFPCompressor1D>
{ {
public: public:
using SupportedTypes = vtkm::ListTagBase<vtkm::Int32, vtkm::Float32, vtkm::Float64>;
VTKM_CONT VTKM_CONT
ZFPCompressor1D(); ZFPCompressor1D();
@ -51,16 +53,6 @@ private:
vtkm::Float64 rate; vtkm::Float64 rate;
vtkm::worklet::ZFP1DCompressor compressor; vtkm::worklet::ZFP1DCompressor compressor;
}; };
template <>
class FilterTraits<ZFPCompressor1D>
{
public:
struct TypeListTagMCScalars : vtkm::ListTagBase<vtkm::Int32, vtkm::Float32, vtkm::Float64>
{
};
using InputFieldTypeList = TypeListTagMCScalars;
};
} }
} // namespace vtkm::filter } // namespace vtkm::filter

@ -27,6 +27,8 @@ namespace filter
class ZFPCompressor2D : public vtkm::filter::FilterField<ZFPCompressor2D> class ZFPCompressor2D : public vtkm::filter::FilterField<ZFPCompressor2D>
{ {
public: public:
using SupportedTypes = vtkm::ListTagBase<vtkm::Int32, vtkm::Float32, vtkm::Float64>;
VTKM_CONT VTKM_CONT
ZFPCompressor2D(); ZFPCompressor2D();
@ -51,16 +53,6 @@ private:
vtkm::Float64 rate; vtkm::Float64 rate;
vtkm::worklet::ZFP2DCompressor compressor; vtkm::worklet::ZFP2DCompressor compressor;
}; };
template <>
class FilterTraits<ZFPCompressor2D>
{
public:
struct TypeListTagMCScalars : vtkm::ListTagBase<vtkm::Int32, vtkm::Float32, vtkm::Float64>
{
};
using InputFieldTypeList = TypeListTagMCScalars;
};
} }
} // namespace vtkm::filter } // namespace vtkm::filter

@ -27,6 +27,7 @@ namespace filter
class ZFPCompressor3D : public vtkm::filter::FilterField<ZFPCompressor3D> class ZFPCompressor3D : public vtkm::filter::FilterField<ZFPCompressor3D>
{ {
public: public:
using SupportedTypes = vtkm::ListTagBase<vtkm::Int32, vtkm::Float32, vtkm::Float64>;
VTKM_CONT VTKM_CONT
ZFPCompressor3D(); ZFPCompressor3D();
@ -51,16 +52,6 @@ private:
vtkm::Float64 rate; vtkm::Float64 rate;
vtkm::worklet::ZFPCompressor compressor; vtkm::worklet::ZFPCompressor compressor;
}; };
template <>
class FilterTraits<ZFPCompressor3D>
{
public:
struct TypeListTagMCScalars : vtkm::ListTagBase<vtkm::Int32, vtkm::Float32, vtkm::Float64>
{
};
using InputFieldTypeList = TypeListTagMCScalars;
};
} }
} // namespace vtkm::filter } // namespace vtkm::filter

@ -28,6 +28,8 @@ namespace filter
class ZFPDecompressor1D : public vtkm::filter::FilterField<ZFPDecompressor1D> class ZFPDecompressor1D : public vtkm::filter::FilterField<ZFPDecompressor1D>
{ {
public: public:
using SupportedTypes = vtkm::ListTagBase<vtkm::Int32, vtkm::Int64, vtkm::Float32, vtkm::Float64>;
VTKM_CONT VTKM_CONT
ZFPDecompressor1D(); ZFPDecompressor1D();
@ -58,17 +60,6 @@ private:
vtkm::Float64 rate; vtkm::Float64 rate;
vtkm::worklet::ZFP1DDecompressor decompressor; vtkm::worklet::ZFP1DDecompressor decompressor;
}; };
template <>
class FilterTraits<ZFPDecompressor1D>
{
public:
struct TypeListTagZFP1DScalars
: vtkm::ListTagBase<vtkm::Int32, vtkm::Int64, vtkm::Float32, vtkm::Float64>
{
};
using InputFieldTypeList = TypeListTagZFP1DScalars;
};
} }
} // namespace vtkm::filter } // namespace vtkm::filter

@ -28,6 +28,8 @@ namespace filter
class ZFPDecompressor2D : public vtkm::filter::FilterField<ZFPDecompressor2D> class ZFPDecompressor2D : public vtkm::filter::FilterField<ZFPDecompressor2D>
{ {
public: public:
using SupportedTypes = vtkm::ListTagBase<vtkm::Int32, vtkm::Int64, vtkm::Float32, vtkm::Float64>;
VTKM_CONT VTKM_CONT
ZFPDecompressor2D(); ZFPDecompressor2D();
@ -58,17 +60,6 @@ private:
vtkm::Float64 rate; vtkm::Float64 rate;
vtkm::worklet::ZFP2DDecompressor decompressor; vtkm::worklet::ZFP2DDecompressor decompressor;
}; };
template <>
class FilterTraits<ZFPDecompressor2D>
{
public:
struct TypeListTagZFP1DScalars
: vtkm::ListTagBase<vtkm::Int32, vtkm::Int64, vtkm::Float32, vtkm::Float64>
{
};
using InputFieldTypeList = TypeListTagZFP1DScalars;
};
} }
} // namespace vtkm::filter } // namespace vtkm::filter

Some files were not shown because too many files have changed in this diff Show More