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+")
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 ALIAS 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
# 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
@ -248,11 +249,6 @@ if(VTKm_ENABLE_CUDA)
set_target_properties(vtkm_cuda PROPERTIES INTERFACE_CUDA_Architecture_Flags "${arch_flags}")
endif()
if (NOT TARGET vtkm::cuda)
add_library(vtkm::cuda ALIAS vtkm_cuda)
endif()
endif()
if(NOT TARGET Threads::Threads)

@ -62,6 +62,7 @@ VTK-m Requires:
+ Clang 3.3+
+ XCode 5.0+
+ MSVC 2015+
+ Intel 17.0.4+
+ [CMake](http://www.cmake.org/download/)
+ CMake 3.8+
+ CMake 3.9+ (for OpenMP support)
@ -98,7 +99,7 @@ Optional dependencies are:
VTK-m has been tested on the following configurations:c
+ 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
+ CUDA 9.2.148, 10.0.130, 10.1.105
+ 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
git repository].
```
$ git clone https://gitlab.kitware.com/vtk/vtk-m.git
The basic procedure for building VTK-m is to unpack the source, create a
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
$ cd vtkm-build
$ cmake-gui ../vtk-m
$ make -j<N>
$ make test
$ cmake-gui ../vtk-m-v1.4.0
$ cmake --build -j . # Runs make (or other build program)
```
A more detailed description of building VTK-m is available in the [VTK-m
Users Guide].
## Example##
## Example ##
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

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

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

@ -42,7 +42,7 @@ enum BenchmarkName
ALL = CELL_TO_POINT | POINT_TO_CELL | MC_CLASSIFY
};
class AveragePointToCell : public vtkm::worklet::WorkletMapPointToCell
class AveragePointToCell : public vtkm::worklet::WorkletVisitCellsWithPoints
{
public:
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:
using ControlSignature = void(FieldInCell inCells, CellSetIn topology, FieldOut outPoints);
@ -91,7 +91,7 @@ public:
// -----------------------------------------------------------------------------
template <typename T>
class Classification : public vtkm::worklet::WorkletMapPointToCell
class Classification : public vtkm::worklet::WorkletVisitCellsWithPoints
{
public:
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
#include <vtkm/filter/FilterField.h>
#include <vtkm/filter/FilterTraits.h>
namespace example
{
@ -23,6 +22,11 @@ namespace example
class HistogramMPI : public vtkm::filter::FilterField<HistogramMPI>
{
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
VTKM_CONT
HistogramMPI();
@ -82,23 +86,6 @@ private:
};
} // 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"
#endif // vtk_m_filter_Histogram_h

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

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

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

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

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

@ -99,8 +99,8 @@ private:
using CellSetP2CExecType =
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
// tests are done on the projection of the point on the cell. Extra checks
@ -140,8 +140,8 @@ public:
, CellCount(cellCount.PrepareForInput(DeviceAdapter{}))
, CellIds(cellIds.PrepareForInput(DeviceAdapter{}))
, CellSet(cellSet.PrepareForInput(DeviceAdapter{},
vtkm::TopologyElementTagPoint{},
vtkm::TopologyElementTagCell{}))
vtkm::TopologyElementTagCell{},
vtkm::TopologyElementTagPoint{}))
, Coords(coords.GetData().PrepareForInput(DeviceAdapter{}))
{
}

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

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

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

@ -50,7 +50,7 @@ namespace cont
template <typename 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
// is the cell id. We
@ -87,8 +87,8 @@ VTKM_CONT void CellSetExtrude::BuildReverseConnectivity(Device)
template <typename Device>
CellSetExtrude::ConnectivityP2C<Device> CellSetExtrude::PrepareForInput(
Device,
vtkm::TopologyElementTagPoint,
vtkm::TopologyElementTagCell) const
vtkm::TopologyElementTagCell,
vtkm::TopologyElementTagPoint) const
{
return ConnectivityP2C<Device>(this->Connectivity.PrepareForInput(Device{}),
this->NextNode.PrepareForInput(Device{}),
@ -102,8 +102,8 @@ CellSetExtrude::ConnectivityP2C<Device> CellSetExtrude::PrepareForInput(
template <typename Device>
VTKM_CONT CellSetExtrude::ConnectivityC2P<Device> CellSetExtrude::PrepareForInput(
Device,
vtkm::TopologyElementTagCell,
vtkm::TopologyElementTagPoint) const
vtkm::TopologyElementTagPoint,
vtkm::TopologyElementTagCell) const
{
if (!this->ReverseConnectivityBuilt)
{

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

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

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

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

@ -15,7 +15,7 @@
#include <vtkm/cont/TryExecute.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/Portals.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
{
vtkm::worklet::colorconversion::TransferFunction transfer(colors->PrepareForExecution(device));
vtkm::worklet::Invoker invoke(device);
vtkm::cont::Invoker invoke(device);
invoke(transfer, std::forward<Args>(args)...);
return true;
}
@ -97,7 +97,7 @@ bool ColorTable::Map(const vtkm::cont::ArrayHandle<T, S>& values,
return false;
}
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);
return true;
}
@ -112,7 +112,7 @@ bool ColorTable::Map(const vtkm::cont::ArrayHandle<T, S>& values,
return false;
}
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);
return true;
}

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

