Viskores  1.0
ArrayHandleTransform.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_cont_ArrayHandleTransform_h
19 #define viskores_cont_ArrayHandleTransform_h
20 
26 
28 
30 
31 namespace viskores
32 {
33 namespace internal
34 {
35 
37 struct NullFunctorType
38 {
39 };
40 
43 template <typename ValueType_,
44  typename PortalType_,
45  typename FunctorType_,
46  typename InverseFunctorType_ = NullFunctorType>
47 class VISKORES_ALWAYS_EXPORT ArrayPortalTransform;
48 
49 template <typename ValueType_, typename PortalType_, typename FunctorType_>
50 class VISKORES_ALWAYS_EXPORT
51  ArrayPortalTransform<ValueType_, PortalType_, FunctorType_, NullFunctorType>
52 {
53 public:
54  using PortalType = PortalType_;
55  using ValueType = ValueType_;
56  using FunctorType = FunctorType_;
57 
59  ArrayPortalTransform(const PortalType& portal = PortalType(),
60  const FunctorType& functor = FunctorType())
61  : Portal(portal)
62  , Functor(functor)
63  {
64  }
65 
70  template <class OtherV, class OtherP, class OtherF>
71  VISKORES_EXEC_CONT ArrayPortalTransform(const ArrayPortalTransform<OtherV, OtherP, OtherF>& src)
72  : Portal(src.GetPortal())
73  , Functor(src.GetFunctor())
74  {
75  }
76 
78  viskores::Id GetNumberOfValues() const { return this->Portal.GetNumberOfValues(); }
79 
81  ValueType Get(viskores::Id index) const { return this->Functor(this->Portal.Get(index)); }
82 
84  const PortalType& GetPortal() const { return this->Portal; }
85 
87  const FunctorType& GetFunctor() const { return this->Functor; }
88 
89 protected:
90  PortalType Portal;
91  FunctorType Functor;
92 };
93 
94 template <typename ValueType_,
95  typename PortalType_,
96  typename FunctorType_,
97  typename InverseFunctorType_>
98 class VISKORES_ALWAYS_EXPORT ArrayPortalTransform
99  : public ArrayPortalTransform<ValueType_, PortalType_, FunctorType_, NullFunctorType>
100 {
101  using Writable = viskores::internal::PortalSupportsSets<PortalType_>;
102 
103 public:
104  using Superclass = ArrayPortalTransform<ValueType_, PortalType_, FunctorType_, NullFunctorType>;
105  using PortalType = PortalType_;
106  using ValueType = ValueType_;
107  using FunctorType = FunctorType_;
108  using InverseFunctorType = InverseFunctorType_;
109 
111  ArrayPortalTransform(const PortalType& portal = PortalType(),
112  const FunctorType& functor = FunctorType(),
113  const InverseFunctorType& inverseFunctor = InverseFunctorType())
114  : Superclass(portal, functor)
115  , InverseFunctor(inverseFunctor)
116  {
117  }
118 
119  template <class OtherV, class OtherP, class OtherF, class OtherInvF>
120  VISKORES_EXEC_CONT ArrayPortalTransform(
121  const ArrayPortalTransform<OtherV, OtherP, OtherF, OtherInvF>& src)
122  : Superclass(src)
123  , InverseFunctor(src.GetInverseFunctor())
124  {
125  }
126 
127  template <typename Writable_ = Writable,
128  typename = typename std::enable_if<Writable_::value>::type>
129  VISKORES_EXEC_CONT void Set(viskores::Id index, const ValueType& value) const
130  {
131  this->Portal.Set(index, this->InverseFunctor(value));
132  }
133 
135  const InverseFunctorType& GetInverseFunctor() const { return this->InverseFunctor; }
136 
137 private:
138  InverseFunctorType InverseFunctor;
139 };
140 }
141 } // namespace viskores::internal
142 
143 namespace viskores
144 {
145 namespace cont
146 {
147 
148 namespace internal
149 {
150 
151 using NullFunctorType = viskores::internal::NullFunctorType;
152 
153 template <typename ProvidedFunctorType, typename FunctorIsExecContObject>
154 struct TransformFunctorManagerImpl;
155 
156 template <typename ProvidedFunctorType>
157 struct TransformFunctorManagerImpl<ProvidedFunctorType, std::false_type>
158 {
160  !viskores::cont::internal::IsExecutionObjectBase<ProvidedFunctorType>::value,
161  "Must use an ExecutionAndControlObject instead of an ExecutionObject.");
162 
163  ProvidedFunctorType Functor;
164  using FunctorType = ProvidedFunctorType;
165 
166  TransformFunctorManagerImpl() = default;
167 
169  TransformFunctorManagerImpl(const ProvidedFunctorType& functor)
170  : Functor(functor)
171  {
172  }
173 
175  ProvidedFunctorType PrepareForControl() const { return this->Functor; }
176 
177  VISKORES_CONT ProvidedFunctorType PrepareForExecution(viskores::cont::DeviceAdapterId,
178  viskores::cont::Token&) const
179  {
180  return this->Functor;
181  }
182 };
183 
184 template <typename ProvidedFunctorType>
185 struct TransformFunctorManagerImpl<ProvidedFunctorType, std::true_type>
186 {
187  VISKORES_IS_EXECUTION_AND_CONTROL_OBJECT(ProvidedFunctorType);
188 
189  ProvidedFunctorType Functor;
190  // using FunctorType = decltype(std::declval<ProvidedFunctorType>().PrepareForControl());
191  // using FunctorType = decltype(Functor.PrepareForControl());
192  using FunctorType = viskores::cont::internal::ControlObjectType<ProvidedFunctorType>;
193 
194  TransformFunctorManagerImpl() = default;
195 
197  TransformFunctorManagerImpl(const ProvidedFunctorType& functor)
198  : Functor(functor)
199  {
200  }
201 
203  auto PrepareForControl() const
204  -> decltype(viskores::cont::internal::CallPrepareForControl(this->Functor))
205  {
206  return viskores::cont::internal::CallPrepareForControl(this->Functor);
207  }
208 
209  VISKORES_CONT auto PrepareForExecution(viskores::cont::DeviceAdapterId device,
210  viskores::cont::Token& token) const
211  -> decltype(viskores::cont::internal::CallPrepareForExecution(this->Functor, device, token))
212  {
213  return viskores::cont::internal::CallPrepareForExecution(this->Functor, device, token);
214  }
215 };
216 
217 template <typename ProvidedFunctorType>
218 struct TransformFunctorManager
219  : TransformFunctorManagerImpl<
220  ProvidedFunctorType,
221  typename viskores::cont::internal::IsExecutionAndControlObjectBase<ProvidedFunctorType>::type>
222 {
223  using Superclass = TransformFunctorManagerImpl<
224  ProvidedFunctorType,
225  typename viskores::cont::internal::IsExecutionAndControlObjectBase<ProvidedFunctorType>::type>;
226  using FunctorType = typename Superclass::FunctorType;
227 
228  VISKORES_CONT TransformFunctorManager() = default;
229 
230  VISKORES_CONT TransformFunctorManager(const TransformFunctorManager&) = default;
231 
232  VISKORES_CONT TransformFunctorManager(const ProvidedFunctorType& functor)
233  : Superclass(functor)
234  {
235  }
236 
237  template <typename ValueType>
238  using TransformedValueType = decltype(std::declval<FunctorType>()(std::declval<ValueType>()));
239 };
240 
241 template <typename ArrayHandleType,
242  typename FunctorType,
243  typename InverseFunctorType = NullFunctorType>
244 struct VISKORES_ALWAYS_EXPORT StorageTagTransform
245 {
246  using FunctorManager = TransformFunctorManager<FunctorType>;
247  using ValueType =
248  typename FunctorManager::template TransformedValueType<typename ArrayHandleType::ValueType>;
249 };
250 
251 template <typename ArrayHandleType, typename FunctorType>
252 class Storage<typename StorageTagTransform<ArrayHandleType, FunctorType>::ValueType,
253  StorageTagTransform<ArrayHandleType, FunctorType>>
254 {
255  using FunctorManager = TransformFunctorManager<FunctorType>;
256  using ValueType = typename StorageTagTransform<ArrayHandleType, FunctorType>::ValueType;
257 
258  using SourceStorage = typename ArrayHandleType::StorageType;
259 
260  static std::vector<viskores::cont::internal::Buffer> SourceBuffers(
261  const std::vector<viskores::cont::internal::Buffer>& buffers)
262  {
263  return std::vector<viskores::cont::internal::Buffer>(buffers.begin() + 1, buffers.end());
264  }
265 
266 public:
269 
270  using ReadPortalType =
271  viskores::internal::ArrayPortalTransform<ValueType,
272  typename ArrayHandleType::ReadPortalType,
273  typename FunctorManager::FunctorType>;
274 
275  VISKORES_CONT static viskores::IdComponent GetNumberOfComponentsFlat(
276  const std::vector<viskores::cont::internal::Buffer>&)
277  {
279  }
280 
281  VISKORES_CONT static viskores::Id GetNumberOfValues(
282  const std::vector<viskores::cont::internal::Buffer>& buffers)
283  {
284  return SourceStorage::GetNumberOfValues(SourceBuffers(buffers));
285  }
286 
287  VISKORES_CONT static ReadPortalType CreateReadPortal(
288  const std::vector<viskores::cont::internal::Buffer>& buffers,
290  viskores::cont::Token& token)
291  {
293  {
294  return ReadPortalType(SourceStorage::CreateReadPortal(SourceBuffers(buffers), device, token),
295  buffers[0].GetMetaData<FunctorManager>().PrepareForControl());
296  }
297  else
298  {
299  return ReadPortalType(
300  SourceStorage::CreateReadPortal(SourceBuffers(buffers), device, token),
301  buffers[0].GetMetaData<FunctorManager>().PrepareForExecution(device, token));
302  }
303  }
304 
305  VISKORES_CONT static std::vector<viskores::cont::internal::Buffer> CreateBuffers(
306  const ArrayHandleType& handle = ArrayHandleType{},
307  const FunctorType& functor = FunctorType())
308  {
309  return viskores::cont::internal::CreateBuffers(FunctorManager(functor), handle);
310  }
311 
312  VISKORES_CONT static ArrayHandleType GetArray(
313  const std::vector<viskores::cont::internal::Buffer>& buffers)
314  {
315  return viskores::cont::ArrayHandle<typename ArrayHandleType::ValueType,
316  typename ArrayHandleType::StorageTag>(
317  SourceBuffers(buffers));
318  }
319 
320  VISKORES_CONT static FunctorType GetFunctor(
321  const std::vector<viskores::cont::internal::Buffer>& buffers)
322  {
323  return buffers[0].GetMetaData<FunctorManager>().Functor;
324  }
325 
326  VISKORES_CONT static NullFunctorType GetInverseFunctor(
327  const std::vector<viskores::cont::internal::Buffer>&)
328  {
329  return NullFunctorType{};
330  }
331 };
332 
333 template <typename ArrayHandleType, typename FunctorType, typename InverseFunctorType>
334 class Storage<
335  typename StorageTagTransform<ArrayHandleType, FunctorType, InverseFunctorType>::ValueType,
336  StorageTagTransform<ArrayHandleType, FunctorType, InverseFunctorType>>
337 {
338  using FunctorManager = TransformFunctorManager<FunctorType>;
339  using InverseFunctorManager = TransformFunctorManager<InverseFunctorType>;
340  using ValueType = typename StorageTagTransform<ArrayHandleType, FunctorType>::ValueType;
341 
342  using SourceStorage = typename ArrayHandleType::StorageType;
343 
344  static std::vector<viskores::cont::internal::Buffer> SourceBuffers(
345  const std::vector<viskores::cont::internal::Buffer>& buffers)
346  {
347  return std::vector<viskores::cont::internal::Buffer>(buffers.begin() + 2, buffers.end());
348  }
349 
350 public:
351  using ReadPortalType =
352  viskores::internal::ArrayPortalTransform<ValueType,
353  typename ArrayHandleType::ReadPortalType,
354  typename FunctorManager::FunctorType,
355  typename InverseFunctorManager::FunctorType>;
356  using WritePortalType =
357  viskores::internal::ArrayPortalTransform<ValueType,
358  typename ArrayHandleType::WritePortalType,
359  typename FunctorManager::FunctorType,
360  typename InverseFunctorManager::FunctorType>;
361 
362  VISKORES_CONT static viskores::IdComponent GetNumberOfComponentsFlat(
363  const std::vector<viskores::cont::internal::Buffer>&)
364  {
366  }
367 
368  VISKORES_CONT static viskores::Id GetNumberOfValues(
369  const std::vector<viskores::cont::internal::Buffer>& buffers)
370  {
371  return SourceStorage::GetNumberOfValues(SourceBuffers(buffers));
372  }
373 
374  VISKORES_CONT static void ResizeBuffers(
375  viskores::Id numValues,
376  const std::vector<viskores::cont::internal::Buffer>& buffers,
377  viskores::CopyFlag preserve,
378  viskores::cont::Token& token)
379  {
380  std::vector<viskores::cont::internal::Buffer> sourceBuffers = SourceBuffers(buffers);
381  SourceStorage::ResizeBuffers(numValues, sourceBuffers, preserve, token);
382  }
383 
384  VISKORES_CONT static ReadPortalType CreateReadPortal(
385  const std::vector<viskores::cont::internal::Buffer>& buffers,
387  viskores::cont::Token& token)
388  {
390  {
391  return ReadPortalType(SourceStorage::CreateReadPortal(SourceBuffers(buffers), device, token),
392  buffers[0].GetMetaData<FunctorManager>().PrepareForControl(),
393  buffers[1].GetMetaData<InverseFunctorManager>().PrepareForControl());
394  }
395  else
396  {
397  return ReadPortalType(
398  SourceStorage::CreateReadPortal(SourceBuffers(buffers), device, token),
399  buffers[0].GetMetaData<FunctorManager>().PrepareForExecution(device, token),
400  buffers[1].GetMetaData<InverseFunctorManager>().PrepareForExecution(device, token));
401  }
402  }
403 
404  VISKORES_CONT static WritePortalType CreateWritePortal(
405  const std::vector<viskores::cont::internal::Buffer>& buffers,
407  viskores::cont::Token& token)
408  {
409  return WritePortalType(
410  SourceStorage::CreateWritePortal(SourceBuffers(buffers), device, token),
411  buffers[0].GetMetaData<FunctorManager>().PrepareForExecution(device, token),
412  buffers[1].GetMetaData<InverseFunctorManager>().PrepareForExecution(device, token));
413  }
414 
415  VISKORES_CONT static std::vector<viskores::cont::internal::Buffer> CreateBuffers(
416  const ArrayHandleType& handle = ArrayHandleType{},
417  const FunctorType& functor = FunctorType(),
418  const InverseFunctorType& inverseFunctor = InverseFunctorType())
419  {
420  return viskores::cont::internal::CreateBuffers(
421  FunctorManager(functor), InverseFunctorManager(inverseFunctor), handle);
422  }
423 
424  VISKORES_CONT static ArrayHandleType GetArray(
425  const std::vector<viskores::cont::internal::Buffer>& buffers)
426  {
427  return viskores::cont::ArrayHandle<typename ArrayHandleType::ValueType,
428  typename ArrayHandleType::StorageTag>(
429  SourceBuffers(buffers));
430  }
431 
432  VISKORES_CONT static FunctorType GetFunctor(
433  const std::vector<viskores::cont::internal::Buffer>& buffers)
434  {
435  return buffers[0].GetMetaData<FunctorManager>().Functor;
436  }
437 
438  VISKORES_CONT static InverseFunctorType GetInverseFunctor(
439  const std::vector<viskores::cont::internal::Buffer>& buffers)
440  {
441  return buffers[1].GetMetaData<InverseFunctorManager>().Functor;
442  }
443 };
444 
445 } // namespace internal
446 
458 template <typename ArrayHandleType,
459  typename FunctorType,
460  typename InverseFunctorType = internal::NullFunctorType>
462 
463 template <typename ArrayHandleType, typename FunctorType>
464 class ArrayHandleTransform<ArrayHandleType, FunctorType, internal::NullFunctorType>
466  typename internal::StorageTagTransform<ArrayHandleType, FunctorType>::ValueType,
467  internal::StorageTagTransform<ArrayHandleType, FunctorType>>
468 {
469  // If the following line gives a compile error, then the ArrayHandleType
470  // template argument is not a valid ArrayHandle type.
471  VISKORES_IS_ARRAY_HANDLE(ArrayHandleType);
472 
473 public:
478  typename internal::StorageTagTransform<ArrayHandleType, FunctorType>::ValueType,
479  internal::StorageTagTransform<ArrayHandleType, FunctorType>>));
480 
482  ArrayHandleTransform(const ArrayHandleType& handle,
483  const FunctorType& functor = FunctorType{},
484  internal::NullFunctorType = internal::NullFunctorType{})
485  : Superclass(StorageType::CreateBuffers(handle, functor))
486  {
487  }
488 };
489 
493 template <typename HandleType, typename FunctorType>
495 make_ArrayHandleTransform(HandleType handle, FunctorType functor)
496 {
497  return ArrayHandleTransform<HandleType, FunctorType>(handle, functor);
498 }
499 
500 // ArrayHandleTransform with inverse functors enabled (no need to subclass from
501 // ArrayHandleTransform without inverse functors: nothing to inherit).
502 template <typename ArrayHandleType, typename FunctorType, typename InverseFunctorType>
503 class ArrayHandleTransform
505  typename internal::StorageTagTransform<ArrayHandleType, FunctorType, InverseFunctorType>::
506  ValueType,
507  internal::StorageTagTransform<ArrayHandleType, FunctorType, InverseFunctorType>>
508 {
509  VISKORES_IS_ARRAY_HANDLE(ArrayHandleType);
510 
511 public:
514  (ArrayHandleTransform<ArrayHandleType, FunctorType, InverseFunctorType>),
516  typename internal::StorageTagTransform<ArrayHandleType, FunctorType, InverseFunctorType>::
517  ValueType,
518  internal::StorageTagTransform<ArrayHandleType, FunctorType, InverseFunctorType>>));
519 
520  ArrayHandleTransform(const ArrayHandleType& handle,
521  const FunctorType& functor = FunctorType(),
522  const InverseFunctorType& inverseFunctor = InverseFunctorType())
523  : Superclass(StorageType::CreateBuffers(handle, functor, inverseFunctor))
524  {
525  }
526 
533 
536  ArrayHandleType GetTransformedArray() const { return StorageType::GetArray(this->GetBuffers()); }
537 
540  FunctorType GetFunctor() const { return StorageType::GetFunctor(this->GetBuffers()); }
541 
544  InverseFunctorType GetInverseFunctor() const
545  {
546  return StorageType::GetInverseFunctor(this->GetBuffers());
547  }
548 };
549 
550 template <typename HandleType, typename FunctorType, typename InverseFunctorType>
552 make_ArrayHandleTransform(HandleType handle, FunctorType functor, InverseFunctorType inverseFunctor)
553 {
555  handle, functor, inverseFunctor);
556 }
557 }
558 
559 } // namespace viskores::cont
560 
561 //=============================================================================
562 // Specializations of serialization related classes
564 namespace viskores
565 {
566 namespace cont
567 {
568 
569 template <typename AH, typename Functor, typename InvFunctor>
570 struct SerializableTypeString<viskores::cont::ArrayHandleTransform<AH, Functor, InvFunctor>>
571 {
572  static VISKORES_CONT const std::string& Get()
573  {
574  static std::string name = "AH_Transform<" + SerializableTypeString<AH>::Get() + "," +
576  ">";
577  return name;
578  }
579 };
580 
581 template <typename AH, typename Functor>
582 struct SerializableTypeString<viskores::cont::ArrayHandleTransform<AH, Functor>>
583 {
584  static VISKORES_CONT const std::string& Get()
585  {
586  static std::string name = "AH_Transform<" + SerializableTypeString<AH>::Get() + "," +
588  return name;
589  }
590 };
591 
592 template <typename AH, typename Functor, typename InvFunctor>
593 struct SerializableTypeString<viskores::cont::ArrayHandle<
594  typename viskores::cont::internal::StorageTagTransform<AH, Functor, InvFunctor>::ValueType,
595  viskores::cont::internal::StorageTagTransform<AH, Functor, InvFunctor>>>
596  : SerializableTypeString<viskores::cont::ArrayHandleTransform<AH, Functor, InvFunctor>>
597 {
598 };
599 }
600 } // viskores::cont
601 
602 namespace mangled_diy_namespace
603 {
604 
605 template <typename AH, typename Functor>
606 struct Serialization<viskores::cont::ArrayHandleTransform<AH, Functor>>
607 {
608 private:
611 
612 public:
613  static VISKORES_CONT void save(BinaryBuffer& bb, const BaseType& obj)
614  {
615  Type transformedArray = obj;
616  viskoresdiy::save(bb, obj.GetArray());
617  viskoresdiy::save(bb, obj.GetFunctor());
618  }
619 
620  static VISKORES_CONT void load(BinaryBuffer& bb, BaseType& obj)
621  {
622  AH array;
623  viskoresdiy::load(bb, array);
624  Functor functor;
625  viskoresdiy::load(bb, functor);
626  obj = viskores::cont::make_ArrayHandleTransform(array, functor);
627  }
628 };
629 
630 template <typename AH, typename Functor, typename InvFunctor>
631 struct Serialization<viskores::cont::ArrayHandleTransform<AH, Functor, InvFunctor>>
632 {
633 private:
636 
637 public:
638  static VISKORES_CONT void save(BinaryBuffer& bb, const BaseType& obj)
639  {
640  Type transformedArray = obj;
641  viskoresdiy::save(bb, transformedArray.GetTransformedArray());
642  viskoresdiy::save(bb, transformedArray.GetFunctor());
643  viskoresdiy::save(bb, transformedArray.GetInverseFunctor());
644  }
645 
646  static VISKORES_CONT void load(BinaryBuffer& bb, BaseType& obj)
647  {
648  AH array;
649  viskoresdiy::load(bb, array);
650  Functor functor;
651  viskoresdiy::load(bb, functor);
652  InvFunctor invFunctor;
653  viskoresdiy::load(bb, invFunctor);
654  obj = viskores::cont::make_ArrayHandleTransform(array, functor, invFunctor);
655  }
656 };
657 
658 template <typename AH, typename Functor, typename InvFunctor>
659 struct Serialization<viskores::cont::ArrayHandle<
660  typename viskores::cont::internal::StorageTagTransform<AH, Functor, InvFunctor>::ValueType,
661  viskores::cont::internal::StorageTagTransform<AH, Functor, InvFunctor>>>
662  : Serialization<viskores::cont::ArrayHandleTransform<AH, Functor, InvFunctor>>
663 {
664 };
665 
666 } // diy
668 
669 #endif //viskores_cont_ArrayHandleTransform_h
viskores::exec::arg::load
T load(const U &u, viskores::Id v)
Definition: FetchTagArrayDirectIn.h:44
viskores::cont::ArrayHandleTransform::GetInverseFunctor
InverseFunctorType GetInverseFunctor() const
Returns the inverse functor transforming the ArrayHandle
Definition: ArrayHandleTransform.h:544
viskores::VecFlat
Treat a Vec or Vec-like object as a flat Vec.
Definition: VecFlat.h:240
viskores::cont::ArrayHandleTransform::GetFunctor
FunctorType GetFunctor() const
Returns the functor transforming the ArrayHandle.
Definition: ArrayHandleTransform.h:540
ArrayHandle.h
ArrayPortalHelpers.h
RuntimeDeviceTracker.h
VISKORES_IS_ARRAY_HANDLE
#define VISKORES_IS_ARRAY_HANDLE(T)
Checks that the given type is a viskores::cont::ArrayHandle.
Definition: ArrayHandle.h:145
viskores::cont::ArrayHandle
Manages an array-worth of data.
Definition: ArrayHandle.h:313
viskores::IdComponent
viskores::Int32 IdComponent
Base type to use to index small lists.
Definition: Types.h:202
VISKORES_EXEC_CONT
#define VISKORES_EXEC_CONT
Definition: ExportMacros.h:60
viskores::cont::ArrayHandleTransform::StorageType
typename Superclass::StorageType StorageType
Definition: ArrayHandleTransform.h:518
mangled_diy_namespace
Definition: Particle.h:373
viskores::Id
viskores::Int64 Id
Base type to use to index arrays.
Definition: Types.h:235
VISKORES_CONT
#define VISKORES_CONT
Definition: ExportMacros.h:65
viskores
Groups connected points that have the same field value.
Definition: Atomic.h:27
VISKORES_STORAGE_NO_RESIZE
#define VISKORES_STORAGE_NO_RESIZE
Definition: Storage.h:194
VISKORES_STORAGE_NO_WRITE_PORTAL
#define VISKORES_STORAGE_NO_WRITE_PORTAL
Definition: Storage.h:209
DeviceAdapterRuntimeDetectorSerial.h
ExecutionAndControlObjectBase.h
viskores::cont::ArrayHandleTransform::Superclass
typename viskores::cont::detail::GetTypeInParentheses< void(viskores::cont::ArrayHandle< typename internal::StorageTagTransform< ArrayHandleType, FunctorType, InverseFunctorType >::ValueType, internal::StorageTagTransform< ArrayHandleType, FunctorType, InverseFunctorType > >) >::type Superclass
Definition: ArrayHandleTransform.h:518
viskores::cont::DeviceAdapterTagUndefined
Tag for a device adapter used to avoid specifying a device.
Definition: DeviceAdapterTag.h:201
VISKORES_STATIC_ASSERT_MSG
#define VISKORES_STATIC_ASSERT_MSG(condition, message)
Definition: StaticAssert.h:26
viskores::cont::DeviceAdapterId
An object used to specify a device.
Definition: DeviceAdapterTag.h:66
VISKORES_IS_EXECUTION_AND_CONTROL_OBJECT
#define VISKORES_IS_EXECUTION_AND_CONTROL_OBJECT(execObject)
Checks that the argument is a proper execution object.
Definition: ExecutionAndControlObjectBase.h:69
viskores::cont::ArrayHandleTransform::GetTransformedArray
ArrayHandleType GetTransformedArray() const
Returns the ArrayHandle that is being transformed.
Definition: ArrayHandleTransform.h:536
viskores::cont::ArrayHandleTransform::ArrayHandleTransform
ArrayHandleTransform()
Definition: ArrayHandleTransform.h:518
VISKORES_ARRAY_HANDLE_SUBCLASS
#define VISKORES_ARRAY_HANDLE_SUBCLASS(classname, fullclasstype, superclass)
Macro to make default methods in ArrayHandle subclasses.
Definition: ArrayHandle.h:256
viskores::cont::ArrayHandleTransform::ArrayHandleTransform
ArrayHandleTransform(const ArrayHandleType &handle, const FunctorType &functor=FunctorType(), const InverseFunctorType &inverseFunctor=InverseFunctorType())
Definition: ArrayHandleTransform.h:520
viskores::cont::ArrayHandleTransform::ValueType
typename Superclass::ValueType ValueType
Definition: ArrayHandleTransform.h:518
viskores::Get
auto Get(const viskores::Tuple< Ts... > &tuple)
Retrieve the object from a viskores::Tuple at the given index.
Definition: Tuple.h:89
viskores::cont::make_ArrayHandleTransform
viskores::cont::ArrayHandleTransform< HandleType, FunctorType > make_ArrayHandleTransform(HandleType handle, FunctorType functor)
make_ArrayHandleTransform is convenience function to generate an ArrayHandleTransform.
Definition: ArrayHandleTransform.h:495
ErrorInternal.h
ErrorBadType.h
viskores::CopyFlag
CopyFlag
Identifier used to specify whether a function should deep copy data.
Definition: Flags.h:25
viskores::cont::ArrayHandleTransform
Implicitly transform values of one array to another with a functor.
Definition: ArrayHandleTransform.h:461
viskores::cont::Token
A token to hold the scope of an ArrayHandle or other object.
Definition: Token.h:43
viskores::cont::ArrayHandleTransform::~ArrayHandleTransform
~ArrayHandleTransform()
Implemented so that it is defined exclusively in the control environment.
Definition: ArrayHandleTransform.h:532