VTK-m  2.2
ArrayHandleSOA.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_ArrayHandleSOA_h
11 #define vtk_m_cont_ArrayHandleSOA_h
12 
14 #include <vtkm/cont/ArrayHandle.h>
15 
16 #include <vtkm/Math.h>
17 #include <vtkm/VecTraits.h>
18 
21 
22 #include <vtkmstd/integer_sequence.h>
23 
24 #include <array>
25 #include <limits>
26 #include <type_traits>
27 
28 namespace vtkm
29 {
30 
31 namespace internal
32 {
33 
38 template <typename ValueType_, typename ComponentPortalType>
39 class ArrayPortalSOA
40 {
41 public:
42  using ValueType = ValueType_;
43 
44 private:
45  using ComponentType = typename ComponentPortalType::ValueType;
46 
47  using VTraits = vtkm::VecTraits<ValueType>;
48  VTKM_STATIC_ASSERT((std::is_same<typename VTraits::ComponentType, ComponentType>::value));
49  static constexpr vtkm::IdComponent NUM_COMPONENTS = VTraits::NUM_COMPONENTS;
50 
51  ComponentPortalType Portals[NUM_COMPONENTS];
52  vtkm::Id NumberOfValues;
53 
54 public:
56  VTKM_EXEC_CONT explicit ArrayPortalSOA(vtkm::Id numValues = 0)
57  : NumberOfValues(numValues)
58  {
59  }
60 
62  VTKM_EXEC_CONT void SetPortal(vtkm::IdComponent index, const ComponentPortalType& portal)
63  {
64  this->Portals[index] = portal;
65  }
66 
67  VTKM_EXEC_CONT vtkm::Id GetNumberOfValues() const { return this->NumberOfValues; }
68 
69  template <typename SPT = ComponentPortalType,
70  typename Supported = typename vtkm::internal::PortalSupportsGets<SPT>::type,
71  typename = typename std::enable_if<Supported::value>::type>
72  VTKM_EXEC_CONT ValueType Get(vtkm::Id valueIndex) const
73  {
74  return this->Get(valueIndex, vtkmstd::make_index_sequence<NUM_COMPONENTS>());
75  }
76 
77  template <typename SPT = ComponentPortalType,
78  typename Supported = typename vtkm::internal::PortalSupportsSets<SPT>::type,
79  typename = typename std::enable_if<Supported::value>::type>
80  VTKM_EXEC_CONT void Set(vtkm::Id valueIndex, const ValueType& value) const
81  {
82  this->Set(valueIndex, value, vtkmstd::make_index_sequence<NUM_COMPONENTS>());
83  }
84 
85 private:
87  template <std::size_t I>
88  VTKM_EXEC_CONT ComponentType GetComponent(vtkm::Id valueIndex) const
89  {
90  return this->Portals[I].Get(valueIndex);
91  }
92 
93  template <std::size_t... I>
94  VTKM_EXEC_CONT ValueType Get(vtkm::Id valueIndex, vtkmstd::index_sequence<I...>) const
95  {
96  return ValueType{ this->GetComponent<I>(valueIndex)... };
97  }
98 
100  template <std::size_t I>
101  VTKM_EXEC_CONT bool SetComponent(vtkm::Id valueIndex, const ValueType& value) const
102  {
103  this->Portals[I].Set(valueIndex,
104  VTraits::GetComponent(value, static_cast<vtkm::IdComponent>(I)));
105  return true;
106  }
107 
108  template <std::size_t... I>
109  VTKM_EXEC_CONT void Set(vtkm::Id valueIndex,
110  const ValueType& value,
111  vtkmstd::index_sequence<I...>) const
112  {
113  // Is there a better way to unpack an expression and execute them with no other side effects?
114  (void)std::initializer_list<bool>{ this->SetComponent<I>(valueIndex, value)... };
115  }
116 };
117 
118 } // namespace internal
119 
120 namespace cont
121 {
122 
124 {
125 };
126 
127 namespace internal
128 {
129 
130 template <typename ComponentType, vtkm::IdComponent NUM_COMPONENTS>
131 class VTKM_ALWAYS_EXPORT
132  Storage<vtkm::Vec<ComponentType, NUM_COMPONENTS>, vtkm::cont::StorageTagSOA>
133 {
135 
136 public:
137  using ReadPortalType =
138  vtkm::internal::ArrayPortalSOA<ValueType, vtkm::internal::ArrayPortalBasicRead<ComponentType>>;
139  using WritePortalType =
140  vtkm::internal::ArrayPortalSOA<ValueType, vtkm::internal::ArrayPortalBasicWrite<ComponentType>>;
141 
142  VTKM_CONT static std::vector<vtkm::cont::internal::Buffer> CreateBuffers()
143  {
144  return std::vector<vtkm::cont::internal::Buffer>(static_cast<std::size_t>(NUM_COMPONENTS));
145  }
146 
147  VTKM_CONT static vtkm::IdComponent GetNumberOfComponentsFlat(
148  const std::vector<vtkm::cont::internal::Buffer>&)
149  {
150  return vtkm::VecFlat<ComponentType>::NUM_COMPONENTS * NUM_COMPONENTS;
151  }
152 
153  VTKM_CONT static void ResizeBuffers(vtkm::Id numValues,
154  const std::vector<vtkm::cont::internal::Buffer>& buffers,
155  vtkm::CopyFlag preserve,
156  vtkm::cont::Token& token)
157  {
158  vtkm::BufferSizeType numBytes =
159  vtkm::internal::NumberOfValuesToNumberOfBytes<ComponentType>(numValues);
160  for (vtkm::IdComponent componentIndex = 0; componentIndex < NUM_COMPONENTS; ++componentIndex)
161  {
162  buffers[componentIndex].SetNumberOfBytes(numBytes, preserve, token);
163  }
164  }
165 
166  VTKM_CONT static vtkm::Id GetNumberOfValues(
167  const std::vector<vtkm::cont::internal::Buffer>& buffers)
168  {
169  // Assume all buffers are the same size.
170  return static_cast<vtkm::Id>(buffers[0].GetNumberOfBytes()) /
171  static_cast<vtkm::Id>(sizeof(ComponentType));
172  }
173 
174  VTKM_CONT static void Fill(const std::vector<vtkm::cont::internal::Buffer>& buffers,
175  const ValueType& fillValue,
176  vtkm::Id startIndex,
177  vtkm::Id endIndex,
178  vtkm::cont::Token& token)
179  {
180  constexpr vtkm::BufferSizeType sourceSize =
181  static_cast<vtkm::BufferSizeType>(sizeof(ComponentType));
182  vtkm::BufferSizeType startByte = startIndex * sourceSize;
183  vtkm::BufferSizeType endByte = endIndex * sourceSize;
184  for (vtkm::IdComponent componentIndex = 0; componentIndex < NUM_COMPONENTS; ++componentIndex)
185  {
186  ComponentType source = fillValue[componentIndex];
187  buffers[componentIndex].Fill(&source, sourceSize, startByte, endByte, token);
188  }
189  }
190 
191  VTKM_CONT static ReadPortalType CreateReadPortal(
192  const std::vector<vtkm::cont::internal::Buffer>& buffers,
194  vtkm::cont::Token& token)
195  {
196  vtkm::Id numValues = GetNumberOfValues(buffers);
197  ReadPortalType portal(numValues);
198  for (vtkm::IdComponent componentIndex = 0; componentIndex < NUM_COMPONENTS; ++componentIndex)
199  {
200  VTKM_ASSERT(buffers[0].GetNumberOfBytes() == buffers[componentIndex].GetNumberOfBytes());
201  portal.SetPortal(componentIndex,
202  vtkm::internal::ArrayPortalBasicRead<ComponentType>(
203  reinterpret_cast<const ComponentType*>(
204  buffers[componentIndex].ReadPointerDevice(device, token)),
205  numValues));
206  }
207  return portal;
208  }
209 
210  VTKM_CONT static WritePortalType CreateWritePortal(
211  const std::vector<vtkm::cont::internal::Buffer>& buffers,
213  vtkm::cont::Token& token)
214  {
215  vtkm::Id numValues = GetNumberOfValues(buffers);
216  WritePortalType portal(numValues);
217  for (vtkm::IdComponent componentIndex = 0; componentIndex < NUM_COMPONENTS; ++componentIndex)
218  {
219  VTKM_ASSERT(buffers[0].GetNumberOfBytes() == buffers[componentIndex].GetNumberOfBytes());
220  portal.SetPortal(componentIndex,
221  vtkm::internal::ArrayPortalBasicWrite<ComponentType>(
222  reinterpret_cast<ComponentType*>(
223  buffers[componentIndex].WritePointerDevice(device, token)),
224  numValues));
225  }
226  return portal;
227  }
228 };
229 
230 } // namespace internal
231 
249 template <typename T>
250 class ArrayHandleSOA : public ArrayHandle<T, vtkm::cont::StorageTagSOA>
251 {
254 
256 
257 public:
261 
262  ArrayHandleSOA(std::initializer_list<vtkm::cont::internal::Buffer>&& componentBuffers)
263  : Superclass(componentBuffers)
264  {
265  }
266 
278  ArrayHandleSOA(const std::array<ComponentArrayType, NUM_COMPONENTS>& componentArrays)
279  {
280  for (vtkm::IdComponent componentIndex = 0; componentIndex < NUM_COMPONENTS; ++componentIndex)
281  {
282  this->SetArray(componentIndex, componentArrays[componentIndex]);
283  }
284  }
285 
297  ArrayHandleSOA(const std::vector<ComponentArrayType>& componentArrays)
298  {
299  VTKM_ASSERT(componentArrays.size() == NUM_COMPONENTS);
300  for (vtkm::IdComponent componentIndex = 0; componentIndex < NUM_COMPONENTS; ++componentIndex)
301  {
302  this->SetArray(componentIndex, componentArrays[componentIndex]);
303  }
304  }
305 
317  ArrayHandleSOA(std::initializer_list<ComponentArrayType>&& componentArrays)
318  {
319  VTKM_ASSERT(componentArrays.size() == NUM_COMPONENTS);
320  vtkm::IdComponent componentIndex = 0;
321  for (auto&& array : componentArrays)
322  {
323  this->SetArray(componentIndex, array);
324  ++componentIndex;
325  }
326  }
327 
341  ArrayHandleSOA(std::initializer_list<std::vector<ComponentType>>&& componentVectors)
342  {
343  VTKM_ASSERT(componentVectors.size() == NUM_COMPONENTS);
344  vtkm::IdComponent componentIndex = 0;
345  for (auto&& vector : componentVectors)
346  {
347  // Note, std::vectors that come from std::initializer_list must be copied because the scope
348  // of the objects in the initializer list disappears.
349  this->SetArray(componentIndex, vtkm::cont::make_ArrayHandle(vector, vtkm::CopyFlag::On));
350  ++componentIndex;
351  }
352  }
353 
370  template <typename Allocator, typename... RemainingVectors>
372  const std::vector<ComponentType, Allocator>& vector0,
373  RemainingVectors&&... componentVectors)
374  : Superclass(std::vector<vtkm::cont::internal::Buffer>{
375  vtkm::cont::make_ArrayHandle(vector0, copy).GetBuffers()[0],
376  vtkm::cont::make_ArrayHandle(std::forward<RemainingVectors>(componentVectors), copy)
377  .GetBuffers()[0]... })
378  {
379  VTKM_STATIC_ASSERT(sizeof...(RemainingVectors) + 1 == NUM_COMPONENTS);
380  }
381 
401  template <typename... RemainingVectors>
403  std::vector<ComponentType>&& vector0,
404  RemainingVectors&&... componentVectors)
405  : Superclass(std::vector<vtkm::cont::internal::Buffer>{
406  vtkm::cont::make_ArrayHandle(std::move(vector0), copy),
407  vtkm::cont::make_ArrayHandle(std::forward<RemainingVectors>(componentVectors), copy)
408  .GetBuffers()[0]... })
409  {
410  VTKM_STATIC_ASSERT(sizeof...(RemainingVectors) + 1 == NUM_COMPONENTS);
411  }
412 
424  ArrayHandleSOA(std::initializer_list<const ComponentType*> componentArrays,
425  vtkm::Id length,
426  vtkm::CopyFlag copy)
427  {
428  VTKM_ASSERT(componentArrays.size() == NUM_COMPONENTS);
429  vtkm::IdComponent componentIndex = 0;
430  for (auto&& vectorIter = componentArrays.begin(); vectorIter != componentArrays.end();
431  ++vectorIter)
432  {
433  this->SetArray(componentIndex, vtkm::cont::make_ArrayHandle(*vectorIter, length, copy));
434  ++componentIndex;
435  }
436  }
437 
452  template <typename... RemainingArrays>
454  vtkm::CopyFlag copy,
455  const ComponentType* array0,
456  const RemainingArrays&... componentArrays)
457  : Superclass(std::vector<vtkm::cont::internal::Buffer>{
458  vtkm::cont::make_ArrayHandle(array0, length, copy).GetBuffers()[0],
459  vtkm::cont::make_ArrayHandle(componentArrays, length, copy).GetBuffers()[0]... })
460  {
461  VTKM_STATIC_ASSERT(sizeof...(RemainingArrays) + 1 == NUM_COMPONENTS);
462  }
463 
466  {
467  return ComponentArrayType({ this->GetBuffers()[index] });
468  }
469 
472  {
473  this->SetBuffer(index, array.GetBuffers()[0]);
474  }
475 };
476 
477 namespace internal
478 {
479 
480 template <typename... Remaining>
481 using VecSizeFromRemaining =
482  std::integral_constant<vtkm::IdComponent, vtkm::IdComponent(sizeof...(Remaining) + 1)>;
483 
484 } // namespace internal
485 
497 template <typename ValueType>
500  vtkm::cont::StorageTagBasic>>&& componentArrays)
501 {
502  return ArrayHandleSOA<ValueType>(std::move(componentArrays));
503 }
504 
519 template <typename ComponentType, typename... RemainingArrays>
520 VTKM_CONT ArrayHandleSOA<
521  vtkm::Vec<ComponentType, internal::VecSizeFromRemaining<RemainingArrays...>::value>>
524  const RemainingArrays&... componentArrays)
525 {
526  return { componentArray0, componentArrays... };
527 }
528 
542 template <typename ValueType>
544  std::initializer_list<std::vector<typename vtkm::VecTraits<ValueType>::ComponentType>>&&
545  componentVectors)
546 {
547  return ArrayHandleSOA<ValueType>(std::move(componentVectors));
548 }
549 
566 template <typename ComponentType, typename... RemainingVectors>
567 VTKM_CONT ArrayHandleSOA<
568  vtkm::Vec<ComponentType, internal::VecSizeFromRemaining<RemainingVectors...>::value>>
570  const std::vector<ComponentType>& vector0,
571  RemainingVectors&&... componentVectors)
572 {
573  // Convert std::vector to ArrayHandle first so that it correctly handles a mix of rvalue args.
574  return { vtkm::cont::make_ArrayHandle(vector0, copy),
575  vtkm::cont::make_ArrayHandle(std::forward<RemainingVectors>(componentVectors),
576  copy)... };
577 }
578 
598 template <typename ComponentType, typename... RemainingVectors>
599 VTKM_CONT ArrayHandleSOA<
600  vtkm::Vec<ComponentType, internal::VecSizeFromRemaining<RemainingVectors...>::value>>
602  std::vector<ComponentType>&& vector0,
603  RemainingVectors&&... componentVectors)
604 {
605  // Convert std::vector to ArrayHandle first so that it correctly handles a mix of rvalue args.
606  return ArrayHandleSOA<
607  vtkm::Vec<ComponentType, internal::VecSizeFromRemaining<RemainingVectors...>::value>>(
608  vtkm::cont::make_ArrayHandle(std::move(vector0), copy),
609  vtkm::cont::make_ArrayHandle(std::forward<RemainingVectors>(componentVectors), copy)...);
610 }
611 
626 template <typename ComponentType, typename... RemainingVectors>
627 VTKM_CONT ArrayHandleSOA<
628  vtkm::Vec<ComponentType, internal::VecSizeFromRemaining<RemainingVectors...>::value>>
629 make_ArrayHandleSOAMove(std::vector<ComponentType>&& vector0,
630  RemainingVectors&&... componentVectors)
631 {
632  return { vtkm::cont::make_ArrayHandleMove(std::move(vector0)),
633  vtkm::cont::make_ArrayHandleMove(std::forward<RemainingVectors>(componentVectors))... };
634 }
635 
647 template <typename ValueType>
649  std::initializer_list<const typename vtkm::VecTraits<ValueType>::ComponentType*>&&
650  componentVectors,
651  vtkm::Id length,
652  vtkm::CopyFlag copy)
653 {
654  return ArrayHandleSOA<ValueType>(std::move(componentVectors), length, copy);
655 }
656 
670 template <typename ComponentType, typename... RemainingArrays>
671 VTKM_CONT ArrayHandleSOA<
672  vtkm::Vec<ComponentType, internal::VecSizeFromRemaining<RemainingArrays...>::value>>
674  vtkm::CopyFlag copy,
675  const ComponentType* array0,
676  const RemainingArrays*... componentArrays)
677 {
678  return ArrayHandleSOA<
679  vtkm::Vec<ComponentType, vtkm::IdComponent(sizeof...(RemainingArrays) + 1)>>(
680  length, copy, array0, componentArrays...);
681 }
682 
683 namespace internal
684 {
685 
687 
688 template <>
689 struct ArrayExtractComponentImpl<vtkm::cont::StorageTagSOA>
690 {
691  template <typename T>
693  vtkm::IdComponent componentIndex,
694  vtkm::CopyFlag allowCopy) const
695  -> decltype(
696  ArrayExtractComponentImpl<vtkm::cont::StorageTagBasic>{}(vtkm::cont::ArrayHandleBasic<T>{},
697  componentIndex,
698  allowCopy))
699  {
700  using FirstLevelComponentType = typename vtkm::VecTraits<T>::ComponentType;
702  constexpr vtkm::IdComponent NUM_SUB_COMPONENTS =
704  return ArrayExtractComponentImpl<vtkm::cont::StorageTagBasic>{}(
705  array.GetArray(componentIndex / NUM_SUB_COMPONENTS),
706  componentIndex % NUM_SUB_COMPONENTS,
707  allowCopy);
708  }
709 };
710 
712 
713 } // namespace internal
714 
715 }
716 } // namespace vtkm::cont
717 
718 //=============================================================================
719 // Specializations of serialization related classes
721 
722 namespace vtkm
723 {
724 namespace cont
725 {
726 
727 template <typename ValueType>
728 struct SerializableTypeString<vtkm::cont::ArrayHandleSOA<ValueType>>
729 {
730  static VTKM_CONT const std::string& Get()
731  {
732  static std::string name = "AH_SOA<" + SerializableTypeString<ValueType>::Get() + ">";
733  return name;
734  }
735 };
736 
737 template <typename ValueType>
738 struct SerializableTypeString<vtkm::cont::ArrayHandle<ValueType, vtkm::cont::StorageTagSOA>>
739  : SerializableTypeString<vtkm::cont::ArrayHandleSOA<ValueType>>
740 {
741 };
742 }
743 } // namespace vtkm::cont
744 
745 namespace mangled_diy_namespace
746 {
747 
748 template <typename ValueType>
749 struct Serialization<vtkm::cont::ArrayHandleSOA<ValueType>>
750 {
752  static constexpr vtkm::IdComponent NUM_COMPONENTS = vtkm::VecTraits<ValueType>::NUM_COMPONENTS;
753 
754  static VTKM_CONT void save(BinaryBuffer& bb, const BaseType& obj)
755  {
756  for (vtkm::IdComponent componentIndex = 0; componentIndex < NUM_COMPONENTS; ++componentIndex)
757  {
758  vtkmdiy::save(bb, obj.GetBuffers()[componentIndex]);
759  }
760  }
761 
762  static VTKM_CONT void load(BinaryBuffer& bb, BaseType& obj)
763  {
764  std::vector<vtkm::cont::internal::Buffer> buffers(NUM_COMPONENTS);
765  for (std::size_t componentIndex = 0; componentIndex < NUM_COMPONENTS; ++componentIndex)
766  {
767  vtkmdiy::load(bb, buffers[componentIndex]);
768  }
769  obj = BaseType(buffers);
770  }
771 };
772 
773 template <typename ValueType>
774 struct Serialization<vtkm::cont::ArrayHandle<ValueType, vtkm::cont::StorageTagSOA>>
775  : Serialization<vtkm::cont::ArrayHandleSOA<ValueType>>
776 {
777 };
778 
779 } // namespace mangled_diy_namespace
780 // @endcond SERIALIZATION
781 
782 //=============================================================================
783 // Precompiled instances
784 
785 #ifndef vtkm_cont_ArrayHandleSOA_cxx
786 
788 
789 namespace vtkm
790 {
791 namespace cont
792 {
793 
794 #define VTKM_ARRAYHANDLE_SOA_EXPORT(Type) \
795  extern template class VTKM_CONT_TEMPLATE_EXPORT ArrayHandle<vtkm::Vec<Type, 2>, StorageTagSOA>; \
796  extern template class VTKM_CONT_TEMPLATE_EXPORT ArrayHandle<vtkm::Vec<Type, 3>, StorageTagSOA>; \
797  extern template class VTKM_CONT_TEMPLATE_EXPORT ArrayHandle<vtkm::Vec<Type, 4>, StorageTagSOA>;
798 
799 VTKM_ARRAYHANDLE_SOA_EXPORT(char)
800 VTKM_ARRAYHANDLE_SOA_EXPORT(vtkm::Int8)
801 VTKM_ARRAYHANDLE_SOA_EXPORT(vtkm::UInt8)
802 VTKM_ARRAYHANDLE_SOA_EXPORT(vtkm::Int16)
803 VTKM_ARRAYHANDLE_SOA_EXPORT(vtkm::UInt16)
804 VTKM_ARRAYHANDLE_SOA_EXPORT(vtkm::Int32)
805 VTKM_ARRAYHANDLE_SOA_EXPORT(vtkm::UInt32)
806 VTKM_ARRAYHANDLE_SOA_EXPORT(vtkm::Int64)
807 VTKM_ARRAYHANDLE_SOA_EXPORT(vtkm::UInt64)
808 VTKM_ARRAYHANDLE_SOA_EXPORT(vtkm::Float32)
809 VTKM_ARRAYHANDLE_SOA_EXPORT(vtkm::Float64)
810 
811 #undef VTKM_ARRAYHANDLE_SOA_EXPORT
812 }
813 } // namespace vtkm::cont
814 
816 
817 #endif // !vtkm_cont_ArrayHandleSOA_cxx
818 
819 #endif //vtk_m_cont_ArrayHandleSOA_h
vtkm::cont::ArrayHandleSOA::ArrayHandleSOA
ArrayHandleSOA(vtkm::CopyFlag copy, const std::vector< ComponentType, Allocator > &vector0, RemainingVectors &&... componentVectors)
Construct an ArrayHandleSOA from a collection of component arrays.
Definition: ArrayHandleSOA.h:371
vtkm::cont::ArrayHandle
Manages an array-worth of data.
Definition: ArrayHandle.h:300
ArrayHandle.h
ArrayExtractComponent.h
vtkm::cont::make_ArrayHandleSOA
ArrayHandleSOA< ValueType > make_ArrayHandleSOA(std::initializer_list< vtkm::cont::ArrayHandle< typename vtkm::VecTraits< ValueType >::ComponentType, vtkm::cont::StorageTagBasic >> &&componentArrays)
Create a vtkm::cont::ArrayHandleSOA with an initializer list of array handles.
Definition: ArrayHandleSOA.h:498
vtkm::cont::ArrayHandle< T, vtkm::cont::StorageTagSOA >::GetBuffers
const std::vector< vtkm::cont::internal::Buffer > & GetBuffers() const
Returns the internal Buffer structures that hold the data.
Definition: ArrayHandle.h:721
vtkm::cont::make_ArrayHandleSOAMove
ArrayHandleSOA< vtkm::Vec< ComponentType, internal::VecSizeFromRemaining< RemainingVectors... >::value > > make_ArrayHandleSOAMove(std::vector< ComponentType > &&vector0, RemainingVectors &&... componentVectors)
Create a vtkm::cont::ArrayHandleSOA with a number of std::vector.
Definition: ArrayHandleSOA.h:629
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::Get
auto Get(const vtkm::Tuple< Ts... > &tuple)
Retrieve the object from a vtkm::Tuple at the given index.
Definition: Tuple.h:81
VTKM_ARRAY_HANDLE_SUBCLASS
#define VTKM_ARRAY_HANDLE_SUBCLASS(classname, fullclasstype, superclass)
Macro to make default methods in ArrayHandle subclasses.
Definition: ArrayHandle.h:243
ArrayPortalHelpers.h
VTKM_ASSERT
#define VTKM_ASSERT(condition)
Definition: Assert.h:43
VTKM_EXEC_CONT
#define VTKM_EXEC_CONT
Definition: ExportMacros.h:52
vtkm::cont::ArrayHandleSOA::ArrayHandleSOA
ArrayHandleSOA(vtkm::CopyFlag copy, std::vector< ComponentType > &&vector0, RemainingVectors &&... componentVectors)
Construct an ArrayHandleSOA from a collection of component arrays.
Definition: ArrayHandleSOA.h:402
vtkm::IdComponent
vtkm::Int32 IdComponent
Base type to use to index small lists.
Definition: Types.h:194
vtkm::cont::StorageTagSOA
Definition: ArrayHandleSOA.h:123
vtkm::VecTraits::NUM_COMPONENTS
static constexpr vtkm::IdComponent NUM_COMPONENTS
Number of components in the vector.
Definition: VecTraits.h:85
vtkm::cont::ArrayHandleSOA::ArrayHandleSOA
ArrayHandleSOA(vtkm::Id length, vtkm::CopyFlag copy, const ComponentType *array0, const RemainingArrays &... componentArrays)
Construct an ArrayHandleSOA from a collection of component arrays.
Definition: ArrayHandleSOA.h:453
vtkm::VecTraits::ComponentType
T ComponentType
Type of the components in the vector.
Definition: VecTraits.h:71
vtkm::cont::ArrayHandle< T, vtkm::cont::StorageTagSOA >::SetBuffer
void SetBuffer(vtkm::IdComponent index, const vtkm::cont::internal::Buffer &buffer)
Definition: ArrayHandle.h:731
vtkm::Int16
int16_t Int16
Base type to use for 16-bit signed integer numbers.
Definition: Types.h:173
vtkm::cont::make_ArrayHandleMove
vtkm::cont::ArrayHandleBasic< T > make_ArrayHandleMove(T *&array, vtkm::Id numberOfValues, vtkm::cont::internal::BufferInfo::Deleter deleter=internal::SimpleArrayDeleter< T >, vtkm::cont::internal::BufferInfo::Reallocater reallocater=internal::SimpleArrayReallocater< T >)
A convenience function to move a user-allocated array into an ArrayHandle.
Definition: ArrayHandleBasic.h:294
vtkm::BufferSizeType
vtkm::Int64 BufferSizeType
Definition: DeviceAdapterMemoryManager.h:27
vtkm::cont::ArrayHandleSOA::ArrayHandleSOA
ArrayHandleSOA(std::initializer_list< vtkm::cont::internal::Buffer > &&componentBuffers)
Definition: ArrayHandleSOA.h:262
mangled_diy_namespace
Definition: Particle.h:351
vtkm::cont::ArrayHandleSOA
An ArrayHandle that for Vecs stores each component in a separate physical array.
Definition: ArrayHandleSOA.h:250
vtkm::cont::ArrayHandleSOA::Superclass
typename vtkm::cont::detail::GetTypeInParentheses< void(ArrayHandle< T, vtkm::cont::StorageTagSOA >) >::type Superclass
Definition: ArrayHandleSOA.h:260
vtkm::cont::ArrayHandleSOA::ComponentType
typename vtkm::VecTraits< T >::ComponentType ComponentType
Definition: ArrayHandleSOA.h:252
vtkm::cont::Token
A token to hold the scope of an ArrayHandle or other object.
Definition: Token.h:35
ArrayPortalBasic.h
vtkm::cont::ArrayHandleSOA::GetArray
vtkm::cont::ArrayHandleBasic< ComponentType > GetArray(vtkm::IdComponent index) const
Get a basic array representing the component for the given index.
Definition: ArrayHandleSOA.h:465
Math.h
VTKM_STATIC_ASSERT
#define VTKM_STATIC_ASSERT(condition)
Definition: StaticAssert.h:16
vtkm::cont::ArrayHandleSOA::ArrayHandleSOA
ArrayHandleSOA(std::initializer_list< ComponentArrayType > &&componentArrays)
Construct an ArrayHandleSOA from a collection of component arrays.
Definition: ArrayHandleSOA.h:317
vtkm::Int8
int8_t Int8
Base type to use for 8-bit signed integer numbers.
Definition: Types.h:165
vtkm::cont::ArrayHandleSOA::ArrayHandleSOA
ArrayHandleSOA(const std::vector< ComponentArrayType > &componentArrays)
Construct an ArrayHandleSOA from a collection of component arrays.
Definition: ArrayHandleSOA.h:297
VTKM_CONT
#define VTKM_CONT
Definition: ExportMacros.h:57
vtkm::Id
vtkm::Int64 Id
Base type to use to index arrays.
Definition: Types.h:227
vtkm::Int64
signed long long Int64
Base type to use for 64-bit signed integer numbers.
Definition: Types.h:204
vtkm::VecFlat
Treat a Vec or Vec-like object as a flat Vec.
Definition: VecFlat.h:224
vtkm::UInt8
uint8_t UInt8
Base type to use for 8-bit unsigned integer numbers.
Definition: Types.h:169
vtkm::CopyFlag::On
@ On
vtkm::cont::ArrayHandleSOA::ArrayHandleSOA
ArrayHandleSOA(std::initializer_list< std::vector< ComponentType >> &&componentVectors)
Construct an ArrayHandleSOA from a collection of component arrays.
Definition: ArrayHandleSOA.h:341
vtkm::cont::DeviceAdapterId
An object used to specify a device.
Definition: DeviceAdapterTag.h:58
vtkm::cont::ArrayHandleSOA::SetArray
void SetArray(vtkm::IdComponent index, const ComponentArrayType &array)
Replace a component array.
Definition: ArrayHandleSOA.h:471
vtkm::Vec
A short fixed-length array.
Definition: Types.h:357
vtkm::VecTraits::GetComponent
static const ComponentType & GetComponent(const T &vector, vtkm::IdComponent)
Returns the value in a given component of the vector.
Definition: VecTraits.h:117
vtkm::UInt32
uint32_t UInt32
Base type to use for 32-bit unsigned integer numbers.
Definition: Types.h:185
vtkm::Float32
float Float32
Base type to use for 32-bit floating-point numbers.
Definition: Types.h:157
vtkm::cont::ArrayHandleSOA::ComponentArrayType
vtkm::cont::ArrayHandle< ComponentType, vtkm::cont::StorageTagBasic > ComponentArrayType
Definition: ArrayHandleSOA.h:255
vtkm::UInt64
unsigned long long UInt64
Base type to use for 64-bit signed integer numbers.
Definition: Types.h:207
vtkm::Int32
int32_t Int32
Base type to use for 32-bit signed integer numbers.
Definition: Types.h:181
vtkm::cont::StorageTagBasic
A tag for the basic implementation of a Storage object.
Definition: ArrayHandle.h:45
vtkm::Float64
double Float64
Base type to use for 64-bit floating-point numbers.
Definition: Types.h:161
vtkm::CopyFlag
CopyFlag
Identifier used to specify whether a function should deep copy data.
Definition: Flags.h:17
vtkm::cont::ArrayHandleSOA::ArrayHandleSOA
ArrayHandleSOA(std::initializer_list< const ComponentType * > componentArrays, vtkm::Id length, vtkm::CopyFlag copy)
Construct an ArrayHandleSOA from a collection of component arrays.
Definition: ArrayHandleSOA.h:424
vtkm::cont::ArrayHandleBasic
Basic array storage for an array handle.
Definition: ArrayHandleBasic.h:111
vtkm::VecTraits
Traits that can be queried to treat any type as a Vec.
Definition: VecTraits.h:61
VTKM_ALWAYS_EXPORT
#define VTKM_ALWAYS_EXPORT
Definition: ExportMacros.h:89
vtkm::cont::make_ArrayHandle
vtkm::cont::ArrayHandleBasic< T > make_ArrayHandle(const T *array, vtkm::Id numberOfValues, vtkm::CopyFlag copy)
A convenience function for creating an ArrayHandle from a standard C array.
Definition: ArrayHandleBasic.h:270
vtkm::UInt16
uint16_t UInt16
Base type to use for 16-bit unsigned integer numbers.
Definition: Types.h:177
vtkm::cont::ArrayHandleSOA::NUM_COMPONENTS
static constexpr vtkm::IdComponent NUM_COMPONENTS
Definition: ArrayHandleSOA.h:253
vtkm::cont::ArrayHandleSOA::ArrayHandleSOA
ArrayHandleSOA(const std::array< ComponentArrayType, NUM_COMPONENTS > &componentArrays)
Construct an ArrayHandleSOA from a collection of component arrays.
Definition: ArrayHandleSOA.h:278
VTKM_SUPPRESS_EXEC_WARNINGS
#define VTKM_SUPPRESS_EXEC_WARNINGS
Definition: ExportMacros.h:53
VecTraits.h