@ -28,26 +28,29 @@ namespace arg
/// \c TransportTagCellSetIn is a tag used with the \c Transport class to
/// transport topology objects for input data.
///
template <typename FromTopology, typename ToTopology>
template <typename VisitTopology, typename IncidentTopology>
struct TransportTagCellSetIn
{
};
template <typename FromTopology, typename ToTopology, typename ContObjectType, typename Device>
struct Transport<vtkm::cont::arg::TransportTagCellSetIn<FromTopology, ToTopology>,
template <typename VisitTopology,
typename IncidentTopology,
typename ContObjectType,
typename Device>
struct Transport<vtkm::cont::arg::TransportTagCellSetIn<VisitTopology, IncidentTopology>,
ContObjectType,
Device>
{
VTKM_IS_CELL_SET(ContObjectType);
using ExecObjectType = decltype(
std::declval<ContObjectType>().PrepareForInput(Device(), FromTopology(), ToTopology()));
std::declval<ContObjectType>().PrepareForInput(Device(), VisitTopology(), IncidentTopology()));
template <typename InputDomainType>
VTKM_CONT ExecObjectType
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.CompleteAddingCells(nVerts);
using FromType = vtkm::TopologyElementTagPoint;
using ToType = vtkm::TopologyElementTagCell;
using IncidentTopology = vtkm::TopologyElementTagPoint;
using VisitTopology = vtkm::TopologyElementTagCell;
using ExecObjectType =
typename vtkm::cont::CellSetExplicit<>::template ExecutionTypes<Device,
FromType,
ToType>::ExecObjectType;
using ExecObjectType = typename vtkm::cont::CellSetExplicit<>::
template ExecutionTypes<Device, VisitTopology, IncidentTopology>::ExecObjectType;
vtkm::cont::arg::Transport<vtkm::cont::arg::TransportTagCellSetIn<FromType, ToType>,
vtkm::cont::CellSetExplicit<>,
Device>
vtkm::cont::arg::Transport<
vtkm::cont::arg::TransportTagCellSetIn<VisitTopology, IncidentTopology>,
vtkm::cont::CellSetExplicit<>,
Device>
transport;
TestKernel<ExecObjectType> kernel;

@ -320,7 +320,11 @@ private:
vtkm::Int32 rVal = this->LocalPopCount;
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)
@ -511,7 +515,11 @@ private:
vtkm::Int32 rVal = this->LocalPopCount;
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)

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

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

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

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

@ -103,11 +103,11 @@ private:
vtkm::Id correctConnectivity[] = { 0, 0, 1, 0, 1, 1, 1 };
vtkm::cont::ArrayHandleConstant<vtkm::UInt8> shapes =
cellset.GetShapesArray(vtkm::TopologyElementTagCell(), vtkm::TopologyElementTagPoint());
cellset.GetShapesArray(vtkm::TopologyElementTagPoint(), vtkm::TopologyElementTagCell());
vtkm::cont::ArrayHandle<vtkm::IdComponent> numIndices =
cellset.GetNumIndicesArray(vtkm::TopologyElementTagCell(), vtkm::TopologyElementTagPoint());
cellset.GetNumIndicesArray(vtkm::TopologyElementTagPoint(), vtkm::TopologyElementTagCell());
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(numIndices, correctNumIndices, numPoints),

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

@ -2483,6 +2483,17 @@ private:
testRandomMask(0xffffffff);
testRandomMask(0x1c0fd395);
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()
@ -2562,6 +2573,17 @@ private:
testRandomMask(0xffffffff);
testRandomMask(0x1c0fd395);
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>

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

