Viskores  1.0
ArrayHandleCartesianProduct.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_ArrayHandleCartesianProduct_h
19 #define viskores_cont_ArrayHandleCartesianProduct_h
20 
21 #include <viskores/Assert.h>
22 #include <viskores/Range.h>
23 #include <viskores/VecTraits.h>
24 
28 #include <viskores/cont/Token.h>
29 
30 #include <array>
31 
32 namespace viskores
33 {
34 namespace internal
35 {
36 
39 template <typename ValueType_,
40  typename PortalTypeFirst_,
41  typename PortalTypeSecond_,
42  typename PortalTypeThird_>
43 class VISKORES_ALWAYS_EXPORT ArrayPortalCartesianProduct
44 {
45 public:
46  using ValueType = ValueType_;
47  using IteratorType = ValueType_;
48  using PortalTypeFirst = PortalTypeFirst_;
49  using PortalTypeSecond = PortalTypeSecond_;
50  using PortalTypeThird = PortalTypeThird_;
51 
52  using set_supported_p1 = viskores::internal::PortalSupportsSets<PortalTypeFirst>;
53  using set_supported_p2 = viskores::internal::PortalSupportsSets<PortalTypeSecond>;
54  using set_supported_p3 = viskores::internal::PortalSupportsSets<PortalTypeThird>;
55 
56  using Writable = std::integral_constant<bool,
57  set_supported_p1::value && set_supported_p2::value &&
58  set_supported_p3::value>;
59 
62  ArrayPortalCartesianProduct()
63  : PortalFirst()
64  , PortalSecond()
65  , PortalThird()
66  {
67  } //needs to be host and device so that cuda can create lvalue of these
68 
70  ArrayPortalCartesianProduct(const PortalTypeFirst& portalfirst,
71  const PortalTypeSecond& portalsecond,
72  const PortalTypeThird& portalthird)
73  : PortalFirst(portalfirst)
74  , PortalSecond(portalsecond)
75  , PortalThird(portalthird)
76  {
77  }
78 
83 
84  template <class OtherV, class OtherP1, class OtherP2, class OtherP3>
85  VISKORES_CONT ArrayPortalCartesianProduct(
86  const ArrayPortalCartesianProduct<OtherV, OtherP1, OtherP2, OtherP3>& src)
87  : PortalFirst(src.GetPortalFirst())
88  , PortalSecond(src.GetPortalSecond())
89  , PortalThird(src.GetPortalThird())
90  {
91  }
92 
95  viskores::Id GetNumberOfValues() const
96  {
97  return this->PortalFirst.GetNumberOfValues() * this->PortalSecond.GetNumberOfValues() *
98  this->PortalThird.GetNumberOfValues();
99  }
100 
103  ValueType Get(viskores::Id index) const
104  {
105  VISKORES_ASSERT(index >= 0);
106  VISKORES_ASSERT(index < this->GetNumberOfValues());
107 
108  viskores::Id dim1 = this->PortalFirst.GetNumberOfValues();
109  viskores::Id dim2 = this->PortalSecond.GetNumberOfValues();
110  viskores::Id dim12 = dim1 * dim2;
111  viskores::Id idx12 = index % dim12;
112  viskores::Id i1 = idx12 % dim1;
113  viskores::Id i2 = idx12 / dim1;
114  viskores::Id i3 = index / dim12;
115 
116  return viskores::make_Vec(
117  this->PortalFirst.Get(i1), this->PortalSecond.Get(i2), this->PortalThird.Get(i3));
118  }
119 
120 
122  template <typename Writable_ = Writable,
123  typename = typename std::enable_if<Writable_::value>::type>
124  VISKORES_EXEC_CONT void Set(viskores::Id index, const ValueType& value) const
125  {
126  VISKORES_ASSERT(index >= 0);
127  VISKORES_ASSERT(index < this->GetNumberOfValues());
128 
129  viskores::Id dim1 = this->PortalFirst.GetNumberOfValues();
130  viskores::Id dim2 = this->PortalSecond.GetNumberOfValues();
131  viskores::Id dim12 = dim1 * dim2;
132  viskores::Id idx12 = index % dim12;
133 
134  viskores::Id i1 = idx12 % dim1;
135  viskores::Id i2 = idx12 / dim1;
136  viskores::Id i3 = index / dim12;
137 
138  this->PortalFirst.Set(i1, value[0]);
139  this->PortalSecond.Set(i2, value[1]);
140  this->PortalThird.Set(i3, value[2]);
141  }
142 
145  const PortalTypeFirst& GetFirstPortal() const { return this->PortalFirst; }
146 
149  const PortalTypeSecond& GetSecondPortal() const { return this->PortalSecond; }
150 
153  const PortalTypeThird& GetThirdPortal() const { return this->PortalThird; }
154 
155 private:
156  PortalTypeFirst PortalFirst;
157  PortalTypeSecond PortalSecond;
158  PortalTypeThird PortalThird;
159 };
160 }
161 } // namespace viskores::internal
162 
163 namespace viskores
164 {
165 namespace cont
166 {
167 
168 template <typename StorageTag1, typename StorageTag2, typename StorageTag3>
169 struct VISKORES_ALWAYS_EXPORT StorageTagCartesianProduct
170 {
171 };
172 
173 namespace internal
174 {
175 
179 template <typename AH1, typename AH2, typename AH3>
180 struct ArrayHandleCartesianProductTraits
181 {
185 
186  using ComponentType = typename AH1::ValueType;
188  (std::is_same<ComponentType, typename AH2::ValueType>::value),
189  "All arrays for ArrayHandleCartesianProduct must have the same value type. "
190  "Use ArrayHandleCast as necessary to make types match.");
192  (std::is_same<ComponentType, typename AH3::ValueType>::value),
193  "All arrays for ArrayHandleCartesianProduct must have the same value type. "
194  "Use ArrayHandleCast as necessary to make types match.");
195 
198  using ValueType = viskores::Vec<ComponentType, 3>;
199 
202  using Tag = viskores::cont::StorageTagCartesianProduct<typename AH1::StorageTag,
203  typename AH2::StorageTag,
204  typename AH3::StorageTag>;
205 
209 };
210 
211 template <typename T, typename ST1, typename ST2, typename ST3>
212 class Storage<viskores::Vec<T, 3>, viskores::cont::StorageTagCartesianProduct<ST1, ST2, ST3>>
213 {
214  struct Info
215  {
216  std::array<std::size_t, 4> BufferOffset;
217  };
218 
219  using Storage1 = viskores::cont::internal::Storage<T, ST1>;
220  using Storage2 = viskores::cont::internal::Storage<T, ST2>;
221  using Storage3 = viskores::cont::internal::Storage<T, ST3>;
222 
226 
227  VISKORES_CONT static std::vector<viskores::cont::internal::Buffer> GetBuffers(
228  const std::vector<viskores::cont::internal::Buffer>& buffers,
229  std::size_t subArray)
230  {
231  Info info = buffers[0].GetMetaData<Info>();
232  return std::vector<viskores::cont::internal::Buffer>(
233  buffers.begin() + info.BufferOffset[subArray - 1],
234  buffers.begin() + info.BufferOffset[subArray]);
235  }
236 
237 public:
239 
240  using ReadPortalType =
241  viskores::internal::ArrayPortalCartesianProduct<viskores::Vec<T, 3>,
242  typename Storage1::ReadPortalType,
243  typename Storage2::ReadPortalType,
244  typename Storage3::ReadPortalType>;
245  using WritePortalType =
246  viskores::internal::ArrayPortalCartesianProduct<viskores::Vec<T, 3>,
247  typename Storage1::WritePortalType,
248  typename Storage2::WritePortalType,
249  typename Storage3::WritePortalType>;
250 
251  VISKORES_CONT static viskores::IdComponent GetNumberOfComponentsFlat(
252  const std::vector<viskores::cont::internal::Buffer>&)
253  {
255  }
256 
257  VISKORES_CONT static viskores::Id GetNumberOfValues(
258  const std::vector<viskores::cont::internal::Buffer>& buffers)
259  {
260  return (Storage1::GetNumberOfValues(GetBuffers(buffers, 1)) *
261  Storage2::GetNumberOfValues(GetBuffers(buffers, 2)) *
262  Storage3::GetNumberOfValues(GetBuffers(buffers, 3)));
263  }
264 
265  VISKORES_CONT static void Fill(const std::vector<viskores::cont::internal::Buffer>& buffers,
266  const viskores::Vec<T, 3>& fillValue,
267  viskores::Id startIndex,
268  viskores::Id endIndex,
269  viskores::cont::Token& token)
270  {
271  if ((startIndex != 0) || (endIndex != GetNumberOfValues(buffers)))
272  {
274  "Fill for ArrayHandleCartesianProduct can only be used to fill entire array.");
275  }
276  auto subBuffers = GetBuffers(buffers, 1);
277  Storage1::Fill(subBuffers, fillValue[0], 0, Storage1::GetNumberOfValues(subBuffers), token);
278  subBuffers = GetBuffers(buffers, 2);
279  Storage2::Fill(subBuffers, fillValue[1], 0, Storage2::GetNumberOfValues(subBuffers), token);
280  subBuffers = GetBuffers(buffers, 3);
281  Storage3::Fill(subBuffers, fillValue[2], 0, Storage3::GetNumberOfValues(subBuffers), token);
282  }
283 
284  VISKORES_CONT static ReadPortalType CreateReadPortal(
285  const std::vector<viskores::cont::internal::Buffer>& buffers,
287  viskores::cont::Token& token)
288  {
289  return ReadPortalType(Storage1::CreateReadPortal(GetBuffers(buffers, 1), device, token),
290  Storage2::CreateReadPortal(GetBuffers(buffers, 2), device, token),
291  Storage3::CreateReadPortal(GetBuffers(buffers, 3), device, token));
292  }
293 
294  VISKORES_CONT static WritePortalType CreateWritePortal(
295  const std::vector<viskores::cont::internal::Buffer>& buffers,
297  viskores::cont::Token& token)
298  {
299  return WritePortalType(Storage1::CreateWritePortal(GetBuffers(buffers, 1), device, token),
300  Storage2::CreateWritePortal(GetBuffers(buffers, 2), device, token),
301  Storage3::CreateWritePortal(GetBuffers(buffers, 3), device, token));
302  }
303 
304  VISKORES_CONT static Array1 GetArrayHandle1(
305  const std::vector<viskores::cont::internal::Buffer>& buffers)
306  {
307  return Array1(GetBuffers(buffers, 1));
308  }
309  VISKORES_CONT static Array2 GetArrayHandle2(
310  const std::vector<viskores::cont::internal::Buffer>& buffers)
311  {
312  return Array2(GetBuffers(buffers, 2));
313  }
314  VISKORES_CONT static Array3 GetArrayHandle3(
315  const std::vector<viskores::cont::internal::Buffer>& buffers)
316  {
317  return Array3(GetBuffers(buffers, 3));
318  }
319 
320  VISKORES_CONT static std::vector<viskores::cont::internal::Buffer> CreateBuffers(
321  const Array1& array1 = Array1{},
322  const Array2& array2 = Array2{},
323  const Array3& array3 = Array3{})
324  {
325  const std::vector<viskores::cont::internal::Buffer>& buffers1 = array1.GetBuffers();
326  const std::vector<viskores::cont::internal::Buffer>& buffers2 = array2.GetBuffers();
327  const std::vector<viskores::cont::internal::Buffer>& buffers3 = array3.GetBuffers();
328 
329  Info info;
330  info.BufferOffset[0] = 1;
331  info.BufferOffset[1] = info.BufferOffset[0] + buffers1.size();
332  info.BufferOffset[2] = info.BufferOffset[1] + buffers2.size();
333  info.BufferOffset[3] = info.BufferOffset[2] + buffers3.size();
334 
335  return viskores::cont::internal::CreateBuffers(info, buffers1, buffers2, buffers3);
336  }
337 };
338 } // namespace internal
339 
344 template <typename FirstHandleType, typename SecondHandleType, typename ThirdHandleType>
346  : public internal::ArrayHandleCartesianProductTraits<FirstHandleType,
347  SecondHandleType,
348  ThirdHandleType>::Superclass
349 {
350  // If the following line gives a compile error, then the FirstHandleType
351  // template argument is not a valid ArrayHandle type.
352  VISKORES_IS_ARRAY_HANDLE(FirstHandleType);
353  VISKORES_IS_ARRAY_HANDLE(SecondHandleType);
354  VISKORES_IS_ARRAY_HANDLE(ThirdHandleType);
355 
356 public:
360  (typename internal::ArrayHandleCartesianProductTraits<FirstHandleType,
361  SecondHandleType,
362  ThirdHandleType>::Superclass));
363 
367  ArrayHandleCartesianProduct(const FirstHandleType& firstArray,
368  const SecondHandleType& secondArray,
369  const ThirdHandleType& thirdArray)
370  : Superclass(StorageType::CreateBuffers(firstArray, secondArray, thirdArray))
371  {
372  }
373 
380 
382  VISKORES_CONT FirstHandleType GetFirstArray() const
383  {
384  return StorageType::GetArrayHandle1(this->GetBuffers());
385  }
387  VISKORES_CONT SecondHandleType GetSecondArray() const
388  {
389  return StorageType::GetArrayHandle2(this->GetBuffers());
390  }
392  VISKORES_CONT ThirdHandleType GetThirdArray() const
393  {
394  return StorageType::GetArrayHandle3(this->GetBuffers());
395  }
396 };
397 
401 template <typename FirstHandleType, typename SecondHandleType, typename ThirdHandleType>
404  make_ArrayHandleCartesianProduct(const FirstHandleType& first,
405  const SecondHandleType& second,
406  const ThirdHandleType& third)
407 {
409  first, second, third);
410 }
411 
412 //--------------------------------------------------------------------------------
413 // Specialization of ArrayExtractComponent
414 namespace internal
415 {
416 
417 // Superclass will inherit the ArrayExtractComponentImplInefficient property if any
418 // of the sub-storage are inefficient (thus making everything inefficient).
419 template <typename... STs>
420 struct ArrayExtractComponentImpl<viskores::cont::StorageTagCartesianProduct<STs...>>
421  : viskores::cont::internal::ArrayExtractComponentImplInherit<STs...>
422 {
423  template <typename T>
424  viskores::cont::ArrayHandleStride<T> AdjustStrideForComponent(
425  const viskores::cont::ArrayHandleStride<T>& componentArray,
426  const viskores::Id3& dims,
427  viskores::IdComponent component,
428  viskores::Id totalNumValues) const
429  {
430  VISKORES_ASSERT(componentArray.GetModulo() == 0);
431  VISKORES_ASSERT(componentArray.GetDivisor() == 1);
432 
433  viskores::Id modulo = 0;
434  if (component < 2)
435  {
436  modulo = dims[component];
437  }
438 
439  viskores::Id divisor = 1;
440  for (viskores::IdComponent c = 0; c < component; ++c)
441  {
442  divisor *= dims[c];
443  }
444 
445  return viskores::cont::ArrayHandleStride<T>(componentArray.GetBasicArray(),
446  totalNumValues,
447  componentArray.GetStride(),
448  componentArray.GetOffset(),
449  modulo,
450  divisor);
451  }
452 
453  template <typename T, typename ST, typename CartesianArrayType>
455  GetStrideForComponentArray(const viskores::cont::ArrayHandle<T, ST>& componentArray,
456  const CartesianArrayType& cartesianArray,
457  viskores::IdComponent subIndex,
458  viskores::IdComponent productIndex,
459  viskores::CopyFlag allowCopy) const
460  {
462  strideArray = ArrayExtractComponentImpl<ST>{}(componentArray, subIndex, allowCopy);
463  if ((strideArray.GetModulo() != 0) || (strideArray.GetDivisor() != 1))
464  {
465  // If the sub array has its own modulo and/or divisor, that will likely interfere
466  // with this math. Give up and fall back to simple copy.
467  constexpr viskores::IdComponent NUM_SUB_COMPONENTS = viskores::VecFlat<T>::NUM_COMPONENTS;
468  return viskores::cont::internal::ArrayExtractComponentFallback(
469  cartesianArray, (productIndex * NUM_SUB_COMPONENTS) + subIndex, allowCopy);
470  }
471 
472  viskores::Id3 dims = { cartesianArray.GetFirstArray().GetNumberOfValues(),
473  cartesianArray.GetSecondArray().GetNumberOfValues(),
474  cartesianArray.GetThirdArray().GetNumberOfValues() };
475 
476  return this->AdjustStrideForComponent(
477  strideArray, dims, productIndex, cartesianArray.GetNumberOfValues());
478  }
479 
480  template <typename T>
484  viskores::IdComponent componentIndex,
485  viskores::CopyFlag allowCopy) const
486  {
488  constexpr viskores::IdComponent NUM_SUB_COMPONENTS = viskores::VecFlat<T>::NUM_COMPONENTS;
489  viskores::IdComponent subIndex = componentIndex % NUM_SUB_COMPONENTS;
490  viskores::IdComponent productIndex = componentIndex / NUM_SUB_COMPONENTS;
491 
492  switch (productIndex)
493  {
494  case 0:
495  return this->GetStrideForComponentArray(
496  array.GetFirstArray(), array, subIndex, productIndex, allowCopy);
497  case 1:
498  return this->GetStrideForComponentArray(
499  array.GetSecondArray(), array, subIndex, productIndex, allowCopy);
500  case 2:
501  return this->GetStrideForComponentArray(
502  array.GetThirdArray(), array, subIndex, productIndex, allowCopy);
503  default:
504  throw viskores::cont::ErrorBadValue("Invalid component index to ArrayExtractComponent.");
505  }
506  }
507 };
508 
509 template <typename T, typename S>
510 viskores::cont::ArrayHandle<viskores::Range> ArrayRangeComputeGeneric(
513  bool computeFiniteRange,
515 
516 template <typename S>
517 struct ArrayRangeComputeImpl;
518 
519 template <typename ST1, typename ST2, typename ST3>
520 struct VISKORES_CONT_EXPORT
521  ArrayRangeComputeImpl<viskores::cont::StorageTagCartesianProduct<ST1, ST2, ST3>>
522 {
523  template <typename T>
527  input_,
529  bool computeFiniteRange,
530  viskores::cont::DeviceAdapterId device) const
531  {
532  if (maskArray.GetNumberOfValues() != 0)
533  {
534  return viskores::cont::internal::ArrayRangeComputeGeneric(
535  input_, maskArray, computeFiniteRange, device);
536  }
537 
538  const auto& input = static_cast<
542  input_);
543 
545  ranges[0] = viskores::cont::internal::ArrayRangeComputeImpl<ST1>{}(
546  input.GetFirstArray(), maskArray, computeFiniteRange, device);
547  ranges[1] = viskores::cont::internal::ArrayRangeComputeImpl<ST2>{}(
548  input.GetSecondArray(), maskArray, computeFiniteRange, device);
549  ranges[2] = viskores::cont::internal::ArrayRangeComputeImpl<ST3>{}(
550  input.GetThirdArray(), maskArray, computeFiniteRange, device);
551 
552  auto numComponents =
553  ranges[0].GetNumberOfValues() + ranges[1].GetNumberOfValues() + ranges[2].GetNumberOfValues();
555  result.Allocate(numComponents);
556  auto resultPortal = result.WritePortal();
557  for (viskores::Id i = 0, index = 0; i < 3; ++i)
558  {
559  auto rangePortal = ranges[i].ReadPortal();
560  for (viskores::Id j = 0; j < rangePortal.GetNumberOfValues(); ++j, ++index)
561  {
562  resultPortal.Set(index, rangePortal.Get(j));
563  }
564  }
565  return result;
566  }
567 };
568 
569 } // namespace internal
570 
571 }
572 } // namespace viskores::cont
573 
574 //=============================================================================
575 // Specializations of serialization related classes
577 namespace viskores
578 {
579 namespace cont
580 {
581 
582 template <typename AH1, typename AH2, typename AH3>
583 struct SerializableTypeString<viskores::cont::ArrayHandleCartesianProduct<AH1, AH2, AH3>>
584 {
585  static VISKORES_CONT const std::string& Get()
586  {
587  static std::string name = "AH_CartesianProduct<" + SerializableTypeString<AH1>::Get() + "," +
589  return name;
590  }
591 };
592 
593 template <typename T, typename ST1, typename ST2, typename ST3>
594 struct SerializableTypeString<
595  viskores::cont::ArrayHandle<viskores::Vec<T, 3>,
596  viskores::cont::StorageTagCartesianProduct<ST1, ST2, ST3>>>
597  : SerializableTypeString<
598  viskores::cont::ArrayHandleCartesianProduct<viskores::cont::ArrayHandle<T, ST1>,
599  viskores::cont::ArrayHandle<T, ST2>,
600  viskores::cont::ArrayHandle<T, ST3>>>
601 {
602 };
603 }
604 } // viskores::cont
605 
606 namespace mangled_diy_namespace
607 {
608 
609 template <typename AH1, typename AH2, typename AH3>
610 struct Serialization<viskores::cont::ArrayHandleCartesianProduct<AH1, AH2, AH3>>
611 {
612 private:
615 
616 public:
617  static VISKORES_CONT void save(BinaryBuffer& bb, const BaseType& obj)
618  {
619  Type array = obj;
620  viskoresdiy::save(bb, array.GetFirstArray());
621  viskoresdiy::save(bb, array.GetSecondArray());
622  viskoresdiy::save(bb, array.GetThirdArray());
623  }
624 
625  static VISKORES_CONT void load(BinaryBuffer& bb, BaseType& obj)
626  {
627  AH1 array1;
628  AH2 array2;
629  AH3 array3;
630 
631  viskoresdiy::load(bb, array1);
632  viskoresdiy::load(bb, array2);
633  viskoresdiy::load(bb, array3);
634 
635  obj = viskores::cont::make_ArrayHandleCartesianProduct(array1, array2, array3);
636  }
637 };
638 
639 template <typename T, typename ST1, typename ST2, typename ST3>
640 struct Serialization<
641  viskores::cont::ArrayHandle<viskores::Vec<T, 3>,
642  viskores::cont::StorageTagCartesianProduct<ST1, ST2, ST3>>>
643  : Serialization<viskores::cont::ArrayHandleCartesianProduct<viskores::cont::ArrayHandle<T, ST1>,
644  viskores::cont::ArrayHandle<T, ST2>,
645  viskores::cont::ArrayHandle<T, ST3>>>
646 {
647 };
648 } // diy
650 
651 #endif //viskores_cont_ArrayHandleCartesianProduct_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::ArrayHandle::StorageType
viskores::cont::internal::Storage< ValueType, StorageTag > StorageType
Definition: ArrayHandle.h:322
ErrorBadAllocation.h
viskores::cont::ArrayHandleCartesianProduct::GetSecondArray
SecondHandleType GetSecondArray() const
Get the array for the coordinates in the y direction.
Definition: ArrayHandleCartesianProduct.h:387
ArrayHandle.h
ArrayExtractComponent.h
viskores::cont::ArrayHandle::ReadPortal
ReadPortalType ReadPortal() const
Get an array portal that can be used in the control environment.
Definition: ArrayHandle.h:447
viskores::cont::ArrayHandleCartesianProduct::GetFirstArray
FirstHandleType GetFirstArray() const
Get the array for the coordinates in the x direction.
Definition: ArrayHandleCartesianProduct.h:382
VISKORES_IS_ARRAY_HANDLE
#define VISKORES_IS_ARRAY_HANDLE(T)
Checks that the given type is a viskores::cont::ArrayHandle.
Definition: ArrayHandle.h:145
viskores::cont::ArrayHandleCartesianProduct::Superclass
typename viskores::cont::detail::GetTypeInParentheses< void(typename internal::ArrayHandleCartesianProductTraits< FirstHandleType, SecondHandleType, ThirdHandleType >::Superclass) >::type Superclass
Definition: ArrayHandleCartesianProduct.h:362
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
Assert.h
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
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::Vec< T, 3 >
Definition: Types.h:1025
viskores::Id
viskores::Int64 Id
Base type to use to index arrays.
Definition: Types.h:235
VISKORES_CONT
#define VISKORES_CONT
Definition: ExportMacros.h:65
viskores
Groups connected points that have the same field value.
Definition: Atomic.h:27
VISKORES_STORAGE_NO_RESIZE
#define VISKORES_STORAGE_NO_RESIZE
Definition: Storage.h:194
viskores::cont::make_ArrayHandleCartesianProduct
viskores::cont::ArrayHandleCartesianProduct< FirstHandleType, SecondHandleType, ThirdHandleType > make_ArrayHandleCartesianProduct(const FirstHandleType &first, const SecondHandleType &second, const ThirdHandleType &third)
A convenience function for creating an ArrayHandleCartesianProduct.
Definition: ArrayHandleCartesianProduct.h:404
viskores::cont::ArrayHandleStride::GetDivisor
viskores::Id GetDivisor() const
Get the divisor of the array index.
Definition: ArrayHandleStride.h:418
viskores::cont::ArrayHandle::Allocate
void Allocate(viskores::Id numberOfValues, viskores::CopyFlag preserve, viskores::cont::Token &token) const
Allocates an array large enough to hold the given number of values.
Definition: ArrayHandle.h:504
viskores::cont::ArrayHandleStride::GetOffset
viskores::Id GetOffset() const
Get the offset to start reading values.
Definition: ArrayHandleStride.h:402
Range.h
viskores::cont::ArrayHandle::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::ArrayHandle::WritePortal
WritePortalType WritePortal() const
Get an array portal that can be used in the control environment.
Definition: ArrayHandle.h:468
viskores::make_Vec
constexpr viskores::Vec< T, viskores::IdComponent(sizeof...(Ts)+1)> make_Vec(T value0, Ts &&... args)
Initializes and returns a Vec containing all the arguments.
Definition: Types.h:1262
VISKORES_STATIC_ASSERT_MSG
#define VISKORES_STATIC_ASSERT_MSG(condition, message)
Definition: StaticAssert.h:26
viskores::cont::DeviceAdapterId
An object used to specify a device.
Definition: DeviceAdapterTag.h:66
viskores::cont::ErrorBadValue
This class is thrown when a Viskores function or method encounters an invalid value that inhibits pro...
Definition: ErrorBadValue.h:33
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::StorageTagCartesianProduct
Definition: ArrayHandleCartesianProduct.h:169
viskores::cont::ArrayHandleCartesianProduct
ArrayHandleCartesianProduct is a specialization of ArrayHandle.
Definition: ArrayHandleCartesianProduct.h:345
viskores::cont::ArrayHandleCartesianProduct::GetThirdArray
ThirdHandleType GetThirdArray() const
Get the array for the coordinates in the z direction.
Definition: ArrayHandleCartesianProduct.h:392
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::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
Token.h
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::GetBuffers
const std::vector< viskores::cont::internal::Buffer > & GetBuffers() const
Returns the internal Buffer structures that hold the data.
Definition: ArrayHandle.h:738
VecTraits.h
viskores::cont::ArrayHandleCartesianProduct::ArrayHandleCartesianProduct
ArrayHandleCartesianProduct(const FirstHandleType &firstArray, const SecondHandleType &secondArray, const ThirdHandleType &thirdArray)
Construct an ArrayHandleCartesianProduct given arrays for the coordinates in the x,...
Definition: ArrayHandleCartesianProduct.h:367
viskores::cont::ArrayHandleStride::GetStride
viskores::Id GetStride() const
Get the stride that values are accessed.
Definition: ArrayHandleStride.h:391
viskores::cont::ArrayHandleCartesianProduct::~ArrayHandleCartesianProduct
~ArrayHandleCartesianProduct()
Implemented so that it is defined exclusively in the control environment.
Definition: ArrayHandleCartesianProduct.h:379
viskores::cont::ArrayHandleStride::GetBasicArray
viskores::cont::ArrayHandleBasic< T > GetBasicArray() const
Return the underlying data as a basic array handle.
Definition: ArrayHandleStride.h:424