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