Merge topic 'refactor-relaxed-threadindicestypes'

d0396e2a4 relaxes ThreadIndicesType across multiple worklets fetchs

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Robert Maynard <robert.maynard@kitware.com>
Merge-request: !2032
This commit is contained in:
Vicente Bolea 2020-04-25 00:09:40 +00:00 committed by Kitware Robot
commit e9c7378782
41 changed files with 271 additions and 378 deletions

@ -119,10 +119,9 @@ namespace arg
// Instead, you need to implement the Load to point to the array portal. You
// can also ignore the Store because the data is already set in the array at
// that point.
template <typename ThreadIndicesType, typename SourcePortalType, typename OffsetsPortalType>
template <typename SourcePortalType, typename OffsetsPortalType>
struct Fetch<vtkm::exec::arg::FetchTagArrayDirectOut,
vtkm::exec::arg::AspectTagDefault,
ThreadIndicesType,
vtkm::exec::internal::ArrayPortalGroupVecVariable<SourcePortalType, OffsetsPortalType>>
{
using ExecObjectType =
@ -130,15 +129,16 @@ struct Fetch<vtkm::exec::arg::FetchTagArrayDirectOut,
using ValueType = typename ExecObjectType::ValueType;
VTKM_SUPPRESS_EXEC_WARNINGS
VTKM_EXEC
ValueType Load(const ThreadIndicesType& indices, const ExecObjectType& arrayPortal) const
template <typename ThreadIndicesType>
VTKM_EXEC ValueType Load(const ThreadIndicesType& indices,
const ExecObjectType& arrayPortal) const
{
return arrayPortal.Get(indices.GetOutputIndex());
}
VTKM_SUPPRESS_EXEC_WARNINGS
VTKM_EXEC
void Store(const ThreadIndicesType&, const ExecObjectType&, const ValueType&) const
template <typename ThreadIndicesType>
VTKM_EXEC void Store(const ThreadIndicesType&, const ExecObjectType&, const ValueType&) const
{
// We can actually ignore this because the VecFromPortal will already have
// set new values in the array.

@ -40,24 +40,20 @@ struct Boundary : vtkm::exec::arg::ExecutionSignatureTagBase
};
template <typename FetchTag, typename ExecObjectType>
struct Fetch<FetchTag,
vtkm::exec::arg::AspectTagBoundary,
vtkm::exec::arg::ThreadIndicesPointNeighborhood,
ExecObjectType>
struct Fetch<FetchTag, vtkm::exec::arg::AspectTagBoundary, ExecObjectType>
{
using ThreadIndicesType = vtkm::exec::arg::ThreadIndicesPointNeighborhood;
using ValueType = vtkm::exec::BoundaryState;
VTKM_SUPPRESS_EXEC_WARNINGS
VTKM_EXEC
ValueType Load(const ThreadIndicesType& indices, const ExecObjectType&) const
template <typename ThreadIndicesType>
VTKM_EXEC ValueType Load(const ThreadIndicesType& indices, const ExecObjectType&) const
{
return indices.GetBoundaryState();
}
VTKM_EXEC
void Store(const ThreadIndicesType&, const ExecObjectType&, const ValueType&) const
template <typename ThreadIndicesType>
VTKM_EXEC void Store(const ThreadIndicesType&, const ExecObjectType&, const ValueType&) const
{
// Store is a no-op.
}

@ -12,7 +12,6 @@
#include <vtkm/exec/arg/ExecutionSignatureTagBase.h>
#include <vtkm/exec/arg/Fetch.h>
#include <vtkm/exec/arg/ThreadIndicesTopologyMap.h>
namespace vtkm
{
@ -38,25 +37,19 @@ struct CellShape : vtkm::exec::arg::ExecutionSignatureTagBase
using AspectTag = vtkm::exec::arg::AspectTagCellShape;
};
template <typename FetchTag, typename ConnectivityType, typename ExecObjectType>
struct Fetch<FetchTag,
vtkm::exec::arg::AspectTagCellShape,
vtkm::exec::arg::ThreadIndicesTopologyMap<ConnectivityType>,
ExecObjectType>
template <typename FetchTag, typename ExecObjectType>
struct Fetch<FetchTag, vtkm::exec::arg::AspectTagCellShape, ExecObjectType>
{
using ThreadIndicesType = vtkm::exec::arg::ThreadIndicesTopologyMap<ConnectivityType>;
using ValueType = typename ThreadIndicesType::CellShapeTag;
VTKM_SUPPRESS_EXEC_WARNINGS
VTKM_EXEC
ValueType Load(const ThreadIndicesType& indices, const ExecObjectType&) const
template <typename ThreadIndicesType>
VTKM_EXEC auto Load(const ThreadIndicesType& indices, const ExecObjectType&) const
-> decltype(indices.GetCellShape())
{
return indices.GetCellShape();
}
VTKM_EXEC
void Store(const ThreadIndicesType&, const ExecObjectType&, const ValueType&) const
template <typename ThreadIndicesType, typename ValueType>
VTKM_EXEC void Store(const ThreadIndicesType&, const ExecObjectType&, const ValueType&) const
{
// Store is a no-op.
}

@ -45,10 +45,7 @@ namespace arg
/// ExecutionSignature with a particular aspect is pointing to the wrong
/// argument or an invalid argument in the ControlSignature.
///
template <typename FetchTag,
typename AspectTag,
typename ThreadIndicesType,
typename ExecObjectType>
template <typename FetchTag, typename AspectTag, typename ExecObjectType>
struct Fetch
#ifdef VTKM_DOXYGEN_ONLY
{
@ -68,8 +65,9 @@ struct Fetch
/// work instance. If there is no actual data to load (for example for a
/// write-only fetch), this method can be a no-op and return any value.
///
VTKM_EXEC
ValueType Load(const ThreadIndicesType& indices, const ExecObjectType& execObject) const;
template <typename ThreadIndicesType>
VTKM_EXEC ValueType Load(const ThreadIndicesType& indices,
const ExecObjectType& execObject) const;
/// \brief Store data from a work instance.
///
@ -80,10 +78,10 @@ struct Fetch
/// fetch. If the store is not applicable (for example for a read-only
/// fetch), this method can be a no-op.
///
VTKM_EXEC
void Store(const ThreadIndicesType& indices,
const ExecObjectType& execObject,
const ValueType& value) const;
template <typename ThreadIndicesType>
VTKM_EXEC void Store(const ThreadIndicesType& indices,
const ExecObjectType& execObject,
const ValueType& value) const;
};
#else // VTKM_DOXYGEN_ONLY
;

@ -26,26 +26,20 @@ 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::AspectTagIncidentElementIndices,
vtkm::exec::arg::ThreadIndicesTopologyMap<vtkm::exec::ConnectivityExtrude<Device>>,
ExecObjectType>
template <typename FetchType, typename ExecObjectType>
struct Fetch<FetchType, vtkm::exec::arg::AspectTagIncidentElementIndices, ExecObjectType>
{
using ThreadIndicesType =
vtkm::exec::arg::ThreadIndicesTopologyMap<vtkm::exec::ConnectivityExtrude<Device>>;
using ValueType = vtkm::Vec<vtkm::Id, 6>;
VTKM_SUPPRESS_EXEC_WARNINGS
VTKM_EXEC
ValueType Load(const ThreadIndicesType& indices, const ExecObjectType&) const
template <typename Device>
VTKM_EXEC auto Load(const vtkm::exec::arg::ThreadIndicesTopologyMap<
vtkm::exec::ConnectivityExtrude<Device>>& indices,
const ExecObjectType&) const -> vtkm::Vec<vtkm::Id, 6>
{
// std::cout << "opimized fetch for point ids" << std::endl;
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;
vtkm::Vec<vtkm::Id, 6> result;
result[0] = offset1 + xgcidx.PointIds[0][0];
result[1] = offset1 + xgcidx.PointIds[0][1];
result[2] = offset1 + xgcidx.PointIds[0][2];
@ -55,132 +49,104 @@ struct Fetch<FetchType,
return result;
}
VTKM_EXEC
void Store(const ThreadIndicesType&, const ExecObjectType&, const ValueType&) const
VTKM_SUPPRESS_EXEC_WARNINGS
template <typename ConnectivityType>
VTKM_EXEC auto Load(const vtkm::exec::arg::ThreadIndicesTopologyMap<ConnectivityType>& indices,
const ExecObjectType&) const -> decltype(indices.GetIndicesIncident())
{
return indices.GetIndicesIncident();
}
template <typename ThreadIndicesType, typename ValueType>
VTKM_EXEC void Store(const ThreadIndicesType&, const ExecObjectType&, const ValueType&) const
{
// Store is a no-op.
}
};
//Optimized fetch for point arrays when iterating the cells ConnectivityExtrude
template <typename Device, typename PortalType>
struct Fetch<vtkm::exec::arg::FetchTagArrayTopologyMapIn,
vtkm::exec::arg::AspectTagDefault,
vtkm::exec::arg::ThreadIndicesTopologyMap<vtkm::exec::ConnectivityExtrude<Device>>,
PortalType>
{
using ThreadIndicesType =
vtkm::exec::arg::ThreadIndicesTopologyMap<vtkm::exec::ConnectivityExtrude<Device>>;
using ValueType = vtkm::Vec<typename PortalType::ValueType, 6>;
VTKM_SUPPRESS_EXEC_WARNINGS
VTKM_EXEC
ValueType Load(const ThreadIndicesType& indices, const PortalType& portal)
{
// std::cout << "opimized fetch for point values" << std::endl;
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;
result[0] = portal.Get(offset1 + xgcidx.PointIds[0][0]);
result[1] = portal.Get(offset1 + xgcidx.PointIds[0][1]);
result[2] = portal.Get(offset1 + xgcidx.PointIds[0][2]);
result[3] = portal.Get(offset2 + xgcidx.PointIds[1][0]);
result[4] = portal.Get(offset2 + xgcidx.PointIds[1][1]);
result[5] = portal.Get(offset2 + xgcidx.PointIds[1][2]);
return result;
}
VTKM_EXEC
void Store(const ThreadIndicesType&, const PortalType&, const ValueType&) const
{
// Store is a no-op for this fetch.
}
};
//Optimized fetch for point coordinates when iterating the cells of ConnectivityExtrude
template <typename Device, typename T>
template <typename T>
struct Fetch<vtkm::exec::arg::FetchTagArrayTopologyMapIn,
vtkm::exec::arg::AspectTagDefault,
vtkm::exec::arg::ThreadIndicesTopologyMap<vtkm::exec::ConnectivityExtrude<Device>>,
vtkm::exec::ArrayPortalExtrude<T>>
{
using ThreadIndicesType =
vtkm::exec::arg::ThreadIndicesTopologyMap<vtkm::exec::ConnectivityExtrude<Device>>;
using ValueType = vtkm::Vec<typename vtkm::exec::ArrayPortalExtrude<T>::ValueType, 6>;
VTKM_SUPPRESS_EXEC_WARNINGS
VTKM_EXEC
ValueType Load(const ThreadIndicesType& indices, const vtkm::exec::ArrayPortalExtrude<T>& points)
template <typename ThreadIndicesType>
VTKM_EXEC auto Load(const ThreadIndicesType& indices,
const vtkm::exec::ArrayPortalExtrude<T>& points)
-> decltype(points.GetWedge(indices.GetIndicesIncident()))
{
// std::cout << "opimized fetch for point coordinates" << std::endl;
return points.GetWedge(indices.GetIndicesIncident());
}
VTKM_EXEC
void Store(const ThreadIndicesType&,
const vtkm::exec::ArrayPortalExtrude<T>&,
const ValueType&) const
template <typename ThreadIndicesType, typename ValueType>
VTKM_EXEC void Store(const ThreadIndicesType&,
const vtkm::exec::ArrayPortalExtrude<T>&,
const ValueType&) const
{
// Store is a no-op for this fetch.
}
};
//Optimized fetch for point coordinates when iterating the cells of ConnectivityExtrude
template <typename Device, typename T>
template <typename T>
struct Fetch<vtkm::exec::arg::FetchTagArrayTopologyMapIn,
vtkm::exec::arg::AspectTagDefault,
vtkm::exec::arg::ThreadIndicesTopologyMap<vtkm::exec::ConnectivityExtrude<Device>>,
vtkm::exec::ArrayPortalExtrudePlane<T>>
{
using ThreadIndicesType =
vtkm::exec::arg::ThreadIndicesTopologyMap<vtkm::exec::ConnectivityExtrude<Device>>;
using ValueType = vtkm::Vec<typename vtkm::exec::ArrayPortalExtrudePlane<T>::ValueType, 6>;
VTKM_SUPPRESS_EXEC_WARNINGS
VTKM_EXEC
ValueType Load(const ThreadIndicesType& indices,
const vtkm::exec::ArrayPortalExtrudePlane<T>& portal)
template <typename ThreadIndicesType>
VTKM_EXEC auto Load(const ThreadIndicesType& indices,
const vtkm::exec::ArrayPortalExtrudePlane<T>& portal)
-> decltype(portal.GetWedge(indices.GetIndicesIncident()))
{
// std::cout << "opimized fetch for point coordinates" << std::endl;
return portal.GetWedge(indices.GetIndicesIncident());
}
VTKM_EXEC
void Store(const ThreadIndicesType&,
const vtkm::exec::ArrayPortalExtrudePlane<T>&,
const ValueType&) const
template <typename ThreadIndicesType, typename ValueType>
VTKM_EXEC void Store(const ThreadIndicesType&,
const vtkm::exec::ArrayPortalExtrudePlane<T>&,
const ValueType&) const
{
// Store is a no-op for this fetch.
}
};
//Optimized fetch for point coordinates when iterating the points of ConnectivityExtrude
template <typename Device, typename T>
struct Fetch<
vtkm::exec::arg::FetchTagArrayDirectIn,
vtkm::exec::arg::AspectTagDefault,
vtkm::exec::arg::ThreadIndicesTopologyMap<vtkm::exec::ReverseConnectivityExtrude<Device>>,
vtkm::exec::ArrayPortalExtrude<T>>
template <typename T>
struct Fetch<vtkm::exec::arg::FetchTagArrayDirectIn,
vtkm::exec::arg::AspectTagDefault,
vtkm::exec::ArrayPortalExtrude<T>>
{
using ThreadIndicesType =
vtkm::exec::arg::ThreadIndicesTopologyMap<vtkm::exec::ReverseConnectivityExtrude<Device>>;
using ValueType = typename vtkm::exec::ArrayPortalExtrude<T>::ValueType;
VTKM_SUPPRESS_EXEC_WARNINGS
template <typename ThreadIndicesType>
VTKM_EXEC auto Load(const ThreadIndicesType& indices,
const vtkm::exec::ArrayPortalExtrude<T>& points)
-> decltype(points.Get(indices.GetInputIndex()))
{
// std::cout << "optimized fetch for point coordinates" << std::endl;
return points.Get(indices.GetInputIndex());
}
VTKM_SUPPRESS_EXEC_WARNINGS
VTKM_EXEC
ValueType Load(const ThreadIndicesType& indices, const vtkm::exec::ArrayPortalExtrude<T>& points)
template <typename Device>
VTKM_EXEC auto Load(const vtkm::exec::arg::ThreadIndicesTopologyMap<
vtkm::exec::ReverseConnectivityExtrude<Device>>& indices,
const vtkm::exec::ArrayPortalExtrude<T>& points)
-> decltype(points.Get(indices.GetIndexLogical()))
{
// std::cout << "opimized fetch for point coordinates" << std::endl;
// std::cout << "optimized fetch for point coordinates" << std::endl;
return points.Get(indices.GetIndexLogical());
}
VTKM_EXEC
void Store(const ThreadIndicesType&,
const vtkm::exec::ArrayPortalExtrude<T>&,
const ValueType&) const
template <typename ThreadIndicesType, typename ValueType>
VTKM_EXEC void Store(const ThreadIndicesType&,
const vtkm::exec::ArrayPortalExtrude<T>&,
const ValueType&) const
{
// Store is a no-op for this fetch.
}

@ -45,10 +45,9 @@ inline VTKM_EXEC T load(const U* u, vtkm::Id v)
return u->Get(v);
}
template <typename ThreadIndicesType, typename ExecObjectType>
template <typename ExecObjectType>
struct Fetch<vtkm::exec::arg::FetchTagArrayDirectIn,
vtkm::exec::arg::AspectTagDefault,
ThreadIndicesType,
ExecObjectType>
{
//need to remove pointer type from ThreadIdicesType
@ -59,14 +58,14 @@ struct Fetch<vtkm::exec::arg::FetchTagArrayDirectIn,
using ValueType = typename ET::ValueType;
VTKM_SUPPRESS_EXEC_WARNINGS
VTKM_EXEC
ValueType Load(const ThreadIndicesType& indices, PortalType arrayPortal) const
template <typename ThreadIndicesType>
VTKM_EXEC ValueType Load(const ThreadIndicesType& indices, PortalType arrayPortal) const
{
return load<ValueType>(arrayPortal, indices.GetInputIndex());
}
VTKM_EXEC
void Store(const ThreadIndicesType&, PortalType, const ValueType&) const
template <typename ThreadIndicesType>
VTKM_EXEC void Store(const ThreadIndicesType&, PortalType, const ValueType&) const
{
// Store is a no-op for this fetch.
}

@ -40,26 +40,26 @@ struct FetchTagArrayDirectInOut
{
};
template <typename ThreadIndicesType, typename ExecObjectType>
template <typename ExecObjectType>
struct Fetch<vtkm::exec::arg::FetchTagArrayDirectInOut,
vtkm::exec::arg::AspectTagDefault,
ThreadIndicesType,
ExecObjectType>
{
using ValueType = typename ExecObjectType::ValueType;
VTKM_SUPPRESS_EXEC_WARNINGS
VTKM_EXEC
ValueType Load(const ThreadIndicesType& indices, const ExecObjectType& arrayPortal) const
template <typename ThreadIndicesType>
VTKM_EXEC ValueType Load(const ThreadIndicesType& indices,
const ExecObjectType& arrayPortal) const
{
return arrayPortal.Get(indices.GetOutputIndex());
}
VTKM_SUPPRESS_EXEC_WARNINGS
VTKM_EXEC
void Store(const ThreadIndicesType& indices,
const ExecObjectType& arrayPortal,
const ValueType& value) const
template <typename ThreadIndicesType>
VTKM_EXEC void Store(const ThreadIndicesType& indices,
const ExecObjectType& arrayPortal,
const ValueType& value) const
{
arrayPortal.Set(indices.GetOutputIndex(), value);
}

@ -30,16 +30,15 @@ struct FetchTagArrayDirectOut
{
};
template <typename ThreadIndicesType, typename ExecObjectType>
template <typename ExecObjectType>
struct Fetch<vtkm::exec::arg::FetchTagArrayDirectOut,
vtkm::exec::arg::AspectTagDefault,
ThreadIndicesType,
ExecObjectType>
{
VTKM_SUPPRESS_EXEC_WARNINGS
VTKM_EXEC
auto Load(const ThreadIndicesType&, const ExecObjectType&) ->
typename ExecObjectType::ValueType const
template <typename ThreadIndicesType>
VTKM_EXEC auto Load(const ThreadIndicesType&, const ExecObjectType&) const ->
typename ExecObjectType::ValueType
{
// Load is a no-op for this fetch.
using ValueType = typename ExecObjectType::ValueType;
@ -47,7 +46,7 @@ struct Fetch<vtkm::exec::arg::FetchTagArrayDirectOut,
}
VTKM_SUPPRESS_EXEC_WARNINGS
template <typename T>
template <typename ThreadIndicesType, typename T>
VTKM_EXEC void Store(const ThreadIndicesType& indices,
const ExecObjectType& arrayPortal,
const T& value) const

@ -34,21 +34,20 @@ struct FetchTagArrayNeighborhoodIn
template <typename ExecObjectType>
struct Fetch<vtkm::exec::arg::FetchTagArrayNeighborhoodIn,
vtkm::exec::arg::AspectTagDefault,
vtkm::exec::arg::ThreadIndicesPointNeighborhood,
ExecObjectType>
{
using ThreadIndicesType = vtkm::exec::arg::ThreadIndicesPointNeighborhood;
using ValueType = vtkm::exec::FieldNeighborhood<ExecObjectType>;
VTKM_SUPPRESS_EXEC_WARNINGS
VTKM_EXEC
ValueType Load(const ThreadIndicesType& indices, const ExecObjectType& arrayPortal) const
template <typename ThreadIndicesType>
VTKM_EXEC ValueType Load(const ThreadIndicesType& indices,
const ExecObjectType& arrayPortal) const
{
return ValueType(arrayPortal, indices.GetBoundaryState());
}
VTKM_EXEC
void Store(const ThreadIndicesType&, const ExecObjectType&, const ValueType&) const
template <typename ThreadIndicesType>
VTKM_EXEC void Store(const ThreadIndicesType&, const ExecObjectType&, const ValueType&) const
{
// Store is a no-op for this fetch.
}

@ -19,6 +19,7 @@
#include <vtkm/internal/ArrayPortalUniformPointCoordinates.h>
#include <vtkm/VecAxisAlignedPointCoordinates.h>
#include <vtkm/exec/ConnectivityExtrude.h>
#include <vtkm/exec/ConnectivityStructured.h>
#include <vtkm/VecFromPortalPermute.h>
@ -51,12 +52,9 @@ namespace detail
// and the field is regular point coordinates, it is much faster to compute the
// field directly.
template <typename ConnectivityType, typename FieldExecObjectType>
template <typename ConnectivityType, typename FieldExecObjectType, typename ThreadIndicesType>
struct FetchArrayTopologyMapInImplementation
{
using ThreadIndicesType = vtkm::exec::arg::ThreadIndicesTopologyMap<ConnectivityType>;
// ThreadIndicesTopologyMap has special incident element indices that are
// stored in a Vec-like object.
using IndexVecType = typename ThreadIndicesType::IndicesIncidentType;
@ -128,18 +126,18 @@ static inline VTKM_EXEC vtkm::VecAxisAlignedPointCoordinates<3> make_VecAxisAlig
return vtkm::VecAxisAlignedPointCoordinates<3>(offsetOrigin, spacing);
}
template <vtkm::IdComponent NumDimensions>
template <vtkm::IdComponent NumDimensions, typename ThreadIndicesType>
struct FetchArrayTopologyMapInImplementation<
vtkm::exec::ConnectivityStructured<vtkm::TopologyElementTagCell,
vtkm::TopologyElementTagPoint,
NumDimensions>,
vtkm::internal::ArrayPortalUniformPointCoordinates>
vtkm::internal::ArrayPortalUniformPointCoordinates,
ThreadIndicesType>
{
using ConnectivityType = vtkm::exec::ConnectivityStructured<vtkm::TopologyElementTagCell,
vtkm::TopologyElementTagPoint,
NumDimensions>;
using ThreadIndicesType = vtkm::exec::arg::ThreadIndicesTopologyMap<ConnectivityType>;
using ValueType = vtkm::VecAxisAlignedPointCoordinates<NumDimensions>;
@ -155,14 +153,15 @@ struct FetchArrayTopologyMapInImplementation<
}
};
template <typename PermutationPortal, vtkm::IdComponent NumDimensions>
template <typename PermutationPortal, vtkm::IdComponent NumDimensions, typename ThreadIndicesType>
struct FetchArrayTopologyMapInImplementation<
vtkm::exec::ConnectivityPermutedVisitCellsWithPoints<
PermutationPortal,
vtkm::exec::ConnectivityStructured<vtkm::TopologyElementTagCell,
vtkm::TopologyElementTagPoint,
NumDimensions>>,
vtkm::internal::ArrayPortalUniformPointCoordinates>
vtkm::internal::ArrayPortalUniformPointCoordinates,
ThreadIndicesType>
{
using ConnectivityType = vtkm::exec::ConnectivityPermutedVisitCellsWithPoints<
@ -170,7 +169,6 @@ struct FetchArrayTopologyMapInImplementation<
vtkm::exec::ConnectivityStructured<vtkm::TopologyElementTagCell,
vtkm::TopologyElementTagPoint,
NumDimensions>>;
using ThreadIndicesType = vtkm::exec::arg::ThreadIndicesTopologyMap<ConnectivityType>;
using ValueType = vtkm::VecAxisAlignedPointCoordinates<NumDimensions>;
@ -191,28 +189,56 @@ struct FetchArrayTopologyMapInImplementation<
} // namespace detail
template <typename ConnectivityType, typename ExecObjectType>
template <typename ExecObjectType>
struct Fetch<vtkm::exec::arg::FetchTagArrayTopologyMapIn,
vtkm::exec::arg::AspectTagDefault,
vtkm::exec::arg::ThreadIndicesTopologyMap<ConnectivityType>,
ExecObjectType>
{
using ThreadIndicesType = vtkm::exec::arg::ThreadIndicesTopologyMap<ConnectivityType>;
using Implementation =
detail::FetchArrayTopologyMapInImplementation<ConnectivityType, ExecObjectType>;
using ValueType = typename Implementation::ValueType;
//using ConnectivityType = typename ThreadIndicesType::Connectivity;
VTKM_SUPPRESS_EXEC_WARNINGS
VTKM_EXEC
ValueType Load(const ThreadIndicesType& indices, const ExecObjectType& field) const
template <typename ThreadIndicesType>
VTKM_EXEC auto Load(const ThreadIndicesType& indices, const ExecObjectType& field) const
-> decltype(
detail::FetchArrayTopologyMapInImplementation<typename ThreadIndicesType::Connectivity,
ExecObjectType,
ThreadIndicesType>::Load(indices, field))
{
using Implementation =
detail::FetchArrayTopologyMapInImplementation<typename ThreadIndicesType::Connectivity,
ExecObjectType,
ThreadIndicesType>;
return Implementation::Load(indices, field);
}
VTKM_EXEC
void Store(const ThreadIndicesType&, const ExecObjectType&, const ValueType&) const
//Optimized fetch for point arrays when iterating the cells ConnectivityExtrude
VTKM_SUPPRESS_EXEC_WARNINGS
template <typename Device>
VTKM_EXEC auto Load(const vtkm::exec::arg::ThreadIndicesTopologyMap<
vtkm::exec::ConnectivityExtrude<Device>>& indices,
const ExecObjectType& portal)
-> vtkm::Vec<typename ExecObjectType::ValueType, 6>
{
// std::cout << "opimized fetch for point values" << std::endl;
const auto& xgcidx = indices.GetIndicesIncident();
const vtkm::Id offset1 = (xgcidx.Planes[0] * xgcidx.NumberOfPointsPerPlane);
const vtkm::Id offset2 = (xgcidx.Planes[1] * xgcidx.NumberOfPointsPerPlane);
using ValueType = vtkm::Vec<typename ExecObjectType::ValueType, 6>;
ValueType result;
result[0] = portal.Get(offset1 + xgcidx.PointIds[0][0]);
result[1] = portal.Get(offset1 + xgcidx.PointIds[0][1]);
result[2] = portal.Get(offset1 + xgcidx.PointIds[0][2]);
result[3] = portal.Get(offset2 + xgcidx.PointIds[1][0]);
result[4] = portal.Get(offset2 + xgcidx.PointIds[1][1]);
result[5] = portal.Get(offset2 + xgcidx.PointIds[1][2]);
return result;
}
template <typename ThreadIndicesType, typename T>
VTKM_EXEC void Store(const ThreadIndicesType&, const ExecObjectType&, const T&) const
{
// Store is a no-op for this fetch.
}

@ -12,7 +12,6 @@
#include <vtkm/exec/arg/AspectTagDefault.h>
#include <vtkm/exec/arg/Fetch.h>
#include <vtkm/exec/arg/ThreadIndicesTopologyMap.h>
namespace vtkm
{
@ -31,25 +30,19 @@ struct FetchTagCellSetIn
{
};
template <typename ConnectivityType, typename ExecObjectType>
struct Fetch<vtkm::exec::arg::FetchTagCellSetIn,
vtkm::exec::arg::AspectTagDefault,
vtkm::exec::arg::ThreadIndicesTopologyMap<ConnectivityType>,
ExecObjectType>
template <typename ExecObjectType>
struct Fetch<vtkm::exec::arg::FetchTagCellSetIn, vtkm::exec::arg::AspectTagDefault, ExecObjectType>
{
using ThreadIndicesType = vtkm::exec::arg::ThreadIndicesTopologyMap<ConnectivityType>;
using ValueType = typename ThreadIndicesType::CellShapeTag;
VTKM_SUPPRESS_EXEC_WARNINGS
VTKM_EXEC
ValueType Load(const ThreadIndicesType& indices, const ExecObjectType&) const
template <typename ThreadIndicesType>
VTKM_EXEC auto Load(const ThreadIndicesType& indices, const ExecObjectType&) const
-> decltype(indices.GetCellShape())
{
return indices.GetCellShape();
}
VTKM_EXEC
void Store(const ThreadIndicesType&, const ExecObjectType&, const ValueType&) const
template <typename ThreadIndicesType, typename ValueType>
VTKM_EXEC void Store(const ThreadIndicesType&, const ExecObjectType&, const ValueType&) const
{
// Store is a no-op for this fetch.
}

@ -33,24 +33,21 @@ struct FetchTagExecObject
{
};
template <typename ThreadIndicesType, typename ExecObjectType>
struct Fetch<vtkm::exec::arg::FetchTagExecObject,
vtkm::exec::arg::AspectTagDefault,
ThreadIndicesType,
ExecObjectType>
template <typename ExecObjectType>
struct Fetch<vtkm::exec::arg::FetchTagExecObject, vtkm::exec::arg::AspectTagDefault, ExecObjectType>
{
using ValueType = ExecObjectType;
VTKM_SUPPRESS_EXEC_WARNINGS
VTKM_EXEC
ValueType Load(const ThreadIndicesType& vtkmNotUsed(indices),
const ExecObjectType& execObject) const
template <typename ThreadIndicesType>
VTKM_EXEC ValueType Load(const ThreadIndicesType& vtkmNotUsed(indices),
const ExecObjectType& execObject) const
{
return execObject;
}
VTKM_EXEC
void Store(const ThreadIndicesType&, const ExecObjectType&, const ValueType&) const
template <typename ThreadIndicesType>
VTKM_EXEC void Store(const ThreadIndicesType&, const ExecObjectType&, const ValueType&) const
{
// Store is a no-op for this fetch.
}

@ -36,24 +36,22 @@ template <typename KeyPortalType, typename IdPortalType, typename IdComponentPor
struct Fetch<
vtkm::exec::arg::FetchTagKeysIn,
vtkm::exec::arg::AspectTagDefault,
vtkm::exec::arg::ThreadIndicesReduceByKey,
vtkm::exec::internal::ReduceByKeyLookup<KeyPortalType, IdPortalType, IdComponentPortalType>>
{
using ThreadIndicesType = vtkm::exec::arg::ThreadIndicesReduceByKey;
using ExecObjectType =
vtkm::exec::internal::ReduceByKeyLookup<KeyPortalType, IdPortalType, IdComponentPortalType>;
using ValueType = typename ExecObjectType::KeyType;
VTKM_SUPPRESS_EXEC_WARNINGS
VTKM_EXEC
ValueType Load(const ThreadIndicesType& indices, const ExecObjectType& keys) const
template <typename ThreadIndicesType>
VTKM_EXEC ValueType Load(const ThreadIndicesType& indices, const ExecObjectType& keys) const
{
return keys.UniqueKeys.Get(indices.GetInputIndex());
}
VTKM_EXEC
void Store(const ThreadIndicesType&, const ExecObjectType&, const ValueType&) const
template <typename ThreadIndicesType>
VTKM_EXEC void Store(const ThreadIndicesType&, const ExecObjectType&, const ValueType&) const
{
// Store is a no-op for this fetch.
}

@ -29,24 +29,23 @@ struct FetchTagWholeCellSetIn
{
};
template <typename ThreadIndicesType, typename ExecObjectType>
template <typename ExecObjectType>
struct Fetch<vtkm::exec::arg::FetchTagWholeCellSetIn,
vtkm::exec::arg::AspectTagDefault,
ThreadIndicesType,
ExecObjectType>
{
using ValueType = ExecObjectType;
VTKM_SUPPRESS_EXEC_WARNINGS
VTKM_EXEC
ValueType Load(const ThreadIndicesType& vtkmNotUsed(indices),
const ExecObjectType& execObject) const
template <typename ThreadIndicesType>
VTKM_EXEC ValueType Load(const ThreadIndicesType& vtkmNotUsed(indices),
const ExecObjectType& execObject) const
{
return execObject;
}
VTKM_EXEC
void Store(const ThreadIndicesType&, const ExecObjectType&, const ValueType&) const
template <typename ThreadIndicesType>
VTKM_EXEC void Store(const ThreadIndicesType&, const ExecObjectType&, const ValueType&) const
{
// Store is a no-op for this fetch.
}

@ -12,7 +12,6 @@
#include <vtkm/exec/arg/ExecutionSignatureTagBase.h>
#include <vtkm/exec/arg/Fetch.h>
#include <vtkm/exec/arg/ThreadIndicesTopologyMap.h>
namespace vtkm
{
@ -44,25 +43,20 @@ struct IncidentElementCount : vtkm::exec::arg::ExecutionSignatureTagBase
using AspectTag = vtkm::exec::arg::AspectTagIncidentElementCount;
};
template <typename FetchTag, typename ConnectivityType, typename ExecObjectType>
struct Fetch<FetchTag,
vtkm::exec::arg::AspectTagIncidentElementCount,
vtkm::exec::arg::ThreadIndicesTopologyMap<ConnectivityType>,
ExecObjectType>
template <typename FetchTag, typename ExecObjectType>
struct Fetch<FetchTag, vtkm::exec::arg::AspectTagIncidentElementCount, ExecObjectType>
{
using ThreadIndicesType = vtkm::exec::arg::ThreadIndicesTopologyMap<ConnectivityType>;
using ValueType = vtkm::IdComponent;
VTKM_SUPPRESS_EXEC_WARNINGS
VTKM_EXEC
ValueType Load(const ThreadIndicesType& indices, const ExecObjectType&) const
template <typename ThreadIndicesType>
VTKM_EXEC ValueType Load(const ThreadIndicesType& indices, const ExecObjectType&) const
{
return indices.GetIndicesIncident().GetNumberOfComponents();
}
VTKM_EXEC
void Store(const ThreadIndicesType&, const ExecObjectType&, const ValueType&) const
template <typename ThreadIndicesType>
VTKM_EXEC void Store(const ThreadIndicesType&, const ExecObjectType&, const ValueType&) const
{
// Store is a no-op.
}

@ -12,7 +12,6 @@
#include <vtkm/exec/arg/ExecutionSignatureTagBase.h>
#include <vtkm/exec/arg/Fetch.h>
#include <vtkm/exec/arg/ThreadIndicesTopologyMap.h>
namespace vtkm
{
@ -44,30 +43,6 @@ struct IncidentElementIndices : vtkm::exec::arg::ExecutionSignatureTagBase
static constexpr vtkm::IdComponent INDEX = 1;
using AspectTag = vtkm::exec::arg::AspectTagIncidentElementIndices;
};
template <typename FetchTag, typename ConnectivityType, typename ExecObjectType>
struct Fetch<FetchTag,
vtkm::exec::arg::AspectTagIncidentElementIndices,
vtkm::exec::arg::ThreadIndicesTopologyMap<ConnectivityType>,
ExecObjectType>
{
using ThreadIndicesType = vtkm::exec::arg::ThreadIndicesTopologyMap<ConnectivityType>;
using ValueType = typename ThreadIndicesType::IndicesIncidentType;
VTKM_SUPPRESS_EXEC_WARNINGS
VTKM_EXEC
ValueType Load(const ThreadIndicesType& indices, const ExecObjectType&) const
{
return indices.GetIndicesIncident();
}
VTKM_EXEC
void Store(const ThreadIndicesType&, const ExecObjectType&, const ValueType&) const
{
// Store is a no-op.
}
};
}
}
} // namespace vtkm::exec::arg

@ -50,19 +50,19 @@ struct InputIndex : vtkm::exec::arg::ExecutionSignatureTagBase
using AspectTag = vtkm::exec::arg::AspectTagInputIndex;
};
template <typename FetchTag, typename ThreadIndicesType, typename ExecObjectType>
struct Fetch<FetchTag, vtkm::exec::arg::AspectTagInputIndex, ThreadIndicesType, ExecObjectType>
template <typename FetchTag, typename ExecObjectType>
struct Fetch<FetchTag, vtkm::exec::arg::AspectTagInputIndex, ExecObjectType>
{
using ValueType = vtkm::Id;
VTKM_EXEC
vtkm::Id Load(const ThreadIndicesType& indices, const ExecObjectType&) const
template <typename ThreadIndicesType>
VTKM_EXEC vtkm::Id Load(const ThreadIndicesType& indices, const ExecObjectType&) const
{
return indices.GetInputIndex();
}
VTKM_EXEC
void Store(const ThreadIndicesType&, const ExecObjectType&, const ValueType&) const
template <typename ThreadIndicesType>
VTKM_EXEC void Store(const ThreadIndicesType&, const ExecObjectType&, const ValueType&) const
{
// Store is a no-op.
}

@ -50,19 +50,19 @@ struct OutputIndex : vtkm::exec::arg::ExecutionSignatureTagBase
using AspectTag = vtkm::exec::arg::AspectTagOutputIndex;
};
template <typename FetchTag, typename ThreadIndicesType, typename ExecObjectType>
struct Fetch<FetchTag, vtkm::exec::arg::AspectTagOutputIndex, ThreadIndicesType, ExecObjectType>
template <typename FetchTag, typename ExecObjectType>
struct Fetch<FetchTag, vtkm::exec::arg::AspectTagOutputIndex, ExecObjectType>
{
using ValueType = vtkm::Id;
VTKM_EXEC
vtkm::Id Load(const ThreadIndicesType& indices, const ExecObjectType&) const
template <typename ThreadIndicesType>
VTKM_EXEC vtkm::Id Load(const ThreadIndicesType& indices, const ExecObjectType&) const
{
return indices.GetOutputIndex();
}
VTKM_EXEC
void Store(const ThreadIndicesType&, const ExecObjectType&, const ValueType&) const
template <typename ThreadIndicesType>
VTKM_EXEC void Store(const ThreadIndicesType&, const ExecObjectType&, const ValueType&) const
{
// Store is a no-op.
}

@ -49,19 +49,21 @@ struct ThreadIndices : vtkm::exec::arg::ExecutionSignatureTagBase
using AspectTag = vtkm::exec::arg::AspectTagThreadIndices;
};
template <typename FetchTag, typename ThreadIndicesType, typename ExecObjectType>
struct Fetch<FetchTag, vtkm::exec::arg::AspectTagThreadIndices, ThreadIndicesType, ExecObjectType>
template <typename FetchTag, typename ExecObjectType>
struct Fetch<FetchTag, vtkm::exec::arg::AspectTagThreadIndices, ExecObjectType>
{
using ValueType = const ThreadIndicesType&;
VTKM_EXEC
const ThreadIndicesType& Load(const ThreadIndicesType& indices, const ExecObjectType&) const
template <typename ThreadIndicesType>
VTKM_EXEC const ThreadIndicesType& Load(const ThreadIndicesType& indices,
const ExecObjectType&) const
{
return indices;
}
VTKM_EXEC
void Store(const ThreadIndicesType&, const ExecObjectType&, const ThreadIndicesType&) const
template <typename ThreadIndicesType>
VTKM_EXEC void Store(const ThreadIndicesType&,
const ExecObjectType&,
const ThreadIndicesType&) const
{
// Store is a no-op.
}

@ -31,7 +31,7 @@ public:
using CellShapeTag = typename ConnectivityType::CellShapeTag;
using IndicesIncidentType = typename ConnectivityType::IndicesType;
using LogicalIndexType = typename ConnectivityType::SchedulingRangeType;
using Connectivity = vtkm::exec::ConnectivityExtrude<Device>;
VTKM_SUPPRESS_EXEC_WARNINGS
VTKM_EXEC ThreadIndicesTopologyMap(vtkm::Id threadIndex,
@ -184,6 +184,7 @@ public:
using CellShapeTag = typename ConnectivityType::CellShapeTag;
using IndicesIncidentType = typename ConnectivityType::IndicesType;
using LogicalIndexType = typename ConnectivityType::SchedulingRangeType;
using Connectivity = ConnectivityType;
VTKM_SUPPRESS_EXEC_WARNINGS
VTKM_EXEC

@ -88,6 +88,7 @@ class ThreadIndicesTopologyMap : public vtkm::exec::arg::ThreadIndicesBasic
public:
using IndicesIncidentType = typename ConnectivityType::IndicesType;
using CellShapeTag = typename ConnectivityType::CellShapeTag;
using Connectivity = ConnectivityType;
VTKM_SUPPRESS_EXEC_WARNINGS
VTKM_EXEC ThreadIndicesTopologyMap(vtkm::Id threadIndex,
@ -155,6 +156,8 @@ public:
using IndicesIncidentType = typename ConnectivityType::IndicesType;
using CellShapeTag = typename ConnectivityType::CellShapeTag;
using LogicalIndexType = typename ConnectivityType::SchedulingRangeType;
using Connectivity =
vtkm::exec::ConnectivityStructured<VisitTopology, IncidentTopology, Dimension>;
VTKM_EXEC ThreadIndicesTopologyMap(vtkm::Id threadIndex,
vtkm::Id inIndex,
@ -317,6 +320,11 @@ public:
using IndicesIncidentType = typename ConnectivityType::IndicesType;
using CellShapeTag = typename ConnectivityType::CellShapeTag;
using LogicalIndexType = typename ConnectivityType::SchedulingRangeType;
using Connectivity = vtkm::exec::ConnectivityPermutedVisitCellsWithPoints<
PermutationPortal,
vtkm::exec::ConnectivityStructured<vtkm::TopologyElementTagCell,
vtkm::TopologyElementTagPoint,
Dimension>>;
VTKM_EXEC ThreadIndicesTopologyMap(vtkm::Id threadIndex,
vtkm::Id inputIndex,

@ -44,24 +44,20 @@ struct ValueCount : vtkm::exec::arg::ExecutionSignatureTagBase
};
template <typename FetchTag, typename ExecObjectType>
struct Fetch<FetchTag,
vtkm::exec::arg::AspectTagValueCount,
vtkm::exec::arg::ThreadIndicesReduceByKey,
ExecObjectType>
struct Fetch<FetchTag, vtkm::exec::arg::AspectTagValueCount, ExecObjectType>
{
using ThreadIndicesType = vtkm::exec::arg::ThreadIndicesReduceByKey;
using ValueType = vtkm::IdComponent;
VTKM_SUPPRESS_EXEC_WARNINGS
VTKM_EXEC
ValueType Load(const ThreadIndicesType& indices, const ExecObjectType&) const
template <typename ThreadIndicesType>
VTKM_EXEC ValueType Load(const ThreadIndicesType& indices, const ExecObjectType&) const
{
return indices.GetNumberOfValues();
}
VTKM_EXEC
void Store(const ThreadIndicesType&, const ExecObjectType&, const ValueType&) const
template <typename ThreadIndicesType>
VTKM_EXEC void Store(const ThreadIndicesType&, const ExecObjectType&, const ValueType&) const
{
// Store is a no-op.
}

@ -51,19 +51,19 @@ struct VisitIndex : vtkm::exec::arg::ExecutionSignatureTagBase
using AspectTag = vtkm::exec::arg::AspectTagVisitIndex;
};
template <typename FetchTag, typename ThreadIndicesType, typename ExecObjectType>
struct Fetch<FetchTag, vtkm::exec::arg::AspectTagVisitIndex, ThreadIndicesType, ExecObjectType>
template <typename FetchTag, typename ExecObjectType>
struct Fetch<FetchTag, vtkm::exec::arg::AspectTagVisitIndex, ExecObjectType>
{
using ValueType = vtkm::IdComponent;
VTKM_EXEC
vtkm::IdComponent Load(const ThreadIndicesType& indices, const ExecObjectType&) const
template <typename ThreadIndicesType>
VTKM_EXEC vtkm::IdComponent Load(const ThreadIndicesType& indices, const ExecObjectType&) const
{
return indices.GetVisitIndex();
}
VTKM_EXEC
void Store(const ThreadIndicesType&, const ExecObjectType&, const ValueType&) const
template <typename ThreadIndicesType>
VTKM_EXEC void Store(const ThreadIndicesType&, const ExecObjectType&, const ValueType&) const
{
// Store is a no-op.
}

@ -47,19 +47,19 @@ struct WorkIndex : vtkm::exec::arg::ExecutionSignatureTagBase
using AspectTag = vtkm::exec::arg::AspectTagWorkIndex;
};
template <typename FetchTag, typename ThreadIndicesType, typename ExecObjectType>
struct Fetch<FetchTag, vtkm::exec::arg::AspectTagWorkIndex, ThreadIndicesType, ExecObjectType>
template <typename FetchTag, typename ExecObjectType>
struct Fetch<FetchTag, vtkm::exec::arg::AspectTagWorkIndex, ExecObjectType>
{
using ValueType = vtkm::Id;
VTKM_EXEC
vtkm::Id Load(const ThreadIndicesType& indices, const ExecObjectType&) const
template <typename ThreadIndicesType>
VTKM_EXEC vtkm::Id Load(const ThreadIndicesType& indices, const ExecObjectType&) const
{
return indices.GetThreadIndex();
}
VTKM_EXEC
void Store(const ThreadIndicesType&, const ExecObjectType&, const ValueType&) const
template <typename ThreadIndicesType>
VTKM_EXEC void Store(const ThreadIndicesType&, const ExecObjectType&, const ValueType&) const
{
// Store is a no-op.
}

@ -45,7 +45,6 @@ struct FetchArrayDirectInTests
using FetchType = vtkm::exec::arg::Fetch<vtkm::exec::arg::FetchTagArrayDirectIn,
vtkm::exec::arg::AspectTagDefault,
vtkm::exec::arg::ThreadIndicesTesting,
TestPortal<T>>;
FetchType fetch;

@ -54,21 +54,21 @@ namespace arg
template <typename T>
struct Fetch<vtkm::exec::arg::FetchTagArrayDirectIn,
vtkm::exec::arg::AspectTagDefault,
vtkm::exec::arg::ThreadIndicesBasic3D,
TestPortal<T>>
{
using ValueType = T;
using PortalType = const TestPortal<T>&;
using ThreadIndicesType = vtkm::exec::arg::ThreadIndicesBasic3D;
VTKM_EXEC
ValueType Load(const ThreadIndicesType& indices, PortalType field) const
template <typename ThreadIndicesType>
VTKM_EXEC ValueType Load(const ThreadIndicesType& indices, PortalType field) const
{
return field.Get(indices.GetInputIndex3D());
}
VTKM_EXEC
void Store(const ThreadIndicesType&, PortalType, ValueType) const {}
template <typename ThreadIndicesType>
VTKM_EXEC void Store(const ThreadIndicesType&, PortalType, ValueType) const
{
}
};
}
}
@ -86,7 +86,6 @@ struct FetchArrayDirectIn3DTests
using FetchType = vtkm::exec::arg::Fetch<vtkm::exec::arg::FetchTagArrayDirectIn,
vtkm::exec::arg::AspectTagDefault,
vtkm::exec::arg::ThreadIndicesBasic3D,
TestPortal<T>>;
FetchType fetch;

@ -58,7 +58,6 @@ struct FetchArrayDirectInTests
using FetchType = vtkm::exec::arg::Fetch<vtkm::exec::arg::FetchTagArrayDirectInOut,
vtkm::exec::arg::AspectTagDefault,
vtkm::exec::arg::ThreadIndicesTesting,
TestPortal<T>>;
FetchType fetch;

@ -50,7 +50,6 @@ struct FetchArrayDirectOutTests
using FetchType = vtkm::exec::arg::Fetch<vtkm::exec::arg::FetchTagArrayDirectOut,
vtkm::exec::arg::AspectTagDefault,
vtkm::exec::arg::ThreadIndicesTesting,
TestPortal<T>>;
FetchType fetch;

@ -96,7 +96,6 @@ struct FetchArrayNeighborhoodInTests
using FetchType = vtkm::exec::arg::Fetch<vtkm::exec::arg::FetchTagArrayNeighborhoodIn,
vtkm::exec::arg::AspectTagDefault,
vtkm::exec::arg::ThreadIndicesPointNeighborhood,
TestPortal<T>>;
FetchType fetch;

@ -8,15 +8,13 @@
// PURPOSE. See the above copyright notice for more information.
//============================================================================
#include <vtkm/testing/Testing.h>
#include <vtkm/exec/arg/FetchTagArrayTopologyMapIn.h>
#include <vtkm/exec/arg/ThreadIndicesTopologyMap.h>
#include <vtkm/internal/FunctionInterface.h>
#include <vtkm/internal/Invocation.h>
#include <vtkm/testing/Testing.h>
namespace
{
@ -93,7 +91,6 @@ struct FetchArrayTopologyMapInTests
using FetchType = vtkm::exec::arg::Fetch<vtkm::exec::arg::FetchTagArrayTopologyMapIn,
vtkm::exec::arg::AspectTagDefault,
ThreadIndicesType,
TestPortal<T>>;
FetchType fetch;
@ -105,7 +102,7 @@ struct FetchArrayTopologyMapInTests
ThreadIndicesType indices(
threadIndex, inputIndex, visitIndex, outputIndex, invocation.GetInputDomain());
typename FetchType::ValueType value =
auto value =
fetch.Load(indices, vtkm::internal::ParameterGet<ParamIndex>(invocation.Parameters));
VTKM_TEST_ASSERT(value.GetNumberOfComponents() == 8,
"Topology fetch got wrong number of components.");
@ -173,7 +170,6 @@ void TryStructuredPointCoordinatesInvocation(const Invocation& invocation)
vtkm::exec::arg::Fetch<vtkm::exec::arg::FetchTagArrayTopologyMapIn,
vtkm::exec::arg::AspectTagDefault,
ThreadIndicesType,
vtkm::internal::ArrayPortalUniformPointCoordinates>
fetch;

@ -38,7 +38,6 @@ void TryInvocation()
using FetchType = vtkm::exec::arg::Fetch<vtkm::exec::arg::FetchTagExecObject,
vtkm::exec::arg::AspectTagDefault,
vtkm::exec::arg::ThreadIndicesTesting,
TestExecutionObject>;
FetchType fetch;

@ -26,7 +26,6 @@ void TestWorkIndexFetch()
using FetchType =
vtkm::exec::arg::Fetch<vtkm::exec::arg::FetchTagArrayDirectIn, // Not used but probably common.
vtkm::exec::arg::AspectTagWorkIndex,
vtkm::exec::arg::ThreadIndicesTesting,
vtkm::internal::NullType>;
FetchType fetch;

@ -97,10 +97,7 @@ namespace arg
{
template <>
struct Fetch<TestFetchTagInput,
vtkm::exec::arg::AspectTagDefault,
vtkm::exec::arg::ThreadIndicesBasic,
TestExecObject>
struct Fetch<TestFetchTagInput, vtkm::exec::arg::AspectTagDefault, TestExecObject>
{
using ValueType = vtkm::Id;
@ -119,10 +116,7 @@ struct Fetch<TestFetchTagInput,
};
template <>
struct Fetch<TestFetchTagOutput,
vtkm::exec::arg::AspectTagDefault,
vtkm::exec::arg::ThreadIndicesBasic,
TestExecObject>
struct Fetch<TestFetchTagOutput, vtkm::exec::arg::AspectTagDefault, TestExecObject>
{
using ValueType = vtkm::Id;

@ -84,7 +84,7 @@ struct InvocationToFetch
typename Invocation::DeviceAdapterTag,
typename Invocation::ParameterInterface::template ParameterType<ControlParameterIndex>::type>::type;
using type = vtkm::exec::arg::Fetch<FetchTag, AspectTag, ThreadIndicesType, ExecObjectType>;
using type = vtkm::exec::arg::Fetch<FetchTag, AspectTag, ExecObjectType>;
VTKM_EXEC static ExecObjectType GetParameterImpl(const Invocation&, std::true_type)
{

@ -145,7 +145,7 @@ struct InvocationToFetch
typename Invocation::DeviceAdapterTag,
typename Invocation::ParameterInterface::template ParameterType<ControlParameterIndex>::type>::type;
using type = vtkm::exec::arg::Fetch<FetchTag, AspectTag, ThreadIndicesType, ExecObjectType>;
using type = vtkm::exec::arg::Fetch<FetchTag, AspectTag, ExecObjectType>;
VTKM_EXEC static ExecObjectType GetParameterImpl(const Invocation&, std::true_type)
{

@ -104,10 +104,7 @@ namespace arg
using namespace vtkm::exec::internal::testing;
template <>
struct Fetch<TestFetchTagInput,
vtkm::exec::arg::AspectTagDefault,
vtkm::exec::arg::ThreadIndicesBasic,
TestExecObject>
struct Fetch<TestFetchTagInput, vtkm::exec::arg::AspectTagDefault, TestExecObject>
{
using ValueType = vtkm::Id;
@ -126,10 +123,7 @@ struct Fetch<TestFetchTagInput,
};
template <>
struct Fetch<TestFetchTagOutput,
vtkm::exec::arg::AspectTagDefault,
vtkm::exec::arg::ThreadIndicesBasic,
TestExecObject>
struct Fetch<TestFetchTagOutput, vtkm::exec::arg::AspectTagDefault, TestExecObject>
{
using ValueType = vtkm::Id;

@ -87,10 +87,7 @@ namespace arg
{
template <>
struct Fetch<TestFetchTagInput,
vtkm::exec::arg::AspectTagDefault,
vtkm::exec::arg::ThreadIndicesBasic,
TestExecObject>
struct Fetch<TestFetchTagInput, vtkm::exec::arg::AspectTagDefault, TestExecObject>
{
using ValueType = vtkm::Id;
@ -109,10 +106,7 @@ struct Fetch<TestFetchTagInput,
};
template <>
struct Fetch<TestFetchTagOutput,
vtkm::exec::arg::AspectTagDefault,
vtkm::exec::arg::ThreadIndicesBasic,
TestExecObject>
struct Fetch<TestFetchTagOutput, vtkm::exec::arg::AspectTagDefault, TestExecObject>
{
using ValueType = vtkm::Id;
@ -226,7 +220,6 @@ VTKM_STATIC_ASSERT(
InvocationToFetch<vtkm::exec::arg::ThreadIndicesBasic, InvocationType1, 1>::type,
vtkm::exec::arg::Fetch<TestFetchTagInput,
vtkm::exec::arg::AspectTagDefault,
vtkm::exec::arg::ThreadIndicesBasic,
TestExecObject>>::type::value));
VTKM_STATIC_ASSERT(
@ -234,7 +227,6 @@ VTKM_STATIC_ASSERT(
InvocationToFetch<vtkm::exec::arg::ThreadIndicesBasic, InvocationType1, 2>::type,
vtkm::exec::arg::Fetch<TestFetchTagOutput,
vtkm::exec::arg::AspectTagDefault,
vtkm::exec::arg::ThreadIndicesBasic,
TestExecObject>>::type::value));
VTKM_STATIC_ASSERT(
@ -242,7 +234,6 @@ VTKM_STATIC_ASSERT(
InvocationToFetch<vtkm::exec::arg::ThreadIndicesBasic, InvocationType2, 0>::type,
vtkm::exec::arg::Fetch<TestFetchTagOutput,
vtkm::exec::arg::AspectTagDefault,
vtkm::exec::arg::ThreadIndicesBasic,
TestExecObject>>::type::value));
void TestNormalFunctorInvoke()

@ -88,10 +88,7 @@ namespace arg
{
template <>
struct Fetch<TestFetchTagInput,
vtkm::exec::arg::AspectTagDefault,
vtkm::exec::arg::ThreadIndicesBasic,
TestExecObject>
struct Fetch<TestFetchTagInput, vtkm::exec::arg::AspectTagDefault, TestExecObject>
{
using ValueType = vtkm::Id;
@ -110,10 +107,7 @@ struct Fetch<TestFetchTagInput,
};
template <>
struct Fetch<TestFetchTagOutput,
vtkm::exec::arg::AspectTagDefault,
vtkm::exec::arg::ThreadIndicesBasic,
TestExecObject>
struct Fetch<TestFetchTagOutput, vtkm::exec::arg::AspectTagDefault, TestExecObject>
{
using ValueType = vtkm::Id;

@ -15,6 +15,7 @@
#include <vtkm/exec/ParametricCoordinates.h>
#include <vtkm/worklet/WorkletMapTopology.h>
#include <utility>
#include <vtkm/worklet/gradient/GradientOutput.h>
@ -50,6 +51,7 @@ struct PointGradient : public vtkm::worklet::WorkletVisitPointsWithCells
GradientOutType& outputGradient) const
{
using CellThreadIndices = vtkm::exec::arg::ThreadIndicesTopologyMap<CellSetInType>;
using ValueType = typename WholeFieldIn::ValueType;
using CellShapeTag = typename CellSetInType::CellShapeTag;
@ -107,10 +109,9 @@ private:
}
}
template <typename CellSetInType>
VTKM_EXEC vtkm::IdComponent GetPointIndexForCell(
const vtkm::exec::arg::ThreadIndicesTopologyMap<CellSetInType>& indices,
vtkm::Id pointId) const
template <typename ThreadIndicesType>
VTKM_EXEC vtkm::IdComponent GetPointIndexForCell(const ThreadIndicesType& indices,
vtkm::Id pointId) const
{
vtkm::IdComponent result = 0;
const auto& topo = indices.GetIndicesIncident();
@ -128,14 +129,12 @@ private:
//VecRectilinearPointCoordinates when using structured connectivity, and
//uniform point coordinates.
//c++14 would make the return type simply auto
template <typename CellSetInType, typename WholeFieldIn>
VTKM_EXEC
typename vtkm::exec::arg::Fetch<vtkm::exec::arg::FetchTagArrayTopologyMapIn,
vtkm::exec::arg::AspectTagDefault,
vtkm::exec::arg::ThreadIndicesTopologyMap<CellSetInType>,
typename WholeFieldIn::PortalType>::ValueType
GetValues(const vtkm::exec::arg::ThreadIndicesTopologyMap<CellSetInType>& indices,
const WholeFieldIn& in) const
template <typename ThreadIndicesType, typename WholeFieldIn>
VTKM_EXEC auto GetValues(const ThreadIndicesType& indices, const WholeFieldIn& in) const
-> decltype(std::declval<vtkm::exec::arg::Fetch<vtkm::exec::arg::FetchTagArrayTopologyMapIn,
vtkm::exec::arg::AspectTagDefault,
typename WholeFieldIn::PortalType>>()
.Load(indices, in.GetPortal()))
{
//the current problem is that when the topology is structured
//we are passing in an vtkm::Id when it wants a Id2 or an Id3 that
@ -143,7 +142,6 @@ private:
using ExecObjectType = typename WholeFieldIn::PortalType;
using Fetch = vtkm::exec::arg::Fetch<vtkm::exec::arg::FetchTagArrayTopologyMapIn,
vtkm::exec::arg::AspectTagDefault,
vtkm::exec::arg::ThreadIndicesTopologyMap<CellSetInType>,
ExecObjectType>;
Fetch fetch;
return fetch.Load(indices, in.GetPortal());

@ -185,10 +185,7 @@ namespace arg
{
template <>
struct Fetch<TestFetchTagInput,
vtkm::exec::arg::AspectTagDefault,
vtkm::exec::arg::ThreadIndicesBasic,
TestExecObjectIn>
struct Fetch<TestFetchTagInput, vtkm::exec::arg::AspectTagDefault, TestExecObjectIn>
{
using ValueType = vtkm::Id;
@ -207,10 +204,7 @@ struct Fetch<TestFetchTagInput,
};
template <>
struct Fetch<TestFetchTagOutput,
vtkm::exec::arg::AspectTagDefault,
vtkm::exec::arg::ThreadIndicesBasic,
TestExecObjectOut>
struct Fetch<TestFetchTagOutput, vtkm::exec::arg::AspectTagDefault, TestExecObjectOut>
{
using ValueType = vtkm::Id;

@ -59,21 +59,21 @@ namespace arg
template <typename PType>
struct Fetch<vtkm::exec::arg::FetchTagExecObject,
vtkm::exec::arg::AspectTagDefault,
vtkm::exec::arg::ThreadIndicesBasic3D,
mapfield3d::ExecutionObject<PType>>
{
using ValueType = typename PType::ValueType;
using PortalType = mapfield3d::ExecutionObject<PType>;
using ThreadIndicesType = vtkm::exec::arg::ThreadIndicesBasic3D;
VTKM_EXEC
ValueType Load(const ThreadIndicesType& indices, const PortalType& field) const
template <typename ThreadIndicesType>
VTKM_EXEC ValueType Load(const ThreadIndicesType& indices, const PortalType& field) const
{
return field.Portal.Get(indices.GetInputIndex());
}
VTKM_EXEC
void Store(const ThreadIndicesType&, const PortalType&, const ValueType&) const {}
template <typename ThreadIndicesType>
VTKM_EXEC void Store(const ThreadIndicesType&, const PortalType&, const ValueType&) const
{
}
};
}
}