2014-10-21 16:51:07 +00:00
|
|
|
//============================================================================
|
|
|
|
// Copyright (c) Kitware, Inc.
|
|
|
|
// All rights reserved.
|
|
|
|
// See LICENSE.txt for details.
|
2019-04-15 23:24:21 +00:00
|
|
|
//
|
2014-10-21 16:51:07 +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.
|
|
|
|
//============================================================================
|
2017-05-01 19:19:42 +00:00
|
|
|
#ifndef vtk_m_exec_internal_TaskSingular_h
|
|
|
|
#define vtk_m_exec_internal_TaskSingular_h
|
2014-10-21 16:51:07 +00:00
|
|
|
|
|
|
|
#include <vtkm/internal/Invocation.h>
|
|
|
|
|
2017-05-01 19:19:42 +00:00
|
|
|
#include <vtkm/exec/TaskBase.h>
|
2014-10-21 16:51:07 +00:00
|
|
|
|
|
|
|
#include <vtkm/exec/arg/Fetch.h>
|
|
|
|
|
2017-05-01 19:19:42 +00:00
|
|
|
//Todo: rename this header to TaskSingularDetail.h
|
2014-10-21 16:51:07 +00:00
|
|
|
#include <vtkm/exec/internal/WorkletInvokeFunctorDetail.h>
|
|
|
|
|
2017-05-18 14:29:41 +00:00
|
|
|
namespace vtkm
|
|
|
|
{
|
|
|
|
namespace exec
|
|
|
|
{
|
|
|
|
namespace internal
|
|
|
|
{
|
2014-10-21 16:51:07 +00:00
|
|
|
|
2016-09-12 14:30:03 +00:00
|
|
|
// TaskSingular represents an execution pattern for a worklet
|
|
|
|
// that is best expressed in terms of single dimension iteration space. Inside
|
|
|
|
// this single dimension no order is preferred.
|
|
|
|
//
|
|
|
|
//
|
2017-05-18 14:29:41 +00:00
|
|
|
template <typename WorkletType, typename InvocationType>
|
2017-05-01 19:19:42 +00:00
|
|
|
class TaskSingular : public vtkm::exec::TaskBase
|
2014-10-21 16:51:07 +00:00
|
|
|
{
|
|
|
|
public:
|
2016-10-19 22:42:58 +00:00
|
|
|
VTKM_CONT
|
2020-03-23 20:27:00 +00:00
|
|
|
TaskSingular(const WorkletType& worklet, const InvocationType& invocation)
|
2017-05-18 14:29:41 +00:00
|
|
|
: Worklet(worklet)
|
|
|
|
, Invocation(invocation)
|
|
|
|
{
|
|
|
|
}
|
2016-09-12 14:30:03 +00:00
|
|
|
|
2016-10-19 22:42:58 +00:00
|
|
|
VTKM_CONT
|
2017-05-18 14:29:41 +00:00
|
|
|
void SetErrorMessageBuffer(const vtkm::exec::internal::ErrorMessageBuffer& buffer)
|
2014-10-21 16:51:07 +00:00
|
|
|
{
|
|
|
|
this->Worklet.SetErrorMessageBuffer(buffer);
|
|
|
|
}
|
2015-09-24 14:39:48 +00:00
|
|
|
VTKM_SUPPRESS_EXEC_WARNINGS
|
2017-05-18 14:29:41 +00:00
|
|
|
template <typename T>
|
|
|
|
VTKM_EXEC void operator()(T index) const
|
2014-10-21 16:51:07 +00:00
|
|
|
{
|
2017-05-01 19:19:42 +00:00
|
|
|
//Todo: rename this function to DoTaskSingular
|
2019-01-21 02:14:55 +00:00
|
|
|
detail::DoWorkletInvokeFunctor(
|
|
|
|
this->Worklet,
|
|
|
|
this->Invocation,
|
|
|
|
this->Worklet.GetThreadIndices(index,
|
|
|
|
this->Invocation.OutputToInputMap,
|
|
|
|
this->Invocation.VisitArray,
|
|
|
|
this->Invocation.ThreadToOutputMap,
|
2020-03-23 20:27:00 +00:00
|
|
|
this->Invocation.GetInputDomain()));
|
2014-10-21 16:51:07 +00:00
|
|
|
}
|
2017-05-18 14:29:41 +00:00
|
|
|
|
2014-10-21 16:51:07 +00:00
|
|
|
private:
|
2018-01-18 18:51:30 +00:00
|
|
|
typename std::remove_const<WorkletType>::type Worklet;
|
2016-01-26 20:08:46 +00:00
|
|
|
// This is held by by value so that when we transfer the invocation object
|
|
|
|
// over to CUDA it gets properly copied to the device. While we want to
|
|
|
|
// hold by reference to reduce the number of copies, it is not possible
|
|
|
|
// currently.
|
|
|
|
const InvocationType Invocation;
|
2014-10-21 16:51:07 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} // vtkm::exec::internal
|
|
|
|
|
2017-05-01 19:19:42 +00:00
|
|
|
#endif //vtk_m_exec_internal_TaskSingular_h
|