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>
|
2019-07-30 16:53:51 +00:00
|
|
|
class ConnectivityPermutedVisitCellsWithPoints
|
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
|
2019-07-30 16:53:51 +00:00
|
|
|
ConnectivityPermutedVisitCellsWithPoints()
|
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
|
2019-07-30 16:53:51 +00:00
|
|
|
ConnectivityPermutedVisitCellsWithPoints(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
|
2019-07-30 16:53:51 +00:00
|
|
|
ConnectivityPermutedVisitCellsWithPoints(const ConnectivityPermutedVisitCellsWithPoints& 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
|
|
|
|
2019-08-30 17:04:17 +00:00
|
|
|
template <typename ConnectivityPortalType, typename OffsetPortalType>
|
2019-07-30 16:53:51 +00:00
|
|
|
class ConnectivityPermutedVisitPointsWithCells
|
2017-07-21 16:19:19 +00:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
using SchedulingRangeType = vtkm::Id;
|
|
|
|
using IndicesType = vtkm::VecFromPortal<ConnectivityPortalType>;
|
|
|
|
using CellShapeTag = vtkm::CellShapeTagVertex;
|
|
|
|
|
2019-07-30 16:53:51 +00:00
|
|
|
ConnectivityPermutedVisitPointsWithCells() = default;
|
2017-07-21 16:19:19 +00:00
|
|
|
|
2019-07-30 16:53:51 +00:00
|
|
|
ConnectivityPermutedVisitPointsWithCells(const ConnectivityPortalType& connectivity,
|
2019-08-30 17:04:17 +00:00
|
|
|
const OffsetPortalType& offsets)
|
2017-07-21 16:19:19 +00:00
|
|
|
: Connectivity(connectivity)
|
2019-08-30 17:04:17 +00:00
|
|
|
, Offsets(offsets)
|
2017-07-21 16:19:19 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
VTKM_EXEC
|
2019-08-30 17:04:17 +00:00
|
|
|
SchedulingRangeType GetNumberOfElements() const { return this->Offsets.GetNumberOfValues() - 1; }
|
2017-07-21 16:19:19 +00:00
|
|
|
|
|
|
|
VTKM_EXEC CellShapeTag GetCellShape(vtkm::Id) const { return CellShapeTag(); }
|
|
|
|
|
|
|
|
VTKM_EXEC
|
2019-08-30 17:04:17 +00:00
|
|
|
vtkm::IdComponent GetNumberOfIndices(vtkm::Id index) const
|
|
|
|
{
|
|
|
|
const vtkm::Id offBegin = this->Offsets.Get(index);
|
|
|
|
const vtkm::Id offEnd = this->Offsets.Get(index + 1);
|
|
|
|
return static_cast<vtkm::IdComponent>(offEnd - offBegin);
|
|
|
|
}
|
2017-07-21 16:19:19 +00:00
|
|
|
|
|
|
|
VTKM_EXEC IndicesType GetIndices(vtkm::Id index) const
|
|
|
|
{
|
2019-08-30 17:04:17 +00:00
|
|
|
const vtkm::Id offBegin = this->Offsets.Get(index);
|
|
|
|
const vtkm::Id offEnd = this->Offsets.Get(index + 1);
|
2017-07-21 16:19:19 +00:00
|
|
|
return IndicesType(
|
2019-08-30 17:04:17 +00:00
|
|
|
this->Connectivity, static_cast<vtkm::IdComponent>(offEnd - offBegin), offBegin);
|
2017-07-21 16:19:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
ConnectivityPortalType Connectivity;
|
2019-08-30 17:04:17 +00:00
|
|
|
OffsetPortalType Offsets;
|
2017-07-21 16:19:19 +00:00
|
|
|
};
|
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
|