VTK-m  2.1
UnknownArrayHandle.h
Go to the documentation of this file.
1 //============================================================================
2 // Copyright (c) Kitware, Inc.
3 // All rights reserved.
4 // See LICENSE.txt for details.
5 //
6 // This software is distributed WITHOUT ANY WARRANTY; without even
7 // the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
8 // PURPOSE. See the above copyright notice for more information.
9 //============================================================================
10 #ifndef vtk_m_cont_UnknownArrayHandle_h
11 #define vtk_m_cont_UnknownArrayHandle_h
12 
14 
16 #include <vtkm/cont/ArrayHandle.h>
22 #include <vtkm/cont/StorageList.h>
23 
24 #include <vtkm/Deprecated.h>
25 #include <vtkm/TypeList.h>
26 #include <vtkm/VecTraits.h>
27 
28 #include <memory>
29 #include <typeindex>
30 
31 namespace vtkm
32 {
33 namespace cont
34 {
35 
36 namespace detail
37 {
38 
39 template <typename T, typename S>
40 void UnknownAHDelete(void* mem)
41 {
43  AH* arrayHandle = reinterpret_cast<AH*>(mem);
44  delete arrayHandle;
45 }
46 
47 template <typename T, typename S>
48 const std::vector<vtkm::cont::internal::Buffer>& UnknownAHBuffers(void* mem)
49 {
51  AH* arrayHandle = reinterpret_cast<AH*>(mem);
52  return arrayHandle->GetBuffers();
53 }
54 
55 template <typename T, typename S>
56 void* UnknownAHNewInstance()
57 {
59 }
60 
61 template <typename T, typename S>
62 vtkm::Id UnknownAHNumberOfValues(void* mem)
63 {
65  AH* arrayHandle = reinterpret_cast<AH*>(mem);
66  return arrayHandle->GetNumberOfValues();
67 }
68 
69 template <typename T, typename S>
70 vtkm::IdComponent UnknownAHNumberOfComponentsFlat(void* mem)
71 {
73  AH* arrayHandle = reinterpret_cast<AH*>(mem);
74  return arrayHandle->GetNumberOfComponentsFlat();
75 }
76 
77 // Uses SFINAE to use Storage<>::GetNumberOfComponents if it exists, or the VecTraits otherwise
78 template <typename T, typename S>
79 inline auto UnknownAHNumberOfComponentsImpl(void* mem)
80  -> decltype(vtkm::cont::internal::Storage<T, S>::GetNumberOfComponents(
81  std::vector<vtkm::cont::internal::Buffer>()))
82 {
84  AH* arrayHandle = reinterpret_cast<AH*>(mem);
85  return vtkm::cont::internal::Storage<T, S>::GetNumberOfComponents(arrayHandle->GetBuffers());
86 }
87 
88 // Uses static vec size.
89 template <typename T, typename S>
90 inline vtkm::IdComponent UnknownAHNumberOfComponentsImpl(void*, vtkm::VecTraitsTagSizeStatic)
91 {
93 }
94 
95 // The size of the vecs are not defined at compile time. Assume that the components are not
96 // nested and use the flat components query.
97 template <typename T, typename S>
98 inline vtkm::IdComponent UnknownAHNumberOfComponentsImpl(void* mem, vtkm::VecTraitsTagSizeVariable)
99 {
100  return UnknownAHNumberOfComponentsFlat<T, S>(mem);
101 }
102 
103 template <typename T, typename S>
104 vtkm::IdComponent UnknownAHNumberOfComponents(void* mem)
105 {
106  return UnknownAHNumberOfComponentsImpl<T, S>(mem, typename vtkm::VecTraits<T>::IsSizeStatic{});
107 }
108 
109 template <typename T, typename S>
110 void UnknownAHAllocate(void* mem,
111  vtkm::Id numValues,
112  vtkm::CopyFlag preserve,
113  vtkm::cont::Token& token)
114 {
116  AH* arrayHandle = reinterpret_cast<AH*>(mem);
117  arrayHandle->Allocate(numValues, preserve, token);
118 }
119 
120 template <typename T, typename S>
121 void UnknownAHShallowCopy(const void* sourceMem, void* destinationMem)
122 {
124  const AH* source = reinterpret_cast<const AH*>(sourceMem);
125  AH* destination = reinterpret_cast<AH*>(destinationMem);
126  *destination = *source;
127 }
128 
129 template <typename T, typename S>
130 void UnknownAHDeepCopy(const void* sourceMem, void* destinationMem)
131 {
133  const AH* source = reinterpret_cast<const AH*>(sourceMem);
134  AH* destination = reinterpret_cast<AH*>(destinationMem);
135  destination->DeepCopyFrom(*source);
136 }
137 
138 template <typename T, typename S>
139 std::vector<vtkm::cont::internal::Buffer>
140 UnknownAHExtractComponent(void* mem, vtkm::IdComponent componentIndex, vtkm::CopyFlag allowCopy)
141 {
143  AH* arrayHandle = reinterpret_cast<AH*>(mem);
144  auto componentArray = vtkm::cont::ArrayExtractComponent(*arrayHandle, componentIndex, allowCopy);
145  return componentArray.GetBuffers();
146 }
147 
148 template <typename T, typename S>
149 void UnknownAHReleaseResources(void* mem)
150 {
152  AH* arrayHandle = reinterpret_cast<AH*>(mem);
153  arrayHandle->ReleaseResources();
154 }
155 
156 template <typename T, typename S>
157 void UnknownAHReleaseResourcesExecution(void* mem)
158 {
160  AH* arrayHandle = reinterpret_cast<AH*>(mem);
161  arrayHandle->ReleaseResourcesExecution();
162 }
163 
164 template <typename T, typename S>
165 void UnknownAHPrintSummary(void* mem, std::ostream& out, bool full)
166 {
168  AH* arrayHandle = reinterpret_cast<AH*>(mem);
169  vtkm::cont::printSummary_ArrayHandle(*arrayHandle, out, full);
170 }
171 
172 struct VTKM_CONT_EXPORT UnknownAHContainer;
173 
174 struct MakeUnknownAHContainerFunctor
175 {
176  template <typename T, typename S>
177  std::shared_ptr<UnknownAHContainer> operator()(const vtkm::cont::ArrayHandle<T, S>& array) const;
178 };
179 
180 struct VTKM_CONT_EXPORT UnknownAHComponentInfo
181 {
182  std::type_index Type;
183  bool IsIntegral;
184  bool IsFloat;
185  bool IsSigned;
186  std::size_t Size;
187 
188  UnknownAHComponentInfo() = delete;
189 
190  bool operator==(const UnknownAHComponentInfo& rhs);
191 
192  template <typename T>
193  static UnknownAHComponentInfo Make()
194  {
195  return UnknownAHComponentInfo{ typeid(T),
196  std::is_integral<T>::value,
197  std::is_floating_point<T>::value,
198  std::is_signed<T>::value,
199  sizeof(T) };
200  }
201 
202 private:
203  UnknownAHComponentInfo(std::type_index&& type,
204  bool isIntegral,
205  bool isFloat,
206  bool isSigned,
207  std::size_t size)
208  : Type(std::move(type))
209  , IsIntegral(isIntegral)
210  , IsFloat(isFloat)
211  , IsSigned(isSigned)
212  , Size(size)
213  {
214  }
215 };
216 
217 struct VTKM_CONT_EXPORT UnknownAHContainer
218 {
219  void* ArrayHandlePointer;
220 
221  std::type_index ValueType;
222  std::type_index StorageType;
223  UnknownAHComponentInfo BaseComponentType;
224 
225  using DeleteType = void(void*);
226  DeleteType* DeleteFunction;
227 
228  using BuffersType = const std::vector<vtkm::cont::internal::Buffer>&(void*);
229  BuffersType* Buffers;
230 
231  using NewInstanceType = void*();
232  NewInstanceType* NewInstance;
233 
234  using NewInstanceBasicType = std::shared_ptr<UnknownAHContainer>(void*);
235  NewInstanceBasicType* NewInstanceBasic;
236  NewInstanceBasicType* NewInstanceFloatBasic;
237 
238  using NumberOfValuesType = vtkm::Id(void*);
239  NumberOfValuesType* NumberOfValues;
240 
241  using NumberOfComponentsType = vtkm::IdComponent(void*);
242  NumberOfComponentsType* NumberOfComponents;
243  NumberOfComponentsType* NumberOfComponentsFlat;
244 
245  using AllocateType = void(void*, vtkm::Id, vtkm::CopyFlag, vtkm::cont::Token&);
246  AllocateType* Allocate;
247 
248  using ShallowCopyType = void(const void*, void*);
249  ShallowCopyType* ShallowCopy;
250 
251  using DeepCopyType = void(const void*, void*);
252  DeepCopyType* DeepCopy;
253 
254  using ExtractComponentType = std::vector<vtkm::cont::internal::Buffer>(void*,
257  ExtractComponentType* ExtractComponent;
258 
259  using ReleaseResourcesType = void(void*);
260  ReleaseResourcesType* ReleaseResources;
261  ReleaseResourcesType* ReleaseResourcesExecution;
262 
263  using PrintSummaryType = void(void*, std::ostream&, bool);
264  PrintSummaryType* PrintSummary;
265 
266  void operator=(const UnknownAHContainer&) = delete;
267 
268  ~UnknownAHContainer() { this->DeleteFunction(this->ArrayHandlePointer); }
269 
270  std::shared_ptr<UnknownAHContainer> MakeNewInstance() const;
271 
272  template <typename T, typename S>
273  static std::shared_ptr<UnknownAHContainer> Make(const vtkm::cont::ArrayHandle<T, S>& array)
274  {
275  return std::shared_ptr<UnknownAHContainer>(new UnknownAHContainer(array));
276  }
277 
278  template <typename TargetT, typename SourceT, typename SourceS>
279  static std::shared_ptr<UnknownAHContainer> Make(
281  {
283  array;
284  return Make(castArray.GetSourceArray());
285  }
286 
287  template <typename T, typename... Ss>
288  static std::shared_ptr<UnknownAHContainer> Make(
290  {
292  .GetArrayHandleVariant();
293  if (variant.IsValid())
294  {
295  return variant.CastAndCall(MakeUnknownAHContainerFunctor{});
296  }
297  else
298  {
299  return std::shared_ptr<UnknownAHContainer>{};
300  }
301  }
302 
303 private:
304  UnknownAHContainer(const UnknownAHContainer&) = default;
305 
306  template <typename T, typename S>
307  explicit UnknownAHContainer(const vtkm::cont::ArrayHandle<T, S>& array);
308 };
309 
310 template <typename T, typename S>
311 std::shared_ptr<UnknownAHContainer> UnknownAHNewInstanceBasic(void*, vtkm::VecTraitsTagSizeStatic)
312 {
313  return UnknownAHContainer::Make(vtkm::cont::ArrayHandleBasic<T>{});
314 }
315 template <typename T, typename S>
316 std::shared_ptr<UnknownAHContainer> UnknownAHNewInstanceBasic(void* mem,
318 {
319  vtkm::IdComponent numComponents = UnknownAHNumberOfComponentsFlat<T, S>(mem);
320  if (numComponents < 1)
321  {
322  // Array can have an inconsistent number of components. Cannot be represented by basic array.
323  throw vtkm::cont::ErrorBadType("Cannot create a basic array from array with ValueType of " +
324  vtkm::cont::TypeToString<T>());
325  }
326  using ComponentType = typename vtkm::VecTraits<T>::BaseComponentType;
327  return UnknownAHContainer::Make(vtkm::cont::ArrayHandleRuntimeVec<ComponentType>(numComponents));
328 }
329 template <typename T, typename S>
330 std::shared_ptr<UnknownAHContainer> UnknownAHNewInstanceBasic(void* mem)
331 {
332  return UnknownAHNewInstanceBasic<T, S>(mem, typename vtkm::VecTraits<T>::IsSizeStatic{});
333 }
334 
335 template <typename T, typename S>
336 std::shared_ptr<UnknownAHContainer> UnknownAHNewInstanceFloatBasic(void*,
338 {
339  using FloatT = typename vtkm::VecTraits<T>::template ReplaceBaseComponentType<vtkm::FloatDefault>;
340  return UnknownAHContainer::Make(vtkm::cont::ArrayHandleBasic<FloatT>{});
341 }
342 template <typename T, typename S>
343 std::shared_ptr<UnknownAHContainer> UnknownAHNewInstanceFloatBasic(void* mem,
345 {
346  vtkm::IdComponent numComponents = UnknownAHNumberOfComponentsFlat<T, S>(mem);
347  if (numComponents < 1)
348  {
349  // Array can have an inconsistent number of components. Cannot be represented by basic array.
350  throw vtkm::cont::ErrorBadType("Cannot create a basic array from array with ValueType of " +
351  vtkm::cont::TypeToString<T>());
352  }
353  return UnknownAHContainer::Make(
355 }
356 template <typename T, typename S>
357 std::shared_ptr<UnknownAHContainer> UnknownAHNewInstanceFloatBasic(void* mem)
358 {
359  return UnknownAHNewInstanceFloatBasic<T, S>(mem, typename vtkm::VecTraits<T>::IsSizeStatic{});
360 }
361 
362 template <typename T, typename S>
363 inline UnknownAHContainer::UnknownAHContainer(const vtkm::cont::ArrayHandle<T, S>& array)
364  : ArrayHandlePointer(new vtkm::cont::ArrayHandle<T, S>(array))
365  , ValueType(typeid(T))
366  , StorageType(typeid(S))
367  , BaseComponentType(
368  UnknownAHComponentInfo::Make<typename vtkm::VecTraits<T>::BaseComponentType>())
369  , DeleteFunction(detail::UnknownAHDelete<T, S>)
370  , Buffers(detail::UnknownAHBuffers<T, S>)
371  , NewInstance(detail::UnknownAHNewInstance<T, S>)
372  , NewInstanceBasic(detail::UnknownAHNewInstanceBasic<T, S>)
373  , NewInstanceFloatBasic(detail::UnknownAHNewInstanceFloatBasic<T, S>)
374  , NumberOfValues(detail::UnknownAHNumberOfValues<T, S>)
375  , NumberOfComponents(detail::UnknownAHNumberOfComponents<T, S>)
376  , NumberOfComponentsFlat(detail::UnknownAHNumberOfComponentsFlat<T, S>)
377  , Allocate(detail::UnknownAHAllocate<T, S>)
378  , ShallowCopy(detail::UnknownAHShallowCopy<T, S>)
379  , DeepCopy(detail::UnknownAHDeepCopy<T, S>)
380  , ExtractComponent(detail::UnknownAHExtractComponent<T, S>)
381  , ReleaseResources(detail::UnknownAHReleaseResources<T, S>)
382  , ReleaseResourcesExecution(detail::UnknownAHReleaseResourcesExecution<T, S>)
383  , PrintSummary(detail::UnknownAHPrintSummary<T, S>)
384 {
385 }
386 
387 template <typename T, typename S>
388 inline std::shared_ptr<UnknownAHContainer> MakeUnknownAHContainerFunctor::operator()(
389  const vtkm::cont::ArrayHandle<T, S>& array) const
390 {
391  return UnknownAHContainer::Make(array);
392 };
393 
394 } // namespace detail
395 
396 // Forward declaration. Include UncertainArrayHandle.h if using this.
397 template <typename ValueTypeList, typename StorageTypeList>
398 class UncertainArrayHandle;
399 
431 {
432  std::shared_ptr<detail::UnknownAHContainer> Container;
433 
434  VTKM_CONT bool IsValueTypeImpl(std::type_index type) const;
435  VTKM_CONT bool IsStorageTypeImpl(std::type_index type) const;
436  VTKM_CONT bool IsBaseComponentTypeImpl(const detail::UnknownAHComponentInfo& type) const;
437 
438 public:
439  VTKM_CONT UnknownArrayHandle() = default;
440 
441  template <typename T, typename S>
443  : Container(detail::UnknownAHContainer::Make(array))
444  {
445  }
446 
453  VTKM_CONT bool IsValid() const;
454 
461  VTKM_CONT UnknownArrayHandle NewInstance() const;
462 
470  VTKM_CONT UnknownArrayHandle NewInstanceBasic() const;
471 
488  VTKM_CONT UnknownArrayHandle NewInstanceFloatBasic() const;
489 
493  VTKM_CONT std::string GetValueTypeName() const;
494 
498  VTKM_CONT std::string GetBaseComponentTypeName() const;
499 
503  VTKM_CONT std::string GetStorageTypeName() const;
504 
510  VTKM_CONT std::string GetArrayTypeName() const;
511 
514  template <typename ValueType>
515  VTKM_CONT bool IsValueType() const
516  {
517  return this->IsValueTypeImpl(typeid(ValueType));
518  }
519 
522  template <typename StorageType>
524  {
525  return this->IsStorageTypeImpl(typeid(StorageType));
526  }
527 
539  template <typename BaseComponentType>
541  {
542  return this->IsBaseComponentTypeImpl(detail::UnknownAHComponentInfo::Make<BaseComponentType>());
543  }
544 
557  template <typename ArrayHandleType>
558  VTKM_CONT bool IsType() const
559  {
560  VTKM_IS_ARRAY_HANDLE(ArrayHandleType);
561  return (this->IsValueType<typename ArrayHandleType::ValueType>() &&
562  this->IsStorageType<typename ArrayHandleType::StorageTag>());
563  }
564 
572  // Defined in UncertainArrayHandle.h
573  template <typename NewValueTypeList, typename NewStorageTypeList>
575  NewValueTypeList = NewValueTypeList{},
576  NewStorageTypeList = NewStorageTypeList{}) const;
577 
580  VTKM_CONT vtkm::Id GetNumberOfValues() const;
581 
589  VTKM_CONT vtkm::IdComponent GetNumberOfComponents() const;
590 
607  VTKM_CONT vtkm::IdComponent GetNumberOfComponentsFlat() const;
608 
614  VTKM_CONT void Allocate(vtkm::Id numValues,
615  vtkm::CopyFlag preserve,
616  vtkm::cont::Token& token) const;
617  VTKM_CONT void Allocate(vtkm::Id numValues, vtkm::CopyFlag preserve = vtkm::CopyFlag::Off) const;
619 
627  template <typename ArrayHandleType>
628  VTKM_CONT bool CanConvert() const;
629 
630  // MSVC will issue deprecation warnings here if this template is instantiated with
631  // a deprecated class even if the template is used from a section of code where
632  // deprecation warnings are suppressed. This is annoying behavior since this template
633  // has no control over what class it is used with. To get around it, we have to
634  // suppress all deprecation warnings here.
635 #ifdef VTKM_MSVC
637 #endif
638 
639 private:
640  template <typename T, typename S>
642  {
643  using ArrayType = vtkm::cont::ArrayHandle<T, S>;
644  if (!this->IsType<ArrayType>())
645  {
646  VTKM_LOG_CAST_FAIL(*this, decltype(array));
647  throwFailedDynamicCast(this->GetArrayTypeName(), vtkm::cont::TypeToString(array));
648  }
649 
650  array = *reinterpret_cast<ArrayType*>(this->Container->ArrayHandlePointer);
651  }
652 
653 public:
659  template <typename T, typename S>
661  {
662  this->BaseAsArrayHandle(array);
663  }
664 
665  template <typename T>
666  VTKM_CONT void AsArrayHandle(vtkm::cont::ArrayHandle<T>& array) const;
667 
668  template <typename T, typename... Ss>
669  VTKM_CONT void AsArrayHandle(
671 
672  template <typename TargetT, typename SourceT, typename SourceS>
675  {
676  using ContainedArrayType = vtkm::cont::ArrayHandle<SourceT, SourceS>;
678  this->AsArrayHandle<ContainedArrayType>());
679  }
680 
681  template <typename T>
684  {
685  using BaseT = typename T::ComponentType;
686  if (this->IsStorageType<vtkm::cont::StorageTagBasic>() && this->IsBaseComponentType<BaseT>())
687  {
688  // Reinterpret the basic array as components, and then wrap that in a runtime vec
689  // with the correct amount of components.
691  this->Container->Buffers(this->Container->ArrayHandlePointer));
692  array =
693  vtkm::cont::ArrayHandleRuntimeVec<BaseT>(this->GetNumberOfComponentsFlat(), basicArray);
694  }
695  else
696  {
697  this->BaseAsArrayHandle(array);
698  }
699  }
700 
701  template <typename ArrayType>
702  VTKM_CONT ArrayType AsArrayHandle() const
703  {
704  VTKM_IS_ARRAY_HANDLE(ArrayType);
705  ArrayType array;
706  this->AsArrayHandle(array);
707  return array;
708  }
710 #ifdef VTKM_MSVC
712 #endif
713 
721  void DeepCopyFrom(const vtkm::cont::UnknownArrayHandle& source);
722 
730  void DeepCopyFrom(const vtkm::cont::UnknownArrayHandle& source) const;
731 
744  void CopyShallowIfPossible(const vtkm::cont::UnknownArrayHandle& source);
745 
760  void CopyShallowIfPossible(const vtkm::cont::UnknownArrayHandle& source) const;
761 
789  template <typename BaseComponentType>
791  vtkm::IdComponent componentIndex,
792  vtkm::CopyFlag allowCopy = vtkm::CopyFlag::On) const
793  {
794  using ComponentArrayType = vtkm::cont::ArrayHandleStride<BaseComponentType>;
795  if (!this->IsBaseComponentType<BaseComponentType>())
796  {
797  VTKM_LOG_CAST_FAIL(*this, ComponentArrayType);
798  throwFailedDynamicCast("UnknownArrayHandle with " + this->GetArrayTypeName(),
799  "component array of " + vtkm::cont::TypeToString<BaseComponentType>());
800  }
801 
802  auto buffers = this->Container->ExtractComponent(
803  this->Container->ArrayHandlePointer, componentIndex, allowCopy);
804  return ComponentArrayType(buffers);
805  }
806 
848  template <typename BaseComponentType>
850  vtkm::CopyFlag allowCopy = vtkm::CopyFlag::On) const
851  {
853  vtkm::IdComponent numComponents = this->GetNumberOfComponentsFlat();
854  for (vtkm::IdComponent cIndex = 0; cIndex < numComponents; ++cIndex)
855  {
856  result.AppendComponentArray(this->ExtractComponent<BaseComponentType>(cIndex, allowCopy));
857  }
858  return result;
859  }
860 
870  template <typename TypeList, typename StorageList, typename Functor, typename... Args>
871  VTKM_CONT void CastAndCallForTypes(Functor&& functor, Args&&... args) const;
872 
886  template <typename TypeList, typename StorageList, typename Functor, typename... Args>
887  VTKM_CONT void CastAndCallForTypesWithFloatFallback(Functor&& functor, Args&&... args) const;
888 
910  template <typename Functor, typename... Args>
911  VTKM_CONT void CastAndCallWithExtractedArray(Functor&& functor, Args&&... args) const;
912 
916  VTKM_CONT void ReleaseResourcesExecution() const;
917 
920  VTKM_CONT void ReleaseResources() const;
921 
922  VTKM_CONT void PrintSummary(std::ostream& out, bool full = false) const;
923 };
924 
925 //=============================================================================
926 // Out of class implementations
927 
928 namespace detail
929 {
930 
931 template <typename T, typename S>
932 struct UnknownArrayHandleCanConvert
933 {
934  VTKM_CONT bool operator()(const vtkm::cont::UnknownArrayHandle& array) const
935  {
936  return array.IsType<vtkm::cont::ArrayHandle<T, S>>();
937  }
938 };
939 
940 template <typename T>
941 struct UnknownArrayHandleCanConvert<T, vtkm::cont::StorageTagBasic>
942 {
943  VTKM_CONT bool operator()(const vtkm::cont::UnknownArrayHandle& array) const
944  {
945  using UnrolledVec = vtkm::internal::UnrollVec<T>;
946  return (array.IsType<vtkm::cont::ArrayHandleBasic<T>>() ||
948  array.IsBaseComponentType<typename UnrolledVec::ComponentType>() &&
949  UnrolledVec::NUM_COMPONENTS == array.GetNumberOfComponentsFlat()));
950  }
951 };
952 
953 template <typename TargetT, typename SourceT, typename SourceS>
954 struct UnknownArrayHandleCanConvert<TargetT, vtkm::cont::StorageTagCast<SourceT, SourceS>>
955 {
956  VTKM_CONT bool operator()(const vtkm::cont::UnknownArrayHandle& array) const
957  {
958  return UnknownArrayHandleCanConvert<SourceT, SourceS>{}(array);
959  }
960 };
961 
962 template <typename T>
963 struct UnknownArrayHandleCanConvertTry
964 {
965  template <typename S>
966  VTKM_CONT void operator()(S, const vtkm::cont::UnknownArrayHandle& array, bool& canConvert) const
967  {
968  canConvert |= UnknownArrayHandleCanConvert<T, S>{}(array);
969  }
970 };
971 
972 template <typename T, typename... Ss>
973 struct UnknownArrayHandleCanConvert<T, vtkm::cont::StorageTagMultiplexer<Ss...>>
974 {
975  VTKM_CONT bool operator()(const vtkm::cont::UnknownArrayHandle& array) const
976  {
977  bool canConvert = false;
978  vtkm::ListForEach(UnknownArrayHandleCanConvertTry<T>{}, vtkm::List<Ss...>{}, array, canConvert);
979  return canConvert;
980  }
981 };
982 
983 template <typename T>
984 struct UnknownArrayHandleCanConvert<T, vtkm::cont::StorageTagRuntimeVec>
985 {
986  VTKM_CONT bool operator()(const vtkm::cont::UnknownArrayHandle& array) const
987  {
988  using BaseComponentType = typename T::ComponentType;
991  array.IsBaseComponentType<BaseComponentType>()));
992  }
993 };
994 
995 } // namespace detail
996 
997 template <typename ArrayHandleType>
998 VTKM_CONT inline bool UnknownArrayHandle::CanConvert() const
999 {
1000  VTKM_IS_ARRAY_HANDLE(ArrayHandleType);
1001 
1002  return detail::UnknownArrayHandleCanConvert<typename ArrayHandleType::ValueType,
1003  typename ArrayHandleType::StorageTag>{}(*this);
1004 }
1005 
1006 namespace detail
1007 {
1008 
1009 template <typename T,
1012 struct UnknownArrayHandleRuntimeVecAsBasic
1013 {
1014  VTKM_CONT bool operator()(const vtkm::cont::UnknownArrayHandle*,
1015  const detail::UnknownAHContainer*,
1017  {
1018  // This version only gets called if T contains a `Vec`-like object that is not a strict `Vec`.
1019  // This is rare but could happen. In this case, the type cannot be stored in an
1020  // `ArrayHandleRuntimeVec` and therefore the load can never happen, so just ignore.
1021  return false;
1022  }
1023 };
1024 
1025 template <typename T>
1026 struct UnknownArrayHandleRuntimeVecAsBasic<T, 1>
1027 {
1028  VTKM_CONT bool operator()(const vtkm::cont::UnknownArrayHandle* self,
1029  const detail::UnknownAHContainer* container,
1030  vtkm::cont::ArrayHandle<T>& array) const
1031  {
1032  using UnrolledVec = vtkm::internal::UnrollVec<T>;
1033  using ComponentType = typename UnrolledVec::ComponentType;
1034  if (self->IsStorageType<vtkm::cont::StorageTagRuntimeVec>() &&
1035  self->IsBaseComponentType<ComponentType>() &&
1036  UnrolledVec::NUM_COMPONENTS == self->GetNumberOfComponentsFlat())
1037  {
1038  // Pull out the components array out of the buffers. The array might not match exactly
1039  // the array put in, but the buffer should still be consistent with the array (which works
1040  // because the size of a basic array is based on the number of bytes in the buffer).
1041  using RuntimeVecType = typename vtkm::cont::ArrayHandleRuntimeVec<ComponentType>::ValueType;
1042  using StorageRuntimeVec =
1043  vtkm::cont::internal::Storage<RuntimeVecType, vtkm::cont::StorageTagRuntimeVec>;
1044  StorageRuntimeVec::AsArrayHandleBasic(container->Buffers(container->ArrayHandlePointer),
1045  array);
1046  return true;
1047  }
1048  else
1049  {
1050  return false;
1051  }
1052  }
1053 };
1054 
1055 } // namespace detail
1056 
1057 template <typename T>
1058 VTKM_CONT inline void UnknownArrayHandle::AsArrayHandle(vtkm::cont::ArrayHandle<T>& array) const
1059 {
1060  if (!detail::UnknownArrayHandleRuntimeVecAsBasic<T>{}(this, this->Container.get(), array))
1061  {
1062  this->BaseAsArrayHandle(array);
1063  }
1064 }
1065 
1066 namespace detail
1067 {
1068 
1069 struct UnknownArrayHandleMultiplexerCastTry
1070 {
1071  template <typename T, typename S, typename... Ss>
1072  VTKM_CONT void operator()(
1073  S,
1074  const vtkm::cont::UnknownArrayHandle& unknownArray,
1076  bool& converted) const
1077  {
1078  using ArrayType = vtkm::cont::ArrayHandle<T, S>;
1079  if (unknownArray.CanConvert<ArrayType>())
1080  {
1081  if (converted && !unknownArray.IsType<ArrayType>())
1082  {
1083  // The array has already been converted and pushed in the multiplexer. It is
1084  // possible that multiple array types can be put in the ArrayHandleMultiplexer
1085  // (for example, and ArrayHandle or an ArrayHandle that has been cast). Exact
1086  // matches will override other matches (hence, the second part of the condition),
1087  // but at this point we have already found a better array to put inside.
1088  return;
1089  }
1091  unknownArray.AsArrayHandle<ArrayType>());
1092  converted = true;
1093  }
1094  }
1095 };
1096 
1097 } // namespace detail
1098 
1099 template <typename T, typename... Ss>
1100 void UnknownArrayHandle::AsArrayHandle(
1102 {
1103  bool converted = false;
1105  detail::UnknownArrayHandleMultiplexerCastTry{}, vtkm::List<Ss...>{}, *this, array, converted);
1106 
1107  if (!converted)
1108  {
1109  VTKM_LOG_CAST_FAIL(*this, decltype(array));
1111  }
1112 }
1113 
1114 namespace detail
1115 {
1116 
1117 struct UnknownArrayHandleTry
1118 {
1119  template <typename T, typename S, typename Functor, typename... Args>
1120  void operator()(vtkm::List<T, S>,
1121  Functor&& f,
1122  bool& called,
1123  const vtkm::cont::UnknownArrayHandle& unknownArray,
1124  Args&&... args) const
1125  {
1126  using DerivedArrayType = vtkm::cont::ArrayHandle<T, S>;
1127  if (!called && unknownArray.CanConvert<DerivedArrayType>())
1128  {
1129  called = true;
1130  DerivedArrayType derivedArray;
1131  unknownArray.AsArrayHandle(derivedArray);
1132  VTKM_LOG_CAST_SUCC(unknownArray, derivedArray);
1133 
1134  // If you get a compile error here, it means that you have called CastAndCall for a
1135  // vtkm::cont::UnknownArrayHandle and the arguments of the functor do not match those
1136  // being passed. This is often because it is calling the functor with an ArrayHandle
1137  // type that was not expected. Either add overloads to the functor to accept all
1138  // possible array types or constrain the types tried for the CastAndCall. Note that
1139  // the functor will be called with an array of type vtkm::cont::ArrayHandle<T, S>.
1140  // Directly using a subclass of ArrayHandle (e.g. vtkm::cont::ArrayHandleConstant<T>)
1141  // might not work.
1142  f(derivedArray, std::forward<Args>(args)...);
1143  }
1144  }
1145 };
1146 
1147 } // namespace detail
1148 
1149 namespace internal
1150 {
1151 
1152 namespace detail
1153 {
1154 
1155 template <typename T>
1156 struct IsUndefinedArrayType
1157 {
1158 };
1159 template <typename T, typename S>
1160 struct IsUndefinedArrayType<vtkm::List<T, S>> : vtkm::cont::internal::IsInvalidArrayHandle<T, S>
1161 {
1162 };
1163 
1164 } // namespace detail
1165 
1166 template <typename ValueTypeList, typename StorageTypeList>
1167 using ListAllArrayTypes =
1169 
1170 VTKM_CONT_EXPORT void ThrowCastAndCallException(const vtkm::cont::UnknownArrayHandle&,
1171  const std::type_info&);
1172 
1173 } // namespace internal
1174 
1175 template <typename TypeList, typename StorageTagList, typename Functor, typename... Args>
1176 inline void UnknownArrayHandle::CastAndCallForTypes(Functor&& f, Args&&... args) const
1177 {
1178  using crossProduct = internal::ListAllArrayTypes<TypeList, StorageTagList>;
1179 
1180  bool called = false;
1181  vtkm::ListForEach(detail::UnknownArrayHandleTry{},
1182  crossProduct{},
1183  std::forward<Functor>(f),
1184  called,
1185  *this,
1186  std::forward<Args>(args)...);
1187  if (!called)
1188  {
1189  // throw an exception
1190  VTKM_LOG_CAST_FAIL(*this, TypeList);
1191  internal::ThrowCastAndCallException(*this, typeid(TypeList));
1192  }
1193 }
1194 
1195 template <typename TypeList, typename StorageTagList, typename Functor, typename... Args>
1196 VTKM_CONT void UnknownArrayHandle::CastAndCallForTypesWithFloatFallback(Functor&& functor,
1197  Args&&... args) const
1198 {
1199  using crossProduct = internal::ListAllArrayTypes<TypeList, StorageTagList>;
1200 
1201  bool called = false;
1202  vtkm::ListForEach(detail::UnknownArrayHandleTry{},
1203  crossProduct{},
1204  std::forward<Functor>(functor),
1205  called,
1206  *this,
1207  std::forward<Args>(args)...);
1208  if (!called)
1209  {
1210  // Copy to a float array and try again
1211  vtkm::cont::UnknownArrayHandle floatArray = this->NewInstanceFloatBasic();
1212  floatArray.DeepCopyFrom(*this);
1213  vtkm::ListForEach(detail::UnknownArrayHandleTry{},
1214  crossProduct{},
1215  std::forward<Functor>(functor),
1216  called,
1217  floatArray,
1218  std::forward<Args>(args)...);
1219  }
1220  if (!called)
1221  {
1222  // throw an exception
1223  VTKM_LOG_CAST_FAIL(*this, TypeList);
1224  internal::ThrowCastAndCallException(*this, typeid(TypeList));
1225  }
1226 }
1227 
1228 //=============================================================================
1229 // Free function casting helpers
1230 
1233 template <typename ArrayHandleType>
1235 {
1236  return array.template IsType<ArrayHandleType>();
1237 }
1238 
1243 template <typename ArrayHandleType>
1244 VTKM_CONT inline ArrayHandleType Cast(const vtkm::cont::UnknownArrayHandle& array)
1245 {
1246  return array.template AsArrayHandle<ArrayHandleType>();
1247 }
1248 
1249 namespace detail
1250 {
1251 
1252 struct UnknownArrayHandleTryExtract
1253 {
1254  template <typename T, typename Functor, typename... Args>
1255  void operator()(T,
1256  Functor&& f,
1257  bool& called,
1258  const vtkm::cont::UnknownArrayHandle& unknownArray,
1259  Args&&... args) const
1260  {
1261  if (!called && unknownArray.IsBaseComponentType<T>())
1262  {
1263  called = true;
1264  auto extractedArray = unknownArray.ExtractArrayFromComponents<T>();
1265  VTKM_LOG_CAST_SUCC(unknownArray, extractedArray);
1266 
1267  // If you get a compile error here, it means that you have called
1268  // CastAndCallWithExtractedArray for a vtkm::cont::UnknownArrayHandle and the arguments of
1269  // the functor do not match those being passed. This is often because it is calling the
1270  // functor with an ArrayHandle type that was not expected. Add overloads to the functor to
1271  // accept all possible array types or constrain the types tried for the CastAndCall. Note
1272  // that the functor will be called with an array of type that is different than the actual
1273  // type of the `ArrayHandle` stored in the `UnknownArrayHandle`.
1274  f(extractedArray, std::forward<Args>(args)...);
1275  }
1276  }
1277 };
1278 
1279 } // namespace detail
1280 
1281 template <typename Functor, typename... Args>
1282 inline void UnknownArrayHandle::CastAndCallWithExtractedArray(Functor&& functor,
1283  Args&&... args) const
1284 {
1285  bool called = false;
1286  vtkm::ListForEach(detail::UnknownArrayHandleTryExtract{},
1288  std::forward<Functor>(functor),
1289  called,
1290  *this,
1291  std::forward<Args>(args)...);
1292  if (!called)
1293  {
1294  // Throw an exception.
1295  // The message will be a little wonky because the types are just the value types, not the
1296  // full type to cast to.
1298  internal::ThrowCastAndCallException(*this, typeid(vtkm::TypeListScalarAll));
1299  }
1300 }
1301 
1302 }
1303 } // namespace vtkm::cont
1304 
1305 //=============================================================================
1306 // Specializations of serialization related classes
1308 
1309 namespace vtkm
1310 {
1311 namespace cont
1312 {
1313 
1314 template <>
1315 struct VTKM_CONT_EXPORT SerializableTypeString<vtkm::cont::UnknownArrayHandle>
1316 {
1317  static VTKM_CONT std::string Get();
1318 };
1319 }
1320 } // namespace vtkm::cont
1321 
1322 namespace mangled_diy_namespace
1323 {
1324 
1325 template <>
1326 struct VTKM_CONT_EXPORT Serialization<vtkm::cont::UnknownArrayHandle>
1327 {
1328 public:
1329  static VTKM_CONT void save(BinaryBuffer& bb, const vtkm::cont::UnknownArrayHandle& obj);
1330  static VTKM_CONT void load(BinaryBuffer& bb, vtkm::cont::UnknownArrayHandle& obj);
1331 };
1332 
1333 } // namespace mangled_diy_namespace
1334 
1336 
1337 #endif //vtk_m_cont_UnknownArrayHandle_h
vtkm::cont::UnknownArrayHandle::CanConvert
bool CanConvert() const
Determine if the contained array can be passed to the given array type.
Definition: UnknownArrayHandle.h:998
vtkm::cont::TypeToString
std::string TypeToString(const std::type_info &t)
Use RTTI information to retrieve the name of the type T.
vtkm::cont::UnknownArrayHandle::IsValueType
bool IsValueType() const
Returns true if this array matches the ValueType template argument.
Definition: UnknownArrayHandle.h:515
vtkm::cont::ArrayHandle
Manages an array-worth of data.
Definition: ArrayHandle.h:300
ArrayHandle.h
ArrayExtractComponent.h
vtkm::cont::ArrayExtractComponent
vtkm::cont::ArrayHandleStride< typename vtkm::VecTraits< T >::BaseComponentType > ArrayExtractComponent(const vtkm::cont::ArrayHandle< T, S > &src, vtkm::IdComponent componentIndex, vtkm::CopyFlag allowCopy=vtkm::CopyFlag::On)
Pulls a component out of an ArrayHandle.
Definition: ArrayExtractComponent.h:255
vtkm::cont::UnknownArrayHandle::AsArrayHandle
void AsArrayHandle(vtkm::cont::ArrayHandle< TargetT, vtkm::cont::StorageTagCast< SourceT, SourceS >> &array) const
Definition: UnknownArrayHandle.h:673
vtkm::cont::ArrayHandle::GetBuffers
const std::vector< vtkm::cont::internal::Buffer > & GetBuffers() const
Returns the internal Buffer structures that hold the data.
Definition: ArrayHandle.h:719
vtkm::cont::ArrayHandleRecombineVec
A grouping of ArrayHandleStrides into an ArrayHandle of Vecs.
Definition: ArrayHandleRecombineVec.h:610
ArrayHandleStride.h
vtkm::cont::UnknownArrayHandle::IsBaseComponentType
bool IsBaseComponentType() const
Returns true if this array's ValueType has the provided base component type.
Definition: UnknownArrayHandle.h:540
vtkm::exec::arg::load
T load(const U &u, vtkm::Id v)
Definition: FetchTagArrayDirectIn.h:36
vtkm
Groups connected points that have the same field value.
Definition: Atomic.h:19
vtkm::cont::UnknownArrayHandle::AsArrayHandle
void AsArrayHandle(vtkm::cont::ArrayHandle< T, vtkm::cont::StorageTagRuntimeVec > &array) const
Definition: UnknownArrayHandle.h:682
vtkm::Get
auto Get(const vtkm::Tuple< Ts... > &tuple)
Retrieve the object from a vtkm::Tuple at the given index.
Definition: Tuple.h:81
ArrayHandleCast.h
VTKM_LOG_CAST_FAIL
#define VTKM_LOG_CAST_FAIL(inObj, outType)
Convenience macro for logging a failed cast of dynamic object.
Definition: Logging.h:230
ArrayHandleRecombineVec.h
vtkm::IdComponent
vtkm::Int32 IdComponent
Base type to use to index small lists.
Definition: Types.h:194
vtkm::cont::IsType
bool IsType(const vtkm::cont::UnknownArrayHandle &array)
Returns true if variant matches the type of ArrayHandleType.
Definition: UnknownArrayHandle.h:1234
vtkm::cont::printSummary_ArrayHandle
void printSummary_ArrayHandle(const vtkm::cont::ArrayHandle< T, StorageT > &array, std::ostream &out, bool full=false)
Definition: ArrayHandle.h:812
vtkm::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:575
vtkm::cont::UnknownArrayHandle
An ArrayHandle of an unknown value type and storage.
Definition: UnknownArrayHandle.h:430
vtkm::cont::ArrayHandleRecombineVec::AppendComponentArray
void AppendComponentArray(const vtkm::cont::ArrayHandle< ComponentType, vtkm::cont::StorageTagStride > &array)
Definition: ArrayHandleRecombineVec.h:632
vtkm::cont::UnknownArrayHandle::UnknownArrayHandle
UnknownArrayHandle(const vtkm::cont::ArrayHandle< T, S > &array)
Definition: UnknownArrayHandle.h:442
vtkm::cont::ArrayHandle::GetNumberOfValues
vtkm::Id GetNumberOfValues() const
Returns the number of entries in the array.
Definition: ArrayHandle.h:466
vtkm::cont::UnknownArrayHandle::AsArrayHandle
ArrayType AsArrayHandle() const
Definition: UnknownArrayHandle.h:702
vtkm::cont::ArrayHandleMultiplexer
An ArrayHandle that can behave like several other handles.
Definition: ArrayHandleMultiplexer.h:416
vtkm::cont::ArrayHandleRuntimeVec::ValueType
typename Superclass::ValueType ValueType
Definition: ArrayHandleRuntimeVec.h:338
vtkm::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:680
vtkm::cont::UnknownArrayHandle::AsArrayHandle
void AsArrayHandle(vtkm::cont::ArrayHandle< T, S > &array) const
Definition: UnknownArrayHandle.h:660
vtkm::cont::ErrorBadType
This class is thrown when VTK-m encounters data of a type that is incompatible with the current opera...
Definition: ErrorBadType.h:25
mangled_diy_namespace
Definition: Particle.h:351
vtkm::cont::UnknownArrayHandle::DeepCopyFrom
void DeepCopyFrom(const vtkm::cont::UnknownArrayHandle &source)
Deep copies data from another UnknownArrayHandle.
VTKM_DEPRECATED_SUPPRESS_END
#define VTKM_DEPRECATED_SUPPRESS_END
Definition: Deprecated.h:123
vtkm::cont::ArrayHandleStride
An ArrayHandle that accesses a basic array with strides and offsets.
Definition: ArrayHandleStride.h:332
vtkm::VecTraits::BaseComponentType
T BaseComponentType
Base component type in the vector.
Definition: VecTraits.h:78
vtkm::cont::throwFailedDynamicCast
void throwFailedDynamicCast(const std::string &baseType, const std::string &derivedType)
Throws an ErrorBadType exception with the following message: Cast failed: baseType --> derivedType".
vtkm::cont::StorageTagCast
Definition: ArrayHandleCast.h:28
vtkm::cont::Token
A token to hold the scope of an ArrayHandle or other object.
Definition: Token.h:35
vtkm::VecTraitsTagSizeVariable
A tag for vectors where the number of components are not determined until run time.
Definition: VecTraits.h:43
vtkm::cont::UnknownArrayHandle::GetNumberOfComponentsFlat
vtkm::IdComponent GetNumberOfComponentsFlat() const
Returns the total number of components for each value in the array.
vtkm::cont::ArrayHandleCast::GetSourceArray
ArrayHandleType GetSourceArray() const
Returns the ArrayHandle that is being transformed.
Definition: ArrayHandleCast.h:169
VTKM_IS_ARRAY_HANDLE
#define VTKM_IS_ARRAY_HANDLE(T)
Checks that the given type is a vtkm::cont::ArrayHandle.
Definition: ArrayHandle.h:137
VTKM_CONT_EXPORT
#define VTKM_CONT_EXPORT
Definition: vtkm_cont_export.h:44
VTKM_LOG_CAST_SUCC
#define VTKM_LOG_CAST_SUCC(inObj, outObj)
Convenience macro for logging the successful cast of dynamic object.
Definition: Logging.h:221
vtkm_cont_export.h
VTKM_CONT
#define VTKM_CONT
Definition: ExportMacros.h:57
vtkm::cont::ArrayHandle::ReleaseResources
void ReleaseResources() const
Releases all resources in both the control and execution environments.
Definition: ArrayHandle.h:582
vtkm::Id
vtkm::Int64 Id
Base type to use to index arrays.
Definition: Types.h:227
TypeList.h
vtkm::CopyFlag::On
@ On
vtkm::cont::ArrayHandleRuntimeVec
Fancy array handle for a basic array with runtime selected vec size.
Definition: ArrayHandleRuntimeVec.h:327
VTKM_DEPRECATED_SUPPRESS_BEGIN
#define VTKM_DEPRECATED_SUPPRESS_BEGIN
Definition: Deprecated.h:122
vtkm::ListForEach
void ListForEach(Functor &&f, vtkm::List< Ts... >, Args &&... args)
For each typename represented by the list, call the functor with a default instance of that type.
Definition: List.h:725
vtkm::cont::Cast
ArrayHandleType Cast(const vtkm::cont::UnknownArrayHandle &array)
Returns variant cast to the given ArrayHandle type.
Definition: UnknownArrayHandle.h:1244
vtkm::cont::ArrayHandle::DeepCopyFrom
void DeepCopyFrom(const vtkm::cont::ArrayHandle< ValueType, StorageTag > &source) const
Deep copies the data in the array.
Definition: ArrayHandle.h:705
vtkm::CopyFlag::Off
@ Off
vtkm::cont::UncertainArrayHandle
An ArrayHandle of an uncertain value type and storage.
Definition: UncertainArrayHandle.h:39
vtkm::VecTraitsTagSizeStatic
A tag for vectors where the number of components are known at compile time.
Definition: VecTraits.h:36
ArrayHandleMultiplexer.h
vtkm::cont::ArrayHandleCast
Cast the values of an array to the specified type, on demand.
Definition: ArrayHandleCast.h:141
Deprecated.h
vtkm::cont::StorageTagRuntimeVec
Definition: ArrayHandleRuntimeVec.h:129
vtkm::List
A template used to hold a list of types.
Definition: List.h:39
vtkm::cont::StorageTagBasic
A tag for the basic implementation of a Storage object.
Definition: ArrayHandle.h:45
vtkm::CopyFlag
CopyFlag
Identifier used to specify whether a function should deep copy data.
Definition: Flags.h:17
vtkm::cont::UnknownArrayHandle::ExtractArrayFromComponents
vtkm::cont::ArrayHandleRecombineVec< BaseComponentType > ExtractArrayFromComponents(vtkm::CopyFlag allowCopy=vtkm::CopyFlag::On) const
Extract the array knowing only the component type of the array.
Definition: UnknownArrayHandle.h:849
vtkm::cont::UnknownArrayHandle::BaseAsArrayHandle
void BaseAsArrayHandle(vtkm::cont::ArrayHandle< T, S > &array) const
Definition: UnknownArrayHandle.h:641
ArrayHandleRuntimeVec.h
vtkm::cont::operator==
bool operator==(const vtkm::cont::Token &token, vtkm::cont::Token::Reference ref)
Definition: Token.h:174
vtkm::cont::ArrayHandle::Allocate
void Allocate(vtkm::Id numberOfValues, vtkm::CopyFlag preserve, vtkm::cont::Token &token) const
Allocates an array large enough to hold the given number of values.
Definition: ArrayHandle.h:488
StorageList.h
vtkm::cont::ArrayHandleBasic
Definition: ArrayHandleBasic.h:105
vtkm::VecTraits
Traits that can be queried to treat any type as a Vec.
Definition: VecTraits.h:61
vtkm::cont::ArrayHandle::GetNumberOfComponentsFlat
vtkm::IdComponent GetNumberOfComponentsFlat() const
Returns the total number of components for each value in the array.
Definition: ArrayHandle.h:472
vtkm::cont::UnknownArrayHandle::IsStorageType
bool IsStorageType() const
Returns true if this array matches the StorageType template argument.
Definition: UnknownArrayHandle.h:523
vtkm::cont::UnknownArrayHandle::IsType
bool IsType() const
Returns true if this array matches the ArrayHandleType template argument.
Definition: UnknownArrayHandle.h:558
vtkm::cont::UnknownArrayHandle::ExtractComponent
vtkm::cont::ArrayHandleStride< BaseComponentType > ExtractComponent(vtkm::IdComponent componentIndex, vtkm::CopyFlag allowCopy=vtkm::CopyFlag::On) const
Extract a component of the array.
Definition: UnknownArrayHandle.h:790
VecTraits.h
vtkm::cont::UnknownArrayHandle::Container
std::shared_ptr< detail::UnknownAHContainer > Container
Definition: UnknownArrayHandle.h:432
vtkm::cont::StorageTagMultiplexer
Definition: ArrayHandleMultiplexer.h:141