@ -65,7 +65,7 @@ vtkm::cont::CellSetExplicit<> MakeTestCellSet2()
return cs;
}
struct WorkletPointToCell : public vtkm::worklet::WorkletMapPointToCell
struct WorkletPointToCell : public vtkm::worklet::WorkletVisitCellsWithPoints
{
using ControlSignature = void(CellSetIn cellset, FieldOutCell numPoints);
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 ExecutionSignature = void(CellIndices, _2);
@ -159,24 +159,24 @@ void TestCellSetExplicit()
std::cout << "\tTesting CellToPoint table caching\n";
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.");
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.");
// 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.");
cellset.ResetConnectivity(CellTag{}, PointTag{});
VTKM_TEST_ASSERT(VTKM_PASS_COMMAS(!cellset.HasConnectivity(CellTag{}, PointTag{})),
cellset.ResetConnectivity(PointTag{}, CellTag{});
VTKM_TEST_ASSERT(VTKM_PASS_COMMAS(!cellset.HasConnectivity(PointTag{}, CellTag{})),
"CellToPoint table exists after resetting.");
// Test a PrepareForInput wrapped inside a dispatch (See #268)
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.");
}

@ -25,7 +25,7 @@ std::vector<int> topology = { 0, 2, 1 };
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 _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 _2 ExecutionSignature(CellShape, CellCount, CellIndices);

@ -20,7 +20,7 @@
namespace
{
struct WorkletPointToCell : public vtkm::worklet::WorkletMapPointToCell
struct WorkletPointToCell : public vtkm::worklet::WorkletVisitCellsWithPoints
{
using ControlSignature = void(CellSetIn cellset, FieldOutCell numPoints);
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 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 ExecutionSignature = void(CellIndices, _2, _3);

@ -105,13 +105,13 @@ void TestDataSet_Explicit()
subset.PrintSummary(std::cout);
using ExecObjectType = SubsetType::ExecutionTypes<vtkm::cont::DeviceAdapterTagSerial,
vtkm::TopologyElementTagPoint,
vtkm::TopologyElementTagCell>::ExecObjectType;
vtkm::TopologyElementTagCell,
vtkm::TopologyElementTagPoint>::ExecObjectType;
ExecObjectType execConnectivity;
execConnectivity = subset.PrepareForInput(vtkm::cont::DeviceAdapterTagSerial(),
vtkm::TopologyElementTagPoint(),
vtkm::TopologyElementTagCell());
vtkm::TopologyElementTagCell(),
vtkm::TopologyElementTagPoint());
//run a basic for-each topology algorithm on this
vtkm::cont::ArrayHandle<vtkm::Float32> result;
@ -154,7 +154,7 @@ void TestDataSet_Structured2D()
//verify that PrepareForInput exists
subset.PrepareForInput(
DeviceAdapterTag(), vtkm::TopologyElementTagPoint(), vtkm::TopologyElementTagCell());
DeviceAdapterTag(), vtkm::TopologyElementTagCell(), vtkm::TopologyElementTagPoint());
//run a basic for-each topology algorithm on this
vtkm::cont::ArrayHandle<vtkm::Float32> result;
@ -193,8 +193,8 @@ void TestDataSet_Structured3D()
//verify that PrepareForInput exists
subset.PrepareForInput(vtkm::cont::DeviceAdapterTagSerial(),
vtkm::TopologyElementTagPoint(),
vtkm::TopologyElementTagCell());
vtkm::TopologyElementTagCell(),
vtkm::TopologyElementTagPoint());
//run a basic for-each topology algorithm on this
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::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>
cellToPoint = cellSet.PrepareForInput(vtkm::cont::DeviceAdapterTagSerial(),
pointToCell = cellSet.PrepareForInput(vtkm::cont::DeviceAdapterTagSerial(),
vtkm::TopologyElementTagCell(),
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 } };
for (vtkm::Id cellIndex = 0; cellIndex < 2; cellIndex++)
@ -164,10 +164,10 @@ static void ThreeDimRectilinearTest()
}
//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(),
vtkm::TopologyElementTagPoint(),
vtkm::TopologyElementTagCell());
vtkm::TopologyElementTagCell(),
vtkm::TopologyElementTagPoint());
vtkm::Id expectedPointIds[8] = { 0, 1, 4, 3, 6, 7, 10, 9 };
vtkm::Vec<vtkm::Id, 8> retrievedPointIds = pointToCell.GetIndices(vtkm::Id3(0));
for (vtkm::IdComponent localPointIndex = 0; localPointIndex < 8; localPointIndex++)
@ -176,10 +176,10 @@ static void ThreeDimRectilinearTest()
"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(),
vtkm::TopologyElementTagCell(),
vtkm::TopologyElementTagPoint());
vtkm::TopologyElementTagPoint(),
vtkm::TopologyElementTagCell());
vtkm::Id retrievedCellIds[6] = { 0, -1, -1, -1, -1, -1 };
vtkm::VecVariable<vtkm::Id, 6> expectedCellIds = cellToPoint.GetIndices(vtkm::Id3(0));
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::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>
cellToPoint = cellSet.PrepareForInput(vtkm::cont::DeviceAdapterTagSerial(),
pointToCell = cellSet.PrepareForInput(vtkm::cont::DeviceAdapterTagSerial(),
vtkm::TopologyElementTagCell(),
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 } };
for (vtkm::Id cellIndex = 0; cellIndex < 2; cellIndex++)
@ -174,10 +174,10 @@ static void ThreeDimUniformTest()
}
//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(),
vtkm::TopologyElementTagPoint(),
vtkm::TopologyElementTagCell());
vtkm::TopologyElementTagCell(),
vtkm::TopologyElementTagPoint());
vtkm::Id expectedPointIds[8] = { 0, 1, 4, 3, 6, 7, 10, 9 };
vtkm::Vec<vtkm::Id, 8> retrievedPointIds = pointToCell.GetIndices(vtkm::Id3(0));
for (vtkm::IdComponent localPointIndex = 0; localPointIndex < 8; localPointIndex++)
@ -186,10 +186,10 @@ static void ThreeDimUniformTest()
"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(),
vtkm::TopologyElementTagCell(),
vtkm::TopologyElementTagPoint());
vtkm::TopologyElementTagPoint(),
vtkm::TopologyElementTagCell());
vtkm::Id retrievedCellIds[6] = { 0, -1, -1, -1, -1, -1 };
vtkm::VecVariable<vtkm::Id, 6> expectedCellIds = cellToPoint.GetIndices(vtkm::Id3(0));
VTKM_TEST_ASSERT(expectedCellIds.GetNumberOfComponents() <= 6,

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

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

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

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

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

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

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

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

@ -56,9 +56,9 @@ struct FetchArrayTopologyMapInImplementation
{
using ThreadIndicesType = vtkm::exec::arg::ThreadIndicesTopologyMap<ConnectivityType>;
// ThreadIndicesTopologyMap has special "from" indices that are stored in a
// Vec-like object.
using IndexVecType = typename ThreadIndicesType::IndicesFromType;
// ThreadIndicesTopologyMap has special incident element indices that are
// stored in a Vec-like object.
using IndexVecType = typename ThreadIndicesType::IndicesIncidentType;
// The FieldExecObjectType is expected to behave like an ArrayPortal.
using PortalType = FieldExecObjectType;
@ -73,7 +73,7 @@ struct FetchArrayTopologyMapInImplementation
// 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
// least as far as the returned VecFromPortalPermute is used.
return ValueType(indices.GetIndicesFromPointer(), field);
return ValueType(indices.GetIndicesIncidentPointer(), field);
}
VTKM_SUPPRESS_EXEC_WARNINGS
@ -84,7 +84,7 @@ struct FetchArrayTopologyMapInImplementation
// 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
// 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>
struct FetchArrayTopologyMapInImplementation<
vtkm::exec::ConnectivityStructured<vtkm::TopologyElementTagPoint,
vtkm::TopologyElementTagCell,
vtkm::exec::ConnectivityStructured<vtkm::TopologyElementTagCell,
vtkm::TopologyElementTagPoint,
NumDimensions>,
vtkm::internal::ArrayPortalUniformPointCoordinates>
{
using ConnectivityType = vtkm::exec::ConnectivityStructured<vtkm::TopologyElementTagPoint,
vtkm::TopologyElementTagCell,
using ConnectivityType = vtkm::exec::ConnectivityStructured<vtkm::TopologyElementTagCell,
vtkm::TopologyElementTagPoint,
NumDimensions>;
using ThreadIndicesType = vtkm::exec::arg::ThreadIndicesTopologyMap<ConnectivityType>;
@ -157,18 +157,18 @@ struct FetchArrayTopologyMapInImplementation<
template <typename PermutationPortal, vtkm::IdComponent NumDimensions>
struct FetchArrayTopologyMapInImplementation<
vtkm::exec::ConnectivityPermutedPointToCell<
vtkm::exec::ConnectivityPermutedVisitCellsWithPoints<
PermutationPortal,
vtkm::exec::ConnectivityStructured<vtkm::TopologyElementTagPoint,
vtkm::TopologyElementTagCell,
vtkm::exec::ConnectivityStructured<vtkm::TopologyElementTagCell,
vtkm::TopologyElementTagPoint,
NumDimensions>>,
vtkm::internal::ArrayPortalUniformPointCoordinates>
{
using ConnectivityType = vtkm::exec::ConnectivityPermutedPointToCell<
using ConnectivityType = vtkm::exec::ConnectivityPermutedVisitCellsWithPoints<
PermutationPortal,
vtkm::exec::ConnectivityStructured<vtkm::TopologyElementTagPoint,
vtkm::TopologyElementTagCell,
vtkm::exec::ConnectivityStructured<vtkm::TopologyElementTagCell,
vtkm::TopologyElementTagPoint,
NumDimensions>>;
using ThreadIndicesType = vtkm::exec::arg::ThreadIndicesTopologyMap<ConnectivityType>;

@ -7,8 +7,8 @@
// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
// PURPOSE. See the above copyright notice for more information.
//============================================================================
#ifndef vtk_m_exec_arg_FromCount_h
#define vtk_m_exec_arg_FromCount_h
#ifndef vtk_m_exec_arg_IncidentElementCount_h
#define vtk_m_exec_arg_IncidentElementCount_h
#include <vtkm/exec/arg/ExecutionSignatureTagBase.h>
#include <vtkm/exec/arg/Fetch.h>
@ -21,32 +21,32 @@ namespace exec
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 number of indices that map to the current topology element.
/// The \c AspectTagIncidentElementCount aspect tag causes the \c Fetch class to
/// 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
/// specified. The scheduling occurs on the \em to elements, and for each \em
/// to element there is some number of incident \em from elements that are
/// accessible. This \c ExecutionSignature tag provides the number of these \em
/// from elements that are accessible.
/// In a topology map, there are \em visited and \em incident topology elements
/// specified. The scheduling occurs on the \em visited elements, and for each
/// \em visited element there is some number of incident \em incident elements
/// that are accessible. This \c ExecutionSignature tag provides the number of
/// 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;
using AspectTag = vtkm::exec::arg::AspectTagFromCount;
using AspectTag = vtkm::exec::arg::AspectTagIncidentElementCount;
};
template <typename FetchTag, typename ConnectivityType, typename ExecObjectType>
struct Fetch<FetchTag,
vtkm::exec::arg::AspectTagFromCount,
vtkm::exec::arg::AspectTagIncidentElementCount,
vtkm::exec::arg::ThreadIndicesTopologyMap<ConnectivityType>,
ExecObjectType>
{
@ -58,7 +58,7 @@ struct Fetch<FetchTag,
VTKM_EXEC
ValueType Load(const ThreadIndicesType& indices, const ExecObjectType&) const
{
return indices.GetIndicesFrom().GetNumberOfComponents();
return indices.GetIndicesIncident().GetNumberOfComponents();
}
VTKM_EXEC
@ -71,4 +71,4 @@ struct Fetch<FetchTag,
}
} // 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
// PURPOSE. See the above copyright notice for more information.
//============================================================================
#ifndef vtk_m_exec_arg_FromIndices_h
#define vtk_m_exec_arg_FromIndices_h
#ifndef vtk_m_exec_arg_IncidentElementIndices_h
#define vtk_m_exec_arg_IncidentElementIndices_h
#include <vtkm/exec/arg/ExecutionSignatureTagBase.h>
#include <vtkm/exec/arg/Fetch.h>
@ -21,44 +21,45 @@ namespace exec
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 indices that map to the current topology element.
/// The \c AspectTagIncidentElementIndices aspect tag causes the \c Fetch class
/// 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
/// specified. The scheduling occurs on the \em to elements, and for each \em
/// to element there is some number of incident \em from elements that are
/// accessible. This \c ExecutionSignature tag provides the indices of these
/// \em from elements that are accessible.
/// In a topology map, there are \em visited and \em incident topology elements
/// specified. The scheduling occurs on the \em visited elements, and for each
/// \em visited element there is some number of incident \em incident elements
/// that are accessible. This \c ExecutionSignature tag provides the indices of
/// 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;
using AspectTag = vtkm::exec::arg::AspectTagFromIndices;
using AspectTag = vtkm::exec::arg::AspectTagIncidentElementIndices;
};
template <typename FetchTag, typename ConnectivityType, typename ExecObjectType>
struct Fetch<FetchTag,
vtkm::exec::arg::AspectTagFromIndices,
vtkm::exec::arg::AspectTagIncidentElementIndices,
vtkm::exec::arg::ThreadIndicesTopologyMap<ConnectivityType>,
ExecObjectType>
{
using ThreadIndicesType = vtkm::exec::arg::ThreadIndicesTopologyMap<ConnectivityType>;
using ValueType = typename ThreadIndicesType::IndicesFromType;
using ValueType = typename ThreadIndicesType::IndicesIncidentType;
VTKM_SUPPRESS_EXEC_WARNINGS
VTKM_EXEC
ValueType Load(const ThreadIndicesType& indices, const ExecObjectType&) const
{
return indices.GetIndicesFrom();
return indices.GetIndicesIncident();
}
VTKM_EXEC
@ -71,4 +72,4 @@ struct Fetch<FetchTag,
}
} // 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:
using CellShapeTag = typename ConnectivityType::CellShapeTag;
using IndicesFromType = typename ConnectivityType::IndicesType;
using IndicesIncidentType = typename ConnectivityType::IndicesType;
using LogicalIndexType = typename ConnectivityType::SchedulingRangeType;
@ -49,7 +49,7 @@ public:
this->OutputIndex = index;
this->VisitIndex = 0;
this->LogicalIndex = logicalIndex;
this->IndicesFrom = connectivity.GetIndices(logicalIndex);
this->IndicesIncident = connectivity.GetIndices(logicalIndex);
//this->CellShape = connectivity.GetCellShape(index);
this->GlobalThreadIndexOffset = globalThreadIndexOffset;
}
@ -70,7 +70,7 @@ public:
this->OutputIndex = index;
this->VisitIndex = 0;
this->LogicalIndex = logicalIndex;
this->IndicesFrom = connectivity.GetIndices(logicalIndex);
this->IndicesIncident = connectivity.GetIndices(logicalIndex);
//this->CellShape = connectivity.GetCellShape(index);
this->GlobalThreadIndexOffset = globalThreadIndexOffset;
}
@ -128,7 +128,7 @@ public:
/// containing the indices to the "from" elements.
///
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.
///
@ -140,7 +140,7 @@ public:
/// not go out of scope, at which time the returned pointer becomes invalid.
///
VTKM_EXEC
const IndicesFromType* GetIndicesFromPointer() const { return &this->IndicesFrom; }
const IndicesIncidentType* GetIndicesIncidentPointer() const { return &this->IndicesIncident; }
/// \brief The shape of the input cell.
///
@ -158,7 +158,7 @@ private:
vtkm::IdComponent VisitIndex;
vtkm::Id OutputIndex;
LogicalIndexType LogicalIndex;
IndicesFromType IndicesFrom;
IndicesIncidentType IndicesIncident;
//CellShapeTag CellShape;
vtkm::Id GlobalThreadIndexOffset;
};
@ -171,7 +171,7 @@ class ThreadIndicesTopologyMap<vtkm::exec::ReverseConnectivityExtrude<Device>>
public:
using CellShapeTag = typename ConnectivityType::CellShapeTag;
using IndicesFromType = typename ConnectivityType::IndicesType;
using IndicesIncidentType = typename ConnectivityType::IndicesType;
using LogicalIndexType = typename ConnectivityType::SchedulingRangeType;
VTKM_SUPPRESS_EXEC_WARNINGS
@ -191,7 +191,7 @@ public:
this->OutputIndex = index;
this->VisitIndex = 0;
this->LogicalIndex = logicalIndex;
this->IndicesFrom = connectivity.GetIndices(logicalIndex);
this->IndicesIncident = connectivity.GetIndices(logicalIndex);
//this->CellShape = connectivity.GetCellShape(index);
this->GlobalThreadIndexOffset = globalThreadIndexOffset;
}
@ -209,7 +209,7 @@ public:
this->OutputIndex = index;
this->VisitIndex = 0;
this->LogicalIndex = logicalIndex;
this->IndicesFrom = connectivity.GetIndices(logicalIndex);
this->IndicesIncident = connectivity.GetIndices(logicalIndex);
//this->CellShape = connectivity.GetCellShape(index);
this->GlobalThreadIndexOffset = globalThreadIndexOffset;
}
@ -266,7 +266,7 @@ public:
/// containing the indices to the "from" elements.
///
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.
///
@ -278,7 +278,7 @@ public:
/// not go out of scope, at which time the returned pointer becomes invalid.
///
VTKM_EXEC
const IndicesFromType* GetIndicesFromPointer() const { return &this->IndicesFrom; }
const IndicesIncidentType* GetIndicesIncidentPointer() const { return &this->IndicesIncident; }
/// \brief The shape of the input cell.
///
@ -296,7 +296,7 @@ private:
vtkm::IdComponent VisitIndex;
vtkm::Id OutputIndex;
LogicalIndexType LogicalIndex;
IndicesFromType IndicesFrom;
IndicesIncidentType IndicesIncident;
//CellShapeTag CellShape;
vtkm::Id GlobalThreadIndexOffset;
};

