2014-10-15 21:47:39 +00:00
|
|
|
//============================================================================
|
|
|
|
// Copyright (c) Kitware, Inc.
|
|
|
|
// All rights reserved.
|
|
|
|
// See LICENSE.txt for details.
|
2019-04-15 23:24:21 +00:00
|
|
|
//
|
2014-10-15 21:47:39 +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.
|
|
|
|
//============================================================================
|
|
|
|
#ifndef vtk_m_worklet_WorkletMapField_h
|
|
|
|
#define vtk_m_worklet_WorkletMapField_h
|
|
|
|
|
|
|
|
#include <vtkm/worklet/internal/WorkletBase.h>
|
|
|
|
|
2014-10-23 14:28:50 +00:00
|
|
|
#include <vtkm/cont/arg/ControlSignatureTagBase.h>
|
2014-10-15 21:47:39 +00:00
|
|
|
#include <vtkm/cont/arg/TransportTagArrayIn.h>
|
2015-08-12 18:58:53 +00:00
|
|
|
#include <vtkm/cont/arg/TransportTagArrayInOut.h>
|
2014-10-15 21:47:39 +00:00
|
|
|
#include <vtkm/cont/arg/TransportTagArrayOut.h>
|
2020-03-19 21:02:54 +00:00
|
|
|
#include <vtkm/cont/arg/TypeCheckTagArrayIn.h>
|
|
|
|
#include <vtkm/cont/arg/TypeCheckTagArrayInOut.h>
|
|
|
|
#include <vtkm/cont/arg/TypeCheckTagArrayOut.h>
|
2014-10-15 21:47:39 +00:00
|
|
|
|
|
|
|
#include <vtkm/exec/arg/FetchTagArrayDirectIn.h>
|
2015-08-12 18:58:53 +00:00
|
|
|
#include <vtkm/exec/arg/FetchTagArrayDirectInOut.h>
|
2014-10-15 21:47:39 +00:00
|
|
|
#include <vtkm/exec/arg/FetchTagArrayDirectOut.h>
|
|
|
|
|
2020-07-21 21:06:37 +00:00
|
|
|
#include <vtkm/worklet/DispatcherMapField.h>
|
|
|
|
|
2017-05-18 14:29:41 +00:00
|
|
|
namespace vtkm
|
|
|
|
{
|
|
|
|
namespace worklet
|
|
|
|
{
|
2014-10-15 21:47:39 +00:00
|
|
|
|
2024-01-12 19:58:07 +00:00
|
|
|
/// @brief 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
|
2014-10-15 21:47:39 +00:00
|
|
|
/// same size.
|
|
|
|
///
|
|
|
|
class WorkletMapField : public vtkm::worklet::internal::WorkletBase
|
|
|
|
{
|
|
|
|
public:
|
2018-08-29 13:30:27 +00:00
|
|
|
template <typename Worklet>
|
|
|
|
using Dispatcher = vtkm::worklet::DispatcherMapField<Worklet>;
|
|
|
|
|
2024-01-12 19:58:07 +00:00
|
|
|
/// @defgroup WorkletMapFieldControlSigTags `ControlSignature` tags
|
|
|
|
/// Tags that can be used in the `ControlSignature` of a `WorkletMapField`.
|
|
|
|
/// @{
|
2018-08-29 13:30:27 +00:00
|
|
|
|
2024-01-12 19:58:07 +00:00
|
|
|
/// @brief A control signature tag for input fields.
|
|
|
|
///
|
|
|
|
/// A `FieldIn` argument expects a `vtkm::cont::ArrayHandle` in the associated
|
|
|
|
/// parameter of the invoke. Each invocation of the worklet gets a single value
|
|
|
|
/// out of this array.
|
2014-10-22 22:51:42 +00:00
|
|
|
///
|
2019-04-18 17:23:20 +00:00
|
|
|
/// This tag means that the field is read only.
|
2014-10-22 22:51:42 +00:00
|
|
|
///
|
2024-01-12 19:58:07 +00:00
|
|
|
/// The worklet's `InputDomain` can be set to a `FieldIn` argument. In this case,
|
|
|
|
/// the input domain will be the size of the array.
|
|
|
|
///
|
2017-05-18 14:29:41 +00:00
|
|
|
struct FieldIn : vtkm::cont::arg::ControlSignatureTagBase
|
|
|
|
{
|
2020-03-19 21:02:54 +00:00
|
|
|
using TypeCheckTag = vtkm::cont::arg::TypeCheckTagArrayIn;
|
2018-02-22 13:29:13 +00:00
|
|
|
using TransportTag = vtkm::cont::arg::TransportTagArrayIn;
|
|
|
|
using FetchTag = vtkm::exec::arg::FetchTagArrayDirectIn;
|
2014-10-15 21:47:39 +00:00
|
|
|
};
|
|
|
|
|
2024-01-12 19:58:07 +00:00
|
|
|
/// @brief A control signature tag for output fields.
|
|
|
|
///
|
|
|
|
/// A `FieldOut` argument expects a `vtkm::cont::ArrayHandle` in the associated
|
|
|
|
/// parameter of the invoke. The array is resized before scheduling begins, and
|
|
|
|
/// each invocation of the worklet sets a single value in the array.
|
2014-10-22 22:51:42 +00:00
|
|
|
///
|
2019-04-18 17:23:20 +00:00
|
|
|
/// This tag means that the field is write only.
|
2014-10-22 22:51:42 +00:00
|
|
|
///
|
2024-01-12 19:58:07 +00:00
|
|
|
/// Although uncommon, it is possible to set the worklet's `InputDomain` to a
|
|
|
|
/// `FieldOut` argument. If this is the case, then the `vtkm::cont::ArrayHandle`
|
|
|
|
/// passed as the argument must be allocated before being passed to the invoke,
|
|
|
|
/// and the input domain will be the size of the array.
|
|
|
|
///
|
2017-05-18 14:29:41 +00:00
|
|
|
struct FieldOut : vtkm::cont::arg::ControlSignatureTagBase
|
|
|
|
{
|
2020-03-19 21:02:54 +00:00
|
|
|
using TypeCheckTag = vtkm::cont::arg::TypeCheckTagArrayOut;
|
2018-02-22 13:29:13 +00:00
|
|
|
using TransportTag = vtkm::cont::arg::TransportTagArrayOut;
|
|
|
|
using FetchTag = vtkm::exec::arg::FetchTagArrayDirectOut;
|
2014-10-15 21:47:39 +00:00
|
|
|
};
|
2015-08-12 18:58:53 +00:00
|
|
|
|
2024-01-12 19:58:07 +00:00
|
|
|
/// @brief A control signature tag for input-output (in-place) fields.
|
|
|
|
///
|
|
|
|
/// A `FieldInOut` argument expects a `vtkm::cont::ArrayHandle` in the
|
|
|
|
/// associated parameter of the invoke. Each invocation of the worklet gets a
|
|
|
|
/// single value out of this array, which is replaced by the resulting value
|
|
|
|
/// after the worklet completes.
|
2015-08-12 18:58:53 +00:00
|
|
|
///
|
2019-04-18 17:23:20 +00:00
|
|
|
/// This tag means that the field is read and write.
|
2015-08-12 18:58:53 +00:00
|
|
|
///
|
2024-01-12 19:58:07 +00:00
|
|
|
/// The worklet's `InputDomain` can be set to a `FieldInOut` argument. In
|
|
|
|
/// this case, the input domain will be the size of the array.
|
|
|
|
///
|
2017-05-18 14:29:41 +00:00
|
|
|
struct FieldInOut : vtkm::cont::arg::ControlSignatureTagBase
|
|
|
|
{
|
2020-03-19 21:02:54 +00:00
|
|
|
using TypeCheckTag = vtkm::cont::arg::TypeCheckTagArrayInOut;
|
2018-02-22 13:29:13 +00:00
|
|
|
using TransportTag = vtkm::cont::arg::TransportTagArrayInOut;
|
|
|
|
using FetchTag = vtkm::exec::arg::FetchTagArrayDirectInOut;
|
2015-08-12 18:58:53 +00:00
|
|
|
};
|
2024-01-12 19:58:07 +00:00
|
|
|
|
|
|
|
#ifdef VTKM_DOXYGEN_ONLY
|
|
|
|
// These redeclarations of superclass features are for documentation purposes only.
|
|
|
|
|
|
|
|
/// @copydoc vtkm::worklet::internal::WorkletBase::WholeArrayIn
|
|
|
|
struct WholeArrayIn : vtkm::worklet::internal::WorkletBase::WholeArrayIn
|
|
|
|
{
|
|
|
|
};
|
|
|
|
|
|
|
|
/// @copydoc vtkm::worklet::internal::WorkletBase::WholeArrayOut
|
|
|
|
struct WholeArrayOut : vtkm::worklet::internal::WorkletBase::WholeArrayOut
|
|
|
|
{
|
|
|
|
};
|
|
|
|
|
|
|
|
/// @copydoc vtkm::worklet::internal::WorkletBase::WholeArrayInOut
|
|
|
|
struct WholeArrayInOut : vtkm::worklet::internal::WorkletBase::WholeArrayInOut
|
|
|
|
{
|
|
|
|
};
|
|
|
|
|
|
|
|
/// @copydoc vtkm::worklet::internal::WorkletBase::AtomicArrayInOut
|
|
|
|
struct AtomicArrayInOut : vtkm::worklet::internal::WorkletBase::AtomicArrayInOut
|
|
|
|
{
|
|
|
|
};
|
|
|
|
|
|
|
|
/// @copydoc vtkm::worklet::internal::WorkletBase::WholeCellSetIn
|
|
|
|
template <typename VisitTopology = Cell, typename IncidentTopology = Point>
|
|
|
|
struct WholeCellSetIn
|
|
|
|
: vtkm::worklet::internal::WorkletBase::WholeCellSetIn<VisitTopology, IncidentTopology>
|
|
|
|
{
|
|
|
|
};
|
|
|
|
|
|
|
|
/// @copydoc vtkm::worklet::internal::WorkletBase::ExecObject
|
|
|
|
struct ExecObject : vtkm::worklet::internal::WorkletBase::ExecObject
|
|
|
|
{
|
|
|
|
};
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/// @}
|
|
|
|
|
|
|
|
/// @defgroup WorkletMapFieldExecutionSigTags `ExecutionSignature` tags
|
|
|
|
/// Tags that can be used in the `ExecutionSignature` of a `WorkletMapField`.
|
|
|
|
/// @{
|
|
|
|
|
|
|
|
#ifdef VTKM_DOXYGEN_ONLY
|
|
|
|
// These redeclarations of superclass features are for documentation purposes only.
|
|
|
|
|
|
|
|
/// @copydoc vtkm::placeholders::Arg
|
|
|
|
struct _1 : vtkm::worklet::internal::WorkletBase::_1
|
|
|
|
{
|
|
|
|
};
|
|
|
|
|
2024-02-12 06:18:09 +00:00
|
|
|
/// @copydoc vtkm::exec::arg::WorkIndex
|
2024-01-12 19:58:07 +00:00
|
|
|
struct WorkIndex : vtkm::worklet::internal::WorkletBase::WorkIndex
|
|
|
|
{
|
|
|
|
};
|
|
|
|
|
2024-02-12 06:18:09 +00:00
|
|
|
/// @copydoc vtkm::exec::arg::VisitIndex
|
2024-01-12 19:58:07 +00:00
|
|
|
struct VisitIndex : vtkm::worklet::internal::WorkletBase::VisitIndex
|
|
|
|
{
|
|
|
|
};
|
|
|
|
|
2024-02-12 06:18:09 +00:00
|
|
|
/// @copydoc vtkm::exec::arg::InputIndex
|
2024-01-12 19:58:07 +00:00
|
|
|
struct InputIndex : vtkm::worklet::internal::WorkletBase::InputIndex
|
|
|
|
{
|
|
|
|
};
|
|
|
|
|
2024-02-12 06:18:09 +00:00
|
|
|
/// @copydoc vtkm::exec::arg::OutputIndex
|
2024-01-12 19:58:07 +00:00
|
|
|
struct OutputIndex : vtkm::worklet::internal::WorkletBase::OutputIndex
|
|
|
|
{
|
|
|
|
};
|
|
|
|
|
2024-02-12 06:18:09 +00:00
|
|
|
/// @copydoc vtkm::exec::arg::ThreadIndices
|
2024-01-12 19:58:07 +00:00
|
|
|
struct ThreadIndices : vtkm::worklet::internal::WorkletBase::ThreadIndices
|
|
|
|
{
|
|
|
|
};
|
|
|
|
|
|
|
|
/// @copydoc vtkm::worklet::internal::WorkletBase::Device
|
|
|
|
struct Device : vtkm::worklet::internal::WorkletBase::Device
|
|
|
|
{
|
|
|
|
};
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/// @}
|
2014-10-15 21:47:39 +00:00
|
|
|
};
|
2024-01-12 19:58:07 +00:00
|
|
|
|
2014-10-15 21:47:39 +00:00
|
|
|
}
|
|
|
|
} // namespace vtkm::worklet
|
|
|
|
|
|
|
|
#endif //vtk_m_worklet_WorkletMapField_h
|