2015-05-12 13:39:00 +00:00
|
|
|
//============================================================================
|
|
|
|
// 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.
|
|
|
|
//
|
|
|
|
// Copyright 2015 Sandia Corporation.
|
|
|
|
// Copyright 2015 UT-Battelle, LLC.
|
|
|
|
// Copyright 2015 Los Alamos National Security.
|
|
|
|
//
|
|
|
|
// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
|
|
|
|
// the U.S. Government retains certain rights in this software.
|
|
|
|
//
|
|
|
|
// Under the terms of Contract DE-AC52-06NA25396 with Los Alamos National
|
|
|
|
// Laboratory (LANL), the U.S. Government retains certain rights in
|
|
|
|
// this software.
|
|
|
|
//============================================================================
|
2015-07-31 20:18:13 +00:00
|
|
|
#ifndef vtk_m_exec_ConnectivityExplicit_h
|
|
|
|
#define vtk_m_exec_ConnectivityExplicit_h
|
2015-05-12 13:39:00 +00:00
|
|
|
|
2015-08-16 18:53:44 +00:00
|
|
|
#include <vtkm/CellShape.h>
|
2015-05-12 16:13:43 +00:00
|
|
|
#include <vtkm/Types.h>
|
2015-08-14 00:10:24 +00:00
|
|
|
|
2016-10-25 20:55:48 +00:00
|
|
|
#include <vtkm/VecFromPortal.h>
|
2015-05-12 16:13:43 +00:00
|
|
|
|
2015-05-12 13:39:00 +00:00
|
|
|
namespace vtkm {
|
|
|
|
namespace exec {
|
|
|
|
|
2015-06-01 13:42:10 +00:00
|
|
|
template<typename ShapePortalType,
|
2015-07-31 20:18:13 +00:00
|
|
|
typename NumIndicesPortalType,
|
2015-06-01 13:42:10 +00:00
|
|
|
typename ConnectivityPortalType,
|
2015-08-11 18:42:34 +00:00
|
|
|
typename IndexOffsetPortalType
|
2015-06-01 13:42:10 +00:00
|
|
|
>
|
2015-07-31 20:18:13 +00:00
|
|
|
class ConnectivityExplicit
|
2015-05-12 13:39:00 +00:00
|
|
|
{
|
2015-05-12 16:13:43 +00:00
|
|
|
public:
|
2017-04-13 13:36:07 +00:00
|
|
|
typedef typename vtkm::Id SchedulingRangeType;
|
|
|
|
|
2015-07-31 20:18:13 +00:00
|
|
|
ConnectivityExplicit() {}
|
2015-05-12 16:13:43 +00:00
|
|
|
|
2015-07-31 20:18:13 +00:00
|
|
|
ConnectivityExplicit(const ShapePortalType& shapePortal,
|
2015-08-11 18:42:34 +00:00
|
|
|
const NumIndicesPortalType& numIndicesPortal,
|
2015-06-01 13:42:10 +00:00
|
|
|
const ConnectivityPortalType& connPortal,
|
2015-08-11 18:42:34 +00:00
|
|
|
const IndexOffsetPortalType& indexOffsetPortal
|
2015-06-01 13:42:10 +00:00
|
|
|
)
|
|
|
|
: Shapes(shapePortal),
|
2015-08-11 18:42:34 +00:00
|
|
|
NumIndices(numIndicesPortal),
|
2015-06-01 13:42:10 +00:00
|
|
|
Connectivity(connPortal),
|
2015-08-11 18:42:34 +00:00
|
|
|
IndexOffset(indexOffsetPortal)
|
2015-06-01 13:42:10 +00:00
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2016-10-19 22:42:58 +00:00
|
|
|
VTKM_EXEC
|
2017-04-13 13:36:07 +00:00
|
|
|
SchedulingRangeType GetNumberOfElements() const
|
2015-05-12 16:13:43 +00:00
|
|
|
{
|
2015-08-14 00:10:24 +00:00
|
|
|
return this->Shapes.GetNumberOfValues();
|
2015-05-12 16:13:43 +00:00
|
|
|
}
|
|
|
|
|
2015-08-19 16:32:01 +00:00
|
|
|
typedef vtkm::CellShapeTagGeneric CellShapeTag;
|
|
|
|
|
2016-10-19 22:42:58 +00:00
|
|
|
VTKM_EXEC
|
2015-08-19 16:32:01 +00:00
|
|
|
CellShapeTag GetCellShape(vtkm::Id index) const
|
2015-05-12 16:13:43 +00:00
|
|
|
{
|
2016-11-05 02:59:19 +00:00
|
|
|
return CellShapeTag(this->Shapes.Get(index));
|
2015-05-12 16:13:43 +00:00
|
|
|
}
|
|
|
|
|
2016-10-25 20:55:48 +00:00
|
|
|
using IndicesType = vtkm::VecFromPortal<ConnectivityPortalType>;
|
2015-08-11 05:38:23 +00:00
|
|
|
|
2015-08-14 18:01:52 +00:00
|
|
|
/// Returns a Vec-like object containing the indices for the given index.
|
|
|
|
/// The object returned is not an actual array, but rather an object that
|
|
|
|
/// loads the indices lazily out of the connectivity array. This prevents
|
|
|
|
/// us from having to know the number of indices at compile time.
|
|
|
|
///
|
2016-10-19 22:42:58 +00:00
|
|
|
VTKM_EXEC
|
2015-08-11 05:38:23 +00:00
|
|
|
IndicesType GetIndices(vtkm::Id index) const
|
2015-05-12 16:13:43 +00:00
|
|
|
{
|
2015-08-14 00:10:24 +00:00
|
|
|
vtkm::Id offset = this->IndexOffset.Get(index);
|
2017-04-13 13:36:07 +00:00
|
|
|
vtkm::IdComponent length = this->NumIndices.Get(index);
|
2015-08-14 00:10:24 +00:00
|
|
|
return IndicesType(this->Connectivity, length, offset);
|
2015-05-12 16:13:43 +00:00
|
|
|
}
|
|
|
|
|
2015-06-01 13:42:10 +00:00
|
|
|
private:
|
2015-08-11 05:38:23 +00:00
|
|
|
ShapePortalType Shapes;
|
|
|
|
NumIndicesPortalType NumIndices;
|
|
|
|
ConnectivityPortalType Connectivity;
|
|
|
|
IndexOffsetPortalType IndexOffset;
|
2015-05-12 13:39:00 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace exec
|
|
|
|
} // namespace vtkm
|
|
|
|
|
2015-07-31 20:18:13 +00:00
|
|
|
#endif // vtk_m_exec_ConnectivityExplicit_h
|