mirror of
https://gitlab.kitware.com/vtk/vtk-m
synced 2024-09-08 13:23:51 +00:00
Make it easier to construct ThreadIndices by hand.
In some cases it is necessary to construct ThreadIndices to manually use vtkm::exec::Fetch. This now makes it possible.
This commit is contained in:
parent
60843cbab8
commit
06af2fbcbf
@ -43,7 +43,7 @@ class ThreadIndicesBasic
|
||||
{
|
||||
public:
|
||||
VTKM_EXEC
|
||||
ThreadIndicesBasic(vtkm::Id threadIndex, vtkm::Id inIndex,
|
||||
ThreadIndicesBasic(vtkm::Id threadIndex, vtkm::Id inIndex,
|
||||
vtkm::IdComponent visitIndex, vtkm::Id globalThreadIndexOffset=0)
|
||||
: InputIndex(inIndex),
|
||||
OutputIndex(threadIndex),
|
||||
|
@ -79,7 +79,7 @@ public:
|
||||
const OutToInArrayType& inToOut,
|
||||
const VisitArrayType& visit,
|
||||
const ConnectivityType& connectivity,
|
||||
vtkm::Id globalThreadIndexOffset)
|
||||
vtkm::Id globalThreadIndexOffset=0)
|
||||
: Superclass(threadIndex, inToOut.Get(threadIndex), visit.Get(threadIndex),
|
||||
globalThreadIndexOffset),
|
||||
CellShape(detail::CellShapeInitializer<CellShapeTag>::GetDefault())
|
||||
@ -93,6 +93,25 @@ public:
|
||||
this->CellShape = connectivity.GetCellShape(this->GetInputIndex());
|
||||
}
|
||||
|
||||
VTKM_SUPPRESS_EXEC_WARNINGS
|
||||
VTKM_EXEC
|
||||
ThreadIndicesTopologyMap(vtkm::Id threadIndex,
|
||||
vtkm::Id inIndex,
|
||||
vtkm::IdComponent visitIndex,
|
||||
const ConnectivityType& connectivity,
|
||||
vtkm::Id globalThreadIndexOffset=0)
|
||||
: Superclass(threadIndex, inIndex, visitIndex, globalThreadIndexOffset),
|
||||
CellShape(detail::CellShapeInitializer<CellShapeTag>::GetDefault())
|
||||
{
|
||||
// The connectivity is stored in the invocation parameter at the given
|
||||
// input domain index. If this class is being used correctly, the type
|
||||
// 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.
|
||||
this->IndicesFrom = connectivity.GetIndices(this->GetInputIndex());
|
||||
this->CellShape = connectivity.GetCellShape(this->GetInputIndex());
|
||||
}
|
||||
|
||||
/// \brief The input indices of the "from" elements.
|
||||
///
|
||||
/// A topology map has "from" and "to" elements (for example from points to
|
||||
@ -193,7 +212,7 @@ public:
|
||||
const OutToInArrayType& inToOut,
|
||||
const VisitArrayType& visit,
|
||||
const ConnectivityType& connectivity,
|
||||
vtkm::Id globalThreadIndexOffset=0)
|
||||
vtkm::Id globalThreadIndexOffset=0)
|
||||
{
|
||||
|
||||
this->InputIndex = inToOut.Get(threadIndex);
|
||||
@ -229,6 +248,23 @@ public:
|
||||
this->GlobalThreadIndexOffset = globalThreadIndexOffset;
|
||||
}
|
||||
|
||||
VTKM_SUPPRESS_EXEC_WARNINGS
|
||||
VTKM_EXEC
|
||||
ThreadIndicesTopologyMap(vtkm::Id threadIndex,
|
||||
vtkm::Id inIndex,
|
||||
vtkm::IdComponent visitIndex,
|
||||
const ConnectivityType& connectivity,
|
||||
vtkm::Id globalThreadIndexOffset=0)
|
||||
{
|
||||
this->InputIndex = threadIndex;
|
||||
this->OutputIndex = threadIndex;
|
||||
this->VisitIndex = visitIndex;
|
||||
this->LogicalIndex = connectivity.FlatToLogicalToIndex(this->InputIndex);
|
||||
this->IndicesFrom = connectivity.GetIndices(this->LogicalIndex);
|
||||
this->CellShape = connectivity.GetCellShape(this->InputIndex);
|
||||
this->GlobalThreadIndexOffset = globalThreadIndexOffset;
|
||||
}
|
||||
|
||||
/// \brief The logical index into the input domain.
|
||||
///
|
||||
/// This is similar to \c GetIndex3D except the Vec size matches the actual
|
||||
|
Loading…
Reference in New Issue
Block a user