Viskores  1.0
UnknownArrayHandle.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_UnknownArrayHandle_h
19 #define viskores_cont_UnknownArrayHandle_h
20 
22 
31 
32 #include <viskores/Deprecated.h>
33 #include <viskores/TypeList.h>
34 #include <viskores/VecTraits.h>
35 
36 #include <memory>
37 #include <typeindex>
38 
39 namespace viskores
40 {
41 namespace cont
42 {
43 
44 namespace detail
45 {
46 
47 template <typename T, typename S>
48 void UnknownAHDelete(void* mem)
49 {
51  AH* arrayHandle = reinterpret_cast<AH*>(mem);
52  delete arrayHandle;
53 }
54 
55 template <typename T, typename S>
56 const std::vector<viskores::cont::internal::Buffer>& UnknownAHBuffers(void* mem)
57 {
59  AH* arrayHandle = reinterpret_cast<AH*>(mem);
60  return arrayHandle->GetBuffers();
61 }
62 
63 template <typename T, typename S>
64 void* UnknownAHNewInstance()
65 {
67 }
68 
69 template <typename T, typename S>
70 viskores::Id UnknownAHNumberOfValues(void* mem)
71 {
73  AH* arrayHandle = reinterpret_cast<AH*>(mem);
74  return arrayHandle->GetNumberOfValues();
75 }
76 
77 template <typename T, typename S>
78 viskores::IdComponent UnknownAHNumberOfComponentsFlat(void* mem)
79 {
81  AH* arrayHandle = reinterpret_cast<AH*>(mem);
82  return arrayHandle->GetNumberOfComponentsFlat();
83 }
84 
85 // Uses SFINAE to use Storage<>::GetNumberOfComponents if it exists, or the VecTraits otherwise
86 template <typename T, typename S>
87 inline auto UnknownAHNumberOfComponentsImpl(void* mem)
88  -> decltype(viskores::cont::internal::Storage<T, S>::GetNumberOfComponents(
89  std::vector<viskores::cont::internal::Buffer>()))
90 {
92  AH* arrayHandle = reinterpret_cast<AH*>(mem);
93  return viskores::cont::internal::Storage<T, S>::GetNumberOfComponents(arrayHandle->GetBuffers());
94 }
95 
96 // Uses static vec size.
97 template <typename T, typename S>
98 inline viskores::IdComponent UnknownAHNumberOfComponentsImpl(void*,
100 {
102 }
103 
104 // The size of the vecs are not defined at compile time. Assume that the components are not
105 // nested and use the flat components query.
106 template <typename T, typename S>
107 inline viskores::IdComponent UnknownAHNumberOfComponentsImpl(void* mem,
109 {
110  return UnknownAHNumberOfComponentsFlat<T, S>(mem);
111 }
112 
113 template <typename T, typename S>
114 viskores::IdComponent UnknownAHNumberOfComponents(void* mem)
115 {
116  return UnknownAHNumberOfComponentsImpl<T, S>(mem,
118 }
119 
120 template <typename T, typename S>
121 void UnknownAHAllocate(void* mem,
122  viskores::Id numValues,
123  viskores::CopyFlag preserve,
124  viskores::cont::Token& token)
125 {
127  AH* arrayHandle = reinterpret_cast<AH*>(mem);
128  arrayHandle->Allocate(numValues, preserve, token);
129 }
130 
131 template <typename T, typename S>
132 void UnknownAHShallowCopy(const void* sourceMem, void* destinationMem)
133 {
135  const AH* source = reinterpret_cast<const AH*>(sourceMem);
136  AH* destination = reinterpret_cast<AH*>(destinationMem);
137  *destination = *source;
138 }
139 
140 template <typename T, typename S>
141 void UnknownAHDeepCopy(const void* sourceMem, void* destinationMem)
142 {
144  const AH* source = reinterpret_cast<const AH*>(sourceMem);
145  AH* destination = reinterpret_cast<AH*>(destinationMem);
146  destination->DeepCopyFrom(*source);
147 }
148 
149 template <typename T, typename S>
150 std::vector<viskores::cont::internal::Buffer> UnknownAHExtractComponent(
151  void* mem,
152  viskores::IdComponent componentIndex,
153  viskores::CopyFlag allowCopy)
154 {
156  AH* arrayHandle = reinterpret_cast<AH*>(mem);
157  auto componentArray =
158  viskores::cont::ArrayExtractComponent(*arrayHandle, componentIndex, allowCopy);
159  return componentArray.GetBuffers();
160 }
161 
162 template <typename T, typename S>
163 void UnknownAHReleaseResources(void* mem)
164 {
166  AH* arrayHandle = reinterpret_cast<AH*>(mem);
167  arrayHandle->ReleaseResources();
168 }
169 
170 template <typename T, typename S>
171 void UnknownAHReleaseResourcesExecution(void* mem)
172 {
174  AH* arrayHandle = reinterpret_cast<AH*>(mem);
175  arrayHandle->ReleaseResourcesExecution();
176 }
177 
178 template <typename T, typename S>
179 void UnknownAHPrintSummary(void* mem, std::ostream& out, bool full)
180 {
182  AH* arrayHandle = reinterpret_cast<AH*>(mem);
183  viskores::cont::printSummary_ArrayHandle(*arrayHandle, out, full);
184 }
185 
186 struct VISKORES_CONT_EXPORT UnknownAHContainer;
187 
188 struct MakeUnknownAHContainerFunctor
189 {
190  template <typename T, typename S>
191  std::shared_ptr<UnknownAHContainer> operator()(
192  const viskores::cont::ArrayHandle<T, S>& array) const;
193 };
194 
195 struct VISKORES_CONT_EXPORT UnknownAHComponentInfo
196 {
197  std::type_index Type;
198  bool IsIntegral;
199  bool IsFloat;
200  bool IsSigned;
201  std::size_t Size;
202 
203  UnknownAHComponentInfo() = delete;
204 
205  bool operator==(const UnknownAHComponentInfo& rhs);
206 
207  template <typename T>
208  static UnknownAHComponentInfo Make()
209  {
210  return UnknownAHComponentInfo{ typeid(T),
211  std::is_integral<T>::value,
212  std::is_floating_point<T>::value,
213  std::is_signed<T>::value,
214  sizeof(T) };
215  }
216 
217 private:
218  UnknownAHComponentInfo(std::type_index&& type,
219  bool isIntegral,
220  bool isFloat,
221  bool isSigned,
222  std::size_t size)
223  : Type(std::move(type))
224  , IsIntegral(isIntegral)
225  , IsFloat(isFloat)
226  , IsSigned(isSigned)
227  , Size(size)
228  {
229  }
230 };
231 
232 struct VISKORES_CONT_EXPORT UnknownAHContainer
233 {
234  void* ArrayHandlePointer;
235 
236  std::type_index ValueType;
237  std::type_index StorageType;
238  UnknownAHComponentInfo BaseComponentType;
239 
240  using DeleteType = void(void*);
241  DeleteType* DeleteFunction;
242 
243  using BuffersType = const std::vector<viskores::cont::internal::Buffer>&(void*);
244  BuffersType* Buffers;
245 
246  using NewInstanceType = void*();
247  NewInstanceType* NewInstance;
248 
249  using NewInstanceBasicType = std::shared_ptr<UnknownAHContainer>(void*);
250  NewInstanceBasicType* NewInstanceBasic;
251  NewInstanceBasicType* NewInstanceFloatBasic;
252 
253  using NumberOfValuesType = viskores::Id(void*);
254  NumberOfValuesType* NumberOfValues;
255 
256  using NumberOfComponentsType = viskores::IdComponent(void*);
257  NumberOfComponentsType* NumberOfComponents;
258  NumberOfComponentsType* NumberOfComponentsFlat;
259 
260  using AllocateType = void(void*, viskores::Id, viskores::CopyFlag, viskores::cont::Token&);
261  AllocateType* Allocate;
262 
263  using ShallowCopyType = void(const void*, void*);
264  ShallowCopyType* ShallowCopy;
265 
266  using DeepCopyType = void(const void*, void*);
267  DeepCopyType* DeepCopy;
268 
269  using ExtractComponentType = std::vector<viskores::cont::internal::Buffer>(void*,
272  ExtractComponentType* ExtractComponent;
273 
274  using ReleaseResourcesType = void(void*);
275  ReleaseResourcesType* ReleaseResources;
276  ReleaseResourcesType* ReleaseResourcesExecution;
277 
278  using PrintSummaryType = void(void*, std::ostream&, bool);
279  PrintSummaryType* PrintSummary;
280 
281  void operator=(const UnknownAHContainer&) = delete;
282 
283  ~UnknownAHContainer() { this->DeleteFunction(this->ArrayHandlePointer); }
284 
285  std::shared_ptr<UnknownAHContainer> MakeNewInstance() const;
286 
287  template <typename T, typename S>
288  static std::shared_ptr<UnknownAHContainer> Make(const viskores::cont::ArrayHandle<T, S>& array)
289  {
290  return std::shared_ptr<UnknownAHContainer>(new UnknownAHContainer(array));
291  }
292 
293  template <typename TargetT, typename SourceT, typename SourceS>
294  static std::shared_ptr<UnknownAHContainer> Make(
296  array)
297  {
299  castArray = array;
300  return Make(castArray.GetSourceArray());
301  }
302 
303  template <typename T, typename... Ss>
304  static std::shared_ptr<UnknownAHContainer> Make(
306  {
307  auto&& variant =
309  .GetArrayHandleVariant();
310  if (variant.IsValid())
311  {
312  return variant.CastAndCall(MakeUnknownAHContainerFunctor{});
313  }
314  else
315  {
316  return std::shared_ptr<UnknownAHContainer>{};
317  }
318  }
319 
320 private:
321  UnknownAHContainer(const UnknownAHContainer&) = default;
322 
323  template <typename T, typename S>
324  explicit UnknownAHContainer(const viskores::cont::ArrayHandle<T, S>& array);
325 };
326 
327 template <typename T, typename S>
328 std::shared_ptr<UnknownAHContainer> UnknownAHNewInstanceBasic(void*,
330 {
331  return UnknownAHContainer::Make(viskores::cont::ArrayHandleBasic<T>{});
332 }
333 template <typename T, typename S>
334 std::shared_ptr<UnknownAHContainer> UnknownAHNewInstanceBasic(void* mem,
336 {
337  viskores::IdComponent numComponents = UnknownAHNumberOfComponentsFlat<T, S>(mem);
338  if (numComponents < 1)
339  {
340  // Array can have an inconsistent number of components. Cannot be represented by basic array.
341  throw viskores::cont::ErrorBadType("Cannot create a basic array from array with ValueType of " +
342  viskores::cont::TypeToString<T>());
343  }
344  using ComponentType = typename viskores::VecTraits<T>::BaseComponentType;
345  return UnknownAHContainer::Make(
347 }
348 template <typename T, typename S>
349 std::shared_ptr<UnknownAHContainer> UnknownAHNewInstanceBasic(void* mem)
350 {
351  return UnknownAHNewInstanceBasic<T, S>(mem, typename viskores::VecTraits<T>::IsSizeStatic{});
352 }
353 
354 template <typename T, typename S>
355 std::shared_ptr<UnknownAHContainer> UnknownAHNewInstanceFloatBasic(void*,
357 {
358  using FloatT =
359  typename viskores::VecTraits<T>::template ReplaceBaseComponentType<viskores::FloatDefault>;
360  return UnknownAHContainer::Make(viskores::cont::ArrayHandleBasic<FloatT>{});
361 }
362 template <typename T, typename S>
363 std::shared_ptr<UnknownAHContainer> UnknownAHNewInstanceFloatBasic(
364  void* mem,
366 {
367  viskores::IdComponent numComponents = UnknownAHNumberOfComponentsFlat<T, S>(mem);
368  if (numComponents < 1)
369  {
370  // Array can have an inconsistent number of components. Cannot be represented by basic array.
371  throw viskores::cont::ErrorBadType("Cannot create a basic array from array with ValueType of " +
372  viskores::cont::TypeToString<T>());
373  }
374  return UnknownAHContainer::Make(
376 }
377 template <typename T, typename S>
378 std::shared_ptr<UnknownAHContainer> UnknownAHNewInstanceFloatBasic(void* mem)
379 {
380  return UnknownAHNewInstanceFloatBasic<T, S>(mem, typename viskores::VecTraits<T>::IsSizeStatic{});
381 }
382 
383 template <typename T, typename S>
384 inline UnknownAHContainer::UnknownAHContainer(const viskores::cont::ArrayHandle<T, S>& array)
385  : ArrayHandlePointer(new viskores::cont::ArrayHandle<T, S>(array))
386  , ValueType(typeid(T))
387  , StorageType(typeid(S))
388  , BaseComponentType(
389  UnknownAHComponentInfo::Make<typename viskores::VecTraits<T>::BaseComponentType>())
390  , DeleteFunction(detail::UnknownAHDelete<T, S>)
391  , Buffers(detail::UnknownAHBuffers<T, S>)
392  , NewInstance(detail::UnknownAHNewInstance<T, S>)
393  , NewInstanceBasic(detail::UnknownAHNewInstanceBasic<T, S>)
394  , NewInstanceFloatBasic(detail::UnknownAHNewInstanceFloatBasic<T, S>)
395  , NumberOfValues(detail::UnknownAHNumberOfValues<T, S>)
396  , NumberOfComponents(detail::UnknownAHNumberOfComponents<T, S>)
397  , NumberOfComponentsFlat(detail::UnknownAHNumberOfComponentsFlat<T, S>)
398  , Allocate(detail::UnknownAHAllocate<T, S>)
399  , ShallowCopy(detail::UnknownAHShallowCopy<T, S>)
400  , DeepCopy(detail::UnknownAHDeepCopy<T, S>)
401  , ExtractComponent(detail::UnknownAHExtractComponent<T, S>)
402  , ReleaseResources(detail::UnknownAHReleaseResources<T, S>)
403  , ReleaseResourcesExecution(detail::UnknownAHReleaseResourcesExecution<T, S>)
404  , PrintSummary(detail::UnknownAHPrintSummary<T, S>)
405 {
406 }
407 
408 template <typename T, typename S>
409 inline std::shared_ptr<UnknownAHContainer> MakeUnknownAHContainerFunctor::operator()(
410  const viskores::cont::ArrayHandle<T, S>& array) const
411 {
412  return UnknownAHContainer::Make(array);
413 };
414 
415 } // namespace detail
416 
417 // Forward declaration. Include UncertainArrayHandle.h if using this.
418 template <typename ValueTypeList, typename StorageTypeList>
419 class UncertainArrayHandle;
420 
451 class VISKORES_CONT_EXPORT UnknownArrayHandle
452 {
453  std::shared_ptr<detail::UnknownAHContainer> Container;
454 
455  VISKORES_CONT bool IsValueTypeImpl(std::type_index type) const;
456  VISKORES_CONT bool IsStorageTypeImpl(std::type_index type) const;
457  VISKORES_CONT bool IsBaseComponentTypeImpl(const detail::UnknownAHComponentInfo& type) const;
458 
459 public:
460  VISKORES_CONT UnknownArrayHandle() = default;
461 
462  template <typename T, typename S>
464  : Container(detail::UnknownAHContainer::Make(array))
465  {
466  }
467 
474  VISKORES_CONT bool IsValid() const;
475 
482  VISKORES_CONT UnknownArrayHandle NewInstance() const;
483 
491  VISKORES_CONT UnknownArrayHandle NewInstanceBasic() const;
492 
509  VISKORES_CONT UnknownArrayHandle NewInstanceFloatBasic() const;
510 
514  VISKORES_CONT std::string GetValueTypeName() const;
515 
519  VISKORES_CONT std::string GetBaseComponentTypeName() const;
520 
524  VISKORES_CONT std::string GetStorageTypeName() const;
525 
531  VISKORES_CONT std::string GetArrayTypeName() const;
532 
535  template <typename ValueType>
537  {
538  return this->IsValueTypeImpl(typeid(ValueType));
539  }
540 
543  template <typename StorageType>
545  {
546  return this->IsStorageTypeImpl(typeid(StorageType));
547  }
548 
560  template <typename BaseComponentType>
562  {
563  return this->IsBaseComponentTypeImpl(detail::UnknownAHComponentInfo::Make<BaseComponentType>());
564  }
565 
578  template <typename ArrayHandleType>
579  VISKORES_CONT bool IsType() const
580  {
581  VISKORES_IS_ARRAY_HANDLE(ArrayHandleType);
582  return (this->IsValueType<typename ArrayHandleType::ValueType>() &&
583  this->IsStorageType<typename ArrayHandleType::StorageTag>());
584  }
585 
593  // Defined in UncertainArrayHandle.h
594  template <typename NewValueTypeList, typename NewStorageTypeList>
596  ResetTypes(NewValueTypeList = NewValueTypeList{},
597  NewStorageTypeList = NewStorageTypeList{}) const;
598 
601  VISKORES_CONT viskores::Id GetNumberOfValues() const;
602 
610  VISKORES_CONT viskores::IdComponent GetNumberOfComponents() const;
611 
628  VISKORES_CONT viskores::IdComponent GetNumberOfComponentsFlat() const;
629 
633  VISKORES_CONT void Allocate(viskores::Id numValues,
634  viskores::CopyFlag preserve,
635  viskores::cont::Token& token) const;
637  VISKORES_CONT void Allocate(viskores::Id numValues,
639 
647  template <typename ArrayHandleType>
648  VISKORES_CONT bool CanConvert() const;
649 
650  // MSVC will issue deprecation warnings here if this template is instantiated with
651  // a deprecated class even if the template is used from a section of code where
652  // deprecation warnings are suppressed. This is annoying behavior since this template
653  // has no control over what class it is used with. To get around it, we have to
654  // suppress all deprecation warnings here.
655 #ifdef VISKORES_MSVC
657 #endif
658 
659 private:
660  template <typename T, typename S>
662  {
663  using ArrayType = viskores::cont::ArrayHandle<T, S>;
664  if (!this->IsType<ArrayType>())
665  {
666  VISKORES_LOG_CAST_FAIL(*this, decltype(array));
667  throwFailedDynamicCast(this->GetArrayTypeName(), viskores::cont::TypeToString(array));
668  }
669 
670  array = *reinterpret_cast<ArrayType*>(this->Container->ArrayHandlePointer);
671  }
672 
673 public:
678  template <typename T, typename S>
680  {
681  this->BaseAsArrayHandle(array);
682  }
684  template <typename T>
685  VISKORES_CONT void AsArrayHandle(viskores::cont::ArrayHandle<T>& array) const;
687  template <typename T, typename... Ss>
688  VISKORES_CONT void AsArrayHandle(
691  template <typename TargetT, typename SourceT, typename SourceS>
694  const
695  {
696  using ContainedArrayType = viskores::cont::ArrayHandle<SourceT, SourceS>;
698  this->AsArrayHandle<ContainedArrayType>());
699  }
701  template <typename T>
704  {
705  using BaseT = typename T::ComponentType;
706  if (this->IsStorageType<viskores::cont::StorageTagBasic>() &&
707  this->IsBaseComponentType<BaseT>())
708  {
709  // Reinterpret the basic array as components, and then wrap that in a runtime vec
710  // with the correct amount of components.
712  this->Container->Buffers(this->Container->ArrayHandlePointer));
713  array =
714  viskores::cont::ArrayHandleRuntimeVec<BaseT>(this->GetNumberOfComponentsFlat(), basicArray);
715  }
716  else
717  {
718  this->BaseAsArrayHandle(array);
719  }
720  }
722  template <typename ArrayType>
723  VISKORES_CONT ArrayType AsArrayHandle() const
724  {
725  VISKORES_IS_ARRAY_HANDLE(ArrayType);
726  ArrayType array;
727  this->AsArrayHandle(array);
728  return array;
729  }
730 
731 #ifdef VISKORES_MSVC
733 #endif
734 
742  void DeepCopyFrom(const viskores::cont::UnknownArrayHandle& source);
743 
751  void DeepCopyFrom(const viskores::cont::UnknownArrayHandle& source) const;
752 
765  void CopyShallowIfPossible(const viskores::cont::UnknownArrayHandle& source);
766 
781  void CopyShallowIfPossible(const viskores::cont::UnknownArrayHandle& source) const;
782 
810  template <typename BaseComponentType>
812  viskores::IdComponent componentIndex,
813  viskores::CopyFlag allowCopy = viskores::CopyFlag::On) const
814  {
815  using ComponentArrayType = viskores::cont::ArrayHandleStride<BaseComponentType>;
816  if (!this->IsBaseComponentType<BaseComponentType>())
817  {
818  VISKORES_LOG_CAST_FAIL(*this, ComponentArrayType);
819  throwFailedDynamicCast("UnknownArrayHandle with " + this->GetArrayTypeName(),
820  "component array of " +
821  viskores::cont::TypeToString<BaseComponentType>());
822  }
823 
824  auto buffers = this->Container->ExtractComponent(
825  this->Container->ArrayHandlePointer, componentIndex, allowCopy);
826  return ComponentArrayType(buffers);
827  }
828 
871  template <typename BaseComponentType>
874  {
876  viskores::IdComponent numComponents = this->GetNumberOfComponentsFlat();
877  for (viskores::IdComponent cIndex = 0; cIndex < numComponents; ++cIndex)
878  {
879  result.AppendComponentArray(this->ExtractComponent<BaseComponentType>(cIndex, allowCopy));
880  }
881  return result;
882  }
883 
893  template <typename TypeList, typename StorageList, typename Functor, typename... Args>
894  VISKORES_CONT void CastAndCallForTypes(Functor&& functor, Args&&... args) const;
895 
909  template <typename TypeList, typename StorageList, typename Functor, typename... Args>
910  VISKORES_CONT void CastAndCallForTypesWithFloatFallback(Functor&& functor, Args&&... args) const;
911 
933  template <typename Functor, typename... Args>
934  VISKORES_CONT void CastAndCallWithExtractedArray(Functor&& functor, Args&&... args) const;
935 
939  VISKORES_CONT void ReleaseResourcesExecution() const;
940 
943  VISKORES_CONT void ReleaseResources() const;
944 
946  VISKORES_CONT void PrintSummary(std::ostream& out, bool full = false) const;
947 };
948 
949 //=============================================================================
950 // Out of class implementations
951 
952 namespace detail
953 {
954 
955 template <typename T, typename S>
956 struct UnknownArrayHandleCanConvert
957 {
958  VISKORES_CONT bool operator()(const viskores::cont::UnknownArrayHandle& array) const
959  {
961  }
962 };
963 
964 template <typename T>
965 struct UnknownArrayHandleCanConvert<T, viskores::cont::StorageTagBasic>
966 {
967  VISKORES_CONT bool operator()(const viskores::cont::UnknownArrayHandle& array) const
968  {
969  using UnrolledVec = viskores::internal::UnrollVec<T>;
970  return (array.IsType<viskores::cont::ArrayHandleBasic<T>>() ||
972  array.IsBaseComponentType<typename UnrolledVec::ComponentType>() &&
973  UnrolledVec::NUM_COMPONENTS == array.GetNumberOfComponentsFlat()));
974  }
975 };
976 
977 template <typename TargetT, typename SourceT, typename SourceS>
978 struct UnknownArrayHandleCanConvert<TargetT, viskores::cont::StorageTagCast<SourceT, SourceS>>
979 {
980  VISKORES_CONT bool operator()(const viskores::cont::UnknownArrayHandle& array) const
981  {
982  return UnknownArrayHandleCanConvert<SourceT, SourceS>{}(array);
983  }
984 };
985 
986 template <typename T>
987 struct UnknownArrayHandleCanConvertTry
988 {
989  template <typename S>
990  VISKORES_CONT void operator()(S,
992  bool& canConvert) const
993  {
994  canConvert |= UnknownArrayHandleCanConvert<T, S>{}(array);
995  }
996 };
997 
998 template <typename T, typename... Ss>
999 struct UnknownArrayHandleCanConvert<T, viskores::cont::StorageTagMultiplexer<Ss...>>
1000 {
1001  VISKORES_CONT bool operator()(const viskores::cont::UnknownArrayHandle& array) const
1002  {
1003  bool canConvert = false;
1005  UnknownArrayHandleCanConvertTry<T>{}, viskores::List<Ss...>{}, array, canConvert);
1006  return canConvert;
1007  }
1008 };
1009 
1010 template <typename T>
1011 struct UnknownArrayHandleCanConvert<T, viskores::cont::StorageTagRuntimeVec>
1012 {
1013  VISKORES_CONT bool operator()(const viskores::cont::UnknownArrayHandle& array) const
1014  {
1015  using BaseComponentType = typename T::ComponentType;
1018  array.IsBaseComponentType<BaseComponentType>()));
1019  }
1020 };
1021 
1022 } // namespace detail
1023 
1024 template <typename ArrayHandleType>
1025 VISKORES_CONT inline bool UnknownArrayHandle::CanConvert() const
1026 {
1027  VISKORES_IS_ARRAY_HANDLE(ArrayHandleType);
1028 
1029  return detail::UnknownArrayHandleCanConvert<typename ArrayHandleType::ValueType,
1030  typename ArrayHandleType::StorageTag>{}(*this);
1031 }
1032 
1033 namespace detail
1034 {
1035 
1036 template <typename T,
1038  typename viskores::internal::UnrollVec<T>::ComponentType>::NUM_COMPONENTS>
1039 struct UnknownArrayHandleRuntimeVecAsBasic
1040 {
1041  VISKORES_CONT bool operator()(const viskores::cont::UnknownArrayHandle*,
1042  const detail::UnknownAHContainer*,
1044  {
1045  // This version only gets called if T contains a `Vec`-like object that is not a strict `Vec`.
1046  // This is rare but could happen. In this case, the type cannot be stored in an
1047  // `ArrayHandleRuntimeVec` and therefore the load can never happen, so just ignore.
1048  return false;
1049  }
1050 };
1051 
1052 template <typename T>
1053 struct UnknownArrayHandleRuntimeVecAsBasic<T, 1>
1054 {
1055  VISKORES_CONT bool operator()(const viskores::cont::UnknownArrayHandle* self,
1056  const detail::UnknownAHContainer* container,
1057  viskores::cont::ArrayHandle<T>& array) const
1058  {
1059  using UnrolledVec = viskores::internal::UnrollVec<T>;
1060  using ComponentType = typename UnrolledVec::ComponentType;
1061  if (self->IsStorageType<viskores::cont::StorageTagRuntimeVec>() &&
1062  self->IsBaseComponentType<ComponentType>() &&
1063  UnrolledVec::NUM_COMPONENTS == self->GetNumberOfComponentsFlat())
1064  {
1065  // Pull out the components array out of the buffers. The array might not match exactly
1066  // the array put in, but the buffer should still be consistent with the array (which works
1067  // because the size of a basic array is based on the number of bytes in the buffer).
1068  using RuntimeVecType =
1070  using StorageRuntimeVec =
1071  viskores::cont::internal::Storage<RuntimeVecType, viskores::cont::StorageTagRuntimeVec>;
1072  StorageRuntimeVec::AsArrayHandleBasic(container->Buffers(container->ArrayHandlePointer),
1073  array);
1074  return true;
1075  }
1076  else
1077  {
1078  return false;
1079  }
1080  }
1081 };
1082 
1083 } // namespace detail
1084 
1085 template <typename T>
1086 VISKORES_CONT inline void UnknownArrayHandle::AsArrayHandle(
1087  viskores::cont::ArrayHandle<T>& array) const
1088 {
1089  if (!detail::UnknownArrayHandleRuntimeVecAsBasic<T>{}(this, this->Container.get(), array))
1090  {
1091  this->BaseAsArrayHandle(array);
1092  }
1093 }
1094 
1095 namespace detail
1096 {
1097 
1098 struct UnknownArrayHandleMultiplexerCastTry
1099 {
1100  template <typename T, typename S, typename... Ss>
1101  VISKORES_CONT void operator()(
1102  S,
1103  const viskores::cont::UnknownArrayHandle& unknownArray,
1105  bool& converted) const
1106  {
1107  using ArrayType = viskores::cont::ArrayHandle<T, S>;
1108  if (unknownArray.CanConvert<ArrayType>())
1109  {
1110  if (converted && !unknownArray.IsType<ArrayType>())
1111  {
1112  // The array has already been converted and pushed in the multiplexer. It is
1113  // possible that multiple array types can be put in the ArrayHandleMultiplexer
1114  // (for example, and ArrayHandle or an ArrayHandle that has been cast). Exact
1115  // matches will override other matches (hence, the second part of the condition),
1116  // but at this point we have already found a better array to put inside.
1117  return;
1118  }
1120  unknownArray.AsArrayHandle<ArrayType>());
1121  converted = true;
1122  }
1123  }
1124 };
1125 
1126 } // namespace detail
1127 
1128 template <typename T, typename... Ss>
1129 void UnknownArrayHandle::AsArrayHandle(
1131 {
1132  bool converted = false;
1133  viskores::ListForEach(detail::UnknownArrayHandleMultiplexerCastTry{},
1134  viskores::List<Ss...>{},
1135  *this,
1136  array,
1137  converted);
1138 
1139  if (!converted)
1140  {
1141  VISKORES_LOG_CAST_FAIL(*this, decltype(array));
1144  }
1145 }
1146 
1147 namespace detail
1148 {
1149 
1150 struct UnknownArrayHandleTry
1151 {
1152  template <typename T, typename S, typename Functor, typename... Args>
1153  void operator()(viskores::List<T, S>,
1154  Functor&& f,
1155  bool& called,
1156  const viskores::cont::UnknownArrayHandle& unknownArray,
1157  Args&&... args) const
1158  {
1159  using DerivedArrayType = viskores::cont::ArrayHandle<T, S>;
1160  if (!called && unknownArray.CanConvert<DerivedArrayType>())
1161  {
1162  called = true;
1163  DerivedArrayType derivedArray;
1164  unknownArray.AsArrayHandle(derivedArray);
1165  VISKORES_LOG_CAST_SUCC(unknownArray, derivedArray);
1166 
1167  // If you get a compile error here, it means that you have called CastAndCall for a
1168  // viskores::cont::UnknownArrayHandle and the arguments of the functor do not match those
1169  // being passed. This is often because it is calling the functor with an ArrayHandle
1170  // type that was not expected. Either add overloads to the functor to accept all
1171  // possible array types or constrain the types tried for the CastAndCall. Note that
1172  // the functor will be called with an array of type viskores::cont::ArrayHandle<T, S>.
1173  // Directly using a subclass of ArrayHandle (e.g. viskores::cont::ArrayHandleConstant<T>)
1174  // might not work.
1175  f(derivedArray, std::forward<Args>(args)...);
1176  }
1177  }
1178 };
1179 
1180 } // namespace detail
1181 
1182 namespace internal
1183 {
1184 
1185 namespace detail
1186 {
1187 
1188 template <typename T>
1189 struct IsUndefinedArrayType
1190 {
1191 };
1192 template <typename T, typename S>
1193 struct IsUndefinedArrayType<viskores::List<T, S>>
1194  : viskores::cont::internal::IsInvalidArrayHandle<T, S>
1195 {
1196 };
1197 
1198 } // namespace detail
1199 
1200 template <typename ValueTypeList, typename StorageTypeList>
1201 using ListAllArrayTypes =
1203  detail::IsUndefinedArrayType>;
1204 
1205 VISKORES_CONT_EXPORT void ThrowCastAndCallException(const viskores::cont::UnknownArrayHandle&,
1206  const std::type_info&);
1207 
1208 } // namespace internal
1209 
1210 template <typename TypeList, typename StorageTagList, typename Functor, typename... Args>
1211 inline void UnknownArrayHandle::CastAndCallForTypes(Functor&& f, Args&&... args) const
1212 {
1213  using crossProduct = internal::ListAllArrayTypes<TypeList, StorageTagList>;
1214 
1215  bool called = false;
1216  viskores::ListForEach(detail::UnknownArrayHandleTry{},
1217  crossProduct{},
1218  std::forward<Functor>(f),
1219  called,
1220  *this,
1221  std::forward<Args>(args)...);
1222  if (!called)
1223  {
1224  // throw an exception
1225  VISKORES_LOG_CAST_FAIL(*this, TypeList);
1226  internal::ThrowCastAndCallException(*this, typeid(TypeList));
1227  }
1228 }
1229 
1230 template <typename TypeList, typename StorageTagList, typename Functor, typename... Args>
1231 VISKORES_CONT void UnknownArrayHandle::CastAndCallForTypesWithFloatFallback(Functor&& functor,
1232  Args&&... args) const
1233 {
1234  using crossProduct = internal::ListAllArrayTypes<TypeList, StorageTagList>;
1235 
1236  bool called = false;
1237  viskores::ListForEach(detail::UnknownArrayHandleTry{},
1238  crossProduct{},
1239  std::forward<Functor>(functor),
1240  called,
1241  *this,
1242  std::forward<Args>(args)...);
1243  if (!called)
1244  {
1245  // Copy to a float array and try again
1247  "Cast and call from %s failed. Copying to basic float array.",
1248  this->GetArrayTypeName().c_str());
1249  viskores::cont::UnknownArrayHandle floatArray = this->NewInstanceFloatBasic();
1250  floatArray.DeepCopyFrom(*this);
1251  viskores::ListForEach(detail::UnknownArrayHandleTry{},
1252  crossProduct{},
1253  std::forward<Functor>(functor),
1254  called,
1255  floatArray,
1256  std::forward<Args>(args)...);
1257  }
1258  if (!called)
1259  {
1260  // throw an exception
1261  VISKORES_LOG_CAST_FAIL(*this, TypeList);
1262  internal::ThrowCastAndCallException(*this, typeid(TypeList));
1263  }
1264 }
1265 
1266 //=============================================================================
1267 // Free function casting helpers
1268 
1271 template <typename ArrayHandleType>
1273 {
1274  return array.template IsType<ArrayHandleType>();
1275 }
1276 
1281 template <typename ArrayHandleType>
1282 VISKORES_CONT inline ArrayHandleType Cast(const viskores::cont::UnknownArrayHandle& array)
1283 {
1284  return array.template AsArrayHandle<ArrayHandleType>();
1285 }
1286 
1287 namespace detail
1288 {
1289 
1290 struct UnknownArrayHandleTryExtract
1291 {
1292  template <typename T, typename Functor, typename... Args>
1293  void operator()(T,
1294  Functor&& f,
1295  bool& called,
1296  const viskores::cont::UnknownArrayHandle& unknownArray,
1297  Args&&... args) const
1298  {
1299  if (!called && unknownArray.IsBaseComponentType<T>())
1300  {
1301  called = true;
1302  auto extractedArray = unknownArray.ExtractArrayFromComponents<T>();
1303  VISKORES_LOG_CAST_SUCC(unknownArray, extractedArray);
1304 
1305  // If you get a compile error here, it means that you have called
1306  // CastAndCallWithExtractedArray for a viskores::cont::UnknownArrayHandle and the arguments of
1307  // the functor do not match those being passed. This is often because it is calling the
1308  // functor with an ArrayHandle type that was not expected. Add overloads to the functor to
1309  // accept all possible array types or constrain the types tried for the CastAndCall. Note
1310  // that the functor will be called with an array of type that is different than the actual
1311  // type of the `ArrayHandle` stored in the `UnknownArrayHandle`.
1312  f(extractedArray, std::forward<Args>(args)...);
1313  }
1314  }
1315 };
1316 
1317 } // namespace detail
1318 
1319 template <typename Functor, typename... Args>
1320 inline void UnknownArrayHandle::CastAndCallWithExtractedArray(Functor&& functor,
1321  Args&&... args) const
1322 {
1323  bool called = false;
1324  viskores::ListForEach(detail::UnknownArrayHandleTryExtract{},
1326  std::forward<Functor>(functor),
1327  called,
1328  *this,
1329  std::forward<Args>(args)...);
1330  if (!called)
1331  {
1332  // Throw an exception.
1333  // The message will be a little wonky because the types are just the value types, not the
1334  // full type to cast to.
1336  internal::ThrowCastAndCallException(*this, typeid(viskores::TypeListScalarAll));
1337  }
1338 }
1339 
1340 }
1341 } // namespace viskores::cont
1342 
1343 //=============================================================================
1344 // Specializations of serialization related classes
1346 
1347 namespace viskores
1348 {
1349 namespace cont
1350 {
1351 
1352 template <>
1353 struct VISKORES_CONT_EXPORT SerializableTypeString<viskores::cont::UnknownArrayHandle>
1354 {
1355  static VISKORES_CONT std::string Get();
1356 };
1357 }
1358 } // namespace viskores::cont
1359 
1360 namespace mangled_diy_namespace
1361 {
1362 
1363 template <>
1364 struct VISKORES_CONT_EXPORT Serialization<viskores::cont::UnknownArrayHandle>
1365 {
1366 public:
1367  static VISKORES_CONT void save(BinaryBuffer& bb, const viskores::cont::UnknownArrayHandle& obj);
1368  static VISKORES_CONT void load(BinaryBuffer& bb, viskores::cont::UnknownArrayHandle& obj);
1369 };
1370 
1371 } // namespace mangled_diy_namespace
1372 
1374 
1375 #endif //viskores_cont_UnknownArrayHandle_h
viskores::exec::arg::load
T load(const U &u, viskores::Id v)
Definition: FetchTagArrayDirectIn.h:44
ArrayHandle.h
ArrayExtractComponent.h
viskores::cont::ArrayHandle::GetNumberOfComponentsFlat
viskores::IdComponent GetNumberOfComponentsFlat() const
Returns the total number of components for each value in the array.
Definition: ArrayHandle.h:488
viskores::cont::StorageTagCast
Definition: ArrayHandleCast.h:36
ArrayHandleStride.h
viskores::CopyFlag::Off
@ Off
viskores::cont::operator==
bool operator==(const viskores::cont::Token &token, viskores::cont::Token::Reference ref)
Definition: Token.h:182
viskores::cont::UncertainArrayHandle
An ArrayHandle of an uncertain value type and storage.
Definition: UncertainArrayHandle.h:47
viskores::cont::UnknownArrayHandle::AsArrayHandle
void AsArrayHandle(viskores::cont::ArrayHandle< T, viskores::cont::StorageTagRuntimeVec > &array) const
Returns this array cast appropriately and stored in the given ArrayHandle type.
Definition: UnknownArrayHandle.h:702
ArrayHandleCast.h
viskores::VecTraitsTagSizeStatic
A tag for vectors where the number of components are known at compile time.
Definition: VecTraits.h:44
viskores::cont::ArrayHandleMultiplexer
An ArrayHandle that can behave like several other handles.
Definition: ArrayHandleMultiplexer.h:430
ArrayHandleRecombineVec.h
viskores::cont::ErrorBadType
This class is thrown when Viskores encounters data of a type that is incompatible with the current op...
Definition: ErrorBadType.h:33
VISKORES_LOG_CAST_FAIL
#define VISKORES_LOG_CAST_FAIL(inObj, outType)
Convenience macro for logging a failed cast of dynamic object.
Definition: Logging.h:241
viskores::cont::ArrayHandleCast
Cast the values of an array to the specified type, on demand.
Definition: ArrayHandleCast.h:151
viskores::VecTraitsTagSizeVariable
A tag for vectors where the number of components are not determined until run time.
Definition: VecTraits.h:51
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::ArrayHandleRuntimeVec
Fancy array handle for a basic array with runtime selected vec size.
Definition: ArrayHandleRuntimeVec.h:338
viskores::cont::ArrayHandle
Manages an array-worth of data.
Definition: ArrayHandle.h:313
viskores::cont::LogLevel::Info
@ Info
Information messages (detected hardware, etc) and temporary debugging output.
viskores::IdComponent
viskores::Int32 IdComponent
Base type to use to index small lists.
Definition: Types.h:202
viskores::cont::StorageTagBasic
A tag for the basic implementation of a Storage object.
Definition: ArrayHandle.h:53
VISKORES_LOG_F
#define VISKORES_LOG_F(level,...)
Writes a message using printf syntax to the indicated log level.
Definition: Logging.h:217
mangled_diy_namespace
Definition: Particle.h:373
viskores::cont::ArrayHandleStride
An ArrayHandle that accesses a basic array with strides and offsets.
Definition: ArrayHandleStride.h:343
viskores::cont::printSummary_ArrayHandle
void printSummary_ArrayHandle(const viskores::cont::ArrayHandle< T, StorageT > &array, std::ostream &out, bool full=false)
Definition: ArrayHandle.h:837
viskores::cont::IsType
bool IsType(const viskores::cont::UnknownArrayHandle &array)
Returns true if variant matches the type of ArrayHandleType.
Definition: UnknownArrayHandle.h:1272
viskores::List
A template used to hold a list of types.
Definition: List.h:47
viskores::cont::ArrayHandleCast::GetSourceArray
ArrayHandleType GetSourceArray() const
Returns the ArrayHandle that is being transformed.
Definition: ArrayHandleCast.h:179
viskores::cont::ArrayExtractComponent
viskores::cont::ArrayHandleStride< typename viskores::VecTraits< T >::BaseComponentType > ArrayExtractComponent(const viskores::cont::ArrayHandle< T, S > &src, viskores::IdComponent componentIndex, viskores::CopyFlag allowCopy=viskores::CopyFlag::On)
Pulls a component out of an ArrayHandle.
Definition: ArrayExtractComponent.h:267
viskores::Id
viskores::Int64 Id
Base type to use to index arrays.
Definition: Types.h:235
viskores::cont::ArrayHandle::ReleaseResources
void ReleaseResources() const
Releases all resources in both the control and execution environments.
Definition: ArrayHandle.h:600
viskores::cont::UnknownArrayHandle::CanConvert
bool CanConvert() const
Determine if the contained array can be passed to the given array type.
Definition: UnknownArrayHandle.h:1025
VISKORES_CONT
#define VISKORES_CONT
Definition: ExportMacros.h:65
viskores::cont::ArrayHandleRecombineVec::AppendComponentArray
void AppendComponentArray(const viskores::cont::ArrayHandle< ComponentType, viskores::cont::StorageTagStride > &array)
Add a component array.
Definition: ArrayHandleRecombineVec.h:664
viskores::cont::StorageTagRuntimeVec
Definition: ArrayHandleRuntimeVec.h:138
viskores
Groups connected points that have the same field value.
Definition: Atomic.h:27
viskores::cont::UnknownArrayHandle::Container
std::shared_ptr< detail::UnknownAHContainer > Container
Definition: UnknownArrayHandle.h:453
viskores::cont::UnknownArrayHandle::BaseAsArrayHandle
void BaseAsArrayHandle(viskores::cont::ArrayHandle< T, S > &array) const
Definition: UnknownArrayHandle.h:661
viskores::CopyFlag::On
@ On
viskores::VecTraits
Traits that can be queried to treat any type as a Vec.
Definition: VecTraits.h:69
viskores::cont::UnknownArrayHandle::IsStorageType
bool IsStorageType() const
Returns true if this array matches the StorageType template argument.
Definition: UnknownArrayHandle.h:544
viskores::cont::ArrayHandle::Allocate
void Allocate(viskores::Id numberOfValues, viskores::CopyFlag preserve, viskores::cont::Token &token) const
Allocates an array large enough to hold the given number of values.
Definition: ArrayHandle.h:504
viskores::cont::ArrayHandleBasic
Basic array storage for an array handle.
Definition: ArrayHandleBasic.h:120
viskores::cont::ArrayHandle::GetNumberOfValues
viskores::Id GetNumberOfValues() const
Returns the number of entries in the array.
Definition: ArrayHandle.h:482
viskores::cont::UnknownArrayHandle::GetNumberOfComponentsFlat
viskores::IdComponent GetNumberOfComponentsFlat() const
Returns the total number of components for each value in the array.
viskores::cont::UnknownArrayHandle::IsValueType
bool IsValueType() const
Returns true if this array matches the ValueType template argument.
Definition: UnknownArrayHandle.h:536
viskores::cont::throwFailedDynamicCast
void throwFailedDynamicCast(const std::string &baseType, const std::string &derivedType)
Throws an ErrorBadType exception with the following message: Cast failed: baseType --> derivedType".
viskores::cont::UnknownArrayHandle::AsArrayHandle
void AsArrayHandle(viskores::cont::ArrayHandle< T, S > &array) const
Returns this array cast appropriately and stored in the given ArrayHandle type.
Definition: UnknownArrayHandle.h:679
TypeList.h
VISKORES_DEPRECATED_SUPPRESS_END
#define VISKORES_DEPRECATED_SUPPRESS_END
Definition: Deprecated.h:132
viskores::cont::UnknownArrayHandle::IsType
bool IsType() const
Returns true if this array matches the ArrayHandleType template argument.
Definition: UnknownArrayHandle.h:579
viskores::cont::ArrayHandle::ReleaseResourcesExecution
void ReleaseResourcesExecution() const
Releases any resources being used in the execution environment (that are not being shared by the cont...
Definition: ArrayHandle.h:593
viskores::cont::Cast
ArrayHandleType Cast(const viskores::cont::UnknownArrayHandle &array)
Returns variant cast to the given ArrayHandle type.
Definition: UnknownArrayHandle.h:1282
viskores::cont::UnknownArrayHandle::UnknownArrayHandle
UnknownArrayHandle(const viskores::cont::ArrayHandle< T, S > &array)
Definition: UnknownArrayHandle.h:463
viskores::ListForEach
void ListForEach(Functor &&f, viskores::List< Ts... >, Args &&... args)
For each typename represented by the list, call the functor with a default instance of that type.
Definition: List.h:745
viskores::cont::ArrayHandle::DeepCopyFrom
void DeepCopyFrom(const viskores::cont::ArrayHandle< ValueType, StorageTag > &source) const
Deep copies the data in the array.
Definition: ArrayHandle.h:723
ArrayHandleMultiplexer.h
Deprecated.h
viskores::cont::UnknownArrayHandle::AsArrayHandle
ArrayType AsArrayHandle() const
Returns this array cast appropriately and stored in the given ArrayHandle type.
Definition: UnknownArrayHandle.h:723
viskores::cont::UnknownArrayHandle::DeepCopyFrom
void DeepCopyFrom(const viskores::cont::UnknownArrayHandle &source)
Deep copies data from another UnknownArrayHandle.
viskores::cont::UnknownArrayHandle::ExtractArrayFromComponents
viskores::cont::ArrayHandleRecombineVec< BaseComponentType > ExtractArrayFromComponents(viskores::CopyFlag allowCopy=viskores::CopyFlag::On) const
Extract the array knowing only the component type of the array.
Definition: UnknownArrayHandle.h:873
viskores::cont::UnknownArrayHandle::AsArrayHandle
void AsArrayHandle(viskores::cont::ArrayHandle< TargetT, viskores::cont::StorageTagCast< SourceT, SourceS >> &array) const
Returns this array cast appropriately and stored in the given ArrayHandle type.
Definition: UnknownArrayHandle.h:692
viskores::cont::ArrayHandleRecombineVec
A grouping of ArrayHandleStrides into an ArrayHandle of viskores::Vecs.
Definition: ArrayHandleRecombineVec.h:626
viskores::cont::UnknownArrayHandle::IsBaseComponentType
bool IsBaseComponentType() const
Returns true if this array's ValueType has the provided base component type.
Definition: UnknownArrayHandle.h:561
ArrayHandleRuntimeVec.h
viskores::VecTraits::BaseComponentType
T BaseComponentType
Base component type in the vector.
Definition: VecTraits.h:86
StorageList.h
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::StorageTagMultiplexer
Definition: ArrayHandleMultiplexer.h:149
viskores::ListRemoveIf
typename detail::ListRemoveIfImpl< List, Predicate >::type ListRemoveIf
Takes an existing List and a predicate template that is applied to each type in the List.
Definition: List.h:700
VISKORES_LOG_CAST_SUCC
#define VISKORES_LOG_CAST_SUCC(inObj, outObj)
Convenience macro for logging the successful cast of dynamic object.
Definition: Logging.h:232
viskores::cont::UnknownArrayHandle
An ArrayHandle of an unknown value type and storage.
Definition: UnknownArrayHandle.h:451
viskores::CopyFlag
CopyFlag
Identifier used to specify whether a function should deep copy data.
Definition: Flags.h:25
viskores::cont::Token
A token to hold the scope of an ArrayHandle or other object.
Definition: Token.h:43
viskores::cont::ArrayHandle::GetBuffers
const std::vector< viskores::cont::internal::Buffer > & GetBuffers() const
Returns the internal Buffer structures that hold the data.
Definition: ArrayHandle.h:738
VecTraits.h
viskores::cont::UnknownArrayHandle::ExtractComponent
viskores::cont::ArrayHandleStride< BaseComponentType > ExtractComponent(viskores::IdComponent componentIndex, viskores::CopyFlag allowCopy=viskores::CopyFlag::On) const
Extract a component of the array.
Definition: UnknownArrayHandle.h:811
viskores::cont::TypeToString
std::string TypeToString(const std::type_info &t)
Use RTTI information to retrieve the name of the type T.
VISKORES_DEPRECATED_SUPPRESS_BEGIN
#define VISKORES_DEPRECATED_SUPPRESS_BEGIN
Definition: Deprecated.h:131
viskores_cont_export.h
viskores::cont::ArrayHandleRuntimeVec::ValueType
typename Superclass::ValueType ValueType
Definition: ArrayHandleRuntimeVec.h:349