vtk-m/vtkm/exec/ConnectivityStructured.h

123 lines
3.5 KiB
C
Raw Normal View History

2015-05-15 16:03:52 +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 2014 National Technology & Engineering Solutions of Sandia, LLC (NTESS).
2015-05-15 16:03:52 +00:00
// Copyright 2014 UT-Battelle, LLC.
// Copyright 2014 Los Alamos National Security.
2015-05-15 16:03:52 +00:00
//
// Under the terms of Contract DE-NA0003525 with NTESS,
2015-05-15 16:03:52 +00:00
// 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.
//============================================================================
#ifndef vtk_m_exec_ConnectivityStructured_h
#define vtk_m_exec_ConnectivityStructured_h
2015-04-15 14:45:39 +00:00
#include <vtkm/TopologyElementTag.h>
#include <vtkm/Types.h>
#include <vtkm/internal/ConnectivityStructuredInternals.h>
2015-04-15 14:45:39 +00:00
2017-05-18 14:29:41 +00:00
namespace vtkm
{
namespace exec
{
2015-05-15 20:22:00 +00:00
2017-05-18 14:29:41 +00:00
template <typename FromTopology, typename ToTopology, vtkm::IdComponent Dimension>
class ConnectivityStructured
{
VTKM_IS_TOPOLOGY_ELEMENT_TAG(FromTopology);
VTKM_IS_TOPOLOGY_ELEMENT_TAG(ToTopology);
using InternalsType = vtkm::internal::ConnectivityStructuredInternals<Dimension>;
2017-05-18 14:29:41 +00:00
using Helper =
vtkm::internal::ConnectivityStructuredIndexHelper<FromTopology, ToTopology, Dimension>;
public:
using SchedulingRangeType = typename InternalsType::SchedulingRangeType;
VTKM_EXEC_CONT
2017-05-18 14:29:41 +00:00
ConnectivityStructured()
: Internals()
2015-04-15 14:45:39 +00:00
{
}
VTKM_EXEC_CONT
2017-05-18 14:29:41 +00:00
ConnectivityStructured(const InternalsType& src)
: Internals(src)
{
}
VTKM_EXEC_CONT
2017-05-18 14:29:41 +00:00
ConnectivityStructured(const ConnectivityStructured& src)
: Internals(src.Internals)
{
}
VTKM_EXEC
vtkm::Id GetNumberOfElements() const { return Helper::GetNumberOfElements(this->Internals); }
using CellShapeTag = typename Helper::CellShapeTag;
VTKM_EXEC
2017-05-18 14:29:41 +00:00
CellShapeTag GetCellShape(vtkm::Id) const { return CellShapeTag(); }
template <typename IndexType>
VTKM_EXEC vtkm::IdComponent GetNumberOfIndices(const IndexType& index) const
{
return Helper::GetNumberOfIndices(this->Internals, index);
}
using IndicesType = typename Helper::IndicesType;
2017-05-18 14:29:41 +00:00
template <typename IndexType>
VTKM_EXEC IndicesType GetIndices(const IndexType& index) const
2015-05-14 20:26:59 +00:00
{
return Helper::GetIndices(this->Internals, index);
2015-05-14 20:26:59 +00:00
}
2015-05-18 21:08:15 +00:00
VTKM_EXEC_CONT
2017-05-18 14:29:41 +00:00
SchedulingRangeType FlatToLogicalFromIndex(vtkm::Id flatFromIndex) const
{
return Helper::FlatToLogicalFromIndex(this->Internals, flatFromIndex);
}
VTKM_EXEC_CONT
2017-05-18 14:29:41 +00:00
vtkm::Id LogicalToFlatFromIndex(const SchedulingRangeType& logicalFromIndex) const
{
return Helper::LogicalToFlatFromIndex(this->Internals, logicalFromIndex);
}
VTKM_EXEC_CONT
2017-05-18 14:29:41 +00:00
SchedulingRangeType FlatToLogicalToIndex(vtkm::Id flatToIndex) const
{
return Helper::FlatToLogicalToIndex(this->Internals, flatToIndex);
}
VTKM_EXEC_CONT
2017-05-18 14:29:41 +00:00
vtkm::Id LogicalToFlatToIndex(const SchedulingRangeType& logicalToIndex) const
{
return Helper::LogicalToFlatToIndex(this->Internals, logicalToIndex);
}
VTKM_EXEC_CONT
2017-05-18 14:29:41 +00:00
vtkm::Vec<vtkm::Id, Dimension> GetPointDimensions() const
2016-01-20 22:40:54 +00:00
{
return this->Internals.GetPointDimensions();
}
private:
InternalsType Internals;
2015-04-15 14:45:39 +00:00
};
}
} // namespace vtkm::exec
2015-04-15 14:45:39 +00:00
#endif //vtk_m_exec_ConnectivityStructured_h