VTK-m  2.2
ArrayHandleStride.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_ArrayHandleStride_h
11 #define vtk_m_cont_ArrayHandleStride_h
12 
14 #include <vtkm/cont/ErrorBadType.h>
16 
18 
19 namespace vtkm
20 {
21 namespace internal
22 {
23 
24 struct ArrayStrideInfo
25 {
26  vtkm::Id NumberOfValues = 0;
27  vtkm::Id Stride = 1;
28  vtkm::Id Offset = 0;
29  vtkm::Id Modulo = 0;
30  vtkm::Id Divisor = 0;
31 
32  ArrayStrideInfo() = default;
33 
34  ArrayStrideInfo(vtkm::Id numValues,
35  vtkm::Id stride,
36  vtkm::Id offset,
37  vtkm::Id modulo,
38  vtkm::Id divisor)
39  : NumberOfValues(numValues)
40  , Stride(stride)
41  , Offset(offset)
42  , Modulo(modulo)
43  , Divisor(divisor)
44  {
45  }
46 
47  VTKM_EXEC_CONT vtkm::Id ArrayIndex(vtkm::Id index) const
48  {
49  vtkm::Id arrayIndex = index;
50  if (this->Divisor > 1)
51  {
52  arrayIndex = arrayIndex / this->Divisor;
53  }
54  if (this->Modulo > 0)
55  {
56  arrayIndex = arrayIndex % this->Modulo;
57  }
58  arrayIndex = (arrayIndex * this->Stride) + this->Offset;
59  return arrayIndex;
60  }
61 };
62 
63 template <typename T>
64 class ArrayPortalStrideRead
65 {
66  const T* Array = nullptr;
67  ArrayStrideInfo Info;
68 
69 public:
70  ArrayPortalStrideRead() = default;
71  ArrayPortalStrideRead(ArrayPortalStrideRead&&) = default;
72  ArrayPortalStrideRead(const ArrayPortalStrideRead&) = default;
73  ArrayPortalStrideRead& operator=(ArrayPortalStrideRead&&) = default;
74  ArrayPortalStrideRead& operator=(const ArrayPortalStrideRead&) = default;
75 
76  ArrayPortalStrideRead(const T* array, const ArrayStrideInfo& info)
77  : Array(array)
78  , Info(info)
79  {
80  }
81 
82  using ValueType = T;
83 
84  VTKM_EXEC_CONT vtkm::Id GetNumberOfValues() const { return this->Info.NumberOfValues; }
85 
86  VTKM_EXEC_CONT ValueType Get(vtkm::Id index) const
87  {
88  VTKM_ASSERT(index >= 0);
89  VTKM_ASSERT(index < this->GetNumberOfValues());
90 
91  return detail::ArrayPortalBasicReadGet(this->Array + this->Info.ArrayIndex(index));
92  }
93 
94  VTKM_EXEC_CONT const ValueType* GetArray() const { return this->Array; }
95  VTKM_EXEC_CONT const ArrayStrideInfo& GetInfo() const { return this->Info; }
96 };
97 
98 template <typename T>
99 class ArrayPortalStrideWrite
100 {
101  T* Array = nullptr;
102  ArrayStrideInfo Info;
103 
104 public:
105  ArrayPortalStrideWrite() = default;
106  ArrayPortalStrideWrite(ArrayPortalStrideWrite&&) = default;
107  ArrayPortalStrideWrite(const ArrayPortalStrideWrite&) = default;
108  ArrayPortalStrideWrite& operator=(ArrayPortalStrideWrite&&) = default;
109  ArrayPortalStrideWrite& operator=(const ArrayPortalStrideWrite&) = default;
110 
111  ArrayPortalStrideWrite(T* array, const ArrayStrideInfo& info)
112  : Array(array)
113  , Info(info)
114  {
115  }
116 
117  using ValueType = T;
118 
119  VTKM_EXEC_CONT vtkm::Id GetNumberOfValues() const { return this->Info.NumberOfValues; }
120 
121  VTKM_EXEC_CONT ValueType Get(vtkm::Id index) const
122  {
123  VTKM_ASSERT(index >= 0);
124  VTKM_ASSERT(index < this->GetNumberOfValues());
125 
126  return detail::ArrayPortalBasicWriteGet(this->Array + this->Info.ArrayIndex(index));
127  }
128 
129  VTKM_EXEC_CONT void Set(vtkm::Id index, const ValueType& value) const
130  {
131  VTKM_ASSERT(index >= 0);
132  VTKM_ASSERT(index < this->GetNumberOfValues());
133 
134  detail::ArrayPortalBasicWriteSet(this->Array + this->Info.ArrayIndex(index), value);
135  }
136 
137  VTKM_EXEC_CONT ValueType* GetArray() const { return this->Array; }
138  VTKM_EXEC_CONT const ArrayStrideInfo& GetInfo() const { return this->Info; }
139 };
140 
141 }
142 } // namespace vtkm::internal
143 
144 namespace vtkm
145 {
146 namespace cont
147 {
148 
150 {
151 };
152 
153 namespace internal
154 {
155 
156 template <typename T>
158 {
159  using StrideInfo = vtkm::internal::ArrayStrideInfo;
160 
161 public:
162  using ReadPortalType = vtkm::internal::ArrayPortalStrideRead<T>;
163  using WritePortalType = vtkm::internal::ArrayPortalStrideWrite<T>;
164 
165  VTKM_CONT static StrideInfo& GetInfo(const std::vector<vtkm::cont::internal::Buffer>& buffers)
166  {
167  return buffers[0].GetMetaData<StrideInfo>();
168  }
169 
170  VTKM_CONT static vtkm::IdComponent GetNumberOfComponentsFlat(
171  const std::vector<vtkm::cont::internal::Buffer>&)
172  {
174  }
175 
176  VTKM_CONT static vtkm::Id GetNumberOfValues(
177  const std::vector<vtkm::cont::internal::Buffer>& buffers)
178  {
179  return GetInfo(buffers).NumberOfValues;
180  }
181 
182  VTKM_CONT static void ResizeBuffers(vtkm::Id numValues,
183  const std::vector<vtkm::cont::internal::Buffer>& buffers,
184  vtkm::CopyFlag preserve,
185  vtkm::cont::Token& token)
186  {
187  StrideInfo& info = GetInfo(buffers);
188 
189  if (info.NumberOfValues == numValues)
190  {
191  // Array resized to current size. Don't need to do anything.
192  return;
193  }
194 
195  // Find the end index after dealing with the divsor and modulo.
196  auto lengthDivMod = [info](vtkm::Id length) -> vtkm::Id {
197  vtkm::Id resultLength = ((length - 1) / info.Divisor) + 1;
198  if ((info.Modulo > 0) && (info.Modulo < resultLength))
199  {
200  resultLength = info.Modulo;
201  }
202  return resultLength;
203  };
204  vtkm::Id lastStridedIndex = lengthDivMod(numValues);
205 
206  vtkm::Id originalStride;
207  vtkm::Id originalOffset;
208  if (info.Stride > 0)
209  {
210  originalStride = info.Stride;
211  originalOffset = info.Offset;
212  }
213  else
214  {
215  // The stride is negative, which means we are counting backward. Here we have to be careful
216  // about the offset, which should move to push to the end of the array. We also need to
217  // be careful about multiplying by the stride.
218  originalStride = -info.Stride;
219 
220  vtkm::Id originalSize = lengthDivMod(info.NumberOfValues);
221 
222  // Because the stride is negative, we expect the offset to be at the end of the array.
223  // We will call the "real" offset the distance from that end.
224  originalOffset = originalSize - info.Offset - 1;
225  }
226 
227  // If the offset is more than the stride, that means there are values skipped at the
228  // beginning of the array, and it is impossible to know exactly how many. In this case,
229  // we cannot know how to resize. (If this is an issue, we will have to change
230  // `ArrayHandleStride` to take resizing parameters.)
231  if (originalOffset >= originalStride)
232  {
233  if (numValues == 0)
234  {
235  // Array resized to zero. This can happen when releasing resources.
236  // Should we try to clear out the buffers, or avoid that for messing up shared buffers?
237  return;
238  }
240  "Cannot resize stride array with offset greater than stride (start of stride unknown).");
241  }
242 
243  // lastIndex should be the index in the source array after each stride block. Assuming the
244  // offset is inside the first stride, this should be the end of the array regardless of
245  // offset.
246  vtkm::Id lastIndex = lastStridedIndex * originalStride;
247 
248  buffers[1].SetNumberOfBytes(
249  vtkm::internal::NumberOfValuesToNumberOfBytes<T>(lastIndex), preserve, token);
250  info.NumberOfValues = numValues;
251 
252  if (info.Stride < 0)
253  {
254  // As described above, when the stride is negative, we are counting backward. This means
255  // that the offset is actually relative to the end, so we need to adjust it to the new
256  // end of the array.
257  info.Offset = lastIndex - originalOffset - 1;
258  }
259  }
260 
261  VTKM_CONT static void Fill(const std::vector<vtkm::cont::internal::Buffer>& buffers,
262  const T& fillValue,
263  vtkm::Id startIndex,
264  vtkm::Id endIndex,
265  vtkm::cont::Token& token);
266 
267  VTKM_CONT static ReadPortalType CreateReadPortal(
268  const std::vector<vtkm::cont::internal::Buffer>& buffers,
270  vtkm::cont::Token& token)
271  {
272  return ReadPortalType(reinterpret_cast<const T*>(buffers[1].ReadPointerDevice(device, token)),
273  GetInfo(buffers));
274  }
275 
276  VTKM_CONT static WritePortalType CreateWritePortal(
277  const std::vector<vtkm::cont::internal::Buffer>& buffers,
279  vtkm::cont::Token& token)
280  {
281  return WritePortalType(reinterpret_cast<T*>(buffers[1].WritePointerDevice(device, token)),
282  GetInfo(buffers));
283  }
284 
285  static std::vector<vtkm::cont::internal::Buffer> CreateBuffers(
286  const vtkm::cont::internal::Buffer& sourceBuffer = vtkm::cont::internal::Buffer{},
287  vtkm::internal::ArrayStrideInfo&& info = vtkm::internal::ArrayStrideInfo{})
288  {
289  return vtkm::cont::internal::CreateBuffers(info, sourceBuffer);
290  }
291 
292  static vtkm::cont::ArrayHandleBasic<T> GetBasicArray(
293  const std::vector<vtkm::cont::internal::Buffer>& buffers)
294  {
296  }
297 };
298 
299 } // namespace internal
300 
331 template <typename T>
333  : public vtkm::cont::ArrayHandle<T, vtkm::cont::StorageTagStride>
334 {
335 public:
339 
340  ArrayHandleStride(vtkm::Id stride, vtkm::Id offset, vtkm::Id modulo = 0, vtkm::Id divisor = 1)
341  : Superclass(StorageType::CreateBuffers(
342  vtkm::cont::internal::Buffer{},
343  vtkm::internal::ArrayStrideInfo(0, stride, offset, modulo, divisor)))
344  {
345  }
346 
349  vtkm::Id numValues,
350  vtkm::Id stride,
351  vtkm::Id offset,
352  vtkm::Id modulo = 0,
353  vtkm::Id divisor = 1)
354  : Superclass(StorageType::CreateBuffers(
355  array.GetBuffers()[0],
356  vtkm::internal::ArrayStrideInfo(numValues, stride, offset, modulo, divisor)))
357  {
358  }
359 
360  ArrayHandleStride(const vtkm::cont::internal::Buffer& buffer,
361  vtkm::Id numValues,
362  vtkm::Id stride,
363  vtkm::Id offset,
364  vtkm::Id modulo = 0,
365  vtkm::Id divisor = 1)
366  : Superclass(StorageType::CreateBuffers(
367  buffer,
368  vtkm::internal::ArrayStrideInfo(numValues, stride, offset, modulo, divisor)))
369  {
370  }
371 
377  vtkm::Id GetStride() const { return StorageType::GetInfo(this->GetBuffers()).Stride; }
378 
388  vtkm::Id GetOffset() const { return StorageType::GetInfo(this->GetBuffers()).Offset; }
389 
397  vtkm::Id GetModulo() const { return StorageType::GetInfo(this->GetBuffers()).Modulo; }
398 
404  vtkm::Id GetDivisor() const { return StorageType::GetInfo(this->GetBuffers()).Divisor; }
405 
411  {
412  return StorageType::GetBasicArray(this->GetBuffers());
413  }
414 };
415 
418 template <typename T>
421  vtkm::Id numValues,
422  vtkm::Id stride,
423  vtkm::Id offset,
424  vtkm::Id modulo = 0,
425  vtkm::Id divisor = 1)
426 {
427  return { array, numValues, stride, offset, modulo, divisor };
428 }
429 
430 }
431 } // namespace vtkm::cont
432 
433 namespace vtkm
434 {
435 namespace cont
436 {
437 namespace internal
438 {
439 
440 template <typename T>
441 VTKM_CONT inline void Storage<T, vtkm::cont::StorageTagStride>::Fill(
442  const std::vector<vtkm::cont::internal::Buffer>& buffers,
443  const T& fillValue,
444  vtkm::Id startIndex,
445  vtkm::Id endIndex,
446  vtkm::cont::Token& token)
447 {
448  const StrideInfo& info = GetInfo(buffers);
449  vtkm::cont::ArrayHandleBasic<T> basicArray = GetBasicArray(buffers);
450  if ((info.Stride == 1) && (info.Modulo == 0) && (info.Divisor <= 1))
451  {
452  // Standard stride in array allows directly calling fill on the basic array.
453  basicArray.Fill(fillValue, startIndex + info.Offset, endIndex + info.Offset, token);
454  }
455  else
456  {
457  // The fill does not necessarily cover a contiguous region. We have to have a loop
458  // to set it. But we are not allowed to write device code here. Instead, create
459  // a stride array containing the fill value with a modulo of 1 so that this fill
460  // value repeates. Then feed this into a precompiled array copy that supports
461  // stride arrays.
462  const vtkm::Id numFill = endIndex - startIndex;
463  auto fillValueArray = vtkm::cont::make_ArrayHandle({ fillValue });
464  vtkm::cont::ArrayHandleStride<T> constantArray(fillValueArray, numFill, 1, 0, 1, 1);
465  vtkm::cont::ArrayHandleStride<T> outputView(GetBasicArray(buffers),
466  numFill,
467  info.Stride,
468  info.ArrayIndex(startIndex),
469  info.Modulo,
470  info.Divisor);
471  // To prevent circular dependencies, this header file does not actually include
472  // UnknownArrayHandle.h. Thus, it is possible to get a compile error on the following
473  // line for using a declared but not defined `UnknownArrayHandle`. In the unlikely
474  // event this occurs, simply include `vtkm/cont/UnknownArrayHandle.h` somewhere up the
475  // include chain.
476  vtkm::cont::internal::ArrayCopyUnknown(constantArray, outputView);
477  }
478 }
479 
480 }
481 }
482 } // namespace vtkm::cont::internal
483 
484 //=============================================================================
485 // Specializations of serialization related classes
487 namespace vtkm
488 {
489 namespace cont
490 {
491 
492 template <typename T>
493 struct SerializableTypeString<vtkm::cont::ArrayHandleStride<T>>
494 {
495  static VTKM_CONT const std::string& Get()
496  {
497  static std::string name = "AHStride<" + SerializableTypeString<T>::Get() + ">";
498  return name;
499  }
500 };
501 
502 template <typename T>
503 struct SerializableTypeString<vtkm::cont::ArrayHandle<T, vtkm::cont::StorageTagStride>>
504  : SerializableTypeString<vtkm::cont::ArrayHandleStride<T>>
505 {
506 };
507 
508 }
509 } // namespace vtkm::cont
510 
511 namespace mangled_diy_namespace
512 {
513 
514 template <typename T>
515 struct Serialization<vtkm::cont::ArrayHandleStride<T>>
516 {
517 private:
519 
520 public:
521  static VTKM_CONT void save(BinaryBuffer& bb, const BaseType& obj_)
522  {
524  vtkmdiy::save(bb, obj.GetNumberOfValues());
525  vtkmdiy::save(bb, obj.GetStride());
526  vtkmdiy::save(bb, obj.GetOffset());
527  vtkmdiy::save(bb, obj.GetModulo());
528  vtkmdiy::save(bb, obj.GetDivisor());
529  vtkmdiy::save(bb, obj.GetBuffers()[1]);
530  }
531 
532  static VTKM_CONT void load(BinaryBuffer& bb, BaseType& obj)
533  {
534  vtkm::Id numValues;
535  vtkm::Id stride;
536  vtkm::Id offset;
537  vtkm::Id modulo;
538  vtkm::Id divisor;
539  vtkm::cont::internal::Buffer buffer;
540 
541  vtkmdiy::load(bb, numValues);
542  vtkmdiy::load(bb, stride);
543  vtkmdiy::load(bb, offset);
544  vtkmdiy::load(bb, modulo);
545  vtkmdiy::load(bb, divisor);
546  vtkmdiy::load(bb, buffer);
547 
548  obj = vtkm::cont::ArrayHandleStride<T>(buffer, stride, offset, modulo, divisor);
549  }
550 };
551 
552 } // namespace diy
554 
557 #ifndef vtk_m_cont_ArrayHandleStride_cxx
558 
559 namespace vtkm
560 {
561 namespace cont
562 {
563 
564 namespace internal
565 {
566 
567 extern template class VTKM_CONT_TEMPLATE_EXPORT Storage<char, StorageTagStride>;
568 extern template class VTKM_CONT_TEMPLATE_EXPORT Storage<vtkm::Int8, StorageTagStride>;
569 extern template class VTKM_CONT_TEMPLATE_EXPORT Storage<vtkm::UInt8, StorageTagStride>;
570 extern template class VTKM_CONT_TEMPLATE_EXPORT Storage<vtkm::Int16, StorageTagStride>;
571 extern template class VTKM_CONT_TEMPLATE_EXPORT Storage<vtkm::UInt16, StorageTagStride>;
572 extern template class VTKM_CONT_TEMPLATE_EXPORT Storage<vtkm::Int32, StorageTagStride>;
573 extern template class VTKM_CONT_TEMPLATE_EXPORT Storage<vtkm::UInt32, StorageTagStride>;
574 extern template class VTKM_CONT_TEMPLATE_EXPORT Storage<vtkm::Int64, StorageTagStride>;
575 extern template class VTKM_CONT_TEMPLATE_EXPORT Storage<vtkm::UInt64, StorageTagStride>;
576 extern template class VTKM_CONT_TEMPLATE_EXPORT Storage<vtkm::Float32, StorageTagStride>;
577 extern template class VTKM_CONT_TEMPLATE_EXPORT Storage<vtkm::Float64, StorageTagStride>;
578 
579 } // namespace internal
580 
581 extern template class VTKM_CONT_TEMPLATE_EXPORT ArrayHandle<char, StorageTagStride>;
582 extern template class VTKM_CONT_TEMPLATE_EXPORT ArrayHandle<vtkm::Int8, StorageTagStride>;
583 extern template class VTKM_CONT_TEMPLATE_EXPORT ArrayHandle<vtkm::UInt8, StorageTagStride>;
584 extern template class VTKM_CONT_TEMPLATE_EXPORT ArrayHandle<vtkm::Int16, StorageTagStride>;
585 extern template class VTKM_CONT_TEMPLATE_EXPORT ArrayHandle<vtkm::UInt16, StorageTagStride>;
586 extern template class VTKM_CONT_TEMPLATE_EXPORT ArrayHandle<vtkm::Int32, StorageTagStride>;
587 extern template class VTKM_CONT_TEMPLATE_EXPORT ArrayHandle<vtkm::UInt32, StorageTagStride>;
588 extern template class VTKM_CONT_TEMPLATE_EXPORT ArrayHandle<vtkm::Int64, StorageTagStride>;
589 extern template class VTKM_CONT_TEMPLATE_EXPORT ArrayHandle<vtkm::UInt64, StorageTagStride>;
590 extern template class VTKM_CONT_TEMPLATE_EXPORT ArrayHandle<vtkm::Float32, StorageTagStride>;
591 extern template class VTKM_CONT_TEMPLATE_EXPORT ArrayHandle<vtkm::Float64, StorageTagStride>;
592 
593 }
594 } // namespace vtkm::cont
595 
596 #endif //vtk_m_cont_ArrayHandleStride_cxx
597 
599 #endif //vtk_m_cont_ArrayHandleStride_h
vtkm::cont::ArrayHandle< T, vtkm::cont::StorageTagBasic >
vtkm::cont::ArrayHandle< T, vtkm::cont::StorageTagStride >::GetBuffers
const std::vector< vtkm::cont::internal::Buffer > & GetBuffers() const
Returns the internal Buffer structures that hold the data.
Definition: ArrayHandle.h:721
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
VTKM_ASSERT
#define VTKM_ASSERT(condition)
Definition: Assert.h:43
VTKM_EXEC_CONT
#define VTKM_EXEC_CONT
Definition: ExportMacros.h:52
vtkm::cont::StorageTagStride
Definition: ArrayHandleStride.h:149
vtkm::IdComponent
vtkm::Int32 IdComponent
Base type to use to index small lists.
Definition: Types.h:194
vtkm::cont::ArrayHandle< T, vtkm::cont::StorageTagBasic >::Fill
void Fill(const ValueType &fillValue, vtkm::Id startIndex, vtkm::Id endIndex, vtkm::cont::Token &token) const
Fills the array with a given value.
Definition: ArrayHandle.h:554
vtkm::cont::ArrayHandleStride::GetStride
vtkm::Id GetStride() const
Get the stride that values are accessed.
Definition: ArrayHandleStride.h:377
ArrayHandleBasic.h
vtkm::cont::ArrayHandleStride::GetOffset
vtkm::Id GetOffset() const
Get the offset to start reading values.
Definition: ArrayHandleStride.h:388
vtkm::cont::ArrayHandle< T, vtkm::cont::StorageTagStride >::GetNumberOfValues
vtkm::Id GetNumberOfValues() const
Returns the number of entries in the array.
Definition: ArrayHandle.h:468
mangled_diy_namespace
Definition: Particle.h:351
vtkm::cont::ArrayHandleStride
An ArrayHandle that accesses a basic array with strides and offsets.
Definition: ArrayHandleStride.h:332
vtkm::cont::ArrayHandleStride::Superclass
typename vtkm::cont::detail::GetTypeInParentheses< void(ArrayHandle< T, vtkm::cont::StorageTagStride >) >::type Superclass
Definition: ArrayHandleStride.h:338
vtkm::cont::make_ArrayHandleStride
vtkm::cont::ArrayHandleStride< T > make_ArrayHandleStride(const vtkm::cont::ArrayHandle< T, vtkm::cont::StorageTagBasic > &array, vtkm::Id numValues, vtkm::Id stride, vtkm::Id offset, vtkm::Id modulo=0, vtkm::Id divisor=1)
Create an array by adding a stride to a basic array.
Definition: ArrayHandleStride.h:419
vtkm::cont::Token
A token to hold the scope of an ArrayHandle or other object.
Definition: Token.h:35
vtkm::cont::LogLevel::Info
@ Info
Information messages (detected hardware, etc) and temporary debugging output.
ArrayPortalBasic.h
vtkm::cont::ArrayHandleStride::GetDivisor
vtkm::Id GetDivisor() const
Get the divisor of the array index.
Definition: ArrayHandleStride.h:404
vtkm::cont::ArrayHandleStride::GetBasicArray
vtkm::cont::ArrayHandleBasic< T > GetBasicArray() const
Return the underlying data as a basic array handle.
Definition: ArrayHandleStride.h:410
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::VecFlat
Treat a Vec or Vec-like object as a flat Vec.
Definition: VecFlat.h:224
vtkm::cont::ArrayHandleStride::StorageType
typename Superclass::StorageType StorageType
Definition: ArrayHandleStride.h:338
vtkm::cont::ArrayHandleStride::GetModulo
vtkm::Id GetModulo() const
Get the modulus of the array index.
Definition: ArrayHandleStride.h:397
vtkm::cont::DeviceAdapterId
An object used to specify a device.
Definition: DeviceAdapterTag.h:58
VTKM_CONT_TEMPLATE_EXPORT
#define VTKM_CONT_TEMPLATE_EXPORT
Definition: vtkm_cont_export.h:62
vtkm::cont::ErrorBadAllocation
This class is thrown when VTK-m attempts to manipulate memory that it should not.
Definition: ErrorBadAllocation.h:25
vtkm::cont::ArrayHandleStride::ArrayHandleStride
ArrayHandleStride(const vtkm::cont::ArrayHandle< T, vtkm::cont::StorageTagBasic > &array, vtkm::Id numValues, vtkm::Id stride, vtkm::Id offset, vtkm::Id modulo=0, vtkm::Id divisor=1)
Construct an ArrayHandleStride from a basic array with specified access patterns.
Definition: ArrayHandleStride.h:348
vtkm::cont::ArrayHandleStride::ArrayHandleStride
ArrayHandleStride(vtkm::Id stride, vtkm::Id offset, vtkm::Id modulo=0, vtkm::Id divisor=1)
Definition: ArrayHandleStride.h:340
vtkm::CopyFlag
CopyFlag
Identifier used to specify whether a function should deep copy data.
Definition: Flags.h:17
Offset
vtkm::Float32 Offset
Definition: Wireframer.h:393
vtkm::cont::ArrayHandleBasic
Basic array storage for an array handle.
Definition: ArrayHandleBasic.h:111
VTKM_ALWAYS_EXPORT
#define VTKM_ALWAYS_EXPORT
Definition: ExportMacros.h:89
ArrayCopyUnknown.h
ErrorBadType.h
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::cont::ArrayHandleStride::ArrayHandleStride
ArrayHandleStride(const vtkm::cont::internal::Buffer &buffer, vtkm::Id numValues, vtkm::Id stride, vtkm::Id offset, vtkm::Id modulo=0, vtkm::Id divisor=1)
Definition: ArrayHandleStride.h:360