@ -58,15 +58,15 @@ public:
template <vtkm::IdComponent Dimension>
VTKM_EXEC ThreadIndicesPointNeighborhood(
const vtkm::Id3& outIndex,
const vtkm::exec::ConnectivityStructured<vtkm::TopologyElementTagCell,
vtkm::TopologyElementTagPoint,
const vtkm::exec::ConnectivityStructured<vtkm::TopologyElementTagPoint,
vtkm::TopologyElementTagCell,
Dimension>& connectivity,
vtkm::Id globalThreadIndexOffset = 0)
: State(outIndex, detail::To3D(connectivity.GetPointDimensions()))
, GlobalThreadIndexOffset(globalThreadIndexOffset)
{
using ConnectivityType = vtkm::exec::ConnectivityStructured<vtkm::TopologyElementTagCell,
vtkm::TopologyElementTagPoint,
using ConnectivityType = vtkm::exec::ConnectivityStructured<vtkm::TopologyElementTagPoint,
vtkm::TopologyElementTagCell,
Dimension>;
using ConnRangeType = typename ConnectivityType::SchedulingRangeType;
const ConnRangeType index = detail::Deflate(outIndex, ConnRangeType());
@ -82,8 +82,8 @@ public:
vtkm::Id inputIndex,
vtkm::IdComponent visitIndex,
vtkm::Id outputIndex,
const vtkm::exec::ConnectivityStructured<vtkm::TopologyElementTagCell,
vtkm::TopologyElementTagPoint,
const vtkm::exec::ConnectivityStructured<vtkm::TopologyElementTagPoint,
vtkm::TopologyElementTagCell,
Dimension>& connectivity,
vtkm::Id globalThreadIndexOffset = 0)
: 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
///
/// This specialization of \c ThreadIndices adds extra indices that deal with
/// topology maps. In particular, it saves the indices used to map the "from"
/// elements in the map. The input and output indices from the superclass are
/// considered to be indexing the "to" elements.
/// topology maps. In particular, it saves the incident element indices. The
/// input and output indices from the superclass are considered to be indexing
/// the visited elements.
///
/// This class is templated on the type that stores the connectivity (such
/// as \c ConnectivityExplicit or \c ConnectivityStructured).
@ -86,7 +86,7 @@ class ThreadIndicesTopologyMap : public vtkm::exec::arg::ThreadIndicesBasic
using Superclass = vtkm::exec::arg::ThreadIndicesBasic;
public:
using IndicesFromType = typename ConnectivityType::IndicesType;
using IndicesIncidentType = typename ConnectivityType::IndicesType;
using CellShapeTag = typename ConnectivityType::CellShapeTag;
VTKM_SUPPRESS_EXEC_WARNINGS
@ -102,24 +102,24 @@ public:
// 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
// set its input domain incorrectly.
, IndicesFrom(connectivity.GetIndices(inputIndex))
, IndicesIncident(connectivity.GetIndices(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
/// cells). For each worklet invocation, there is exactly one "to" element,
/// but can be several "from" element. This method returns a Vec-like object
/// containing the indices to the "from" elements.
/// A topology map has "visited" and "incident" elements (e.g. points, cells,
/// etc). For each worklet invocation, there is exactly one visited element,
/// but there can be several incident elements. This method returns a Vec-like
/// object containing the indices to the incident elements.
///
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.
/// 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
@ -127,7 +127,7 @@ public:
/// not go out of scope, at which time the returned pointer becomes invalid.
///
VTKM_EXEC
const IndicesFromType* GetIndicesFromPointer() const { return &this->IndicesFrom; }
const IndicesIncidentType* GetIndicesIncidentPointer() const { return &this->IndicesIncident; }
/// \brief The shape of the input cell.
///
@ -140,19 +140,20 @@ public:
CellShapeTag GetCellShape() const { return this->CellShape; }
private:
IndicesFromType IndicesFrom;
IndicesIncidentType IndicesIncident;
CellShapeTag CellShape;
};
// Specialization for structured connectivity types.
template <typename FromTopology, typename ToTopology, vtkm::IdComponent Dimension>
template <typename VisitTopology, typename IncidentTopology, vtkm::IdComponent Dimension>
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:
using IndicesFromType = typename ConnectivityType::IndicesType;
using IndicesIncidentType = typename ConnectivityType::IndicesType;
using CellShapeTag = typename ConnectivityType::CellShapeTag;
using LogicalIndexType = typename ConnectivityType::SchedulingRangeType;
@ -168,7 +169,7 @@ public:
this->VisitIndex = visitIndex;
this->OutputIndex = outIndex;
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->GlobalThreadIndexOffset = globalThreadIndexOffset;
}
@ -188,7 +189,7 @@ public:
this->OutputIndex = index;
this->VisitIndex = 0;
this->LogicalIndex = logicalIndex;
this->IndicesFrom = connectivity.GetIndices(logicalIndex);
this->IndicesIncident = connectivity.GetIndices(logicalIndex);
this->CellShape = connectivity.GetCellShape(index);
this->GlobalThreadIndexOffset = globalThreadIndexOffset;
}
@ -247,19 +248,19 @@ public:
VTKM_EXEC
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
/// cells). For each worklet invocation, there is exactly one "to" element,
/// but can be several "from" element. This method returns a Vec-like object
/// containing the indices to the "from" elements.
/// A topology map has "visited" and "incident" elements (e.g. points, cells,
/// etc). For each worklet invocation, there is exactly one visited element,
/// but there can be several incident elements. This method returns a
/// Vec-like object containing the indices to the incident elements.
///
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.
/// 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
@ -267,7 +268,7 @@ public:
/// not go out of scope, at which time the returned pointer becomes invalid.
///
VTKM_EXEC
const IndicesFromType* GetIndicesFromPointer() const { return &this->IndicesFrom; }
const IndicesIncidentType* GetIndicesIncidentPointer() const { return &this->IndicesIncident; }
/// \brief The shape of the input cell.
///
@ -285,29 +286,29 @@ private:
vtkm::IdComponent VisitIndex;
vtkm::Id OutputIndex;
LogicalIndexType LogicalIndex;
IndicesFromType IndicesFrom;
IndicesIncidentType IndicesIncident;
CellShapeTag CellShape;
vtkm::Id GlobalThreadIndexOffset;
};
// Specialization for permuted structured connectivity types.
template <typename PermutationPortal, vtkm::IdComponent Dimension>
class ThreadIndicesTopologyMap<vtkm::exec::ConnectivityPermutedPointToCell<
class ThreadIndicesTopologyMap<vtkm::exec::ConnectivityPermutedVisitCellsWithPoints<
PermutationPortal,
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,
vtkm::exec::ConnectivityStructured<vtkm::TopologyElementTagPoint,
vtkm::TopologyElementTagCell,
vtkm::exec::ConnectivityStructured<vtkm::TopologyElementTagCell,
vtkm::TopologyElementTagPoint,
Dimension>>;
using ConnectivityType = vtkm::exec::ConnectivityStructured<vtkm::TopologyElementTagPoint,
vtkm::TopologyElementTagCell,
using ConnectivityType = vtkm::exec::ConnectivityStructured<vtkm::TopologyElementTagCell,
vtkm::TopologyElementTagPoint,
Dimension>;
public:
using IndicesFromType = typename ConnectivityType::IndicesType;
using IndicesIncidentType = typename ConnectivityType::IndicesType;
using CellShapeTag = typename ConnectivityType::CellShapeTag;
using LogicalIndexType = typename ConnectivityType::SchedulingRangeType;
@ -325,7 +326,7 @@ public:
const vtkm::Id permutedIndex = permutation.Portal.Get(this->InputIndex);
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->GlobalThreadIndexOffset = globalThreadIndexOffset;
}
@ -384,19 +385,19 @@ public:
VTKM_EXEC
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
/// cells). For each worklet invocation, there is exactly one "to" element,
/// but can be several "from" element. This method returns a Vec-like object
/// containing the indices to the "from" elements.
/// A topology map has "visited" and "incident" elements (e.g. points, cells,
/// etc). For each worklet invocation, there is exactly one visited element,
/// but there can be several incident elements. This method returns a
/// Vec-like object containing the indices to the incident elements.
///
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.
/// 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
@ -404,7 +405,7 @@ public:
/// not go out of scope, at which time the returned pointer becomes invalid.
///
VTKM_EXEC
const IndicesFromType* GetIndicesFromPointer() const { return &this->IndicesFrom; }
const IndicesIncidentType* GetIndicesIncidentPointer() const { return &this->IndicesIncident; }
/// \brief The shape of the input cell.
///
@ -422,7 +423,7 @@ private:
vtkm::IdComponent VisitIndex;
vtkm::Id OutputIndex;
LogicalIndexType LogicalIndex;
IndicesFromType IndicesFrom;
IndicesIncidentType IndicesIncident;
CellShapeTag CellShape;
vtkm::Id GlobalThreadIndexOffset;
};

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

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

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

