Viskores  1.0
Types.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_Types_h
19 #define viskores_Types_h
20 
23 
24 #include <viskores/Assert.h>
25 #include <viskores/StaticAssert.h>
26 
27 #include <cstdint>
28 #include <iostream>
29 #include <type_traits>
30 
157 namespace viskores
158 {
159 //*****************************************************************************
160 // Typedefs for basic types.
161 //*****************************************************************************
162 
165 using Float32 = float;
166 
169 using Float64 = double;
170 
173 using Int8 = int8_t;
174 
177 using UInt8 = uint8_t;
178 
181 using Int16 = int16_t;
182 
185 using UInt16 = uint16_t;
186 
189 using Int32 = int32_t;
190 
193 using UInt32 = uint32_t;
194 
203 
207 
208 //In this order so that we exactly match the logic that exists in VTK
209 #if (VISKORES_SIZE_LONG_LONG == 8) || defined(VISKORES_DOXYGEN_ONLY)
210 using Int64 = signed long long;
215 using UInt64 = unsigned long long;
216 #define VISKORES_UNUSED_INT_TYPE long
217 #elif VISKORES_SIZE_LONG == 8
218 using Int64 = signed long;
223 using UInt64 = unsigned long;
224 #define VISKORES_UNUSED_INT_TYPE long long
225 #else
226 #error Could not find a 64-bit integer.
227 #endif
228 
234 #ifdef VISKORES_USE_64BIT_IDS
236 #else
237 using Id = viskores::Int32;
238 #endif
239 
241 #ifdef VISKORES_USE_DOUBLE_PRECISION
243 #else
245 #endif
246 
247 
248 namespace internal
249 {
250 
252 struct NullType
253 {
254 };
255 
256 } // namespace internal
257 
258 // Disable conversion warnings for Add, Subtract, Multiply, Divide on GCC only.
259 // GCC creates false positive warnings for signed/unsigned char* operations.
260 // This occurs because the values are implicitly casted up to int's for the
261 // operation, and than casted back down to char's when return.
262 // This causes a false positive warning, even when the values is within
263 // the value types range
264 #if (defined(VISKORES_GCC) || defined(VISKORES_CLANG))
265 #pragma GCC diagnostic push
266 #pragma GCC diagnostic ignored "-Wconversion"
267 #endif // gcc || clang
268 struct Add
269 {
270  template <typename T, typename U>
271  inline VISKORES_EXEC_CONT auto operator()(const T& a, const U& b) const -> decltype(a + b)
272  {
273  return a + b;
274  }
275 
276  // If both arguments are short integers, explicitly cast the result back to the
277  // type to avoid narrowing conversion warnings from operations that promote to
278  // integers.
279  template <typename T>
280  inline VISKORES_EXEC_CONT
281  typename std::enable_if<std::is_integral<T>::value && sizeof(T) < sizeof(int), T>::type
282  operator()(T a, T b) const
283  {
284  return static_cast<T>(a + b);
285  }
286 };
287 
288 struct Subtract
289 {
290  template <typename T, typename U>
291  inline VISKORES_EXEC_CONT auto operator()(const T& a, const U& b) const -> decltype(a - b)
292  {
293  return a - b;
294  }
295 
296  // If both arguments are short integers, explicitly cast the result back to the
297  // type to avoid narrowing conversion warnings from operations that promote to
298  // integers.
299  template <typename T>
300  inline VISKORES_EXEC_CONT
301  typename std::enable_if<std::is_integral<T>::value && sizeof(T) < sizeof(int), T>::type
302  operator()(T a, T b) const
303  {
304  return static_cast<T>(a - b);
305  }
306 };
307 
308 struct Multiply
309 {
310  template <typename T, typename U>
311  inline VISKORES_EXEC_CONT auto operator()(const T& a, const U& b) const -> decltype(a * b)
312  {
313  return a * b;
314  }
315 
316  // If both arguments are short integers, explicitly cast the result back to the
317  // type to avoid narrowing conversion warnings from operations that promote to
318  // integers.
319  template <typename T>
320  inline VISKORES_EXEC_CONT
321  typename std::enable_if<std::is_integral<T>::value && sizeof(T) < sizeof(int), T>::type
322  operator()(T a, T b) const
323  {
324  return static_cast<T>(a * b);
325  }
326 };
327 
328 struct Divide
329 {
330  template <typename T, typename U>
331  inline VISKORES_EXEC_CONT auto operator()(const T& a, const U& b) const -> decltype(a / b)
332  {
333  return a / b;
334  }
335 
336  // If both arguments are short integers, explicitly cast the result back to the
337  // type to avoid narrowing conversion warnings from operations that promote to
338  // integers.
339  template <typename T>
340  inline VISKORES_EXEC_CONT
341  typename std::enable_if<std::is_integral<T>::value && sizeof(T) < sizeof(int), T>::type
342  operator()(T a, T b) const
343  {
344  return static_cast<T>(a / b);
345  }
346 };
347 
348 struct Negate
349 {
350  template <typename T>
351  inline VISKORES_EXEC_CONT T operator()(const T& x) const
352  {
353  return T(-x);
354  }
355 };
356 
357 #if (defined(VISKORES_GCC) || defined(VISKORES_CLANG))
358 #pragma GCC diagnostic pop
359 #endif // gcc || clang
360 
361 //-----------------------------------------------------------------------------
362 
363 // Pre declaration
364 template <typename T, viskores::IdComponent Size>
365 class VISKORES_ALWAYS_EXPORT Vec;
366 
367 template <typename T>
368 class VISKORES_ALWAYS_EXPORT VecC;
369 
370 template <typename T>
371 class VISKORES_ALWAYS_EXPORT VecCConst;
372 
373 namespace detail
374 {
375 
378 // Disable conversion warnings for Add, Subtract, Multiply, Divide on GCC only.
379 // GCC creates false positive warnings for signed/unsigned char* operations.
380 // This occurs because the values are implicitly casted up to int's for the
381 // operation, and than casted back down to char's when return.
382 // This causes a false positive warning, even when the values is within
383 // the value types range
384 //
385 // NVCC 7.5 and below does not recognize this pragma inside of class bodies,
386 // so put them before entering the class.
387 //
388 #if (defined(VISKORES_CUDA) && (__CUDACC_VER_MAJOR__ < 8))
389 #if (defined(VISKORES_GCC) || defined(VISKORES_CLANG))
390 #pragma GCC diagnostic push
391 #pragma GCC diagnostic ignored "-Wunknown-pragmas"
392 #pragma GCC diagnostic ignored "-Wpragmas"
393 #pragma GCC diagnostic ignored "-Wconversion"
394 #pragma GCC diagnostic ignored "-Wfloat-conversion"
395 #endif // gcc || clang
396 #endif // use cuda < 8
397 template <typename T, typename DerivedClass>
398 class VISKORES_ALWAYS_EXPORT VecBaseCommon
399 {
400 public:
401  using ComponentType = T;
402 
403 protected:
404  constexpr VecBaseCommon() = default;
405 
407  constexpr const DerivedClass& Derived() const { return *static_cast<const DerivedClass*>(this); }
408 
410  constexpr DerivedClass& Derived() { return *static_cast<DerivedClass*>(this); }
411 
412 private:
413  // Only for internal use
415  constexpr viskores::IdComponent NumComponents() const
416  {
417  return this->Derived().GetNumberOfComponents();
418  }
419 
420  // Only for internal use
422  constexpr const T& Component(viskores::IdComponent index) const { return this->Derived()[index]; }
423 
424  // Only for internal use
426  constexpr T& Component(viskores::IdComponent index) { return this->Derived()[index]; }
427 
428 public:
429  template <viskores::IdComponent OtherSize>
431  {
432  for (viskores::IdComponent index = 0; (index < this->NumComponents()) && (index < OtherSize);
433  index++)
434  {
435  dest[index] = this->Component(index);
436  }
437  }
438 
439  // Only works with Vec-like objects with operator[] and GetNumberOfComponents().
440  template <typename OtherVecType>
441  VISKORES_EXEC_CONT DerivedClass& operator=(const OtherVecType& src)
442  {
443  VISKORES_ASSERT(this->NumComponents() == src.GetNumberOfComponents());
444  for (viskores::IdComponent i = 0; i < this->NumComponents(); ++i)
445  {
446  this->Component(i) = src[i];
447  }
448  return this->Derived();
449  }
450 
452  bool operator==(const DerivedClass& other) const
453  {
454  bool equal = true;
455  for (viskores::IdComponent i = 0; i < this->NumComponents() && equal; ++i)
456  {
457  equal = (this->Component(i) == other[i]);
458  }
459  return equal;
460  }
461 
463  bool operator<(const DerivedClass& other) const
464  {
465  for (viskores::IdComponent i = 0; i < this->NumComponents(); ++i)
466  {
467  // ignore equals as that represents check next value
468  if (this->Component(i) < other[i])
469  {
470  return true;
471  }
472  else if (other[i] < this->Component(i))
473  {
474  return false;
475  }
476  } // if all same we are not less
477 
478  return false;
479  }
480 
482  bool operator!=(const DerivedClass& other) const { return !(this->operator==(other)); }
483 
484 #if (!(defined(VISKORES_CUDA) && (__CUDACC_VER_MAJOR__ < 8)))
485 #if (defined(VISKORES_GCC) || defined(VISKORES_CLANG))
486 #pragma GCC diagnostic push
487 #pragma GCC diagnostic ignored "-Wunknown-pragmas"
488 #pragma GCC diagnostic ignored "-Wpragmas"
489 #pragma GCC diagnostic ignored "-Wconversion"
490 #pragma GCC diagnostic ignored "-Wfloat-conversion"
491 #endif // gcc || clang
492 #endif // not using cuda < 8
493 
494  template <viskores::IdComponent Size>
496  const viskores::Vec<ComponentType, Size>& other) const
497  {
498  VISKORES_ASSERT(Size == this->NumComponents());
500  for (viskores::IdComponent i = 0; i < Size; ++i)
501  {
502  result[i] = this->Component(i) + other[i];
503  }
504  return result;
505  }
506 
507  template <typename OtherClass>
508  inline VISKORES_EXEC_CONT DerivedClass& operator+=(const OtherClass& other)
509  {
510  VISKORES_ASSERT(this->NumComponents() == other.GetNumberOfComponents());
511  for (viskores::IdComponent i = 0; i < this->NumComponents(); ++i)
512  {
513  this->Component(i) += other[i];
514  }
515  return this->Derived();
516  }
517 
518  template <viskores::IdComponent Size>
520  const viskores::Vec<ComponentType, Size>& other) const
521  {
522  VISKORES_ASSERT(Size == this->NumComponents());
524  for (viskores::IdComponent i = 0; i < Size; ++i)
525  {
526  result[i] = this->Component(i) - other[i];
527  }
528  return result;
529  }
530 
531  template <typename OtherClass>
532  inline VISKORES_EXEC_CONT DerivedClass& operator-=(const OtherClass& other)
533  {
534  VISKORES_ASSERT(this->NumComponents() == other.GetNumberOfComponents());
535  for (viskores::IdComponent i = 0; i < this->NumComponents(); ++i)
536  {
537  this->Component(i) -= other[i];
538  }
539  return this->Derived();
540  }
541 
542  template <viskores::IdComponent Size>
544  const viskores::Vec<ComponentType, Size>& other) const
545  {
547  for (viskores::IdComponent i = 0; i < Size; ++i)
548  {
549  result[i] = this->Component(i) * other[i];
550  }
551  return result;
552  }
553 
554  template <typename OtherClass>
555  inline VISKORES_EXEC_CONT DerivedClass& operator*=(const OtherClass& other)
556  {
557  VISKORES_ASSERT(this->NumComponents() == other.GetNumberOfComponents());
558  for (viskores::IdComponent i = 0; i < this->NumComponents(); ++i)
559  {
560  this->Component(i) *= other[i];
561  }
562  return this->Derived();
563  }
564 
565  template <viskores::IdComponent Size>
567  const viskores::Vec<ComponentType, Size>& other) const
568  {
570  for (viskores::IdComponent i = 0; i < Size; ++i)
571  {
572  result[i] = this->Component(i) / other[i];
573  }
574  return result;
575  }
576 
577  template <typename OtherClass>
578  VISKORES_EXEC_CONT DerivedClass& operator/=(const OtherClass& other)
579  {
580  VISKORES_ASSERT(this->NumComponents() == other.GetNumberOfComponents());
581  for (viskores::IdComponent i = 0; i < this->NumComponents(); ++i)
582  {
583  this->Component(i) /= other[i];
584  }
585  return this->Derived();
586  }
587 
588 #if (!(defined(VISKORES_CUDA) && (__CUDACC_VER_MAJOR__ < 8)))
589 #if (defined(VISKORES_GCC) || defined(VISKORES_CLANG))
590 #pragma GCC diagnostic pop
591 #endif // gcc || clang
592 #endif // not using cuda < 8
593 
595  constexpr ComponentType* GetPointer() { return &this->Component(0); }
596 
598  constexpr const ComponentType* GetPointer() const { return &this->Component(0); }
599 };
600 
601 
604 template <typename T, viskores::IdComponent Size, typename DerivedClass>
605 class VISKORES_ALWAYS_EXPORT VecBase : public viskores::detail::VecBaseCommon<T, DerivedClass>
606 {
607 public:
608  using ComponentType = T;
609  static constexpr viskores::IdComponent NUM_COMPONENTS = Size;
610 
611  VecBase() = default;
612 
613  // The enable_if predicate will disable this constructor for Size=1 so that
614  // the variadic constructor constexpr VecBase(T, Ts&&...) is called instead.
616  template <viskores::IdComponent Size2 = Size, typename std::enable_if<Size2 != 1, int>::type = 0>
617  VISKORES_EXEC_CONT explicit VecBase(const ComponentType& value)
618  {
619  for (viskores::IdComponent i = 0; i < Size; ++i)
620  {
621  this->Components[i] = value;
622  }
623  }
624 
626  template <typename... Ts>
627  VISKORES_EXEC_CONT constexpr VecBase(ComponentType value0, Ts&&... values)
628  : Components{ value0, values... }
629  {
630  VISKORES_STATIC_ASSERT(sizeof...(Ts) + 1 == Size);
631  }
632 
635  VecBase(std::initializer_list<ComponentType> values)
636  {
637  ComponentType* dest = this->Components;
638  auto src = values.begin();
639  if (values.size() == 1)
640  {
641  for (viskores::IdComponent i = 0; i < Size; ++i)
642  {
643  this->Components[i] = *src;
644  ++dest;
645  }
646  }
647  else
648  {
649  VISKORES_ASSERT((values.size() == NUM_COMPONENTS) &&
650  "Vec object initialized wrong number of components.");
651  for (; src != values.end(); ++src)
652  {
653  *dest = *src;
654  ++dest;
655  }
656  }
657  }
658 
659 #if (!(defined(VISKORES_CUDA) && (__CUDACC_VER_MAJOR__ < 8)))
660 #if (defined(VISKORES_GCC) || defined(VISKORES_CLANG))
661 #pragma GCC diagnostic push
662 #pragma GCC diagnostic ignored "-Wunknown-pragmas"
663 #pragma GCC diagnostic ignored "-Wpragmas"
664 #pragma GCC diagnostic ignored "-Wconversion"
665 #pragma GCC diagnostic ignored "-Wfloat-conversion"
666 #endif // gcc || clang
667 #endif //not using cuda < 8
668 #if defined(VISKORES_MSVC)
669 #pragma warning(push)
670 #pragma warning(disable : 4244)
671 #endif
672 
674  template <typename OtherValueType, typename OtherDerivedType>
675  VISKORES_EXEC_CONT explicit VecBase(const VecBase<OtherValueType, Size, OtherDerivedType>& src)
676  {
677  //DO NOT CHANGE THIS AND THE ABOVE PRAGMA'S UNLESS YOU FULLY UNDERSTAND THE
678  //ISSUE https://gitlab.kitware.com/vtk/viskores/-/issues/221
679  for (viskores::IdComponent i = 0; i < Size; ++i)
680  {
681  this->Components[i] = src[i];
682  }
683  }
684 
685 public:
686  inline VISKORES_EXEC_CONT constexpr viskores::IdComponent GetNumberOfComponents() const
687  {
688  return NUM_COMPONENTS;
689  }
690 
691  inline VISKORES_EXEC_CONT constexpr const ComponentType& operator[](
692  viskores::IdComponent idx) const
693  {
694  return this->Components[idx];
695  }
696 
697  inline VISKORES_EXEC_CONT constexpr ComponentType& operator[](viskores::IdComponent idx)
698  {
699  VISKORES_ASSERT(idx >= 0);
700  VISKORES_ASSERT(idx < NUM_COMPONENTS);
701  return this->Components[idx];
702  }
703 
705  template <typename OtherComponentType, typename OtherClass>
706  inline VISKORES_EXEC_CONT DerivedClass
707  operator+(const VecBaseCommon<OtherComponentType, OtherClass>& other) const
708  {
709  const OtherClass& other_derived = static_cast<const OtherClass&>(other);
710  VISKORES_ASSERT(NUM_COMPONENTS == other_derived.GetNumberOfComponents());
711 
712  DerivedClass result;
713  for (viskores::IdComponent i = 0; i < NUM_COMPONENTS; ++i)
714  {
715  result[i] = this->Components[i] + static_cast<ComponentType>(other_derived[i]);
716  }
717  return result;
718  }
719 
721  template <typename OtherComponentType, typename OtherClass>
722  inline VISKORES_EXEC_CONT DerivedClass
723  operator-(const VecBaseCommon<OtherComponentType, OtherClass>& other) const
724  {
725  const OtherClass& other_derived = static_cast<const OtherClass&>(other);
726  VISKORES_ASSERT(NUM_COMPONENTS == other_derived.GetNumberOfComponents());
727 
728  DerivedClass result;
729  for (viskores::IdComponent i = 0; i < NUM_COMPONENTS; ++i)
730  {
731  result[i] = this->Components[i] - static_cast<ComponentType>(other_derived[i]);
732  }
733  return result;
734  }
735 
737  template <typename OtherComponentType, typename OtherClass>
738  inline VISKORES_EXEC_CONT DerivedClass
739  operator*(const VecBaseCommon<OtherComponentType, OtherClass>& other) const
740  {
741  const OtherClass& other_derived = static_cast<const OtherClass&>(other);
742  VISKORES_ASSERT(NUM_COMPONENTS == other_derived.GetNumberOfComponents());
743 
744  DerivedClass result;
745  for (viskores::IdComponent i = 0; i < NUM_COMPONENTS; ++i)
746  {
747  result[i] = this->Components[i] * static_cast<ComponentType>(other_derived[i]);
748  }
749  return result;
750  }
751 
753  template <typename OtherComponentType, typename OtherClass>
754  inline VISKORES_EXEC_CONT DerivedClass
755  operator/(const VecBaseCommon<OtherComponentType, OtherClass>& other) const
756  {
757  const OtherClass& other_derived = static_cast<const OtherClass&>(other);
758  VISKORES_ASSERT(NUM_COMPONENTS == other_derived.GetNumberOfComponents());
759 
760  DerivedClass result;
761  for (viskores::IdComponent i = 0; i < NUM_COMPONENTS; ++i)
762  {
763  result[i] = this->Components[i] / static_cast<ComponentType>(other_derived[i]);
764  }
765  return result;
766  }
767 
768 #if (!(defined(VISKORES_CUDA) && (__CUDACC_VER_MAJOR__ < 8)))
769 #if (defined(VISKORES_GCC) || defined(VISKORES_CLANG))
770 #pragma GCC diagnostic pop
771 #endif // gcc || clang
772 #endif // not using cuda < 8
773 #if defined(VISKORES_MSVC)
774 #pragma warning(pop)
775 #endif
776 
777 protected:
778  ComponentType Components[NUM_COMPONENTS];
779 };
780 
781 #if (defined(VISKORES_CUDA) && (__CUDACC_VER_MAJOR__ < 8))
782 #if (defined(VISKORES_GCC) || defined(VISKORES_CLANG))
783 #pragma GCC diagnostic pop
784 #endif // gcc || clang
785 #endif // use cuda < 8
786 
789 template <typename T, typename DerivedClass>
790 class VISKORES_ALWAYS_EXPORT VecCBase : public viskores::detail::VecBaseCommon<T, DerivedClass>
791 {
792 protected:
794  constexpr VecCBase() {}
795 };
796 
797 } // namespace detail
798 
799 //-----------------------------------------------------------------------------
800 
816 template <typename T, viskores::IdComponent Size>
817 class VISKORES_ALWAYS_EXPORT Vec : public detail::VecBase<T, Size, Vec<T, Size>>
818 {
819  using Superclass = detail::VecBase<T, Size, Vec<T, Size>>;
820 
821 public:
822 #ifdef VISKORES_DOXYGEN_ONLY
823  using ComponentType = T;
824  static constexpr viskores::IdComponent NUM_COMPONENTS = Size;
825 #endif
826 
827  using Superclass::Superclass;
828  constexpr Vec() = default;
829 #if defined(_MSC_VER) && _MSC_VER < 1910
830  template <typename... Ts>
831  constexpr Vec(T value, Ts&&... values)
832  : Superclass(value, std::forward<Ts>(values)...)
833  {
834  }
835 #endif
836 
837  inline VISKORES_EXEC_CONT void CopyInto(Vec<T, Size>& dest) const { dest = *this; }
838 };
839 
840 //-----------------------------------------------------------------------------
841 // Specializations for common small tuples. We implement them a bit specially.
842 
843 // A vector of size 0 cannot use VecBase because it will try to create a
844 // zero length array which troubles compilers. Vecs of size 0 are a bit
845 // pointless but might occur in some generic functions or classes.
846 template <typename T>
847 class VISKORES_ALWAYS_EXPORT Vec<T, 0>
848 {
849 public:
850  using ComponentType = T;
851  static constexpr viskores::IdComponent NUM_COMPONENTS = 0;
852 
853  constexpr Vec() = default;
855 
856  template <typename OtherType>
858  {
859  }
860 
863  {
864  return *this;
865  }
866 
868  {
869  return NUM_COMPONENTS;
870  }
871 
874  {
875  return ComponentType();
876  }
877 
879  bool operator==(const Vec<T, NUM_COMPONENTS>& viskoresNotUsed(other)) const { return true; }
881  bool operator!=(const Vec<T, NUM_COMPONENTS>& viskoresNotUsed(other)) const { return false; }
882 };
883 
884 // Vectors of size 1 should implicitly convert between the scalar and the
885 // vector. Otherwise, it should behave the same.
886 template <typename T>
887 class VISKORES_ALWAYS_EXPORT Vec<T, 1> : public detail::VecBase<T, 1, Vec<T, 1>>
888 {
889  using Superclass = detail::VecBase<T, 1, Vec<T, 1>>;
890 
891 public:
892  Vec() = default;
893  VISKORES_EXEC_CONT constexpr Vec(const T& value)
894  : Superclass(value)
895  {
896  }
897 
898  template <typename OtherType>
900  : Superclass(src)
901  {
902  }
903 };
904 
905 //-----------------------------------------------------------------------------
906 // Specializations for common tuple sizes (with special names).
907 
908 template <typename T>
909 class VISKORES_ALWAYS_EXPORT Vec<T, 2> : public detail::VecBase<T, 2, Vec<T, 2>>
910 {
911  using Superclass = detail::VecBase<T, 2, Vec<T, 2>>;
912 
913 public:
914  constexpr Vec() = default;
915  VISKORES_EXEC_CONT Vec(const T& value)
916  : Superclass(value)
917  {
918  }
919 
920  template <typename OtherType>
922  : Superclass(src)
923  {
924  }
925 
927  constexpr Vec(const T& x, const T& y)
928  : Superclass(x, y)
929  {
930  }
931 };
932 
936 
940 
947 
953 
959 
965 
971 
977 
983 
989 
994 #ifdef VISKORES_USE_64BIT_IDS
996 #else
998 #endif
999 
1005 
1011 
1017 
1023 
1024 template <typename T>
1025 class VISKORES_ALWAYS_EXPORT Vec<T, 3> : public detail::VecBase<T, 3, Vec<T, 3>>
1026 {
1027  using Superclass = detail::VecBase<T, 3, Vec<T, 3>>;
1028 
1029 public:
1030  constexpr Vec() = default;
1031  VISKORES_EXEC_CONT Vec(const T& value)
1032  : Superclass(value)
1033  {
1034  }
1035 
1036  template <typename OtherType>
1038  : Superclass(src)
1039  {
1040  }
1041 
1043  constexpr Vec(const T& x, const T& y, const T& z)
1044  : Superclass(x, y, z)
1045  {
1046  }
1047 };
1048 
1054 
1058 
1065 
1071 
1077 
1083 
1089 
1095 
1101 
1107 
1112 #ifdef VISKORES_USE_64BIT_IDS
1114 #else
1116 #endif
1117 
1123 
1129 
1135 
1141 
1142 template <typename T>
1143 class VISKORES_ALWAYS_EXPORT Vec<T, 4> : public detail::VecBase<T, 4, Vec<T, 4>>
1144 {
1145  using Superclass = detail::VecBase<T, 4, Vec<T, 4>>;
1146 
1147 public:
1148  constexpr Vec() = default;
1149  VISKORES_EXEC_CONT Vec(const T& value)
1150  : Superclass(value)
1151  {
1152  }
1153 
1154  template <typename OtherType>
1156  : Superclass(src)
1157  {
1158  }
1159 
1161  constexpr Vec(const T& x, const T& y, const T& z, const T& w)
1162  : Superclass(x, y, z, w)
1163  {
1164  }
1165 };
1166 
1170 
1174 
1181 
1187 
1193 
1199 
1205 
1211 
1217 
1223 
1228 #ifdef VISKORES_USE_64BIT_IDS
1230 #else
1232 #endif
1233 
1239 
1245 
1251 
1257 
1261 template <typename T, typename... Ts>
1263  T value0,
1264  Ts&&... args)
1265 {
1266  return viskores::Vec<T, viskores::IdComponent(sizeof...(Ts) + 1)>(value0, T(args)...);
1267 }
1268 
1287 template <typename T>
1288 class VISKORES_ALWAYS_EXPORT VecC : public detail::VecCBase<T, VecC<T>>
1289 {
1290  using Superclass = detail::VecCBase<T, VecC<T>>;
1291 
1292  VISKORES_STATIC_ASSERT_MSG(std::is_const<T>::value == false,
1293  "You cannot use VecC with a const type as its template argument. "
1294  "Use either const VecC or VecCConst.");
1295 
1296 public:
1297 #ifdef VISKORES_DOXYGEN_ONLY
1298  using ComponentType = T;
1299 #endif
1300 
1302  constexpr VecC()
1303  : Components(nullptr)
1304  , NumberOfComponents(0)
1305  {
1306  }
1307 
1309  constexpr VecC(T* array, viskores::IdComponent size)
1310  : Components(array)
1311  , NumberOfComponents(size)
1312  {
1313  }
1314 
1315  template <viskores::IdComponent Size>
1317  : Components(src.GetPointer())
1318  , NumberOfComponents(Size)
1319  {
1320  }
1321 
1323  explicit constexpr VecC(T& src)
1324  : Components(&src)
1325  , NumberOfComponents(1)
1326  {
1327  }
1328 
1330  constexpr VecC(const VecC<T>& src)
1331  : Components(src.Components)
1332  , NumberOfComponents(src.NumberOfComponents)
1333  {
1334  }
1335 
1336  inline VISKORES_EXEC_CONT constexpr const T& operator[](viskores::IdComponent index) const
1337  {
1338  VISKORES_ASSERT(index >= 0);
1339  VISKORES_ASSERT(index < this->NumberOfComponents);
1340  return this->Components[index];
1341  }
1342 
1344  {
1345  VISKORES_ASSERT(index >= 0);
1346  VISKORES_ASSERT(index < this->NumberOfComponents);
1347  return this->Components[index];
1348  }
1349 
1351  {
1352  return this->NumberOfComponents;
1353  }
1354 
1357  {
1358  VISKORES_ASSERT(this->NumberOfComponents == src.GetNumberOfComponents());
1359  for (viskores::IdComponent index = 0; index < this->NumberOfComponents; index++)
1360  {
1361  (*this)[index] = src[index];
1362  }
1363 
1364  return *this;
1365  }
1366 
1367 private:
1368  T* const Components;
1370 };
1371 
1381 template <typename T>
1382 class VISKORES_ALWAYS_EXPORT VecCConst : public detail::VecCBase<T, VecCConst<T>>
1383 {
1384  using Superclass = detail::VecCBase<T, VecCConst<T>>;
1385 
1386  VISKORES_STATIC_ASSERT_MSG(std::is_const<T>::value == false,
1387  "You cannot use VecCConst with a const type as its template argument. "
1388  "Remove the const from the type.");
1389 
1390 public:
1391 #ifdef VISKORES_DOXYGEN_ONLY
1392  using ComponentType = T;
1393 #endif
1394 
1396  constexpr VecCConst()
1397  : Components(nullptr)
1398  , NumberOfComponents(0)
1399  {
1400  }
1401 
1403  constexpr VecCConst(const T* array, viskores::IdComponent size)
1404  : Components(array)
1405  , NumberOfComponents(size)
1406  {
1407  }
1408 
1409  template <viskores::IdComponent Size>
1411  : Components(src.GetPointer())
1412  , NumberOfComponents(Size)
1413  {
1414  }
1415 
1417  explicit constexpr VecCConst(const T& src)
1418  : Components(&src)
1419  , NumberOfComponents(1)
1420  {
1421  }
1422 
1424  constexpr VecCConst(const VecCConst<T>& src)
1425  : Components(src.Components)
1426  , NumberOfComponents(src.NumberOfComponents)
1427  {
1428  }
1429 
1431  constexpr VecCConst(const VecC<T>& src)
1432  : Components(src.Components)
1433  , NumberOfComponents(src.NumberOfComponents)
1434  {
1435  }
1436 
1437  inline VISKORES_EXEC_CONT constexpr const T& operator[](viskores::IdComponent index) const
1438  {
1439  VISKORES_ASSERT(index >= 0);
1440  VISKORES_ASSERT(index < this->NumberOfComponents);
1441  return this->Components[index];
1442  }
1443 
1445  {
1446  return this->NumberOfComponents;
1447  }
1448 
1449 private:
1450  const T* const Components;
1452 
1453  // You are not allowed to assign to a VecCConst, so these operators are not
1454  // implemented and are disallowed.
1455  void operator=(const VecCConst<T>&) = delete;
1456  void operator+=(const VecCConst<T>&) = delete;
1457  void operator-=(const VecCConst<T>&) = delete;
1458  void operator*=(const VecCConst<T>&) = delete;
1459  void operator/=(const VecCConst<T>&) = delete;
1460 };
1461 
1464 template <typename T>
1465 static inline VISKORES_EXEC_CONT constexpr viskores::VecC<T> make_VecC(T* array,
1466  viskores::IdComponent size)
1467 {
1468  return viskores::VecC<T>(array, size);
1469 }
1470 
1473 template <typename T>
1474 static inline VISKORES_EXEC_CONT constexpr viskores::VecCConst<T> make_VecC(
1475  const T* array,
1476  viskores::IdComponent size)
1477 {
1478  return viskores::VecCConst<T>(array, size);
1479 }
1480 
1481 namespace detail
1482 {
1483 
1484 template <typename T>
1485 static inline VISKORES_EXEC_CONT auto vec_dot(const T& a, const T& b)
1486 {
1487  auto result = a[0] * b[0];
1488  for (viskores::IdComponent i = 1; i < a.GetNumberOfComponents(); ++i)
1489  {
1490  result = result + a[i] * b[i];
1491  }
1492  return result;
1493 }
1494 template <typename T, viskores::IdComponent Size>
1495 static inline VISKORES_EXEC_CONT auto vec_dot(const viskores::Vec<T, Size>& a,
1496  const viskores::Vec<T, Size>& b)
1497 {
1498  auto result = a[0] * b[0];
1499  for (viskores::IdComponent i = 1; i < Size; ++i)
1500  {
1501  result = result + a[i] * b[i];
1502  }
1503  return result;
1504 }
1505 
1506 } // namespace detail
1507 
1508 template <typename T>
1509 static inline VISKORES_EXEC_CONT auto Dot(const T& a, const T& b)
1510 {
1511  return detail::vec_dot(a, b);
1512 }
1513 
1514 template <typename T>
1515 static inline VISKORES_EXEC_CONT auto Dot(const viskores::Vec<T, 2>& a,
1516  const viskores::Vec<T, 2>& b)
1517 {
1518  return (a[0] * b[0]) + (a[1] * b[1]);
1519 }
1520 template <typename T>
1521 static inline VISKORES_EXEC_CONT auto Dot(const viskores::Vec<T, 3>& a,
1522  const viskores::Vec<T, 3>& b)
1523 {
1524  return (a[0] * b[0]) + (a[1] * b[1]) + (a[2] * b[2]);
1525 }
1526 template <typename T>
1527 static inline VISKORES_EXEC_CONT auto Dot(const viskores::Vec<T, 4>& a,
1528  const viskores::Vec<T, 4>& b)
1529 {
1530  return (a[0] * b[0]) + (a[1] * b[1]) + (a[2] * b[2]) + (a[3] * b[3]);
1531 }
1532 // Integer types of a width less than an integer get implicitly casted to
1533 // an integer when doing a multiplication.
1534 #define VISKORES_SCALAR_DOT(stype) \
1535  static inline VISKORES_EXEC_CONT auto dot(stype a, stype b) \
1536  { \
1537  return a * b; \
1538  } /* LEGACY */ \
1539  static inline VISKORES_EXEC_CONT auto Dot(stype a, stype b) \
1540  { \
1541  return a * b; \
1542  }
1553 
1554 // v============ LEGACY =============v
1555 template <typename T>
1556 static inline VISKORES_EXEC_CONT auto dot(const T& a, const T& b) -> decltype(detail::vec_dot(a, b))
1557 {
1558  return viskores::Dot(a, b);
1559 }
1560 template <typename T>
1561 static inline VISKORES_EXEC_CONT auto dot(const viskores::Vec<T, 2>& a,
1562  const viskores::Vec<T, 2>& b)
1563 {
1564  return viskores::Dot(a, b);
1565 }
1566 template <typename T>
1567 static inline VISKORES_EXEC_CONT auto dot(const viskores::Vec<T, 3>& a,
1568  const viskores::Vec<T, 3>& b)
1569 {
1570  return viskores::Dot(a, b);
1571 }
1572 template <typename T>
1573 static inline VISKORES_EXEC_CONT auto dot(const viskores::Vec<T, 4>& a,
1574  const viskores::Vec<T, 4>& b)
1575 {
1576  return viskores::Dot(a, b);
1577 }
1578 // ^============ LEGACY =============^
1579 
1580 template <typename T, viskores::IdComponent Size>
1582 {
1583  T result = a[0];
1584  for (viskores::IdComponent i = 1; i < Size; ++i)
1585  {
1586  result += a[i];
1587  }
1588  return result;
1589 }
1590 
1591 template <typename T>
1593 {
1594  return a[0] + a[1];
1595 }
1596 
1597 template <typename T>
1599 {
1600  return a[0] + a[1] + a[2];
1601 }
1602 
1603 template <typename T>
1605 {
1606  return a[0] + a[1] + a[2] + a[3];
1607 }
1608 
1609 template <typename T, viskores::IdComponent Size>
1611 {
1612  T result = a[0];
1613  for (viskores::IdComponent i = 1; i < Size; ++i)
1614  {
1615  result *= a[i];
1616  }
1617  return result;
1618 }
1619 
1620 template <typename T>
1622 {
1623  return a[0] * a[1];
1624 }
1625 
1626 template <typename T>
1628 {
1629  return a[0] * a[1] * a[2];
1630 }
1631 
1632 template <typename T>
1634 {
1635  return a[0] * a[1] * a[2] * a[3];
1636 }
1637 
1638 // A pre-declaration of viskores::Pair so that classes templated on them can refer
1639 // to it. The actual implementation is in viskores/Pair.h.
1640 template <typename U, typename V>
1641 struct Pair;
1642 
1645 template <typename T, viskores::IdComponent Size>
1646 inline VISKORES_CONT std::ostream& operator<<(std::ostream& stream,
1647  const viskores::Vec<T, Size>& vec)
1648 {
1649  stream << "[";
1650  for (viskores::IdComponent component = 0; component < Size - 1; component++)
1651  {
1652  stream << vec[component] << ",";
1653  }
1654  return stream << vec[Size - 1] << "]";
1655 }
1656 
1659 template <typename T, typename U>
1660 inline VISKORES_EXEC_CONT std::ostream& operator<<(std::ostream& stream,
1661  const viskores::Pair<T, U>& vec)
1662 {
1663  return stream << "[" << vec.first << "," << vec.second << "]";
1664 }
1665 
1666 } // End of namespace viskores
1667 
1669 // Declared inside of viskores namespace so that the operator work with ADL lookup
1670 #endif //viskores_Types_h
viskores::Negate::operator()
T operator()(const T &x) const
Definition: Types.h:351
viskores::VecC::NumberOfComponents
viskores::IdComponent NumberOfComponents
Definition: Types.h:1369
viskores::operator/
VISKORES_EXEC_CONT viskores::Vec< T, Size > operator/(viskores::Vec< T, Size > a, const viskores::Vec< T, Size > &b)
Definition: VecOperators.h:379
viskores::Vec< T, 0 >::operator==
bool operator==(const Vec< T, NUM_COMPONENTS > &) const
Definition: Types.h:879
viskores::operator==
bool operator==(const viskores::Matrix< T, NumRow, NumCol > &a, const viskores::Matrix< T, NumRow, NumCol > &b)
Definition: Matrix.h:632
viskores::VecC::VecC
constexpr VecC(const VecC< T > &src)
Definition: Types.h:1330
viskores::VecCConst
A const version of VecC.
Definition: Types.h:371
viskores::VecCConst::GetNumberOfComponents
constexpr viskores::IdComponent GetNumberOfComponents() const
Definition: Types.h:1444
viskores::Int16
int16_t Int16
Base type to use for 16-bit signed integer numbers.
Definition: Types.h:181
viskores::Vec< T, 0 >::operator=
Vec< ComponentType, NUM_COMPONENTS > & operator=(const Vec< ComponentType, NUM_COMPONENTS > &)
Definition: Types.h:862
viskores::VecC::VecC
constexpr VecC(T *array, viskores::IdComponent size)
Definition: Types.h:1309
viskores::VecCConst::Superclass
detail::VecCBase< T, VecCConst< T > > Superclass
Definition: Types.h:1384
viskores::VecCConst::Components
const T *const Components
Definition: Types.h:1450
viskores::Vec< viskores::Float64, 3 >::Superclass
detail::VecBase< viskores::Float64, Size, Vec< viskores::Float64, Size > > Superclass
Definition: Types.h:819
viskores::Subtract
Definition: Types.h:288
viskores::Vec< T, 3 >::Vec
constexpr Vec(const T &x, const T &y, const T &z)
Definition: Types.h:1043
viskores::Add::operator()
auto operator()(const T &a, const U &b) const -> decltype(a+b)
Definition: Types.h:271
viskores::VecCConst::VecCConst
constexpr VecCConst(const T &src)
Definition: Types.h:1417
viskores::Vec< T, 0 >::operator[]
constexpr ComponentType operator[](viskores::IdComponent) const
Definition: Types.h:873
viskores::VecCConst::VecCConst
constexpr VecCConst(const VecC< T > &src)
Definition: Types.h:1431
viskores::Vec< T, 3 >::Vec
Vec(const T &value)
Definition: Types.h:1031
viskores::Int8
int8_t Int8
Base type to use for 8-bit signed integer numbers.
Definition: Types.h:173
viskores::VecC::GetNumberOfComponents
constexpr viskores::IdComponent GetNumberOfComponents() const
Definition: Types.h:1350
viskores::VecC
A Vec-like representation for short arrays.
Definition: Types.h:368
viskoresNotUsed
#define viskoresNotUsed(parameter_name)
Simple macro to identify a parameter as unused.
Definition: ExportMacros.h:136
viskores::Vec::CopyInto
void CopyInto(Vec< T, Size > &dest) const
Definition: Types.h:837
VISKORES_SUPPRESS_EXEC_WARNINGS
#define VISKORES_SUPPRESS_EXEC_WARNINGS
Definition: ExportMacros.h:61
viskores::operator+
VISKORES_EXEC_CONT viskores::Vec< T, Size > operator+(viskores::Vec< T, Size > a, const viskores::Vec< T, Size > &b)
Definition: VecOperators.h:100
viskores::Vec< T, 2 >::Vec
Vec(const Vec< OtherType, 2 > &src)
Definition: Types.h:921
viskores::VecCConst::NumberOfComponents
viskores::IdComponent NumberOfComponents
Definition: Types.h:1451
viskores::Vec< T, 2 >::Superclass
detail::VecBase< T, 2, Vec< T, 2 > > Superclass
Definition: Types.h:911
Assert.h
viskores::UInt16
uint16_t UInt16
Base type to use for 16-bit unsigned integer numbers.
Definition: Types.h:185
viskores::operator*
VISKORES_EXEC_CONT viskores::Vec< T, Size > operator*(viskores::Vec< T, Size > a, const viskores::Vec< T, Size > &b)
Definition: VecOperators.h:193
viskores::IdComponent
viskores::Int32 IdComponent
Base type to use to index small lists.
Definition: Types.h:202
viskores::Subtract::operator()
auto operator()(const T &a, const U &b) const -> decltype(a - b)
Definition: Types.h:291
viskores::Vec< T, 4 >::Superclass
detail::VecBase< T, 4, Vec< T, 4 > > Superclass
Definition: Types.h:1145
VISKORES_EXEC_CONT
#define VISKORES_EXEC_CONT
Definition: ExportMacros.h:60
viskores::VecC::Superclass
detail::VecCBase< T, VecC< T > > Superclass
Definition: Types.h:1290
viskores::Vec< T, 3 >::Vec
Vec(const Vec< OtherType, 3 > &src)
Definition: Types.h:1037
viskores::Vec< T, 3 >
Definition: Types.h:1025
viskores::VecCConst::VecCConst
constexpr VecCConst(const viskores::Vec< T, Size > &src)
Definition: Types.h:1410
VecOperators.h
viskores::Multiply
Definition: Types.h:308
viskores::Add
Definition: Types.h:268
viskores::Vec< T, 2 >
Definition: Types.h:909
viskores::Int64
signed long long Int64
Base type to use for 64-bit signed integer numbers.
Definition: Types.h:212
viskores::Vec< T, 0 >::GetNumberOfComponents
constexpr viskores::IdComponent GetNumberOfComponents() const
Definition: Types.h:867
ExportMacros.h
viskores::VecC::VecC
constexpr VecC()
Definition: Types.h:1302
viskores::VecC::ComponentType
T ComponentType
Definition: Types.h:1298
viskores::Negate
Definition: Types.h:348
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::operator<<
std::ostream & operator<<(std::ostream &stream, const viskores::Bounds &bounds)
Helper function for printing bounds during testing.
Definition: Bounds.h:268
viskores
Groups connected points that have the same field value.
Definition: Atomic.h:27
viskores::VecC::operator[]
constexpr T & operator[](viskores::IdComponent index)
Definition: Types.h:1343
viskores::Pair::first
FirstType first
The pair's first object.
Definition: Pair.h:58
viskores::Vec< T, 0 >::Vec
Vec(const Vec< OtherType, NUM_COMPONENTS > &)
Definition: Types.h:857
viskores::Vec< T, 4 >::Vec
Vec(const T &value)
Definition: Types.h:1149
viskores::Float32
float Float32
Base type to use for 32-bit floating-point numbers.
Definition: Types.h:165
viskores::Vec< T, 1 >::Superclass
detail::VecBase< T, 1, Vec< T, 1 > > Superclass
Definition: Types.h:889
viskores::Vec< T, 2 >::Vec
constexpr Vec(const T &x, const T &y)
Definition: Types.h:927
viskores::Divide
Definition: Types.h:328
viskores::ReduceProduct
T ReduceProduct(const viskores::Vec< T, Size > &a)
Definition: Types.h:1610
viskores::ReduceSum
T ReduceSum(const viskores::Vec< T, Size > &a)
Definition: Types.h:1581
viskores::Vec< T, 0 >::ComponentType
T ComponentType
Definition: Types.h:850
Configure.h
viskores::VecC::Components
T *const Components
Definition: Types.h:1368
viskores::Vec< T, 1 >::Vec
constexpr Vec(const T &value)
Definition: Types.h:893
viskores::operator-
VISKORES_EXEC_CONT std::enable_if<(std::is_floating_point< T >::value||std::is_signed< T >::value), viskores::Vec< T, Size > >::type operator-(viskores::Vec< T, Size > x)
Definition: VecOperators.h:49
viskores::Vec< T, 2 >::Vec
Vec(const T &value)
Definition: Types.h:915
VISKORES_ASSERT
#define VISKORES_ASSERT(condition)
Definition: Assert.h:51
viskores::Vec< T, 0 >::operator!=
bool operator!=(const Vec< T, NUM_COMPONENTS > &) const
Definition: Types.h:881
viskores::Vec< T, 3 >::Superclass
detail::VecBase< T, 3, Vec< T, 3 > > Superclass
Definition: Types.h:1027
viskores::VecC::VecC
constexpr VecC(T &src)
Definition: Types.h:1323
viskores::Pair
A viskores::Pair is essentially the same as an STL pair object except that the methods (constructors ...
Definition: Pair.h:37
viskores::Multiply::operator()
auto operator()(const T &a, const U &b) const -> decltype(a *b)
Definition: Types.h:311
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::UInt64
unsigned long long UInt64
Base type to use for 64-bit signed integer numbers.
Definition: Types.h:215
viskores::UInt8
uint8_t UInt8
Base type to use for 8-bit unsigned integer numbers.
Definition: Types.h:177
viskores::Vec< T, 4 >
Definition: Types.h:1143
viskores::Int32
int32_t Int32
Base type to use for 32-bit signed integer numbers.
Definition: Types.h:189
viskores::VecCConst::operator[]
constexpr const T & operator[](viskores::IdComponent index) const
Definition: Types.h:1437
viskores::VecCConst::VecCConst
constexpr VecCConst(const T *array, viskores::IdComponent size)
Definition: Types.h:1403
viskores::VecCConst::VecCConst
constexpr VecCConst()
Definition: Types.h:1396
StaticAssert.h
viskores::VecCConst::ComponentType
T ComponentType
Definition: Types.h:1392
viskores::FloatDefault
viskores::Float32 FloatDefault
The floating point type to use when no other precision is specified.
Definition: Types.h:244
viskores::operator!=
bool operator!=(const viskores::Matrix< T, NumRow, NumCol > &a, const viskores::Matrix< T, NumRow, NumCol > &b)
Definition: Matrix.h:646
viskores::Vec< T, 1 >::Vec
Vec(const Vec< OtherType, 1 > &src)
Definition: Types.h:899
viskores::Pair::second
SecondType second
The pair's second object.
Definition: Pair.h:63
viskores::Vec< viskores::Float64, 3 >::ComponentType
viskores::Float64 ComponentType
Definition: Types.h:823
viskores::VecCConst::VecCConst
constexpr VecCConst(const VecCConst< T > &src)
Definition: Types.h:1424
viskores::WordTypeDefault
viskores::UInt32 WordTypeDefault
The default word size used for atomic bitwise operations.
Definition: Types.h:206
viskores::Divide::operator()
auto operator()(const T &a, const U &b) const -> decltype(a/b)
Definition: Types.h:331
viskores::VecC::operator=
VecC< T > & operator=(const VecC< T > &src)
Definition: Types.h:1356
viskores::Float64
double Float64
Base type to use for 64-bit floating-point numbers.
Definition: Types.h:169
viskores::Vec< T, 4 >::Vec
Vec(const Vec< OtherType, 4 > &src)
Definition: Types.h:1155
viskores::VecC::VecC
constexpr VecC(viskores::Vec< T, Size > &src)
Definition: Types.h:1316
VISKORES_SCALAR_DOT
#define VISKORES_SCALAR_DOT(stype)
Definition: Types.h:1534
viskores::Vec
A short fixed-length array.
Definition: Types.h:365
viskores::Vec< T, 0 >::Vec
Vec(const ComponentType &)
Definition: Types.h:854
viskores::VecC::operator[]
constexpr const T & operator[](viskores::IdComponent index) const
Definition: Types.h:1336
viskores::Vec< T, 4 >::Vec
constexpr Vec(const T &x, const T &y, const T &z, const T &w)
Definition: Types.h:1161
viskores::UInt32
uint32_t UInt32
Base type to use for 32-bit unsigned integer numbers.
Definition: Types.h:193
VISKORES_STATIC_ASSERT
#define VISKORES_STATIC_ASSERT(condition)
Definition: StaticAssert.h:24