2015-02-10 20:01:27 +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.
|
|
|
|
//
|
2017-09-20 21:33:44 +00:00
|
|
|
// Copyright 2014 National Technology & Engineering Solutions of Sandia, LLC (NTESS).
|
2015-02-10 20:01:27 +00:00
|
|
|
// Copyright 2014 UT-Battelle, LLC.
|
2015-06-03 19:06:43 +00:00
|
|
|
// Copyright 2014 Los Alamos National Security.
|
2015-02-10 20:01:27 +00:00
|
|
|
//
|
2017-09-20 21:33:44 +00:00
|
|
|
// Under the terms of Contract DE-NA0003525 with NTESS,
|
2015-02-10 20:01:27 +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_worklet_WorkletMapTopology_h
|
|
|
|
#define vtk_m_worklet_WorkletMapTopology_h
|
|
|
|
|
|
|
|
#include <vtkm/worklet/internal/WorkletBase.h>
|
|
|
|
|
2015-08-25 19:37:53 +00:00
|
|
|
#include <vtkm/TopologyElementTag.h>
|
2017-05-18 14:51:24 +00:00
|
|
|
#include <vtkm/TypeListTag.h>
|
2015-02-10 20:01:27 +00:00
|
|
|
|
|
|
|
#include <vtkm/cont/arg/ControlSignatureTagBase.h>
|
2015-08-12 18:58:53 +00:00
|
|
|
#include <vtkm/cont/arg/TransportTagArrayInOut.h>
|
2015-02-10 20:01:27 +00:00
|
|
|
#include <vtkm/cont/arg/TransportTagArrayOut.h>
|
2016-05-17 17:36:23 +00:00
|
|
|
#include <vtkm/cont/arg/TransportTagCellSetIn.h>
|
2016-12-19 22:41:00 +00:00
|
|
|
#include <vtkm/cont/arg/TransportTagTopologyFieldIn.h>
|
2015-02-10 20:01:27 +00:00
|
|
|
#include <vtkm/cont/arg/TypeCheckTagArray.h>
|
2016-05-17 17:36:23 +00:00
|
|
|
#include <vtkm/cont/arg/TypeCheckTagCellSet.h>
|
2015-02-10 20:01:27 +00:00
|
|
|
|
2015-08-03 16:06:59 +00:00
|
|
|
#include <vtkm/exec/arg/CellShape.h>
|
2015-02-10 20:01:27 +00:00
|
|
|
#include <vtkm/exec/arg/FetchTagArrayDirectIn.h>
|
2015-08-12 18:58:53 +00:00
|
|
|
#include <vtkm/exec/arg/FetchTagArrayDirectInOut.h>
|
2015-02-10 20:01:27 +00:00
|
|
|
#include <vtkm/exec/arg/FetchTagArrayDirectOut.h>
|
|
|
|
#include <vtkm/exec/arg/FetchTagArrayTopologyMapIn.h>
|
2017-05-18 14:51:24 +00:00
|
|
|
#include <vtkm/exec/arg/FetchTagCellSetIn.h>
|
2015-08-03 16:06:59 +00:00
|
|
|
#include <vtkm/exec/arg/FromCount.h>
|
|
|
|
#include <vtkm/exec/arg/FromIndices.h>
|
2015-10-07 18:14:00 +00:00
|
|
|
#include <vtkm/exec/arg/ThreadIndicesTopologyMap.h>
|
2015-02-10 20:01:27 +00:00
|
|
|
|
2017-05-18 14:29:41 +00:00
|
|
|
namespace vtkm
|
|
|
|
{
|
|
|
|
namespace worklet
|
|
|
|
{
|
2015-02-10 20:01:27 +00:00
|
|
|
|
2017-05-18 14:29:41 +00:00
|
|
|
namespace detail
|
|
|
|
{
|
2016-12-19 22:41:00 +00:00
|
|
|
|
|
|
|
struct WorkletMapTopologyBase : vtkm::worklet::internal::WorkletBase
|
2017-05-18 14:29:41 +00:00
|
|
|
{
|
|
|
|
};
|
2016-12-19 22:41:00 +00:00
|
|
|
|
|
|
|
} // namespace detail
|
|
|
|
|
|
|
|
/// Base class for worklets that do a simple mapping of field arrays. All
|
|
|
|
/// inputs and outputs are on the same domain. That is, all the arrays are the
|
|
|
|
/// same size.
|
|
|
|
///
|
2017-05-18 14:29:41 +00:00
|
|
|
template <typename FromTopology, typename ToTopology>
|
2016-12-19 22:41:00 +00:00
|
|
|
class WorkletMapTopology : public detail::WorkletMapTopologyBase
|
2015-02-10 20:01:27 +00:00
|
|
|
{
|
|
|
|
public:
|
2016-12-19 22:41:00 +00:00
|
|
|
using FromTopologyType = FromTopology;
|
|
|
|
using ToTopologyType = ToTopology;
|
|
|
|
|
2015-02-10 20:01:27 +00:00
|
|
|
/// \brief A control signature tag for input fields.
|
|
|
|
///
|
|
|
|
/// This tag takes a template argument that is a type list tag that limits
|
|
|
|
/// the possible value types in the array.
|
|
|
|
///
|
2017-05-18 14:29:41 +00:00
|
|
|
template <typename TypeList = AllTypes>
|
|
|
|
struct FieldInTo : vtkm::cont::arg::ControlSignatureTagBase
|
|
|
|
{
|
2016-12-19 22:41:00 +00:00
|
|
|
using TypeCheckTag = vtkm::cont::arg::TypeCheckTagArray<TypeList>;
|
|
|
|
using TransportTag = vtkm::cont::arg::TransportTagTopologyFieldIn<ToTopologyType>;
|
|
|
|
using FetchTag = vtkm::exec::arg::FetchTagArrayDirectIn;
|
2015-02-10 20:01:27 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/// \brief A control signature tag for input connectivity.
|
|
|
|
///
|
|
|
|
/// This tag takes a template argument that is a type list tag that limits
|
|
|
|
/// the possible value types in the array.
|
|
|
|
///
|
2017-05-18 14:29:41 +00:00
|
|
|
template <typename TypeList = AllTypes>
|
|
|
|
struct FieldInFrom : vtkm::cont::arg::ControlSignatureTagBase
|
|
|
|
{
|
2016-12-19 22:41:00 +00:00
|
|
|
using TypeCheckTag = vtkm::cont::arg::TypeCheckTagArray<TypeList>;
|
|
|
|
using TransportTag = vtkm::cont::arg::TransportTagTopologyFieldIn<FromTopologyType>;
|
|
|
|
using FetchTag = vtkm::exec::arg::FetchTagArrayTopologyMapIn;
|
2015-02-10 20:01:27 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/// \brief A control signature tag for output fields.
|
|
|
|
///
|
|
|
|
/// This tag takes a template argument that is a type list tag that limits
|
|
|
|
/// the possible value types in the array.
|
|
|
|
///
|
2017-05-18 14:29:41 +00:00
|
|
|
template <typename TypeList = AllTypes>
|
|
|
|
struct FieldOut : vtkm::cont::arg::ControlSignatureTagBase
|
|
|
|
{
|
2016-12-19 22:41:00 +00:00
|
|
|
using TypeCheckTag = vtkm::cont::arg::TypeCheckTagArray<TypeList>;
|
|
|
|
using TransportTag = vtkm::cont::arg::TransportTagArrayOut;
|
|
|
|
using FetchTag = vtkm::exec::arg::FetchTagArrayDirectOut;
|
2015-02-10 20:01:27 +00:00
|
|
|
};
|
2015-08-03 16:06:59 +00:00
|
|
|
|
2015-08-12 18:58:53 +00:00
|
|
|
/// \brief A control signature tag for input-output (in-place) fields.
|
|
|
|
///
|
|
|
|
/// This tag takes a template argument that is a type list tag that limits
|
|
|
|
/// the possible value types in the array.
|
|
|
|
///
|
2017-05-18 14:29:41 +00:00
|
|
|
template <typename TypeList = AllTypes>
|
|
|
|
struct FieldInOut : vtkm::cont::arg::ControlSignatureTagBase
|
|
|
|
{
|
2016-12-19 22:41:00 +00:00
|
|
|
using TypeCheckTag = vtkm::cont::arg::TypeCheckTagArray<TypeList>;
|
|
|
|
using TransportTag = vtkm::cont::arg::TransportTagArrayInOut;
|
|
|
|
using FetchTag = vtkm::exec::arg::FetchTagArrayDirectInOut;
|
|
|
|
};
|
|
|
|
|
|
|
|
/// \brief A control signature tag for input connectivity.
|
|
|
|
///
|
2017-05-18 14:29:41 +00:00
|
|
|
struct CellSetIn : vtkm::cont::arg::ControlSignatureTagBase
|
|
|
|
{
|
2016-12-19 22:41:00 +00:00
|
|
|
using TypeCheckTag = vtkm::cont::arg::TypeCheckTagCellSet;
|
2017-05-18 14:29:41 +00:00
|
|
|
using TransportTag = vtkm::cont::arg::TransportTagCellSetIn<FromTopologyType, ToTopologyType>;
|
2016-12-19 22:41:00 +00:00
|
|
|
using FetchTag = vtkm::exec::arg::FetchTagCellSetIn;
|
2015-08-12 18:58:53 +00:00
|
|
|
};
|
|
|
|
|
2015-08-03 16:06:59 +00:00
|
|
|
/// \brief An execution signature tag for getting the cell shape.
|
|
|
|
///
|
2017-05-18 14:29:41 +00:00
|
|
|
struct CellShape : vtkm::exec::arg::CellShape
|
|
|
|
{
|
|
|
|
};
|
2015-08-03 16:06:59 +00:00
|
|
|
|
|
|
|
/// \brief An execution signature tag to get the number of from elements.
|
|
|
|
///
|
|
|
|
/// In a topology map, there are \em from and \em to topology elements
|
|
|
|
/// specified. The scheduling occurs on the \em to elements, and for each \em
|
|
|
|
/// to element there is some number of incident \em from elements that are
|
|
|
|
/// accessible. This \c ExecutionSignature tag provides the number of these
|
|
|
|
/// \em from elements that are accessible.
|
|
|
|
///
|
2017-05-18 14:29:41 +00:00
|
|
|
struct FromCount : vtkm::exec::arg::FromCount
|
|
|
|
{
|
|
|
|
};
|
2015-08-03 16:06:59 +00:00
|
|
|
|
|
|
|
/// \brief An execution signature tag to get the indices of from elements.
|
|
|
|
///
|
|
|
|
/// In a topology map, there are \em from and \em to topology elements
|
|
|
|
/// specified. The scheduling occurs on the \em to elements, and for each \em
|
|
|
|
/// to element there is some number of incident \em from elements that are
|
|
|
|
/// accessible. This \c ExecutionSignature tag provides the indices of these
|
|
|
|
/// \em from elements that are accessible.
|
|
|
|
///
|
2017-05-18 14:29:41 +00:00
|
|
|
struct FromIndices : vtkm::exec::arg::FromIndices
|
|
|
|
{
|
|
|
|
};
|
2015-10-07 18:14:00 +00:00
|
|
|
|
|
|
|
/// Topology map worklets use topology map indices.
|
|
|
|
///
|
2016-06-29 15:56:24 +00:00
|
|
|
VTKM_SUPPRESS_EXEC_WARNINGS
|
2017-05-26 17:53:28 +00:00
|
|
|
template <typename T,
|
|
|
|
typename OutToInArrayType,
|
|
|
|
typename VisitArrayType,
|
|
|
|
typename InputDomainType,
|
|
|
|
typename G>
|
2017-05-18 14:29:41 +00:00
|
|
|
VTKM_EXEC vtkm::exec::arg::ThreadIndicesTopologyMap<InputDomainType> GetThreadIndices(
|
2017-05-26 17:53:28 +00:00
|
|
|
const T& threadIndex,
|
|
|
|
const OutToInArrayType& outToIn,
|
|
|
|
const VisitArrayType& visit,
|
|
|
|
const InputDomainType& connectivity,
|
|
|
|
const G& globalThreadIndexOffset) const
|
2015-10-07 18:14:00 +00:00
|
|
|
{
|
2016-04-19 20:47:37 +00:00
|
|
|
return vtkm::exec::arg::ThreadIndicesTopologyMap<InputDomainType>(
|
2017-05-18 14:29:41 +00:00
|
|
|
threadIndex, outToIn, visit, connectivity, globalThreadIndexOffset);
|
2015-10-07 18:14:00 +00:00
|
|
|
}
|
2015-02-10 20:01:27 +00:00
|
|
|
};
|
|
|
|
|
2015-10-23 13:49:44 +00:00
|
|
|
/// Base class for worklets that map from Points to Cells.
|
2015-10-07 18:14:00 +00:00
|
|
|
///
|
2016-12-19 22:41:00 +00:00
|
|
|
class WorkletMapPointToCell
|
2017-05-18 14:29:41 +00:00
|
|
|
: public WorkletMapTopology<vtkm::TopologyElementTagPoint, vtkm::TopologyElementTagCell>
|
2015-10-22 00:07:20 +00:00
|
|
|
{
|
|
|
|
public:
|
2017-05-18 14:29:41 +00:00
|
|
|
template <typename TypeList = AllTypes>
|
2016-12-19 22:41:00 +00:00
|
|
|
using FieldInPoint = FieldInFrom<TypeList>;
|
2015-10-23 13:49:44 +00:00
|
|
|
|
2017-05-18 14:29:41 +00:00
|
|
|
template <typename TypeList = AllTypes>
|
2016-12-19 22:41:00 +00:00
|
|
|
using FieldInCell = FieldInTo<TypeList>;
|
2015-10-23 13:49:44 +00:00
|
|
|
|
2017-05-18 14:29:41 +00:00
|
|
|
template <typename TypeList = AllTypes>
|
2016-12-19 22:41:00 +00:00
|
|
|
using FieldOutCell = FieldOut<TypeList>;
|
2015-10-23 13:49:44 +00:00
|
|
|
|
2017-05-18 14:29:41 +00:00
|
|
|
template <typename TypeList = AllTypes>
|
2016-12-19 22:41:00 +00:00
|
|
|
using FieldInOutCell = FieldInOut<TypeList>;
|
2015-11-07 11:57:16 +00:00
|
|
|
|
2016-12-19 22:41:00 +00:00
|
|
|
using PointCount = FromCount;
|
2016-01-07 22:26:29 +00:00
|
|
|
|
2016-12-19 22:41:00 +00:00
|
|
|
using PointIndices = FromIndices;
|
2015-10-22 00:07:20 +00:00
|
|
|
};
|
2015-08-27 18:36:55 +00:00
|
|
|
|
2016-01-20 23:16:58 +00:00
|
|
|
/// Base class for worklets that map from Cells to Points.
|
|
|
|
///
|
2016-12-19 22:41:00 +00:00
|
|
|
class WorkletMapCellToPoint
|
2017-05-18 14:29:41 +00:00
|
|
|
: public WorkletMapTopology<vtkm::TopologyElementTagCell, vtkm::TopologyElementTagPoint>
|
2016-01-20 23:16:58 +00:00
|
|
|
{
|
|
|
|
public:
|
2017-05-18 14:29:41 +00:00
|
|
|
template <typename TypeList = AllTypes>
|
2016-12-19 22:41:00 +00:00
|
|
|
using FieldInCell = FieldInFrom<TypeList>;
|
2016-01-20 23:16:58 +00:00
|
|
|
|
2017-05-18 14:29:41 +00:00
|
|
|
template <typename TypeList = AllTypes>
|
2016-12-19 22:41:00 +00:00
|
|
|
using FieldInPoint = FieldInTo<TypeList>;
|
2016-01-20 23:16:58 +00:00
|
|
|
|
2017-05-18 14:29:41 +00:00
|
|
|
template <typename TypeList = AllTypes>
|
2016-12-19 22:41:00 +00:00
|
|
|
using FieldOutPoint = FieldOut<TypeList>;
|
2016-01-20 23:16:58 +00:00
|
|
|
|
2017-05-18 14:29:41 +00:00
|
|
|
template <typename TypeList = AllTypes>
|
2016-12-19 22:41:00 +00:00
|
|
|
using FieldInOutPoint = FieldInOut<TypeList>;
|
2016-01-20 23:16:58 +00:00
|
|
|
|
2016-12-19 22:41:00 +00:00
|
|
|
using CellCount = FromCount;
|
2016-01-20 23:16:58 +00:00
|
|
|
|
2016-12-19 22:41:00 +00:00
|
|
|
using CellIndices = FromIndices;
|
2016-01-20 23:16:58 +00:00
|
|
|
};
|
2015-02-10 20:01:27 +00:00
|
|
|
}
|
|
|
|
} // namespace vtkm::worklet
|
|
|
|
|
|
|
|
#endif //vtk_m_worklet_WorkletMapTopology_h
|