2014-10-21 16:51:07 +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).
|
2014-10-21 16:51:07 +00:00
|
|
|
// Copyright 2014 UT-Battelle, LLC.
|
2015-05-21 12:09:22 +00:00
|
|
|
// Copyright 2014 Los Alamos National Security.
|
2014-10-21 16:51:07 +00:00
|
|
|
//
|
2017-09-20 21:33:44 +00:00
|
|
|
// Under the terms of Contract DE-NA0003525 with NTESS,
|
2014-10-21 16:51:07 +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.
|
|
|
|
//============================================================================
|
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
|
2017-05-26 17:53:28 +00:00
|
|
|
TaskSingular(const WorkletType& worklet,
|
|
|
|
const InvocationType& invocation,
|
2018-01-18 20:27:40 +00:00
|
|
|
vtkm::Id globalIndexOffset = 0)
|
2017-05-18 14:29:41 +00:00
|
|
|
: Worklet(worklet)
|
|
|
|
, Invocation(invocation)
|
|
|
|
, GlobalIndexOffset(globalIndexOffset)
|
|
|
|
{
|
|
|
|
}
|
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
|
2017-05-26 17:53:28 +00:00
|
|
|
detail::DoWorkletInvokeFunctor(this->Worklet,
|
|
|
|
this->Invocation,
|
|
|
|
this->Worklet.GetThreadIndices(index,
|
|
|
|
this->Invocation.OutputToInputMap,
|
|
|
|
this->Invocation.VisitArray,
|
|
|
|
this->Invocation.GetInputDomain(),
|
|
|
|
GlobalIndexOffset));
|
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;
|
2016-08-18 03:33:04 +00:00
|
|
|
const vtkm::Id GlobalIndexOffset;
|
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
|