Viskores  1.0
ArrayHandleSOA.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_ArrayHandleSOA_h
19 #define viskores_cont_ArrayHandleSOA_h
20 
23 
24 #include <viskores/Math.h>
25 #include <viskores/VecTraits.h>
26 
29 
30 #include <viskoresstd/integer_sequence.h>
31 
32 #include <array>
33 #include <limits>
34 #include <type_traits>
35 
36 namespace viskores
37 {
38 
39 namespace internal
40 {
41 
46 template <typename ValueType_, typename ComponentPortalType>
47 class ArrayPortalSOA
48 {
49 public:
50  using ValueType = ValueType_;
51 
52 private:
53  using ComponentType = typename ComponentPortalType::ValueType;
54 
55  using VTraits = viskores::VecTraits<ValueType>;
56  VISKORES_STATIC_ASSERT((std::is_same<typename VTraits::ComponentType, ComponentType>::value));
57  static constexpr viskores::IdComponent NUM_COMPONENTS = VTraits::NUM_COMPONENTS;
58 
59  ComponentPortalType Portals[NUM_COMPONENTS];
60  viskores::Id NumberOfValues;
61 
62 public:
64  VISKORES_EXEC_CONT explicit ArrayPortalSOA(viskores::Id numValues = 0)
65  : NumberOfValues(numValues)
66  {
67  }
68 
70  VISKORES_EXEC_CONT void SetPortal(viskores::IdComponent index, const ComponentPortalType& portal)
71  {
72  this->Portals[index] = portal;
73  }
74 
75  VISKORES_EXEC_CONT viskores::Id GetNumberOfValues() const { return this->NumberOfValues; }
76 
77  template <typename SPT = ComponentPortalType,
78  typename Supported = typename viskores::internal::PortalSupportsGets<SPT>::type,
79  typename = typename std::enable_if<Supported::value>::type>
80  VISKORES_EXEC_CONT ValueType Get(viskores::Id valueIndex) const
81  {
82  return this->Get(valueIndex, viskoresstd::make_index_sequence<NUM_COMPONENTS>());
83  }
84 
85  template <typename SPT = ComponentPortalType,
86  typename Supported = typename viskores::internal::PortalSupportsSets<SPT>::type,
87  typename = typename std::enable_if<Supported::value>::type>
88  VISKORES_EXEC_CONT void Set(viskores::Id valueIndex, const ValueType& value) const
89  {
90  this->Set(valueIndex, value, viskoresstd::make_index_sequence<NUM_COMPONENTS>());
91  }
92 
93 private:
95  template <std::size_t I>
96  VISKORES_EXEC_CONT ComponentType GetComponent(viskores::Id valueIndex) const
97  {
98  return this->Portals[I].Get(valueIndex);
99  }
100 
101  template <std::size_t... I>
102  VISKORES_EXEC_CONT ValueType Get(viskores::Id valueIndex, viskoresstd::index_sequence<I...>) const
103  {
104  return ValueType{ this->GetComponent<I>(valueIndex)... };
105  }
106 
108  template <std::size_t I>
109  VISKORES_EXEC_CONT bool SetComponent(viskores::Id valueIndex, const ValueType& value) const
110  {
111  this->Portals[I].Set(valueIndex,
112  VTraits::GetComponent(value, static_cast<viskores::IdComponent>(I)));
113  return true;
114  }
115 
116  template <std::size_t... I>
117  VISKORES_EXEC_CONT void Set(viskores::Id valueIndex,
118  const ValueType& value,
119  viskoresstd::index_sequence<I...>) const
120  {
121  // Is there a better way to unpack an expression and execute them with no other side effects?
122  (void)std::initializer_list<bool>{ this->SetComponent<I>(valueIndex, value)... };
123  }
124 };
125 
126 } // namespace internal
127 
128 namespace cont
129 {
130 
131 struct VISKORES_ALWAYS_EXPORT StorageTagSOA
132 {
133 };
134 
135 namespace internal
136 {
137 
138 template <typename ComponentType, viskores::IdComponent NUM_COMPONENTS>
139 class VISKORES_ALWAYS_EXPORT
140  Storage<viskores::Vec<ComponentType, NUM_COMPONENTS>, viskores::cont::StorageTagSOA>
141 {
143 
144 public:
145  using ReadPortalType =
146  viskores::internal::ArrayPortalSOA<ValueType,
147  viskores::internal::ArrayPortalBasicRead<ComponentType>>;
148  using WritePortalType =
149  viskores::internal::ArrayPortalSOA<ValueType,
150  viskores::internal::ArrayPortalBasicWrite<ComponentType>>;
151 
152  VISKORES_CONT static std::vector<viskores::cont::internal::Buffer> CreateBuffers()
153  {
154  return std::vector<viskores::cont::internal::Buffer>(static_cast<std::size_t>(NUM_COMPONENTS));
155  }
156 
157  VISKORES_CONT static viskores::IdComponent GetNumberOfComponentsFlat(
158  const std::vector<viskores::cont::internal::Buffer>&)
159  {
160  return viskores::VecFlat<ComponentType>::NUM_COMPONENTS * NUM_COMPONENTS;
161  }
162 
163  VISKORES_CONT static void ResizeBuffers(
164  viskores::Id numValues,
165  const std::vector<viskores::cont::internal::Buffer>& buffers,
166  viskores::CopyFlag preserve,
167  viskores::cont::Token& token)
168  {
169  viskores::BufferSizeType numBytes =
170  viskores::internal::NumberOfValuesToNumberOfBytes<ComponentType>(numValues);
171  for (viskores::IdComponent componentIndex = 0; componentIndex < NUM_COMPONENTS;
172  ++componentIndex)
173  {
174  buffers[componentIndex].SetNumberOfBytes(numBytes, preserve, token);
175  }
176  }
177 
178  VISKORES_CONT static viskores::Id GetNumberOfValues(
179  const std::vector<viskores::cont::internal::Buffer>& buffers)
180  {
181  // Assume all buffers are the same size.
182  return static_cast<viskores::Id>(buffers[0].GetNumberOfBytes()) /
183  static_cast<viskores::Id>(sizeof(ComponentType));
184  }
185 
186  VISKORES_CONT static void Fill(const std::vector<viskores::cont::internal::Buffer>& buffers,
187  const ValueType& fillValue,
188  viskores::Id startIndex,
189  viskores::Id endIndex,
190  viskores::cont::Token& token)
191  {
192  constexpr viskores::BufferSizeType sourceSize =
193  static_cast<viskores::BufferSizeType>(sizeof(ComponentType));
194  viskores::BufferSizeType startByte = startIndex * sourceSize;
195  viskores::BufferSizeType endByte = endIndex * sourceSize;
196  for (viskores::IdComponent componentIndex = 0; componentIndex < NUM_COMPONENTS;
197  ++componentIndex)
198  {
199  ComponentType source = fillValue[componentIndex];
200  buffers[componentIndex].Fill(&source, sourceSize, startByte, endByte, token);
201  }
202  }
203 
204  VISKORES_CONT static ReadPortalType CreateReadPortal(
205  const std::vector<viskores::cont::internal::Buffer>& buffers,
207  viskores::cont::Token& token)
208  {
209  viskores::Id numValues = GetNumberOfValues(buffers);
210  ReadPortalType portal(numValues);
211  for (viskores::IdComponent componentIndex = 0; componentIndex < NUM_COMPONENTS;
212  ++componentIndex)
213  {
214  VISKORES_ASSERT(buffers[0].GetNumberOfBytes() == buffers[componentIndex].GetNumberOfBytes());
215  portal.SetPortal(componentIndex,
216  viskores::internal::ArrayPortalBasicRead<ComponentType>(
217  reinterpret_cast<const ComponentType*>(
218  buffers[componentIndex].ReadPointerDevice(device, token)),
219  numValues));
220  }
221  return portal;
222  }
223 
224  VISKORES_CONT static WritePortalType CreateWritePortal(
225  const std::vector<viskores::cont::internal::Buffer>& buffers,
227  viskores::cont::Token& token)
228  {
229  viskores::Id numValues = GetNumberOfValues(buffers);
230  WritePortalType portal(numValues);
231  for (viskores::IdComponent componentIndex = 0; componentIndex < NUM_COMPONENTS;
232  ++componentIndex)
233  {
234  VISKORES_ASSERT(buffers[0].GetNumberOfBytes() == buffers[componentIndex].GetNumberOfBytes());
235  portal.SetPortal(componentIndex,
236  viskores::internal::ArrayPortalBasicWrite<ComponentType>(
237  reinterpret_cast<ComponentType*>(
238  buffers[componentIndex].WritePointerDevice(device, token)),
239  numValues));
240  }
241  return portal;
242  }
243 };
244 
245 } // namespace internal
246 
264 template <typename T>
265 class ArrayHandleSOA : public ArrayHandle<T, viskores::cont::StorageTagSOA>
266 {
269 
270  using ComponentArrayType =
272 
273 public:
277 
278  ArrayHandleSOA(std::initializer_list<viskores::cont::internal::Buffer>&& componentBuffers)
279  : Superclass(componentBuffers)
280  {
281  }
282 
294  ArrayHandleSOA(const std::array<ComponentArrayType, NUM_COMPONENTS>& componentArrays)
295  {
296  for (viskores::IdComponent componentIndex = 0; componentIndex < NUM_COMPONENTS;
297  ++componentIndex)
298  {
299  this->SetArray(componentIndex, componentArrays[componentIndex]);
300  }
301  }
302 
314  ArrayHandleSOA(const std::vector<ComponentArrayType>& componentArrays)
315  {
316  VISKORES_ASSERT(componentArrays.size() == NUM_COMPONENTS);
317  for (viskores::IdComponent componentIndex = 0; componentIndex < NUM_COMPONENTS;
318  ++componentIndex)
319  {
320  this->SetArray(componentIndex, componentArrays[componentIndex]);
321  }
322  }
323 
335  ArrayHandleSOA(std::initializer_list<ComponentArrayType>&& componentArrays)
336  {
337  VISKORES_ASSERT(componentArrays.size() == NUM_COMPONENTS);
338  viskores::IdComponent componentIndex = 0;
339  for (auto&& array : componentArrays)
340  {
341  this->SetArray(componentIndex, array);
342  ++componentIndex;
343  }
344  }
345 
359  ArrayHandleSOA(std::initializer_list<std::vector<ComponentType>>&& componentVectors)
360  {
361  VISKORES_ASSERT(componentVectors.size() == NUM_COMPONENTS);
362  viskores::IdComponent componentIndex = 0;
363  for (auto&& vector : componentVectors)
364  {
365  // Note, std::vectors that come from std::initializer_list must be copied because the scope
366  // of the objects in the initializer list disappears.
367  this->SetArray(componentIndex,
369  ++componentIndex;
370  }
371  }
372 
389  template <typename Allocator, typename... RemainingVectors>
391  const std::vector<ComponentType, Allocator>& vector0,
392  RemainingVectors&&... componentVectors)
393  : Superclass(std::vector<viskores::cont::internal::Buffer>{
394  viskores::cont::make_ArrayHandle(vector0, copy).GetBuffers()[0],
395  viskores::cont::make_ArrayHandle(std::forward<RemainingVectors>(componentVectors), copy)
396  .GetBuffers()[0]... })
397  {
398  VISKORES_STATIC_ASSERT(sizeof...(RemainingVectors) + 1 == NUM_COMPONENTS);
399  }
400 
420  template <typename... RemainingVectors>
422  std::vector<ComponentType>&& vector0,
423  RemainingVectors&&... componentVectors)
424  : Superclass(std::vector<viskores::cont::internal::Buffer>{
425  viskores::cont::make_ArrayHandle(std::move(vector0), copy),
426  viskores::cont::make_ArrayHandle(std::forward<RemainingVectors>(componentVectors), copy)
427  .GetBuffers()[0]... })
428  {
429  VISKORES_STATIC_ASSERT(sizeof...(RemainingVectors) + 1 == NUM_COMPONENTS);
430  }
431 
443  ArrayHandleSOA(std::initializer_list<const ComponentType*> componentArrays,
444  viskores::Id length,
445  viskores::CopyFlag copy)
446  {
447  VISKORES_ASSERT(componentArrays.size() == NUM_COMPONENTS);
448  viskores::IdComponent componentIndex = 0;
449  for (auto&& vectorIter = componentArrays.begin(); vectorIter != componentArrays.end();
450  ++vectorIter)
451  {
452  this->SetArray(componentIndex, viskores::cont::make_ArrayHandle(*vectorIter, length, copy));
453  ++componentIndex;
454  }
455  }
456 
471  template <typename... RemainingArrays>
473  viskores::CopyFlag copy,
474  const ComponentType* array0,
475  const RemainingArrays&... componentArrays)
476  : Superclass(std::vector<viskores::cont::internal::Buffer>{
477  viskores::cont::make_ArrayHandle(array0, length, copy).GetBuffers()[0],
478  viskores::cont::make_ArrayHandle(componentArrays, length, copy).GetBuffers()[0]... })
479  {
480  VISKORES_STATIC_ASSERT(sizeof...(RemainingArrays) + 1 == NUM_COMPONENTS);
481  }
482 
485  viskores::IdComponent index) const
486  {
487  return ComponentArrayType({ this->GetBuffers()[index] });
488  }
489 
492  {
493  this->SetBuffer(index, array.GetBuffers()[0]);
494  }
495 };
496 
497 namespace internal
498 {
499 
500 template <typename... Remaining>
501 using VecSizeFromRemaining =
502  std::integral_constant<viskores::IdComponent, viskores::IdComponent(sizeof...(Remaining) + 1)>;
503 
504 } // namespace internal
505 
517 template <typename ValueType>
519  std::initializer_list<
521  viskores::cont::StorageTagBasic>>&& componentArrays)
522 {
523  return ArrayHandleSOA<ValueType>(std::move(componentArrays));
524 }
525 
540 template <typename ComponentType, typename... RemainingArrays>
541 VISKORES_CONT ArrayHandleSOA<
542  viskores::Vec<ComponentType, internal::VecSizeFromRemaining<RemainingArrays...>::value>>
545  componentArray0,
546  const RemainingArrays&... componentArrays)
547 {
548  return { componentArray0, componentArrays... };
549 }
550 
564 template <typename ValueType>
566  std::initializer_list<std::vector<typename viskores::VecTraits<ValueType>::ComponentType>>&&
567  componentVectors)
568 {
569  return ArrayHandleSOA<ValueType>(std::move(componentVectors));
570 }
571 
588 template <typename ComponentType, typename... RemainingVectors>
589 VISKORES_CONT ArrayHandleSOA<
590  viskores::Vec<ComponentType, internal::VecSizeFromRemaining<RemainingVectors...>::value>>
592  const std::vector<ComponentType>& vector0,
593  RemainingVectors&&... componentVectors)
594 {
595  // Convert std::vector to ArrayHandle first so that it correctly handles a mix of rvalue args.
596  return { viskores::cont::make_ArrayHandle(vector0, copy),
597  viskores::cont::make_ArrayHandle(std::forward<RemainingVectors>(componentVectors),
598  copy)... };
599 }
600 
620 template <typename ComponentType, typename... RemainingVectors>
621 VISKORES_CONT ArrayHandleSOA<
622  viskores::Vec<ComponentType, internal::VecSizeFromRemaining<RemainingVectors...>::value>>
624  std::vector<ComponentType>&& vector0,
625  RemainingVectors&&... componentVectors)
626 {
627  // Convert std::vector to ArrayHandle first so that it correctly handles a mix of rvalue args.
628  return ArrayHandleSOA<
629  viskores::Vec<ComponentType, internal::VecSizeFromRemaining<RemainingVectors...>::value>>(
630  viskores::cont::make_ArrayHandle(std::move(vector0), copy),
631  viskores::cont::make_ArrayHandle(std::forward<RemainingVectors>(componentVectors), copy)...);
632 }
633 
648 template <typename ComponentType, typename... RemainingVectors>
649 VISKORES_CONT ArrayHandleSOA<
650  viskores::Vec<ComponentType, internal::VecSizeFromRemaining<RemainingVectors...>::value>>
651 make_ArrayHandleSOAMove(std::vector<ComponentType>&& vector0,
652  RemainingVectors&&... componentVectors)
653 {
654  return { viskores::cont::make_ArrayHandleMove(std::move(vector0)),
656  std::forward<RemainingVectors>(componentVectors))... };
657 }
658 
670 template <typename ValueType>
672  std::initializer_list<const typename viskores::VecTraits<ValueType>::ComponentType*>&&
673  componentVectors,
674  viskores::Id length,
675  viskores::CopyFlag copy)
676 {
677  return ArrayHandleSOA<ValueType>(std::move(componentVectors), length, copy);
678 }
679 
693 template <typename ComponentType, typename... RemainingArrays>
694 VISKORES_CONT ArrayHandleSOA<
695  viskores::Vec<ComponentType, internal::VecSizeFromRemaining<RemainingArrays...>::value>>
697  viskores::CopyFlag copy,
698  const ComponentType* array0,
699  const RemainingArrays*... componentArrays)
700 {
701  return ArrayHandleSOA<
702  viskores::Vec<ComponentType, viskores::IdComponent(sizeof...(RemainingArrays) + 1)>>(
703  length, copy, array0, componentArrays...);
704 }
705 
706 namespace internal
707 {
708 
710 
711 template <>
712 struct ArrayExtractComponentImpl<viskores::cont::StorageTagSOA>
713 {
714  template <typename T>
716  viskores::IdComponent componentIndex,
717  viskores::CopyFlag allowCopy) const
718  -> decltype(ArrayExtractComponentImpl<viskores::cont::StorageTagBasic>{}(
720  componentIndex,
721  allowCopy))
722  {
723  using FirstLevelComponentType = typename viskores::VecTraits<T>::ComponentType;
725  constexpr viskores::IdComponent NUM_SUB_COMPONENTS =
727  return ArrayExtractComponentImpl<viskores::cont::StorageTagBasic>{}(
728  array.GetArray(componentIndex / NUM_SUB_COMPONENTS),
729  componentIndex % NUM_SUB_COMPONENTS,
730  allowCopy);
731  }
732 };
733 
735 
736 } // namespace internal
737 
738 }
739 } // namespace viskores::cont
740 
741 //=============================================================================
742 // Specializations of serialization related classes
744 
745 namespace viskores
746 {
747 namespace cont
748 {
749 
750 template <typename ValueType>
751 struct SerializableTypeString<viskores::cont::ArrayHandleSOA<ValueType>>
752 {
753  static VISKORES_CONT const std::string& Get()
754  {
755  static std::string name = "AH_SOA<" + SerializableTypeString<ValueType>::Get() + ">";
756  return name;
757  }
758 };
759 
760 template <typename ValueType>
761 struct SerializableTypeString<viskores::cont::ArrayHandle<ValueType, viskores::cont::StorageTagSOA>>
762  : SerializableTypeString<viskores::cont::ArrayHandleSOA<ValueType>>
763 {
764 };
765 }
766 } // namespace viskores::cont
767 
768 namespace mangled_diy_namespace
769 {
770 
771 template <typename ValueType>
772 struct Serialization<viskores::cont::ArrayHandleSOA<ValueType>>
773 {
775  static constexpr viskores::IdComponent NUM_COMPONENTS =
777 
778  static VISKORES_CONT void save(BinaryBuffer& bb, const BaseType& obj)
779  {
780  for (viskores::IdComponent componentIndex = 0; componentIndex < NUM_COMPONENTS;
781  ++componentIndex)
782  {
783  viskoresdiy::save(bb, obj.GetBuffers()[componentIndex]);
784  }
785  }
786 
787  static VISKORES_CONT void load(BinaryBuffer& bb, BaseType& obj)
788  {
789  std::vector<viskores::cont::internal::Buffer> buffers(NUM_COMPONENTS);
790  for (std::size_t componentIndex = 0; componentIndex < NUM_COMPONENTS; ++componentIndex)
791  {
792  viskoresdiy::load(bb, buffers[componentIndex]);
793  }
794  obj = BaseType(buffers);
795  }
796 };
797 
798 template <typename ValueType>
799 struct Serialization<viskores::cont::ArrayHandle<ValueType, viskores::cont::StorageTagSOA>>
800  : Serialization<viskores::cont::ArrayHandleSOA<ValueType>>
801 {
802 };
803 
804 } // namespace mangled_diy_namespace
805 // @endcond SERIALIZATION
806 
807 //=============================================================================
808 // Precompiled instances
809 
810 #ifndef viskores_cont_ArrayHandleSOA_cxx
811 
813 
814 namespace viskores
815 {
816 namespace cont
817 {
818 
819 #define VISKORES_ARRAYHANDLE_SOA_EXPORT(Type) \
820  extern template class VISKORES_CONT_TEMPLATE_EXPORT \
821  ArrayHandle<viskores::Vec<Type, 2>, StorageTagSOA>; \
822  extern template class VISKORES_CONT_TEMPLATE_EXPORT \
823  ArrayHandle<viskores::Vec<Type, 3>, StorageTagSOA>; \
824  extern template class VISKORES_CONT_TEMPLATE_EXPORT \
825  ArrayHandle<viskores::Vec<Type, 4>, StorageTagSOA>;
826 
827 VISKORES_ARRAYHANDLE_SOA_EXPORT(char)
828 VISKORES_ARRAYHANDLE_SOA_EXPORT(viskores::Int8)
829 VISKORES_ARRAYHANDLE_SOA_EXPORT(viskores::UInt8)
830 VISKORES_ARRAYHANDLE_SOA_EXPORT(viskores::Int16)
831 VISKORES_ARRAYHANDLE_SOA_EXPORT(viskores::UInt16)
832 VISKORES_ARRAYHANDLE_SOA_EXPORT(viskores::Int32)
833 VISKORES_ARRAYHANDLE_SOA_EXPORT(viskores::UInt32)
834 VISKORES_ARRAYHANDLE_SOA_EXPORT(viskores::Int64)
835 VISKORES_ARRAYHANDLE_SOA_EXPORT(viskores::UInt64)
836 VISKORES_ARRAYHANDLE_SOA_EXPORT(viskores::Float32)
837 VISKORES_ARRAYHANDLE_SOA_EXPORT(viskores::Float64)
838 
839 #undef VISKORES_ARRAYHANDLE_SOA_EXPORT
840 }
841 } // namespace viskores::cont
842 
844 
845 #endif // !viskores_cont_ArrayHandleSOA_cxx
846 
847 #endif //viskores_cont_ArrayHandleSOA_h
viskores::exec::arg::load
T load(const U &u, viskores::Id v)
Definition: FetchTagArrayDirectIn.h:44
viskores::cont::ArrayHandleSOA::ArrayHandleSOA
ArrayHandleSOA(viskores::CopyFlag copy, const std::vector< ComponentType, Allocator > &vector0, RemainingVectors &&... componentVectors)
Construct an ArrayHandleSOA from a collection of component arrays.
Definition: ArrayHandleSOA.h:390
viskores::VecFlat
Treat a Vec or Vec-like object as a flat Vec.
Definition: VecFlat.h:240
ArrayHandle.h
ArrayExtractComponent.h
viskores::Int16
int16_t Int16
Base type to use for 16-bit signed integer numbers.
Definition: Types.h:181
viskores::cont::ArrayHandleSOA::SetArray
void SetArray(viskores::IdComponent index, const ComponentArrayType &array)
Replace a component array.
Definition: ArrayHandleSOA.h:491
ArrayPortalHelpers.h
viskores::cont::ArrayHandleSOA::Superclass
typename viskores::cont::detail::GetTypeInParentheses< void(ArrayHandle< T, viskores::cont::StorageTagSOA >) >::type Superclass
Definition: ArrayHandleSOA.h:276
viskores::Int8
int8_t Int8
Base type to use for 8-bit signed integer numbers.
Definition: Types.h:173
viskores::cont::ArrayHandleSOA::ArrayHandleSOA
ArrayHandleSOA(std::initializer_list< viskores::cont::internal::Buffer > &&componentBuffers)
Definition: ArrayHandleSOA.h:278
VISKORES_SUPPRESS_EXEC_WARNINGS
#define VISKORES_SUPPRESS_EXEC_WARNINGS
Definition: ExportMacros.h:61
viskores::cont::ArrayHandle
Manages an array-worth of data.
Definition: ArrayHandle.h:313
viskores::UInt16
uint16_t UInt16
Base type to use for 16-bit unsigned integer numbers.
Definition: Types.h:185
viskores::cont::ArrayHandleSOA::ArrayHandleSOA
ArrayHandleSOA(std::initializer_list< std::vector< ComponentType >> &&componentVectors)
Construct an ArrayHandleSOA from a collection of component arrays.
Definition: ArrayHandleSOA.h:359
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::cont::ArrayHandleSOA::NUM_COMPONENTS
static constexpr viskores::IdComponent NUM_COMPONENTS
Definition: ArrayHandleSOA.h:268
viskores::cont::make_ArrayHandleMove
viskores::cont::ArrayHandleBasic< T > make_ArrayHandleMove(T *&array, viskores::Id numberOfValues, viskores::cont::internal::BufferInfo::Deleter deleter=internal::SimpleArrayDeleter< T >, viskores::cont::internal::BufferInfo::Reallocater reallocater=internal::SimpleArrayReallocater< T >)
A convenience function to move a user-allocated array into an ArrayHandle.
Definition: ArrayHandleBasic.h:310
VISKORES_EXEC_CONT
#define VISKORES_EXEC_CONT
Definition: ExportMacros.h:60
viskores::cont::ArrayHandle< T, viskores::cont::StorageTagSOA >::SetBuffer
void SetBuffer(viskores::IdComponent index, const viskores::cont::internal::Buffer &buffer)
Definition: ArrayHandle.h:751
mangled_diy_namespace
Definition: Particle.h:373
viskores::VecTraits::GetComponent
static const ComponentType & GetComponent(const T &vector, viskores::IdComponent)
Returns the value in a given component of the vector.
Definition: VecTraits.h:125
viskores::Int64
signed long long Int64
Base type to use for 64-bit signed integer numbers.
Definition: Types.h:212
viskores::Id
viskores::Int64 Id
Base type to use to index arrays.
Definition: Types.h:235
ArrayPortalBasic.h
VISKORES_CONT
#define VISKORES_CONT
Definition: ExportMacros.h:65
viskores
Groups connected points that have the same field value.
Definition: Atomic.h:27
viskores::cont::ArrayHandleSOA::ArrayHandleSOA
ArrayHandleSOA(std::initializer_list< ComponentArrayType > &&componentArrays)
Construct an ArrayHandleSOA from a collection of component arrays.
Definition: ArrayHandleSOA.h:335
Math.h
viskores::cont::ArrayHandleSOA::ArrayHandleSOA
ArrayHandleSOA(const std::array< ComponentArrayType, NUM_COMPONENTS > &componentArrays)
Construct an ArrayHandleSOA from a collection of component arrays.
Definition: ArrayHandleSOA.h:294
viskores::CopyFlag::On
@ On
viskores::cont::ArrayHandleSOA::ArrayHandleSOA
ArrayHandleSOA(std::initializer_list< const ComponentType * > componentArrays, viskores::Id length, viskores::CopyFlag copy)
Construct an ArrayHandleSOA from a collection of component arrays.
Definition: ArrayHandleSOA.h:443
viskores::Float32
float Float32
Base type to use for 32-bit floating-point numbers.
Definition: Types.h:165
viskores::VecTraits::NUM_COMPONENTS
static constexpr viskores::IdComponent NUM_COMPONENTS
Number of components in the vector.
Definition: VecTraits.h:93
viskores::VecTraits
Traits that can be queried to treat any type as a Vec.
Definition: VecTraits.h:69
viskores::cont::ArrayHandleBasic
Basic array storage for an array handle.
Definition: ArrayHandleBasic.h:120
VISKORES_ASSERT
#define VISKORES_ASSERT(condition)
Definition: Assert.h:51
viskores::cont::StorageTagSOA
Definition: ArrayHandleSOA.h:131
viskores::BufferSizeType
viskores::Int64 BufferSizeType
Definition: DeviceAdapterMemoryManager.h:35
viskores::cont::ArrayHandleSOA::ArrayHandleSOA
ArrayHandleSOA(const std::vector< ComponentArrayType > &componentArrays)
Construct an ArrayHandleSOA from a collection of component arrays.
Definition: ArrayHandleSOA.h:314
viskores::UInt64
unsigned long long UInt64
Base type to use for 64-bit signed integer numbers.
Definition: Types.h:215
viskores::UInt8
uint8_t UInt8
Base type to use for 8-bit unsigned integer numbers.
Definition: Types.h:177
viskores::cont::DeviceAdapterId
An object used to specify a device.
Definition: DeviceAdapterTag.h:66
viskores::Int32
int32_t Int32
Base type to use for 32-bit signed integer numbers.
Definition: Types.h:189
viskores::cont::ArrayHandleSOA::ComponentType
typename viskores::VecTraits< T >::ComponentType ComponentType
Definition: ArrayHandleSOA.h:267
VISKORES_ARRAY_HANDLE_SUBCLASS
#define VISKORES_ARRAY_HANDLE_SUBCLASS(classname, fullclasstype, superclass)
Macro to make default methods in ArrayHandle subclasses.
Definition: ArrayHandle.h:256
viskores::cont::make_ArrayHandleSOA
ArrayHandleSOA< ValueType > make_ArrayHandleSOA(std::initializer_list< viskores::cont::ArrayHandle< typename viskores::VecTraits< ValueType >::ComponentType, viskores::cont::StorageTagBasic >> &&componentArrays)
Create a viskores::cont::ArrayHandleSOA with an initializer list of array handles.
Definition: ArrayHandleSOA.h:518
viskores::VecTraits::ComponentType
T ComponentType
Type of the components in the vector.
Definition: VecTraits.h:79
viskores::cont::make_ArrayHandleSOAMove
ArrayHandleSOA< viskores::Vec< ComponentType, internal::VecSizeFromRemaining< RemainingVectors... >::value > > make_ArrayHandleSOAMove(std::vector< ComponentType > &&vector0, RemainingVectors &&... componentVectors)
Create a viskores::cont::ArrayHandleSOA with a number of std::vector.
Definition: ArrayHandleSOA.h:651
viskores::cont::ArrayHandleSOA::ComponentArrayType
viskores::cont::ArrayHandle< ComponentType, viskores::cont::StorageTagBasic > ComponentArrayType
Definition: ArrayHandleSOA.h:271
viskores::cont::ArrayHandleSOA::ArrayHandleSOA
ArrayHandleSOA(viskores::Id length, viskores::CopyFlag copy, const ComponentType *array0, const RemainingArrays &... componentArrays)
Construct an ArrayHandleSOA from a collection of component arrays.
Definition: ArrayHandleSOA.h:472
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::ArrayHandleSOA::ArrayHandleSOA
ArrayHandleSOA(viskores::CopyFlag copy, std::vector< ComponentType > &&vector0, RemainingVectors &&... componentVectors)
Construct an ArrayHandleSOA from a collection of component arrays.
Definition: ArrayHandleSOA.h:421
viskores::cont::ArrayHandleSOA::GetArray
viskores::cont::ArrayHandleBasic< ComponentType > GetArray(viskores::IdComponent index) const
Get a basic array representing the component for the given index.
Definition: ArrayHandleSOA.h:484
viskores::CopyFlag
CopyFlag
Identifier used to specify whether a function should deep copy data.
Definition: Flags.h:25
viskores::Float64
double Float64
Base type to use for 64-bit floating-point numbers.
Definition: Types.h:169
viskores::cont::make_ArrayHandle
viskores::cont::ArrayHandleBasic< T > make_ArrayHandle(const T *array, viskores::Id numberOfValues, viskores::CopyFlag copy)
A convenience function for creating an ArrayHandle from a standard C array.
Definition: ArrayHandleBasic.h:285
viskores::Vec
A short fixed-length array.
Definition: Types.h:365
viskores::cont::Token
A token to hold the scope of an ArrayHandle or other object.
Definition: Token.h:43
viskores::cont::ArrayHandle< T, viskores::cont::StorageTagSOA >::GetBuffers
const std::vector< viskores::cont::internal::Buffer > & GetBuffers() const
Returns the internal Buffer structures that hold the data.
Definition: ArrayHandle.h:738
viskores::UInt32
uint32_t UInt32
Base type to use for 32-bit unsigned integer numbers.
Definition: Types.h:193
viskores::cont::ArrayHandleSOA
An ArrayHandle that for Vecs stores each component in a separate physical array.
Definition: ArrayHandleSOA.h:265
VecTraits.h
VISKORES_STATIC_ASSERT
#define VISKORES_STATIC_ASSERT(condition)
Definition: StaticAssert.h:24