2015-09-28 17:15:26 +00:00
|
|
|
//============================================================================
|
|
|
|
// Copyright (c) Kitware, Inc.
|
|
|
|
// All rights reserved.
|
|
|
|
// See LICENSE.txt for details.
|
2019-04-15 23:24:21 +00:00
|
|
|
//
|
2015-09-28 17:15:26 +00:00
|
|
|
// 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.
|
|
|
|
//============================================================================
|
|
|
|
|
2016-04-08 17:49:51 +00:00
|
|
|
#ifndef vtk_m_exec_ConnectivityPermuted_h
|
|
|
|
#define vtk_m_exec_ConnectivityPermuted_h
|
2015-09-28 17:15:26 +00:00
|
|
|
|
2017-07-21 16:19:19 +00:00
|
|
|
#include <vtkm/CellShape.h>
|
2015-09-28 17:15:26 +00:00
|
|
|
#include <vtkm/TopologyElementTag.h>
|
|
|
|
#include <vtkm/Types.h>
|
2017-07-21 16:19:19 +00:00
|
|
|
#include <vtkm/VecFromPortal.h>
|
2015-09-28 17:15:26 +00:00
|
|
|
|
2017-05-18 14:29:41 +00:00
|
|
|
namespace vtkm
|
|
|
|
{
|
|
|
|
namespace exec
|
|
|
|
{
|
2015-09-28 17:15:26 +00:00
|
|
|
|
2017-05-18 14:29:41 +00:00
|
|
|
template <typename PermutationPortal, typename OriginalConnectivity>
|
2017-07-21 16:19:19 +00:00
|
|
|
class ConnectivityPermutedPointToCell
|
2015-09-28 17:15:26 +00:00
|
|
|
{
|
|
|
|
public:
|
2017-08-16 15:34:21 +00:00
|
|
|
using SchedulingRangeType = typename OriginalConnectivity::SchedulingRangeType;
|
2015-09-28 17:15:26 +00:00
|
|
|
|
2017-01-02 16:38:05 +00:00
|
|
|
VTKM_SUPPRESS_EXEC_WARNINGS
|
2016-10-19 22:42:58 +00:00
|
|
|
VTKM_EXEC_CONT
|
2017-07-21 16:19:19 +00:00
|
|
|
ConnectivityPermutedPointToCell()
|
2017-05-18 14:29:41 +00:00
|
|
|
: Portal()
|
|
|
|
, Connectivity()
|
2015-09-28 17:15:26 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2016-10-19 22:42:58 +00:00
|
|
|
VTKM_EXEC_CONT
|
2017-07-21 16:19:19 +00:00
|
|
|
ConnectivityPermutedPointToCell(const PermutationPortal& portal, const OriginalConnectivity& src)
|
2017-05-18 14:29:41 +00:00
|
|
|
: Portal(portal)
|
|
|
|
, Connectivity(src)
|
2015-09-28 17:15:26 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2016-10-19 22:42:58 +00:00
|
|
|
VTKM_EXEC_CONT
|
2017-07-21 16:19:19 +00:00
|
|
|
ConnectivityPermutedPointToCell(const ConnectivityPermutedPointToCell& src)
|
2017-05-18 14:29:41 +00:00
|
|
|
: Portal(src.Portal)
|
|
|
|
, Connectivity(src.Connectivity)
|
2015-09-28 17:15:26 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2017-07-28 19:40:31 +00:00
|
|
|
VTKM_EXEC
|
|
|
|
vtkm::Id GetNumberOfElements() const { return this->Portal.GetNumberOfValues(); }
|
|
|
|
|
2017-08-16 15:34:21 +00:00
|
|
|
using CellShapeTag = typename OriginalConnectivity::CellShapeTag;
|
2016-04-08 17:49:51 +00:00
|
|
|
|
2016-10-19 22:42:58 +00:00
|
|
|
VTKM_EXEC
|
2017-05-18 14:29:41 +00:00
|
|
|
CellShapeTag GetCellShape(vtkm::Id index) const
|
|
|
|
{
|
2016-04-08 17:49:51 +00:00
|
|
|
vtkm::Id pIndex = this->Portal.Get(index);
|
2017-05-18 14:29:41 +00:00
|
|
|
return this->Connectivity.GetCellShape(pIndex);
|
2015-09-28 17:15:26 +00:00
|
|
|
}
|
|
|
|
|
2017-07-28 19:40:31 +00:00
|
|
|
VTKM_EXEC
|
|
|
|
vtkm::IdComponent GetNumberOfIndices(vtkm::Id index) const
|
|
|
|
{
|
|
|
|
return this->Connectivity.GetNumberOfIndices(this->Portal.Get(index));
|
|
|
|
}
|
|
|
|
|
2017-08-16 15:34:21 +00:00
|
|
|
using IndicesType = typename OriginalConnectivity::IndicesType;
|
2015-09-28 17:15:26 +00:00
|
|
|
|
2017-05-18 14:29:41 +00:00
|
|
|
template <typename IndexType>
|
|
|
|
VTKM_EXEC IndicesType GetIndices(const IndexType& index) const
|
2015-09-28 17:15:26 +00:00
|
|
|
{
|
2017-05-18 14:29:41 +00:00
|
|
|
return this->Connectivity.GetIndices(this->Portal.Get(index));
|
2015-09-28 17:15:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
PermutationPortal Portal;
|
2016-04-08 17:49:51 +00:00
|
|
|
OriginalConnectivity Connectivity;
|
2015-09-28 17:15:26 +00:00
|
|
|
};
|
2017-07-21 16:19:19 +00:00
|
|
|
|
|
|
|
template <typename ConnectivityPortalType,
|
|
|
|
typename NumIndicesPortalType,
|
|
|
|
typename IndexOffsetPortalType>
|
|
|
|
class ConnectivityPermutedCellToPoint
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
using SchedulingRangeType = vtkm::Id;
|
|
|
|
using IndicesType = vtkm::VecFromPortal<ConnectivityPortalType>;
|
|
|
|
using CellShapeTag = vtkm::CellShapeTagVertex;
|
|
|
|
|
|
|
|
ConnectivityPermutedCellToPoint() = default;
|
|
|
|
|
|
|
|
ConnectivityPermutedCellToPoint(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;
|
|
|
|
};
|
2015-09-28 17:15:26 +00:00
|
|
|
}
|
|
|
|
} // namespace vtkm::exec
|
|
|
|
|
2016-04-08 17:49:51 +00:00
|
|
|
#endif //vtk_m_exec_ConnectivityPermuted_h
|