added PrepareForExecution to compile code base

added prepare for execution function to all the execution object factories that did not have it implemented to compile the code base
This commit is contained in:
Matthew Letter 2018-03-05 16:26:12 -07:00 committed by Matthew Letter
parent cc7035ae9e
commit af250acbfc
5 changed files with 111 additions and 43 deletions

@ -722,7 +722,7 @@ public:
const vtkm::cont::ArrayHandle<vtkm::Vec<PointComponentType, 3>, PointStorageType>& points,
vtkm::cont::ArrayHandle<vtkm::Id>& cellIds,
vtkm::cont::ArrayHandle<FloatVec3>& parametricCoords,
DeviceAdapter device,
DeviceAdapter,
CellSetList cellSetTypes = CellSetList()) const
{
vtkm::worklet::DispatcherMapField<FindCellWorklet, DeviceAdapter>().Invoke(

@ -129,6 +129,12 @@ public:
{
}
template <typename Device>
VTKM_CONT Texture2DSampler<Device> PrepareForExecution(Device) const
{
return *this;
}
VTKM_EXEC
inline ColorType GetColor(vtkm::Float32 u, vtkm::Float32 v) const
{

@ -66,6 +66,68 @@ VTKM_EXEC_CONT vtkm::Vec<T, NumComponents> Scale(const vtkm::Vec<T, NumComponent
return val * scale;
}
template <typename DeviceAdapter>
class ExecutionObject
{
private:
using UInt8Portal =
typename vtkm::cont::ArrayHandle<vtkm::UInt8>::template ExecutionTypes<DeviceAdapter>::Portal;
using IdComponentPortal = typename vtkm::cont::ArrayHandle<
vtkm::IdComponent>::template ExecutionTypes<DeviceAdapter>::Portal;
using IdPortal =
typename vtkm::cont::ArrayHandle<vtkm::Id>::template ExecutionTypes<DeviceAdapter>::Portal;
public:
VTKM_CONT
ExecutionObject()
: Shapes()
, NumIndices()
, Connectivity()
, IndexOffsets()
{
}
VTKM_CONT
ExecutionObject(const UInt8Portal& shapes,
const IdComponentPortal& numIndices,
const IdPortal& connectivity,
const IdPortal& indexOffsets)
: Shapes(shapes)
, NumIndices(numIndices)
, Connectivity(connectivity)
, IndexOffsets(indexOffsets)
{
}
VTKM_EXEC
void SetCellShape(vtkm::Id cellIndex, vtkm::UInt8 shape) { this->Shapes.Set(cellIndex, shape); }
VTKM_EXEC
void SetNumberOfIndices(vtkm::Id cellIndex, vtkm::IdComponent numIndices)
{
this->NumIndices.Set(cellIndex, numIndices);
}
VTKM_EXEC
void SetIndexOffset(vtkm::Id cellIndex, vtkm::Id indexOffset)
{
this->IndexOffsets.Set(cellIndex, indexOffset);
}
VTKM_EXEC
void SetConnectivity(vtkm::Id connectivityIndex, vtkm::Id pointIndex)
{
this->Connectivity.Set(connectivityIndex, pointIndex);
}
private:
UInt8Portal Shapes;
IdComponentPortal NumIndices;
IdPortal Connectivity;
IdPortal IndexOffsets;
};
template <typename DeviceAdapter>
class ExecutionConnectivityExplicit : vtkm::cont::ExecutionObjectFactoryBase
{
@ -100,26 +162,12 @@ public:
, IndexOffsets(indexOffsets)
{
}
VTKM_EXEC
void SetCellShape(vtkm::Id cellIndex, vtkm::UInt8 shape) { this->Shapes.Set(cellIndex, shape); }
VTKM_EXEC
void SetNumberOfIndices(vtkm::Id cellIndex, vtkm::IdComponent numIndices)
template <typename Device>
VTKM_CONT ExecutionObject<Device> PrepareForExecution(Device) const
{
this->NumIndices.Set(cellIndex, numIndices);
}
VTKM_EXEC
void SetIndexOffset(vtkm::Id cellIndex, vtkm::Id indexOffset)
{
this->IndexOffsets.Set(cellIndex, indexOffset);
}
VTKM_EXEC
void SetConnectivity(vtkm::Id connectivityIndex, vtkm::Id pointIndex)
{
this->Connectivity.Set(connectivityIndex, pointIndex);
ExecutionObject<Device> object(
this->Shapes, this->NumIndices, this->Connectivity, this->IndexOffsets);
return object;
}
private:
@ -285,20 +333,20 @@ public:
template <typename CellShapeTag,
typename ScalarsVecType,
typename IndicesVecType,
typename ExecutinoObjectType,
typename InterpolationWholeArrayType,
typename ReverseMapWholeArrayType,
typename CellMapType>
VTKM_EXEC void operator()(
CellShapeTag shape,
vtkm::Id inputCellIdx,
const ScalarsVecType& scalars,
const IndicesVecType& indices,
vtkm::Id clipTableIdx,
ClipStats cellSetIndices,
internal::ExecutionConnectivityExplicit<DeviceAdapter>& connectivityExplicit,
InterpolationWholeArrayType& interpolation,
ReverseMapWholeArrayType& newPointsConnectivityReverseMap,
CellMapType& cellMap) const
VTKM_EXEC void operator()(CellShapeTag shape,
vtkm::Id inputCellIdx,
const ScalarsVecType& scalars,
const IndicesVecType& indices,
vtkm::Id clipTableIdx,
ClipStats cellSetIndices,
ExecutinoObjectType& connectivityExplicit,
InterpolationWholeArrayType& interpolation,
ReverseMapWholeArrayType& newPointsConnectivityReverseMap,
CellMapType& cellMap) const
{
(void)shape; //C4100 false positive workaround
vtkm::Id idx = clipTableIdx;

@ -88,12 +88,16 @@ static vtkm::IdComponent TriangleIndexData[] = {
3
};
template <typename Device>
template <typename DeviceAdapter>
class TriangulateTablesExecutionObject : public vtkm::cont::ExecutionObjectFactoryBase
{
public:
using PortalType = typename TriangulateArrayHandle::ExecutionTypes<Device>::PortalConst;
using PortalType = typename TriangulateArrayHandle::ExecutionTypes<DeviceAdapter>::PortalConst;
template <typename Device>
VTKM_CONT TriangulateTablesExecutionObject PrepareForExecution(Device) const
{
return *this;
}
VTKM_SUPPRESS_EXEC_WARNINGS
VTKM_EXEC
TriangulateTablesExecutionObject() {}
@ -102,9 +106,9 @@ public:
TriangulateTablesExecutionObject(const TriangulateArrayHandle& counts,
const TriangulateArrayHandle& offsets,
const TriangulateArrayHandle& indices)
: Counts(counts.PrepareForInput(Device()))
, Offsets(offsets.PrepareForInput(Device()))
, Indices(indices.PrepareForInput(Device()))
: Counts(counts.PrepareForInput(DeviceAdapter()))
, Offsets(offsets.PrepareForInput(DeviceAdapter()))
, Indices(indices.PrepareForInput(DeviceAdapter()))
{
}
@ -261,12 +265,16 @@ static vtkm::IdComponent TetrahedronIndexData[] = {
4
};
template <typename Device>
template <typename DeviceAdapter>
class TetrahedralizeTablesExecutionObject : public vtkm::cont::ExecutionObjectFactoryBase
{
public:
using PortalType = typename TriangulateArrayHandle::ExecutionTypes<Device>::PortalConst;
using PortalType = typename TriangulateArrayHandle::ExecutionTypes<DeviceAdapter>::PortalConst;
template <typename Device>
VTKM_CONT TetrahedralizeTablesExecutionObject PrepareForExecution(Device) const
{
return *this;
}
VTKM_SUPPRESS_EXEC_WARNINGS
VTKM_EXEC
TetrahedralizeTablesExecutionObject() {}
@ -275,9 +283,9 @@ public:
TetrahedralizeTablesExecutionObject(const TriangulateArrayHandle& counts,
const TriangulateArrayHandle& offsets,
const TriangulateArrayHandle& indices)
: Counts(counts.PrepareForInput(Device()))
, Offsets(offsets.PrepareForInput(Device()))
, Indices(indices.PrepareForInput(Device()))
: Counts(counts.PrepareForInput(DeviceAdapter()))
, Offsets(offsets.PrepareForInput(DeviceAdapter()))
, Indices(indices.PrepareForInput(DeviceAdapter()))
{
}

@ -54,6 +54,12 @@ private:
DeviceAdapterTag>::Portal;
public:
template <typename Device>
VTKM_CONT Particles PrepareForExecution(Device) const
{
return *this;
}
VTKM_EXEC_CONT
Particles()
: Pos()