5db762ee71
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 ```
127 lines
3.6 KiB
C++
127 lines
3.6 KiB
C++
//============================================================================
|
|
// Copyright (c) Kitware, Inc.
|
|
// All rights reserved.
|
|
// See LICENSE.txt for details.
|
|
//
|
|
// This software is distributed WITHOUT ANY WARRANTY; without even
|
|
// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
|
// PURPOSE. See the above copyright notice for more information.
|
|
//============================================================================
|
|
|
|
#ifndef vtk_m_exec_ConnectivityPermuted_h
|
|
#define vtk_m_exec_ConnectivityPermuted_h
|
|
|
|
#include <vtkm/CellShape.h>
|
|
#include <vtkm/TopologyElementTag.h>
|
|
#include <vtkm/Types.h>
|
|
#include <vtkm/VecFromPortal.h>
|
|
|
|
namespace vtkm
|
|
{
|
|
namespace exec
|
|
{
|
|
|
|
template <typename PermutationPortal, typename OriginalConnectivity>
|
|
class ConnectivityPermutedVisitCellsWithPoints
|
|
{
|
|
public:
|
|
using SchedulingRangeType = typename OriginalConnectivity::SchedulingRangeType;
|
|
|
|
VTKM_SUPPRESS_EXEC_WARNINGS
|
|
VTKM_EXEC_CONT
|
|
ConnectivityPermutedVisitCellsWithPoints()
|
|
: Portal()
|
|
, Connectivity()
|
|
{
|
|
}
|
|
|
|
VTKM_EXEC_CONT
|
|
ConnectivityPermutedVisitCellsWithPoints(const PermutationPortal& portal,
|
|
const OriginalConnectivity& src)
|
|
: Portal(portal)
|
|
, Connectivity(src)
|
|
{
|
|
}
|
|
|
|
VTKM_EXEC_CONT
|
|
ConnectivityPermutedVisitCellsWithPoints(const ConnectivityPermutedVisitCellsWithPoints& src)
|
|
: Portal(src.Portal)
|
|
, Connectivity(src.Connectivity)
|
|
{
|
|
}
|
|
|
|
VTKM_EXEC
|
|
vtkm::Id GetNumberOfElements() const { return this->Portal.GetNumberOfValues(); }
|
|
|
|
using CellShapeTag = typename OriginalConnectivity::CellShapeTag;
|
|
|
|
VTKM_EXEC
|
|
CellShapeTag GetCellShape(vtkm::Id index) const
|
|
{
|
|
vtkm::Id pIndex = this->Portal.Get(index);
|
|
return this->Connectivity.GetCellShape(pIndex);
|
|
}
|
|
|
|
VTKM_EXEC
|
|
vtkm::IdComponent GetNumberOfIndices(vtkm::Id index) const
|
|
{
|
|
return this->Connectivity.GetNumberOfIndices(this->Portal.Get(index));
|
|
}
|
|
|
|
using IndicesType = typename OriginalConnectivity::IndicesType;
|
|
|
|
template <typename IndexType>
|
|
VTKM_EXEC IndicesType GetIndices(const IndexType& index) const
|
|
{
|
|
return this->Connectivity.GetIndices(this->Portal.Get(index));
|
|
}
|
|
|
|
PermutationPortal Portal;
|
|
OriginalConnectivity Connectivity;
|
|
};
|
|
|
|
template <typename ConnectivityPortalType,
|
|
typename NumIndicesPortalType,
|
|
typename IndexOffsetPortalType>
|
|
class ConnectivityPermutedVisitPointsWithCells
|
|
{
|
|
public:
|
|
using SchedulingRangeType = vtkm::Id;
|
|
using IndicesType = vtkm::VecFromPortal<ConnectivityPortalType>;
|
|
using CellShapeTag = vtkm::CellShapeTagVertex;
|
|
|
|
ConnectivityPermutedVisitPointsWithCells() = default;
|
|
|
|
ConnectivityPermutedVisitPointsWithCells(const ConnectivityPortalType& connectivity,
|
|
const NumIndicesPortalType& numIndices,
|
|
const IndexOffsetPortalType& indexOffset)
|
|
: Connectivity(connectivity)
|
|
, NumIndices(numIndices)
|
|
, IndexOffset(indexOffset)
|
|
{
|
|
}
|
|
|
|
VTKM_EXEC
|
|
SchedulingRangeType GetNumberOfElements() const { return this->NumIndices.GetNumberOfValues(); }
|
|
|
|
VTKM_EXEC CellShapeTag GetCellShape(vtkm::Id) const { return CellShapeTag(); }
|
|
|
|
VTKM_EXEC
|
|
vtkm::IdComponent GetNumberOfIndices(vtkm::Id index) const { return this->NumIndices.Get(index); }
|
|
|
|
VTKM_EXEC IndicesType GetIndices(vtkm::Id index) const
|
|
{
|
|
return IndicesType(
|
|
this->Connectivity, this->NumIndices.Get(index), this->IndexOffset.Get(index));
|
|
}
|
|
|
|
private:
|
|
ConnectivityPortalType Connectivity;
|
|
NumIndicesPortalType NumIndices;
|
|
IndexOffsetPortalType IndexOffset;
|
|
};
|
|
}
|
|
} // namespace vtkm::exec
|
|
|
|
#endif //vtk_m_exec_ConnectivityPermuted_h
|