VTK-m  2.2
ArrayHandleCartesianProduct.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_ArrayHandleCartesianProduct_h
11 #define vtk_m_cont_ArrayHandleCartesianProduct_h
12 
13 #include <vtkm/Assert.h>
14 #include <vtkm/Range.h>
15 #include <vtkm/VecTraits.h>
16 
18 #include <vtkm/cont/ArrayHandle.h>
20 #include <vtkm/cont/Token.h>
21 
22 #include <array>
23 
24 namespace vtkm
25 {
26 namespace internal
27 {
28 
31 template <typename ValueType_,
32  typename PortalTypeFirst_,
33  typename PortalTypeSecond_,
34  typename PortalTypeThird_>
35 class VTKM_ALWAYS_EXPORT ArrayPortalCartesianProduct
36 {
37 public:
38  using ValueType = ValueType_;
39  using IteratorType = ValueType_;
40  using PortalTypeFirst = PortalTypeFirst_;
41  using PortalTypeSecond = PortalTypeSecond_;
42  using PortalTypeThird = PortalTypeThird_;
43 
44  using set_supported_p1 = vtkm::internal::PortalSupportsSets<PortalTypeFirst>;
45  using set_supported_p2 = vtkm::internal::PortalSupportsSets<PortalTypeSecond>;
46  using set_supported_p3 = vtkm::internal::PortalSupportsSets<PortalTypeThird>;
47 
48  using Writable = std::integral_constant<bool,
49  set_supported_p1::value && set_supported_p2::value &&
50  set_supported_p3::value>;
51 
54  ArrayPortalCartesianProduct()
55  : PortalFirst()
56  , PortalSecond()
57  , PortalThird()
58  {
59  } //needs to be host and device so that cuda can create lvalue of these
60 
61  VTKM_CONT
62  ArrayPortalCartesianProduct(const PortalTypeFirst& portalfirst,
63  const PortalTypeSecond& portalsecond,
64  const PortalTypeThird& portalthird)
65  : PortalFirst(portalfirst)
66  , PortalSecond(portalsecond)
67  , PortalThird(portalthird)
68  {
69  }
70 
75 
76  template <class OtherV, class OtherP1, class OtherP2, class OtherP3>
77  VTKM_CONT ArrayPortalCartesianProduct(
78  const ArrayPortalCartesianProduct<OtherV, OtherP1, OtherP2, OtherP3>& src)
79  : PortalFirst(src.GetPortalFirst())
80  , PortalSecond(src.GetPortalSecond())
81  , PortalThird(src.GetPortalThird())
82  {
83  }
84 
87  vtkm::Id GetNumberOfValues() const
88  {
89  return this->PortalFirst.GetNumberOfValues() * this->PortalSecond.GetNumberOfValues() *
90  this->PortalThird.GetNumberOfValues();
91  }
92 
95  ValueType Get(vtkm::Id index) const
96  {
97  VTKM_ASSERT(index >= 0);
98  VTKM_ASSERT(index < this->GetNumberOfValues());
99 
100  vtkm::Id dim1 = this->PortalFirst.GetNumberOfValues();
101  vtkm::Id dim2 = this->PortalSecond.GetNumberOfValues();
102  vtkm::Id dim12 = dim1 * dim2;
103  vtkm::Id idx12 = index % dim12;
104  vtkm::Id i1 = idx12 % dim1;
105  vtkm::Id i2 = idx12 / dim1;
106  vtkm::Id i3 = index / dim12;
107 
108  return vtkm::make_Vec(
109  this->PortalFirst.Get(i1), this->PortalSecond.Get(i2), this->PortalThird.Get(i3));
110  }
111 
112 
114  template <typename Writable_ = Writable,
115  typename = typename std::enable_if<Writable_::value>::type>
116  VTKM_EXEC_CONT void Set(vtkm::Id index, const ValueType& value) const
117  {
118  VTKM_ASSERT(index >= 0);
119  VTKM_ASSERT(index < this->GetNumberOfValues());
120 
121  vtkm::Id dim1 = this->PortalFirst.GetNumberOfValues();
122  vtkm::Id dim2 = this->PortalSecond.GetNumberOfValues();
123  vtkm::Id dim12 = dim1 * dim2;
124  vtkm::Id idx12 = index % dim12;
125 
126  vtkm::Id i1 = idx12 % dim1;
127  vtkm::Id i2 = idx12 / dim1;
128  vtkm::Id i3 = index / dim12;
129 
130  this->PortalFirst.Set(i1, value[0]);
131  this->PortalSecond.Set(i2, value[1]);
132  this->PortalThird.Set(i3, value[2]);
133  }
134 
137  const PortalTypeFirst& GetFirstPortal() const { return this->PortalFirst; }
138 
141  const PortalTypeSecond& GetSecondPortal() const { return this->PortalSecond; }
142 
145  const PortalTypeThird& GetThirdPortal() const { return this->PortalThird; }
146 
147 private:
148  PortalTypeFirst PortalFirst;
149  PortalTypeSecond PortalSecond;
150  PortalTypeThird PortalThird;
151 };
152 }
153 } // namespace vtkm::internal
154 
155 namespace vtkm
156 {
157 namespace cont
158 {
159 
160 template <typename StorageTag1, typename StorageTag2, typename StorageTag3>
162 {
163 };
164 
165 namespace internal
166 {
167 
171 template <typename AH1, typename AH2, typename AH3>
172 struct ArrayHandleCartesianProductTraits
173 {
177 
178  using ComponentType = typename AH1::ValueType;
180  (std::is_same<ComponentType, typename AH2::ValueType>::value),
181  "All arrays for ArrayHandleCartesianProduct must have the same value type. "
182  "Use ArrayHandleCast as necessary to make types match.");
184  (std::is_same<ComponentType, typename AH3::ValueType>::value),
185  "All arrays for ArrayHandleCartesianProduct must have the same value type. "
186  "Use ArrayHandleCast as necessary to make types match.");
187 
190  using ValueType = vtkm::Vec<ComponentType, 3>;
191 
194  using Tag = vtkm::cont::StorageTagCartesianProduct<typename AH1::StorageTag,
195  typename AH2::StorageTag,
196  typename AH3::StorageTag>;
197 
200  using Superclass = vtkm::cont::ArrayHandle<ValueType, Tag>;
201 };
202 
203 template <typename T, typename ST1, typename ST2, typename ST3>
204 class Storage<vtkm::Vec<T, 3>, vtkm::cont::StorageTagCartesianProduct<ST1, ST2, ST3>>
205 {
206  struct Info
207  {
208  std::array<std::size_t, 4> BufferOffset;
209  };
210 
211  using Storage1 = vtkm::cont::internal::Storage<T, ST1>;
212  using Storage2 = vtkm::cont::internal::Storage<T, ST2>;
213  using Storage3 = vtkm::cont::internal::Storage<T, ST3>;
214 
215  using Array1 = vtkm::cont::ArrayHandle<T, ST1>;
216  using Array2 = vtkm::cont::ArrayHandle<T, ST2>;
217  using Array3 = vtkm::cont::ArrayHandle<T, ST3>;
218 
219  VTKM_CONT static std::vector<vtkm::cont::internal::Buffer> GetBuffers(
220  const std::vector<vtkm::cont::internal::Buffer>& buffers,
221  std::size_t subArray)
222  {
223  Info info = buffers[0].GetMetaData<Info>();
224  return std::vector<vtkm::cont::internal::Buffer>(buffers.begin() +
225  info.BufferOffset[subArray - 1],
226  buffers.begin() + info.BufferOffset[subArray]);
227  }
228 
229 public:
231 
232  using ReadPortalType =
233  vtkm::internal::ArrayPortalCartesianProduct<vtkm::Vec<T, 3>,
234  typename Storage1::ReadPortalType,
235  typename Storage2::ReadPortalType,
236  typename Storage3::ReadPortalType>;
237  using WritePortalType =
238  vtkm::internal::ArrayPortalCartesianProduct<vtkm::Vec<T, 3>,
239  typename Storage1::WritePortalType,
240  typename Storage2::WritePortalType,
241  typename Storage3::WritePortalType>;
242 
243  VTKM_CONT static vtkm::IdComponent GetNumberOfComponentsFlat(
244  const std::vector<vtkm::cont::internal::Buffer>&)
245  {
247  }
248 
249  VTKM_CONT static vtkm::Id GetNumberOfValues(
250  const std::vector<vtkm::cont::internal::Buffer>& buffers)
251  {
252  return (Storage1::GetNumberOfValues(GetBuffers(buffers, 1)) *
253  Storage2::GetNumberOfValues(GetBuffers(buffers, 2)) *
254  Storage3::GetNumberOfValues(GetBuffers(buffers, 3)));
255  }
256 
257  VTKM_CONT static void Fill(const std::vector<vtkm::cont::internal::Buffer>& buffers,
258  const vtkm::Vec<T, 3>& fillValue,
259  vtkm::Id startIndex,
260  vtkm::Id endIndex,
261  vtkm::cont::Token& token)
262  {
263  if ((startIndex != 0) || (endIndex != GetNumberOfValues(buffers)))
264  {
266  "Fill for ArrayHandleCartesianProduct can only be used to fill entire array.");
267  }
268  auto subBuffers = GetBuffers(buffers, 1);
269  Storage1::Fill(subBuffers, fillValue[0], 0, Storage1::GetNumberOfValues(subBuffers), token);
270  subBuffers = GetBuffers(buffers, 2);
271  Storage2::Fill(subBuffers, fillValue[1], 0, Storage2::GetNumberOfValues(subBuffers), token);
272  subBuffers = GetBuffers(buffers, 3);
273  Storage3::Fill(subBuffers, fillValue[2], 0, Storage3::GetNumberOfValues(subBuffers), token);
274  }
275 
276  VTKM_CONT static ReadPortalType CreateReadPortal(
277  const std::vector<vtkm::cont::internal::Buffer>& buffers,
279  vtkm::cont::Token& token)
280  {
281  return ReadPortalType(Storage1::CreateReadPortal(GetBuffers(buffers, 1), device, token),
282  Storage2::CreateReadPortal(GetBuffers(buffers, 2), device, token),
283  Storage3::CreateReadPortal(GetBuffers(buffers, 3), device, token));
284  }
285 
286  VTKM_CONT static WritePortalType CreateWritePortal(
287  const std::vector<vtkm::cont::internal::Buffer>& buffers,
289  vtkm::cont::Token& token)
290  {
291  return WritePortalType(Storage1::CreateWritePortal(GetBuffers(buffers, 1), device, token),
292  Storage2::CreateWritePortal(GetBuffers(buffers, 2), device, token),
293  Storage3::CreateWritePortal(GetBuffers(buffers, 3), device, token));
294  }
295 
296  VTKM_CONT static Array1 GetArrayHandle1(const std::vector<vtkm::cont::internal::Buffer>& buffers)
297  {
298  return Array1(GetBuffers(buffers, 1));
299  }
300  VTKM_CONT static Array2 GetArrayHandle2(const std::vector<vtkm::cont::internal::Buffer>& buffers)
301  {
302  return Array2(GetBuffers(buffers, 2));
303  }
304  VTKM_CONT static Array3 GetArrayHandle3(const std::vector<vtkm::cont::internal::Buffer>& buffers)
305  {
306  return Array3(GetBuffers(buffers, 3));
307  }
308 
309  VTKM_CONT static std::vector<vtkm::cont::internal::Buffer> CreateBuffers(
310  const Array1& array1 = Array1{},
311  const Array2& array2 = Array2{},
312  const Array3& array3 = Array3{})
313  {
314  const std::vector<vtkm::cont::internal::Buffer>& buffers1 = array1.GetBuffers();
315  const std::vector<vtkm::cont::internal::Buffer>& buffers2 = array2.GetBuffers();
316  const std::vector<vtkm::cont::internal::Buffer>& buffers3 = array3.GetBuffers();
317 
318  Info info;
319  info.BufferOffset[0] = 1;
320  info.BufferOffset[1] = info.BufferOffset[0] + buffers1.size();
321  info.BufferOffset[2] = info.BufferOffset[1] + buffers2.size();
322  info.BufferOffset[3] = info.BufferOffset[2] + buffers3.size();
323 
324  return vtkm::cont::internal::CreateBuffers(info, buffers1, buffers2, buffers3);
325  }
326 };
327 } // namespace internal
328 
333 template <typename FirstHandleType, typename SecondHandleType, typename ThirdHandleType>
335  : public internal::ArrayHandleCartesianProductTraits<FirstHandleType,
336  SecondHandleType,
337  ThirdHandleType>::Superclass
338 {
339  // If the following line gives a compile error, then the FirstHandleType
340  // template argument is not a valid ArrayHandle type.
341  VTKM_IS_ARRAY_HANDLE(FirstHandleType);
342  VTKM_IS_ARRAY_HANDLE(SecondHandleType);
343  VTKM_IS_ARRAY_HANDLE(ThirdHandleType);
344 
345 public:
349  (typename internal::ArrayHandleCartesianProductTraits<FirstHandleType,
350  SecondHandleType,
351  ThirdHandleType>::Superclass));
352 
355  VTKM_CONT
356  ArrayHandleCartesianProduct(const FirstHandleType& firstArray,
357  const SecondHandleType& secondArray,
358  const ThirdHandleType& thirdArray)
359  : Superclass(StorageType::CreateBuffers(firstArray, secondArray, thirdArray))
360  {
361  }
362 
369 
371  VTKM_CONT FirstHandleType GetFirstArray() const
372  {
373  return StorageType::GetArrayHandle1(this->GetBuffers());
374  }
376  VTKM_CONT SecondHandleType GetSecondArray() const
377  {
378  return StorageType::GetArrayHandle2(this->GetBuffers());
379  }
381  VTKM_CONT ThirdHandleType GetThirdArray() const
382  {
383  return StorageType::GetArrayHandle3(this->GetBuffers());
384  }
385 };
386 
390 template <typename FirstHandleType, typename SecondHandleType, typename ThirdHandleType>
391 VTKM_CONT
393  make_ArrayHandleCartesianProduct(const FirstHandleType& first,
394  const SecondHandleType& second,
395  const ThirdHandleType& third)
396 {
398  first, second, third);
399 }
400 
401 //--------------------------------------------------------------------------------
402 // Specialization of ArrayExtractComponent
403 namespace internal
404 {
405 
406 // Superclass will inherit the ArrayExtractComponentImplInefficient property if any
407 // of the sub-storage are inefficient (thus making everything inefficient).
408 template <typename... STs>
409 struct ArrayExtractComponentImpl<vtkm::cont::StorageTagCartesianProduct<STs...>>
410  : vtkm::cont::internal::ArrayExtractComponentImplInherit<STs...>
411 {
412  template <typename T>
413  vtkm::cont::ArrayHandleStride<T> AdjustStrideForComponent(
414  const vtkm::cont::ArrayHandleStride<T>& componentArray,
415  const vtkm::Id3& dims,
416  vtkm::IdComponent component,
417  vtkm::Id totalNumValues) const
418  {
419  VTKM_ASSERT(componentArray.GetModulo() == 0);
420  VTKM_ASSERT(componentArray.GetDivisor() == 1);
421 
422  vtkm::Id modulo = 0;
423  if (component < 2)
424  {
425  modulo = dims[component];
426  }
427 
428  vtkm::Id divisor = 1;
429  for (vtkm::IdComponent c = 0; c < component; ++c)
430  {
431  divisor *= dims[c];
432  }
433 
434  return vtkm::cont::ArrayHandleStride<T>(componentArray.GetBasicArray(),
435  totalNumValues,
436  componentArray.GetStride(),
437  componentArray.GetOffset(),
438  modulo,
439  divisor);
440  }
441 
442  template <typename T, typename ST, typename CartesianArrayType>
444  GetStrideForComponentArray(const vtkm::cont::ArrayHandle<T, ST>& componentArray,
445  const CartesianArrayType& cartesianArray,
446  vtkm::IdComponent subIndex,
447  vtkm::IdComponent productIndex,
448  vtkm::CopyFlag allowCopy) const
449  {
451  ArrayExtractComponentImpl<ST>{}(componentArray, subIndex, allowCopy);
452  if ((strideArray.GetModulo() != 0) || (strideArray.GetDivisor() != 1))
453  {
454  // If the sub array has its own modulo and/or divisor, that will likely interfere
455  // with this math. Give up and fall back to simple copy.
456  constexpr vtkm::IdComponent NUM_SUB_COMPONENTS = vtkm::VecFlat<T>::NUM_COMPONENTS;
457  return vtkm::cont::internal::ArrayExtractComponentFallback(
458  cartesianArray, (productIndex * NUM_SUB_COMPONENTS) + subIndex, allowCopy);
459  }
460 
461  vtkm::Id3 dims = { cartesianArray.GetFirstArray().GetNumberOfValues(),
462  cartesianArray.GetSecondArray().GetNumberOfValues(),
463  cartesianArray.GetThirdArray().GetNumberOfValues() };
464 
465  return this->AdjustStrideForComponent(
466  strideArray, dims, productIndex, cartesianArray.GetNumberOfValues());
467  }
468 
469  template <typename T>
472  src,
473  vtkm::IdComponent componentIndex,
474  vtkm::CopyFlag allowCopy) const
475  {
477  constexpr vtkm::IdComponent NUM_SUB_COMPONENTS = vtkm::VecFlat<T>::NUM_COMPONENTS;
478  vtkm::IdComponent subIndex = componentIndex % NUM_SUB_COMPONENTS;
479  vtkm::IdComponent productIndex = componentIndex / NUM_SUB_COMPONENTS;
480 
481  switch (productIndex)
482  {
483  case 0:
484  return this->GetStrideForComponentArray(
485  array.GetFirstArray(), array, subIndex, productIndex, allowCopy);
486  case 1:
487  return this->GetStrideForComponentArray(
488  array.GetSecondArray(), array, subIndex, productIndex, allowCopy);
489  case 2:
490  return this->GetStrideForComponentArray(
491  array.GetThirdArray(), array, subIndex, productIndex, allowCopy);
492  default:
493  throw vtkm::cont::ErrorBadValue("Invalid component index to ArrayExtractComponent.");
494  }
495  }
496 };
497 
498 template <typename T, typename S>
499 vtkm::cont::ArrayHandle<vtkm::Range> ArrayRangeComputeGeneric(
500  const vtkm::cont::ArrayHandle<T, S>& input,
501  const vtkm::cont::ArrayHandle<vtkm::UInt8>& maskArray,
502  bool computeFiniteRange,
504 
505 template <typename S>
506 struct ArrayRangeComputeImpl;
507 
508 template <typename ST1, typename ST2, typename ST3>
509 struct VTKM_CONT_EXPORT ArrayRangeComputeImpl<vtkm::cont::StorageTagCartesianProduct<ST1, ST2, ST3>>
510 {
511  template <typename T>
515  const vtkm::cont::ArrayHandle<vtkm::UInt8>& maskArray,
516  bool computeFiniteRange,
517  vtkm::cont::DeviceAdapterId device) const
518  {
519  if (maskArray.GetNumberOfValues() != 0)
520  {
521  return vtkm::cont::internal::ArrayRangeComputeGeneric(
522  input_, maskArray, computeFiniteRange, device);
523  }
524 
525  const auto& input =
529  input_);
530 
532  ranges[0] = vtkm::cont::internal::ArrayRangeComputeImpl<ST1>{}(
533  input.GetFirstArray(), maskArray, computeFiniteRange, device);
534  ranges[1] = vtkm::cont::internal::ArrayRangeComputeImpl<ST2>{}(
535  input.GetSecondArray(), maskArray, computeFiniteRange, device);
536  ranges[2] = vtkm::cont::internal::ArrayRangeComputeImpl<ST3>{}(
537  input.GetThirdArray(), maskArray, computeFiniteRange, device);
538 
539  auto numComponents =
540  ranges[0].GetNumberOfValues() + ranges[1].GetNumberOfValues() + ranges[2].GetNumberOfValues();
542  result.Allocate(numComponents);
543  auto resultPortal = result.WritePortal();
544  for (vtkm::Id i = 0, index = 0; i < 3; ++i)
545  {
546  auto rangePortal = ranges[i].ReadPortal();
547  for (vtkm::Id j = 0; j < rangePortal.GetNumberOfValues(); ++j, ++index)
548  {
549  resultPortal.Set(index, rangePortal.Get(j));
550  }
551  }
552  return result;
553  }
554 };
555 
556 } // namespace internal
557 
558 }
559 } // namespace vtkm::cont
560 
561 //=============================================================================
562 // Specializations of serialization related classes
564 namespace vtkm
565 {
566 namespace cont
567 {
568 
569 template <typename AH1, typename AH2, typename AH3>
570 struct SerializableTypeString<vtkm::cont::ArrayHandleCartesianProduct<AH1, AH2, AH3>>
571 {
572  static VTKM_CONT const std::string& Get()
573  {
574  static std::string name = "AH_CartesianProduct<" + SerializableTypeString<AH1>::Get() + "," +
576  return name;
577  }
578 };
579 
580 template <typename T, typename ST1, typename ST2, typename ST3>
581 struct SerializableTypeString<
582  vtkm::cont::ArrayHandle<vtkm::Vec<T, 3>, vtkm::cont::StorageTagCartesianProduct<ST1, ST2, ST3>>>
583  : SerializableTypeString<vtkm::cont::ArrayHandleCartesianProduct<vtkm::cont::ArrayHandle<T, ST1>,
584  vtkm::cont::ArrayHandle<T, ST2>,
585  vtkm::cont::ArrayHandle<T, ST3>>>
586 {
587 };
588 }
589 } // vtkm::cont
590 
591 namespace mangled_diy_namespace
592 {
593 
594 template <typename AH1, typename AH2, typename AH3>
595 struct Serialization<vtkm::cont::ArrayHandleCartesianProduct<AH1, AH2, AH3>>
596 {
597 private:
600 
601 public:
602  static VTKM_CONT void save(BinaryBuffer& bb, const BaseType& obj)
603  {
604  Type array = obj;
605  vtkmdiy::save(bb, array.GetFirstArray());
606  vtkmdiy::save(bb, array.GetSecondArray());
607  vtkmdiy::save(bb, array.GetThirdArray());
608  }
609 
610  static VTKM_CONT void load(BinaryBuffer& bb, BaseType& obj)
611  {
612  AH1 array1;
613  AH2 array2;
614  AH3 array3;
615 
616  vtkmdiy::load(bb, array1);
617  vtkmdiy::load(bb, array2);
618  vtkmdiy::load(bb, array3);
619 
620  obj = vtkm::cont::make_ArrayHandleCartesianProduct(array1, array2, array3);
621  }
622 };
623 
624 template <typename T, typename ST1, typename ST2, typename ST3>
625 struct Serialization<
626  vtkm::cont::ArrayHandle<vtkm::Vec<T, 3>, vtkm::cont::StorageTagCartesianProduct<ST1, ST2, ST3>>>
627  : Serialization<vtkm::cont::ArrayHandleCartesianProduct<vtkm::cont::ArrayHandle<T, ST1>,
628  vtkm::cont::ArrayHandle<T, ST2>,
629  vtkm::cont::ArrayHandle<T, ST3>>>
630 {
631 };
632 } // diy
634 
635 #endif //vtk_m_cont_ArrayHandleCartesianProduct_h
ErrorBadAllocation.h
vtkm::cont::ArrayHandle
Manages an array-worth of data.
Definition: ArrayHandle.h:300
ArrayHandle.h
ArrayExtractComponent.h
vtkm::cont::ArrayHandle::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::make_Vec
constexpr vtkm::Vec< T, vtkm::IdComponent(sizeof...(Ts)+1)> make_Vec(T value0, Ts &&... args)
Initializes and returns a Vec containing all the arguments.
Definition: Types.h:1250
vtkm::cont::ArrayHandleCartesianProduct::GetThirdArray
ThirdHandleType GetThirdArray() const
Get the array for the coordinates in the z direction.
Definition: ArrayHandleCartesianProduct.h:381
vtkm::IdComponent
vtkm::Int32 IdComponent
Base type to use to index small lists.
Definition: Types.h:194
vtkm::cont::ArrayHandleStride::GetStride
vtkm::Id GetStride() const
Get the stride that values are accessed.
Definition: ArrayHandleStride.h:377
vtkm::cont::ArrayHandleCartesianProduct
ArrayHandleCartesianProduct is a specialization of ArrayHandle.
Definition: ArrayHandleCartesianProduct.h:334
vtkm::cont::ArrayHandleCartesianProduct::GetFirstArray
FirstHandleType GetFirstArray() const
Get the array for the coordinates in the x direction.
Definition: ArrayHandleCartesianProduct.h:371
vtkm::cont::ArrayHandleStride::GetOffset
vtkm::Id GetOffset() const
Get the offset to start reading values.
Definition: ArrayHandleStride.h:388
vtkm::cont::ArrayHandle::GetNumberOfValues
vtkm::Id GetNumberOfValues() const
Returns the number of entries in the array.
Definition: ArrayHandle.h:468
vtkm::cont::StorageTagCartesianProduct
Definition: ArrayHandleCartesianProduct.h:161
Assert.h
vtkm::cont::make_ArrayHandleCartesianProduct
vtkm::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:393
vtkm::cont::ArrayHandleCartesianProduct::GetSecondArray
SecondHandleType GetSecondArray() const
Get the array for the coordinates in the y direction.
Definition: ArrayHandleCartesianProduct.h:376
VTKM_STORAGE_NO_RESIZE
#define VTKM_STORAGE_NO_RESIZE
Definition: Storage.h:185
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::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.
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_IS_ARRAY_HANDLE
#define VTKM_IS_ARRAY_HANDLE(T)
Checks that the given type is a vtkm::cont::ArrayHandle.
Definition: ArrayHandle.h:137
VTKM_STATIC_ASSERT_MSG
#define VTKM_STATIC_ASSERT_MSG(condition, message)
Definition: StaticAssert.h:18
VTKM_CONT_EXPORT
#define VTKM_CONT_EXPORT
Definition: vtkm_cont_export.h:44
Range.h
VTKM_CONT
#define VTKM_CONT
Definition: ExportMacros.h:57
vtkm::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:356
vtkm::Id
vtkm::Int64 Id
Base type to use to index arrays.
Definition: Types.h:227
vtkm::cont::ArrayHandleCartesianProduct::Superclass
typename vtkm::cont::detail::GetTypeInParentheses< void(typename internal::ArrayHandleCartesianProductTraits< FirstHandleType, SecondHandleType, ThirdHandleType >::Superclass) >::type Superclass
Definition: ArrayHandleCartesianProduct.h:351
vtkm::cont::ArrayHandleCartesianProduct::~ArrayHandleCartesianProduct
~ArrayHandleCartesianProduct()
Implemented so that it is defined exclusively in the control environment.
Definition: ArrayHandleCartesianProduct.h:368
vtkm::VecFlat
Treat a Vec or Vec-like object as a flat Vec.
Definition: VecFlat.h:224
vtkm::cont::ArrayHandle::ReadPortal
ReadPortalType ReadPortal() const
Get an array portal that can be used in the control environment.
Definition: ArrayHandle.h:433
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::Vec< T, 3 >
Definition: Types.h:1013
vtkm::Vec
A short fixed-length array.
Definition: Types.h:357
vtkm::cont::ErrorBadValue
This class is thrown when a VTKm function or method encounters an invalid value that inhibits progres...
Definition: ErrorBadValue.h:25
vtkm::cont::ArrayHandle::StorageType
vtkm::cont::internal::Storage< ValueType, StorageTag > StorageType
Definition: ArrayHandle.h:309
vtkm::CopyFlag
CopyFlag
Identifier used to specify whether a function should deep copy data.
Definition: Flags.h:17
vtkm::cont::ArrayHandle::Allocate
void Allocate(vtkm::Id numberOfValues, vtkm::CopyFlag preserve, vtkm::cont::Token &token) const
Allocates an array large enough to hold the given number of values.
Definition: ArrayHandle.h:490
VTKM_ALWAYS_EXPORT
#define VTKM_ALWAYS_EXPORT
Definition: ExportMacros.h:89
vtkm::cont::ArrayHandle::WritePortal
WritePortalType WritePortal() const
Get an array portal that can be used in the control environment.
Definition: ArrayHandle.h:454
Token.h
VTKM_SUPPRESS_EXEC_WARNINGS
#define VTKM_SUPPRESS_EXEC_WARNINGS
Definition: ExportMacros.h:53
VecTraits.h