Viskores  1.0
TaskSingular.h
Go to the documentation of this file.
1 //============================================================================
2 // The contents of this file are covered by the Viskores license. See
3 // LICENSE.txt for details.
4 //
5 // By contributing to this file, all contributors agree to the Developer
6 // Certificate of Origin Version 1.1 (DCO 1.1) as stated in DCO.txt.
7 //============================================================================
8 
9 //============================================================================
10 // Copyright (c) Kitware, Inc.
11 // All rights reserved.
12 // See LICENSE.txt for details.
13 //
14 // This software is distributed WITHOUT ANY WARRANTY; without even
15 // the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
16 // PURPOSE. See the above copyright notice for more information.
17 //============================================================================
18 #ifndef viskores_exec_internal_TaskSingular_h
19 #define viskores_exec_internal_TaskSingular_h
20 
22 
23 #include <viskores/exec/TaskBase.h>
24 
26 
27 //Todo: rename this header to TaskSingularDetail.h
29 
30 namespace viskores
31 {
32 namespace exec
33 {
34 namespace internal
35 {
36 
37 // TaskSingular represents an execution pattern for a worklet
38 // that is best expressed in terms of single dimension iteration space. Inside
39 // this single dimension no order is preferred.
40 //
41 //
42 template <typename WorkletType, typename InvocationType>
43 class TaskSingular : public viskores::exec::TaskBase
44 {
45 public:
47  TaskSingular(const WorkletType& worklet, const InvocationType& invocation)
48  : Worklet(worklet)
49  , Invocation(invocation)
50  {
51  }
52 
54  void SetErrorMessageBuffer(const viskores::exec::internal::ErrorMessageBuffer& buffer)
55  {
56  this->Worklet.SetErrorMessageBuffer(buffer);
57  }
59  template <typename T>
60  VISKORES_EXEC void operator()(T index) const
61  {
62  //Todo: rename this function to DoTaskSingular
63  detail::DoWorkletInvokeFunctor(
64  this->Worklet,
65  this->Invocation,
66  this->Worklet.GetThreadIndices(index,
67  this->Invocation.OutputToInputMap,
68  this->Invocation.VisitArray,
69  this->Invocation.ThreadToOutputMap,
70  this->Invocation.GetInputDomain()));
71  }
72 
73 private:
74  typename std::remove_const<WorkletType>::type Worklet;
75  // This is held by by value so that when we transfer the invocation object
76  // over to CUDA it gets properly copied to the device. While we want to
77  // hold by reference to reduce the number of copies, it is not possible
78  // currently.
79  const InvocationType Invocation;
80 };
81 }
82 }
83 } // viskores::exec::internal
84 
85 #endif //viskores_exec_internal_TaskSingular_h
WorkletInvokeFunctorDetail.h
VISKORES_SUPPRESS_EXEC_WARNINGS
#define VISKORES_SUPPRESS_EXEC_WARNINGS
Definition: ExportMacros.h:61
VISKORES_CONT
#define VISKORES_CONT
Definition: ExportMacros.h:65
viskores
Groups connected points that have the same field value.
Definition: Atomic.h:27
Fetch.h
Invocation.h
TaskBase.h
VISKORES_EXEC
#define VISKORES_EXEC
Definition: ExportMacros.h:59
viskores::exec::TaskBase
Base class for all classes that are used to marshal data from the invocation parameters to the user w...
Definition: TaskBase.h:34