mirror of
https://gitlab.kitware.com/vtk/vtk-m
synced 2024-10-05 01:49:02 +00:00
Rename structured connectivity index conversion methods
The structured connectivity classes are templated on two tags to determine what 2 incident topological elements are being accessed. Back in the day, these were called the "from" elements and "to" elements, as taken from VTK filter names like `PointDataToCellData`. However, these names were found to be very confusion, and after much debate they have been renamed to the visit element type and the incident element type. Meaning that a worklet is "visiting" elements of a particular type (such as visiting each cell) and can access "incident" elements of a particular type (such as the points incident on the cell). I found a few methods converting flat and logical indices using the old, confusing from/to convention. This changes them to the new convention.
This commit is contained in:
parent
40a30dbfe7
commit
29c96a24fa
@ -92,7 +92,7 @@ static void TwoDimRectilinearTest()
|
||||
vtkm::Id cells[2][4] = { { 0, 1, 4, 3 }, { 1, 2, 5, 4 } };
|
||||
for (vtkm::Id cellIndex = 0; cellIndex < 2; cellIndex++)
|
||||
{
|
||||
vtkm::Id4 pointIds = pointToCell.GetIndices(pointToCell.FlatToLogicalToIndex(cellIndex));
|
||||
vtkm::Id4 pointIds = pointToCell.GetIndices(pointToCell.FlatToLogicalVisitIndex(cellIndex));
|
||||
for (vtkm::IdComponent localPointIndex = 0; localPointIndex < 4; localPointIndex++)
|
||||
{
|
||||
VTKM_TEST_ASSERT(pointIds[localPointIndex] == cells[cellIndex][localPointIndex],
|
||||
@ -106,7 +106,7 @@ static void TwoDimRectilinearTest()
|
||||
for (vtkm::Id pointIndex = 0; pointIndex < 6; pointIndex++)
|
||||
{
|
||||
vtkm::VecVariable<vtkm::Id, 4> retrievedCellIds =
|
||||
cellToPoint.GetIndices(cellToPoint.FlatToLogicalToIndex(pointIndex));
|
||||
cellToPoint.GetIndices(cellToPoint.FlatToLogicalVisitIndex(pointIndex));
|
||||
VTKM_TEST_ASSERT(retrievedCellIds.GetNumberOfComponents() <= 4,
|
||||
"Got wrong number of cell ids.");
|
||||
for (vtkm::IdComponent cellIndex = 0; cellIndex < retrievedCellIds.GetNumberOfComponents();
|
||||
|
@ -94,7 +94,7 @@ static void TwoDimUniformTest()
|
||||
vtkm::Id cells[2][4] = { { 0, 1, 4, 3 }, { 1, 2, 5, 4 } };
|
||||
for (vtkm::Id cellIndex = 0; cellIndex < 2; cellIndex++)
|
||||
{
|
||||
vtkm::Id4 pointIds = pointToCell.GetIndices(pointToCell.FlatToLogicalToIndex(cellIndex));
|
||||
vtkm::Id4 pointIds = pointToCell.GetIndices(pointToCell.FlatToLogicalVisitIndex(cellIndex));
|
||||
for (vtkm::IdComponent localPointIndex = 0; localPointIndex < 4; localPointIndex++)
|
||||
{
|
||||
VTKM_TEST_ASSERT(pointIds[localPointIndex] == cells[cellIndex][localPointIndex],
|
||||
@ -108,7 +108,7 @@ static void TwoDimUniformTest()
|
||||
for (vtkm::Id pointIndex = 0; pointIndex < 6; pointIndex++)
|
||||
{
|
||||
vtkm::VecVariable<vtkm::Id, 4> retrievedCellIds =
|
||||
cellToPoint.GetIndices(cellToPoint.FlatToLogicalToIndex(pointIndex));
|
||||
cellToPoint.GetIndices(cellToPoint.FlatToLogicalVisitIndex(pointIndex));
|
||||
VTKM_TEST_ASSERT(retrievedCellIds.GetNumberOfComponents() <= 4,
|
||||
"Got wrong number of cell ids.");
|
||||
for (vtkm::IdComponent cellIndex = 0; cellIndex < retrievedCellIds.GetNumberOfComponents();
|
||||
|
@ -11,6 +11,7 @@
|
||||
#ifndef vtk_m_exec_ConnectivityStructured_h
|
||||
#define vtk_m_exec_ConnectivityStructured_h
|
||||
|
||||
#include <vtkm/Deprecated.h>
|
||||
#include <vtkm/TopologyElementTag.h>
|
||||
#include <vtkm/Types.h>
|
||||
#include <vtkm/internal/ConnectivityStructuredInternals.h>
|
||||
@ -77,28 +78,54 @@ public:
|
||||
return Helper::GetIndices(this->Internals, index);
|
||||
}
|
||||
|
||||
VTKM_EXEC_CONT SchedulingRangeType FlatToLogicalVisitIndex(vtkm::Id flatVisitIndex) const
|
||||
{
|
||||
return Helper::FlatToLogicalVisitIndex(this->Internals, flatVisitIndex);
|
||||
}
|
||||
|
||||
VTKM_EXEC_CONT SchedulingRangeType FlatToLogicalIncidentIndex(vtkm::Id flatIncidentIndex) const
|
||||
{
|
||||
return Helper::FlatToLogicalIncidentIndex(this->Internals, flatIncidentIndex);
|
||||
}
|
||||
|
||||
VTKM_EXEC_CONT vtkm::Id LogicalToFlatVisitIndex(
|
||||
const SchedulingRangeType& logicalVisitIndex) const
|
||||
{
|
||||
return Helper::LogicalToFlatVisitIndex(this->Internals, logicalVisitIndex);
|
||||
}
|
||||
|
||||
VTKM_EXEC_CONT vtkm::Id LogicalToFlatIncidentIndex(
|
||||
const SchedulingRangeType& logicalIncidentIndex) const
|
||||
{
|
||||
return Helper::LogicalToFlatIncidentIndex(this->Internals, logicalIncidentIndex);
|
||||
}
|
||||
|
||||
VTKM_EXEC_CONT
|
||||
VTKM_DEPRECATED(2.1, "Use FlatToLogicalIncidentIndex.")
|
||||
SchedulingRangeType FlatToLogicalFromIndex(vtkm::Id flatFromIndex) const
|
||||
{
|
||||
return Helper::FlatToLogicalFromIndex(this->Internals, flatFromIndex);
|
||||
return this->FlatToLogicalIncidentIndex(flatFromIndex);
|
||||
}
|
||||
|
||||
VTKM_EXEC_CONT
|
||||
VTKM_DEPRECATED(2.1, "Use LogicalToFlatIncidentIndex.")
|
||||
vtkm::Id LogicalToFlatFromIndex(const SchedulingRangeType& logicalFromIndex) const
|
||||
{
|
||||
return Helper::LogicalToFlatFromIndex(this->Internals, logicalFromIndex);
|
||||
return this->LogicalToFlatIncidentIndex(logicalFromIndex);
|
||||
}
|
||||
|
||||
VTKM_EXEC_CONT
|
||||
VTKM_DEPRECATED(2.1, "Use FlatToLogicalVisitIndex.")
|
||||
SchedulingRangeType FlatToLogicalToIndex(vtkm::Id flatToIndex) const
|
||||
{
|
||||
return Helper::FlatToLogicalToIndex(this->Internals, flatToIndex);
|
||||
return this->FlatToLogicalVisitIndex(flatToIndex);
|
||||
}
|
||||
|
||||
VTKM_EXEC_CONT
|
||||
VTKM_DEPRECATED(2.1, "Use LogicalToFlatVisitIndex.")
|
||||
vtkm::Id LogicalToFlatToIndex(const SchedulingRangeType& logicalToIndex) const
|
||||
{
|
||||
return Helper::LogicalToFlatToIndex(this->Internals, logicalToIndex);
|
||||
return this->LogicalToFlatVisitIndex(logicalToIndex);
|
||||
}
|
||||
|
||||
VTKM_EXEC_CONT
|
||||
|
@ -72,7 +72,7 @@ public:
|
||||
inputIndex,
|
||||
visitIndex,
|
||||
outputIndex,
|
||||
vtkm::exec::BoundaryState{ detail::To3D(connectivity.FlatToLogicalToIndex(inputIndex)),
|
||||
vtkm::exec::BoundaryState{ detail::To3D(connectivity.FlatToLogicalVisitIndex(inputIndex)),
|
||||
detail::To3D(connectivity.GetPointDimensions()) })
|
||||
{
|
||||
}
|
||||
|
@ -181,7 +181,7 @@ public:
|
||||
this->InputIndex = inputIndex;
|
||||
this->VisitIndex = visitIndex;
|
||||
this->OutputIndex = outputIndex;
|
||||
this->LogicalIndex = connectivity.FlatToLogicalToIndex(this->InputIndex);
|
||||
this->LogicalIndex = connectivity.FlatToLogicalVisitIndex(this->InputIndex);
|
||||
this->IndicesIncident = connectivity.GetIndices(this->LogicalIndex);
|
||||
this->CellShape = connectivity.GetCellShape(this->InputIndex);
|
||||
}
|
||||
@ -338,7 +338,7 @@ public:
|
||||
const ConnectivityType& connectivity)
|
||||
{
|
||||
this->ThreadIndex = threadIndex;
|
||||
this->LogicalIndex = connectivity.FlatToLogicalToIndex(inputIndex);
|
||||
this->LogicalIndex = connectivity.FlatToLogicalVisitIndex(inputIndex);
|
||||
this->IndicesIncident = connectivity.GetIndices(this->LogicalIndex);
|
||||
this->CellShape = connectivity.GetCellShape(inputIndex);
|
||||
}
|
||||
@ -503,7 +503,7 @@ public:
|
||||
this->OutputIndex = outputIndex;
|
||||
|
||||
const vtkm::Id permutedIndex = permutation.Portal.Get(this->InputIndex);
|
||||
this->LogicalIndex = permutation.Connectivity.FlatToLogicalToIndex(permutedIndex);
|
||||
this->LogicalIndex = permutation.Connectivity.FlatToLogicalVisitIndex(permutedIndex);
|
||||
this->IndicesIncident = permutation.Connectivity.GetIndices(this->LogicalIndex);
|
||||
this->CellShape = permutation.Connectivity.GetCellShape(permutedIndex);
|
||||
}
|
||||
|
@ -607,29 +607,29 @@ struct ConnectivityStructuredIndexHelper<vtkm::TopologyElementTagCell,
|
||||
}
|
||||
|
||||
VTKM_EXEC_CONT
|
||||
static LogicalIndexType FlatToLogicalFromIndex(const ConnectivityType& connectivity,
|
||||
vtkm::Id flatFromIndex)
|
||||
static LogicalIndexType FlatToLogicalIncidentIndex(const ConnectivityType& connectivity,
|
||||
vtkm::Id flatFromIndex)
|
||||
{
|
||||
return connectivity.FlatToLogicalPointIndex(flatFromIndex);
|
||||
}
|
||||
|
||||
VTKM_EXEC_CONT
|
||||
static vtkm::Id LogicalToFlatFromIndex(const ConnectivityType& connectivity,
|
||||
const LogicalIndexType& logicalFromIndex)
|
||||
static vtkm::Id LogicalToFlatIncidentIndex(const ConnectivityType& connectivity,
|
||||
const LogicalIndexType& logicalFromIndex)
|
||||
{
|
||||
return connectivity.LogicalToFlatPointIndex(logicalFromIndex);
|
||||
}
|
||||
|
||||
VTKM_EXEC_CONT
|
||||
static LogicalIndexType FlatToLogicalToIndex(const ConnectivityType& connectivity,
|
||||
vtkm::Id flatToIndex)
|
||||
static LogicalIndexType FlatToLogicalVisitIndex(const ConnectivityType& connectivity,
|
||||
vtkm::Id flatToIndex)
|
||||
{
|
||||
return connectivity.FlatToLogicalCellIndex(flatToIndex);
|
||||
}
|
||||
|
||||
VTKM_EXEC_CONT
|
||||
static vtkm::Id LogicalToFlatToIndex(const ConnectivityType& connectivity,
|
||||
const LogicalIndexType& logicalToIndex)
|
||||
static vtkm::Id LogicalToFlatVisitIndex(const ConnectivityType& connectivity,
|
||||
const LogicalIndexType& logicalToIndex)
|
||||
{
|
||||
return connectivity.LogicalToFlatCellIndex(logicalToIndex);
|
||||
}
|
||||
@ -667,29 +667,29 @@ struct ConnectivityStructuredIndexHelper<vtkm::TopologyElementTagPoint,
|
||||
}
|
||||
|
||||
VTKM_EXEC_CONT
|
||||
static LogicalIndexType FlatToLogicalFromIndex(const ConnectivityType& connectivity,
|
||||
vtkm::Id flatFromIndex)
|
||||
static LogicalIndexType FlatToLogicalIncidentIndex(const ConnectivityType& connectivity,
|
||||
vtkm::Id flatFromIndex)
|
||||
{
|
||||
return connectivity.FlatToLogicalCellIndex(flatFromIndex);
|
||||
}
|
||||
|
||||
VTKM_EXEC_CONT
|
||||
static vtkm::Id LogicalToFlatFromIndex(const ConnectivityType& connectivity,
|
||||
const LogicalIndexType& logicalFromIndex)
|
||||
static vtkm::Id LogicalToFlatIncidentIndex(const ConnectivityType& connectivity,
|
||||
const LogicalIndexType& logicalFromIndex)
|
||||
{
|
||||
return connectivity.LogicalToFlatCellIndex(logicalFromIndex);
|
||||
}
|
||||
|
||||
VTKM_EXEC_CONT
|
||||
static LogicalIndexType FlatToLogicalToIndex(const ConnectivityType& connectivity,
|
||||
vtkm::Id flatToIndex)
|
||||
static LogicalIndexType FlatToLogicalVisitIndex(const ConnectivityType& connectivity,
|
||||
vtkm::Id flatToIndex)
|
||||
{
|
||||
return connectivity.FlatToLogicalPointIndex(flatToIndex);
|
||||
}
|
||||
|
||||
VTKM_EXEC_CONT
|
||||
static vtkm::Id LogicalToFlatToIndex(const ConnectivityType& connectivity,
|
||||
const LogicalIndexType& logicalToIndex)
|
||||
static vtkm::Id LogicalToFlatVisitIndex(const ConnectivityType& connectivity,
|
||||
const LogicalIndexType& logicalToIndex)
|
||||
{
|
||||
return connectivity.LogicalToFlatPointIndex(logicalToIndex);
|
||||
}
|
||||
|
@ -430,7 +430,7 @@ public:
|
||||
|
||||
cellIndex[dir1] = cellIndex[dir1] + dir1Offset;
|
||||
cellIndex[dir2] = cellIndex[dir2] + dir2Offset;
|
||||
vtkm::Id cellId = Connectivity.LogicalToFlatToIndex(cellIndex);
|
||||
vtkm::Id cellId = Connectivity.LogicalToFlatVisitIndex(cellIndex);
|
||||
vtkm::VecVariable<vtkm::Id, 8> cellIndices = Connectivity.GetIndices(cellId);
|
||||
|
||||
// Look up the offset into the face list for each cell type
|
||||
|
@ -61,7 +61,7 @@ public:
|
||||
vtkm::Id cellId{};
|
||||
auto self = static_cast<const Derived*>(this);
|
||||
self->Locator.FindCell(point, cellId, parametric);
|
||||
cell = self->Conn.FlatToLogicalToIndex(cellId);
|
||||
cell = self->Conn.FlatToLogicalVisitIndex(cellId);
|
||||
self->ComputeInvSpacing(cell, point, invSpacing, parametric);
|
||||
}
|
||||
|
||||
@ -74,7 +74,7 @@ public:
|
||||
VTKM_EXEC
|
||||
inline vtkm::Id GetCellIndex(const vtkm::Id3& cell) const
|
||||
{
|
||||
return static_cast<const Derived*>(this)->Conn.LogicalToFlatToIndex(cell);
|
||||
return static_cast<const Derived*>(this)->Conn.LogicalToFlatVisitIndex(cell);
|
||||
}
|
||||
|
||||
VTKM_EXEC
|
||||
@ -88,7 +88,7 @@ public:
|
||||
inline void GetMinPoint(const vtkm::Id3& cell, vtkm::Vec3f_32& point) const
|
||||
{
|
||||
const vtkm::Id pointIndex =
|
||||
static_cast<const Derived*>(this)->Conn.LogicalToFlatFromIndex(cell);
|
||||
static_cast<const Derived*>(this)->Conn.LogicalToFlatIncidentIndex(cell);
|
||||
point = static_cast<const Derived*>(this)->Coordinates.Get(pointIndex);
|
||||
}
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user