@ -22,6 +22,7 @@ namespace filter
class CellSetConnectivity : public vtkm::filter::FilterCell<CellSetConnectivity>
{
public:
using SupportedTypes = vtkm::TypeListTagScalarAll;
VTKM_CONT CellSetConnectivity();
template <typename T, typename StorageType, typename DerivedPolicy>
@ -30,15 +31,6 @@ public:
const vtkm::filter::FieldMetadata& fieldMetadata,
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>
{
public:
using SupportedTypes = vtkm::TypeListTagScalarAll;
VTKM_CONT
ClipWithField();
@ -58,13 +60,6 @@ private:
vtkm::worklet::Clip Worklet;
bool Invert;
};
template <>
class FilterTraits<ClipWithField>
{ //currently the Clip filter only works on scalar data.
public:
using InputFieldTypeList = TypeListTagScalarAll;
};
}
} // namespace vtkm::filter

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

@ -72,6 +72,7 @@ namespace filter
class ContourTreePPP2 : public vtkm::filter::FilterField<ContourTreePPP2>
{
public:
using SupportedTypes = vtkm::TypeListTagScalarAll;
VTKM_CONT
ContourTreePPP2(bool useMarchingCubes = false, bool computeRegularStructure = true);
@ -100,12 +101,6 @@ private:
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
struct GetRowsColsSlices

@ -25,6 +25,8 @@ class CylindricalCoordinateTransform
: public vtkm::filter::FilterField<CylindricalCoordinateTransform>
{
public:
using SupportedTypes = vtkm::TypeListTagFieldVec3;
VTKM_CONT
CylindricalCoordinateTransform();
@ -41,17 +43,11 @@ private:
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>
{
public:
using SupportedTypes = vtkm::TypeListTagFieldVec3;
VTKM_CONT
SphericalCoordinateTransform();
@ -68,14 +64,6 @@ public:
private:
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

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

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

@ -25,6 +25,9 @@ namespace filter
class Entropy : public vtkm::filter::FilterField<Entropy>
{
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
VTKM_CONT
Entropy();
@ -41,13 +44,6 @@ public:
private:
vtkm::Id NumberOfBins;
};
template <>
class FilterTraits<Entropy>
{
public:
using InputFieldTypeList = TypeListTagScalarAll;
};
}
} // namespace vtkm::filter

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

@ -173,6 +173,14 @@ public:
VTKM_CONT
~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.
///

@ -18,27 +18,30 @@ namespace vtkm
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>
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>
template <typename DerivedPolicy, typename ListOfTypes>
struct DeduceFilterFieldTypes
{
using FList = typename vtkm::filter::FilterTraits<FilterType, FieldTag>::InputFieldTypeList;
using PList = typename DerivedPolicy::FieldTypeList;
using TypeList = vtkm::ListTagIntersect<FList, PList>;
using TypeList = vtkm::ListTagIntersect<ListOfTypes, PList>;
};
}
}

@ -30,6 +30,9 @@ struct GhostCellRemovePolicy : vtkm::filter::PolicyBase<GhostCellRemovePolicy>
class GhostCellRemove : public vtkm::filter::FilterDataSetWithField<GhostCellRemove>
{
public:
//currently the GhostCellRemove filter only works on uint8 data.
using SupportedTypes = vtkm::ListTagBase<vtkm::UInt8>;
VTKM_CONT
GhostCellRemove();
@ -82,13 +85,6 @@ private:
VTKM_CONT vtkm::cont::CellSetExplicit<> ConvertOutputToUnstructured(
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

@ -30,6 +30,9 @@ namespace filter
class Gradient : public vtkm::filter::FilterCell<Gradient>
{
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
/// point based gradients, which are significantly more costly since for each
/// point we need to compute the gradient of each cell that uses it.
@ -104,18 +107,6 @@ private:
std::string QCriterionName = "QCriterion";
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

@ -25,6 +25,8 @@ namespace filter
class Histogram : public vtkm::filter::FilterField<Histogram>
{
public:
using SupportedTypes = vtkm::TypeListTagScalarAll;
//Construct a histogram with a default of 10 bins
VTKM_CONT
Histogram();
@ -82,15 +84,6 @@ private:
vtkm::Range ComputedRange;
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

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

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

@ -28,6 +28,8 @@ namespace filter
class MarchingCubes : public vtkm::filter::FilterDataSetWithField<MarchingCubes>
{
public:
using SupportedTypes = vtkm::ListTagBase<vtkm::UInt8, vtkm::Int8, vtkm::Float32, vtkm::Float64>;
VTKM_CONT
MarchingCubes();
@ -117,17 +119,6 @@ private:
std::string NormalArrayName;
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

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

@ -87,7 +87,7 @@ inline VTKM_CONT vtkm::cont::DataSet MeshQuality::DoExecute(
input.GetCellSet(this->GetActiveCellSetIndex()).CopyTo(cellSet);
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
IdHandle uniqueCellCounts;

@ -27,6 +27,8 @@ namespace filter
class OscillatorSource : public vtkm::filter::FilterField<OscillatorSource>
{
public:
using SupportedTypes = vtkm::TypeListTagFieldVec3;
VTKM_CONT
OscillatorSource();
@ -66,14 +68,6 @@ public:
private:
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>
{
public:
using SupportedTypes = vtkm::TypeListTagFieldVec3;
VTKM_CONT
Pathline();
@ -71,16 +73,6 @@ private:
vtkm::Id NumberOfSteps;
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

@ -28,6 +28,8 @@ namespace filter
class PointElevation : public vtkm::filter::FilterField<PointElevation>
{
public:
using SupportedTypes = vtkm::TypeListTagFieldVec3;
VTKM_CONT
PointElevation();
@ -49,14 +51,6 @@ public:
private:
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

@ -25,6 +25,8 @@ template <typename S>
class PointTransform : public vtkm::filter::FilterField<PointTransform<S>>
{
public:
using SupportedTypes = vtkm::TypeListTagFieldVec3;
VTKM_CONT
PointTransform();
@ -59,14 +61,6 @@ public:
private:
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

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

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

@ -27,6 +27,8 @@ namespace filter
class Streamline : public vtkm::filter::FilterDataSetWithField<Streamline>
{
public:
using SupportedTypes = vtkm::TypeListTagFieldVec3;
VTKM_CONT
Streamline();
@ -60,16 +62,6 @@ private:
vtkm::Id NumberOfSteps;
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

@ -26,34 +26,72 @@ namespace filter
class SurfaceNormals : public vtkm::filter::FilterCell<SurfaceNormals>
{
public:
using SupportedTypes = vtkm::TypeListTagFieldVec3;
/// Create SurfaceNormals filter. This calls
/// this->SetUseCoordinateSystemAsField(true) since that is the most common
/// use-case for surface normals.
SurfaceNormals();
/// Set/Get if cell normals should be generated. Default is off.
/// @{
void SetGenerateCellNormals(bool value) { this->GenerateCellNormals = value; }
bool GetGenerateCellNormals() const { return this->GenerateCellNormals; }
/// @}
/// 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
/// normals generation by skipping the normalization of the face normals.
/// Note that when set to false, the result cell normals will not be unit
/// length normals and the point normals will be different.
/// @{
void SetNormalizeCellNormals(bool value) { this->NormalizeCellNormals = value; }
bool GetNormalizeCellNormals() const { return this->NormalizeCellNormals; }
/// @}
/// Set/Get if the point normals should be generated. Default is on.
/// @{
void SetGeneratePointNormals(bool value) { this->GeneratePointNormals = value; }
bool GetGeneratePointNormals() const { return this->GeneratePointNormals; }
/// @}
/// Set/Get the name of the cell normals field. Default is "Normals".
/// @{
void SetCellNormalsName(const std::string& name) { this->CellNormalsName = name; }
const std::string& GetCellNormalsName() const { return this->CellNormalsName; }
/// @}
/// Set/Get the name of the point normals field. Default is "Normals".
/// @{
void SetPointNormalsName(const std::string& name) { this->PointNormalsName = name; }
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>
vtkm::cont::DataSet DoExecute(const vtkm::cont::DataSet& input,
@ -65,17 +103,13 @@ private:
bool GenerateCellNormals;
bool NormalizeCellNormals;
bool GeneratePointNormals;
bool AutoOrientNormals;
bool FlipNormals;
bool Consistency;
std::string CellNormalsName;
std::string PointNormalsName;
};
template <>
class FilterTraits<SurfaceNormals>
{
public:
using InputFieldTypeList = vtkm::TypeListTagFieldVec3;
};
}
} // vtkm::filter

@ -8,9 +8,13 @@
// PURPOSE. See the above copyright notice for more information.
//============================================================================
#include <vtkm/filter/SurfaceNormals.h>
#include <vtkm/cont/ErrorFilterExecution.h>
#include <vtkm/filter/internal/CreateResult.h>
#include <vtkm/worklet/OrientNormals.h>
#include <vtkm/worklet/SurfaceNormals.h>
#include <vtkm/worklet/TriangleWinding.h>
namespace vtkm
{
@ -58,6 +62,9 @@ inline SurfaceNormals::SurfaceNormals()
: GenerateCellNormals(false)
, NormalizeCellNormals(true)
, GeneratePointNormals(true)
, AutoOrientNormals(false)
, FlipNormals(false)
, Consistency(true)
{
this->SetUseCoordinateSystemAsField(true);
}
@ -76,19 +83,22 @@ inline vtkm::cont::DataSet SurfaceNormals::DoExecute(
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::worklet::FacetedSurfaceNormals faceted;
faceted.SetNormalize(this->NormalizeCellNormals);
faceted.Run(vtkm::filter::ApplyPolicy(cellset, policy), points, faceNormals);
faceted.Run(cellset, points, faceNormals);
vtkm::cont::DataSet result;
vtkm::cont::ArrayHandle<vtkm::Vec3f> pointNormals;
if (this->GeneratePointNormals)
{
vtkm::cont::ArrayHandle<vtkm::Vec3f> pointNormals;
vtkm::worklet::SmoothSurfaceNormals smooth;
smooth.Run(vtkm::filter::ApplyPolicy(cellset, policy), faceNormals, pointNormals);
smooth.Run(cellset, faceNormals, pointNormals);
result = internal::CreateResult(input,
pointNormals,
@ -111,6 +121,66 @@ inline vtkm::cont::DataSet SurfaceNormals::DoExecute(
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;
}
}

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

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

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

@ -29,6 +29,9 @@ namespace filter
class WarpScalar : public vtkm::filter::FilterField<WarpScalar>
{
public:
// WarpScalar can only applies to Float and Double Vec3 arrays
using SupportedTypes = vtkm::TypeListTagFieldVec3;
VTKM_CONT
WarpScalar(vtkm::FloatDefault scaleAmount);
@ -90,24 +93,6 @@ private:
vtkm::cont::Field::Association ScalarFactorFieldAssociation;
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(
field,
vtkm::filter::ApplyPolicy(normalF, policy, vtkm::filter::FilterTraits<WarpScalar>()),
vtkm::filter::ApplyPolicy(
sfF, policy, vtkm::filter::FilterTraits<WarpScalar, WarpScalarScalarFieldTag>()),
vtkm::filter::ApplyPolicy(sfF, policy, vtkm::TypeListTagFieldScalar{}),
this->ScaleAmount,
result);

@ -29,6 +29,8 @@ namespace filter
class WarpVector : public vtkm::filter::FilterField<WarpVector>
{
public:
using SupportedTypes = vtkm::TypeListTagFieldVec3;
VTKM_CONT
WarpVector(vtkm::FloatDefault scale);
@ -65,14 +67,6 @@ private:
vtkm::cont::Field::Association VectorFieldAssociation;
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>
{
public:
using SupportedTypes = vtkm::ListTagBase<vtkm::Int32, vtkm::Float32, vtkm::Float64>;
VTKM_CONT
ZFPCompressor1D();
@ -51,16 +53,6 @@ private:
vtkm::Float64 rate;
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

@ -27,6 +27,8 @@ namespace filter
class ZFPCompressor2D : public vtkm::filter::FilterField<ZFPCompressor2D>
{
public:
using SupportedTypes = vtkm::ListTagBase<vtkm::Int32, vtkm::Float32, vtkm::Float64>;
VTKM_CONT
ZFPCompressor2D();
@ -51,16 +53,6 @@ private:
vtkm::Float64 rate;
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

@ -27,6 +27,7 @@ namespace filter
class ZFPCompressor3D : public vtkm::filter::FilterField<ZFPCompressor3D>
{
public:
using SupportedTypes = vtkm::ListTagBase<vtkm::Int32, vtkm::Float32, vtkm::Float64>;
VTKM_CONT
ZFPCompressor3D();
@ -51,16 +52,6 @@ private:
vtkm::Float64 rate;
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

@ -28,6 +28,8 @@ namespace filter
class ZFPDecompressor1D : public vtkm::filter::FilterField<ZFPDecompressor1D>
{
public:
using SupportedTypes = vtkm::ListTagBase<vtkm::Int32, vtkm::Int64, vtkm::Float32, vtkm::Float64>;
VTKM_CONT
ZFPDecompressor1D();
@ -58,17 +60,6 @@ private:
vtkm::Float64 rate;
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

@ -28,6 +28,8 @@ namespace filter
class ZFPDecompressor2D : public vtkm::filter::FilterField<ZFPDecompressor2D>
{
public:
using SupportedTypes = vtkm::ListTagBase<vtkm::Int32, vtkm::Int64, vtkm::Float32, vtkm::Float64>;
VTKM_CONT
ZFPDecompressor2D();
@ -58,17 +60,6 @@ private:
vtkm::Float64 rate;
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

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