VTK-m  2.0
Types.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_Types_h
11 #define vtk_m_Types_h
12 
13 #include <vtkm/internal/Configure.h>
15 
16 #include <vtkm/Assert.h>
17 #include <vtkm/StaticAssert.h>
18 
19 #include <cstdint>
20 #include <iostream>
21 #include <type_traits>
22 
149 namespace vtkm
150 {
151 //*****************************************************************************
152 // Typedefs for basic types.
153 //*****************************************************************************
154 using Float32 = float;
155 using Float64 = double;
156 using Int8 = int8_t;
157 using UInt8 = uint8_t;
158 using Int16 = int16_t;
159 using UInt16 = uint16_t;
160 using Int32 = int32_t;
161 using UInt32 = uint32_t;
162 
169 
173 
174 //In this order so that we exactly match the logic that exists in VTK
175 #if VTKM_SIZE_LONG_LONG == 8
176 using Int64 = signed long long;
177 using UInt64 = unsigned long long;
178 #define VTKM_UNUSED_INT_TYPE long
179 #elif VTKM_SIZE_LONG == 8
180 using Int64 = signed long;
181 using UInt64 = unsigned long;
182 #define VTKM_UNUSED_INT_TYPE long long
183 #else
184 #error Could not find a 64-bit integer.
185 #endif
186 
188 #ifdef VTKM_USE_64BIT_IDS
189 using Id = vtkm::Int64;
190 #else
191 using Id = vtkm::Int32;
192 #endif
193 
195 #ifdef VTKM_USE_DOUBLE_PRECISION
197 #else
199 #endif
200 
201 
202 namespace internal
203 {
204 
206 struct NullType
207 {
208 };
209 
210 } // namespace internal
211 
212 // Disable conversion warnings for Add, Subtract, Multiply, Divide on GCC only.
213 // GCC creates false positive warnings for signed/unsigned char* operations.
214 // This occurs because the values are implicitly casted up to int's for the
215 // operation, and than casted back down to char's when return.
216 // This causes a false positive warning, even when the values is within
217 // the value types range
218 #if (defined(VTKM_GCC) || defined(VTKM_CLANG))
219 #pragma GCC diagnostic push
220 #pragma GCC diagnostic ignored "-Wconversion"
221 #endif // gcc || clang
222 struct Add
223 {
224  template <typename T, typename U>
225  inline VTKM_EXEC_CONT auto operator()(const T& a, const U& b) const -> decltype(a + b)
226  {
227  return a + b;
228  }
229 
230  // If both arguments are short integers, explicitly cast the result back to the
231  // type to avoid narrowing conversion warnings from operations that promote to
232  // integers.
233  template <typename T>
234  inline VTKM_EXEC_CONT
235  typename std::enable_if<std::is_integral<T>::value && sizeof(T) < sizeof(int), T>::type
236  operator()(T a, T b) const
237  {
238  return static_cast<T>(a + b);
239  }
240 };
241 
242 struct Subtract
243 {
244  template <typename T, typename U>
245  inline VTKM_EXEC_CONT auto operator()(const T& a, const U& b) const -> decltype(a - b)
246  {
247  return a - b;
248  }
249 
250  // If both arguments are short integers, explicitly cast the result back to the
251  // type to avoid narrowing conversion warnings from operations that promote to
252  // integers.
253  template <typename T>
254  inline VTKM_EXEC_CONT
255  typename std::enable_if<std::is_integral<T>::value && sizeof(T) < sizeof(int), T>::type
256  operator()(T a, T b) const
257  {
258  return static_cast<T>(a - b);
259  }
260 };
261 
262 struct Multiply
263 {
264  template <typename T, typename U>
265  inline VTKM_EXEC_CONT auto operator()(const T& a, const U& b) const -> decltype(a * b)
266  {
267  return a * b;
268  }
269 
270  // If both arguments are short integers, explicitly cast the result back to the
271  // type to avoid narrowing conversion warnings from operations that promote to
272  // integers.
273  template <typename T>
274  inline VTKM_EXEC_CONT
275  typename std::enable_if<std::is_integral<T>::value && sizeof(T) < sizeof(int), T>::type
276  operator()(T a, T b) const
277  {
278  return static_cast<T>(a * b);
279  }
280 };
281 
282 struct Divide
283 {
284  template <typename T, typename U>
285  inline VTKM_EXEC_CONT auto operator()(const T& a, const U& b) const -> decltype(a / b)
286  {
287  return a / b;
288  }
289 
290  // If both arguments are short integers, explicitly cast the result back to the
291  // type to avoid narrowing conversion warnings from operations that promote to
292  // integers.
293  template <typename T>
294  inline VTKM_EXEC_CONT
295  typename std::enable_if<std::is_integral<T>::value && sizeof(T) < sizeof(int), T>::type
296  operator()(T a, T b) const
297  {
298  return static_cast<T>(a / b);
299  }
300 };
301 
302 struct Negate
303 {
304  template <typename T>
305  inline VTKM_EXEC_CONT T operator()(const T& x) const
306  {
307  return T(-x);
308  }
309 };
310 
311 #if (defined(VTKM_GCC) || defined(VTKM_CLANG))
312 #pragma GCC diagnostic pop
313 #endif // gcc || clang
314 
315 //-----------------------------------------------------------------------------
316 
317 // Pre declaration
318 template <typename T, vtkm::IdComponent Size>
320 
321 template <typename T>
323 
324 template <typename T>
326 
327 namespace detail
328 {
329 
332 // Disable conversion warnings for Add, Subtract, Multiply, Divide on GCC only.
333 // GCC creates false positive warnings for signed/unsigned char* operations.
334 // This occurs because the values are implicitly casted up to int's for the
335 // operation, and than casted back down to char's when return.
336 // This causes a false positive warning, even when the values is within
337 // the value types range
338 //
339 // NVCC 7.5 and below does not recognize this pragma inside of class bodies,
340 // so put them before entering the class.
341 //
342 #if (defined(VTKM_CUDA) && (__CUDACC_VER_MAJOR__ < 8))
343 #if (defined(VTKM_GCC) || defined(VTKM_CLANG))
344 #pragma GCC diagnostic push
345 #pragma GCC diagnostic ignored "-Wunknown-pragmas"
346 #pragma GCC diagnostic ignored "-Wpragmas"
347 #pragma GCC diagnostic ignored "-Wconversion"
348 #pragma GCC diagnostic ignored "-Wfloat-conversion"
349 #endif // gcc || clang
350 #endif // use cuda < 8
351 template <typename T, typename DerivedClass>
352 class VTKM_ALWAYS_EXPORT VecBaseCommon
353 {
354 public:
355  using ComponentType = T;
356 
357 protected:
358  VecBaseCommon() = default;
359 
361  const DerivedClass& Derived() const { return *static_cast<const DerivedClass*>(this); }
362 
364  DerivedClass& Derived() { return *static_cast<DerivedClass*>(this); }
365 
366 private:
367  // Only for internal use
369  inline vtkm::IdComponent NumComponents() const { return this->Derived().GetNumberOfComponents(); }
370 
371  // Only for internal use
373  inline const T& Component(vtkm::IdComponent index) const { return this->Derived()[index]; }
374 
375  // Only for internal use
377  inline T& Component(vtkm::IdComponent index) { return this->Derived()[index]; }
378 
379 public:
380  template <vtkm::IdComponent OtherSize>
381  VTKM_EXEC_CONT void CopyInto(vtkm::Vec<ComponentType, OtherSize>& dest) const
382  {
383  for (vtkm::IdComponent index = 0; (index < this->NumComponents()) && (index < OtherSize);
384  index++)
385  {
386  dest[index] = this->Component(index);
387  }
388  }
389 
390  // Only works with Vec-like objects with operator[] and GetNumberOfComponents().
391  template <typename OtherVecType>
392  VTKM_EXEC_CONT DerivedClass& operator=(const OtherVecType& src)
393  {
394  VTKM_ASSERT(this->NumComponents() == src.GetNumberOfComponents());
395  for (vtkm::IdComponent i = 0; i < this->NumComponents(); ++i)
396  {
397  this->Component(i) = src[i];
398  }
399  return this->Derived();
400  }
401 
403  bool operator==(const DerivedClass& other) const
404  {
405  bool equal = true;
406  for (vtkm::IdComponent i = 0; i < this->NumComponents() && equal; ++i)
407  {
408  equal = (this->Component(i) == other[i]);
409  }
410  return equal;
411  }
412 
414  bool operator<(const DerivedClass& other) const
415  {
416  for (vtkm::IdComponent i = 0; i < this->NumComponents(); ++i)
417  {
418  // ignore equals as that represents check next value
419  if (this->Component(i) < other[i])
420  {
421  return true;
422  }
423  else if (other[i] < this->Component(i))
424  {
425  return false;
426  }
427  } // if all same we are not less
428 
429  return false;
430  }
431 
433  bool operator!=(const DerivedClass& other) const { return !(this->operator==(other)); }
434 
435 #if (!(defined(VTKM_CUDA) && (__CUDACC_VER_MAJOR__ < 8)))
436 #if (defined(VTKM_GCC) || defined(VTKM_CLANG))
437 #pragma GCC diagnostic push
438 #pragma GCC diagnostic ignored "-Wunknown-pragmas"
439 #pragma GCC diagnostic ignored "-Wpragmas"
440 #pragma GCC diagnostic ignored "-Wconversion"
441 #pragma GCC diagnostic ignored "-Wfloat-conversion"
442 #endif // gcc || clang
443 #endif // not using cuda < 8
444 
445  template <vtkm::IdComponent Size>
447  const vtkm::Vec<ComponentType, Size>& other) const
448  {
449  VTKM_ASSERT(Size == this->NumComponents());
451  for (vtkm::IdComponent i = 0; i < Size; ++i)
452  {
453  result[i] = this->Component(i) + other[i];
454  }
455  return result;
456  }
457 
458  template <typename OtherClass>
459  inline VTKM_EXEC_CONT DerivedClass& operator+=(const OtherClass& other)
460  {
461  VTKM_ASSERT(this->NumComponents() == other.GetNumberOfComponents());
462  for (vtkm::IdComponent i = 0; i < this->NumComponents(); ++i)
463  {
464  this->Component(i) += other[i];
465  }
466  return this->Derived();
467  }
468 
469  template <vtkm::IdComponent Size>
471  const vtkm::Vec<ComponentType, Size>& other) const
472  {
473  VTKM_ASSERT(Size == this->NumComponents());
475  for (vtkm::IdComponent i = 0; i < Size; ++i)
476  {
477  result[i] = this->Component(i) - other[i];
478  }
479  return result;
480  }
481 
482  template <typename OtherClass>
483  inline VTKM_EXEC_CONT DerivedClass& operator-=(const OtherClass& other)
484  {
485  VTKM_ASSERT(this->NumComponents() == other.GetNumberOfComponents());
486  for (vtkm::IdComponent i = 0; i < this->NumComponents(); ++i)
487  {
488  this->Component(i) -= other[i];
489  }
490  return this->Derived();
491  }
492 
493  template <vtkm::IdComponent Size>
495  const vtkm::Vec<ComponentType, Size>& other) const
496  {
498  for (vtkm::IdComponent i = 0; i < Size; ++i)
499  {
500  result[i] = this->Component(i) * other[i];
501  }
502  return result;
503  }
504 
505  template <typename OtherClass>
506  inline VTKM_EXEC_CONT DerivedClass& operator*=(const OtherClass& other)
507  {
508  VTKM_ASSERT(this->NumComponents() == other.GetNumberOfComponents());
509  for (vtkm::IdComponent i = 0; i < this->NumComponents(); ++i)
510  {
511  this->Component(i) *= other[i];
512  }
513  return this->Derived();
514  }
515 
516  template <vtkm::IdComponent Size>
518  const vtkm::Vec<ComponentType, Size>& other) const
519  {
521  for (vtkm::IdComponent i = 0; i < Size; ++i)
522  {
523  result[i] = this->Component(i) / other[i];
524  }
525  return result;
526  }
527 
528  template <typename OtherClass>
529  VTKM_EXEC_CONT DerivedClass& operator/=(const OtherClass& other)
530  {
531  VTKM_ASSERT(this->NumComponents() == other.GetNumberOfComponents());
532  for (vtkm::IdComponent i = 0; i < this->NumComponents(); ++i)
533  {
534  this->Component(i) /= other[i];
535  }
536  return this->Derived();
537  }
538 
539 #if (!(defined(VTKM_CUDA) && (__CUDACC_VER_MAJOR__ < 8)))
540 #if (defined(VTKM_GCC) || defined(VTKM_CLANG))
541 #pragma GCC diagnostic pop
542 #endif // gcc || clang
543 #endif // not using cuda < 8
544 
546  ComponentType* GetPointer() { return &this->Component(0); }
547 
549  const ComponentType* GetPointer() const { return &this->Component(0); }
550 };
551 
552 
555 template <typename T, vtkm::IdComponent Size, typename DerivedClass>
556 class VTKM_ALWAYS_EXPORT VecBase : public vtkm::detail::VecBaseCommon<T, DerivedClass>
557 {
558 public:
559  using ComponentType = T;
560  static constexpr vtkm::IdComponent NUM_COMPONENTS = Size;
561 
562  VecBase() = default;
563 
564  // The enable_if predicate will disable this constructor for Size=1 so that
565  // the variadic constructor constexpr VecBase(T, Ts&&...) is called instead.
567  template <vtkm::IdComponent Size2 = Size, typename std::enable_if<Size2 != 1, int>::type = 0>
568  VTKM_EXEC_CONT explicit VecBase(const ComponentType& value)
569  {
570  for (vtkm::IdComponent i = 0; i < Size; ++i)
571  {
572  this->Components[i] = value;
573  }
574  }
575 
577  template <typename... Ts>
578  VTKM_EXEC_CONT constexpr VecBase(ComponentType value0, Ts&&... values)
579  : Components{ value0, values... }
580  {
581  VTKM_STATIC_ASSERT(sizeof...(Ts) + 1 == Size);
582  }
583 
586  VecBase(std::initializer_list<ComponentType> values)
587  {
588  ComponentType* dest = this->Components;
589  auto src = values.begin();
590  if (values.size() == 1)
591  {
592  for (vtkm::IdComponent i = 0; i < Size; ++i)
593  {
594  this->Components[i] = *src;
595  ++dest;
596  }
597  }
598  else
599  {
600  VTKM_ASSERT((values.size() == NUM_COMPONENTS) &&
601  "Vec object initialized wrong number of components.");
602  for (; src != values.end(); ++src)
603  {
604  *dest = *src;
605  ++dest;
606  }
607  }
608  }
609 
610 #if (!(defined(VTKM_CUDA) && (__CUDACC_VER_MAJOR__ < 8)))
611 #if (defined(VTKM_GCC) || defined(VTKM_CLANG))
612 #pragma GCC diagnostic push
613 #pragma GCC diagnostic ignored "-Wunknown-pragmas"
614 #pragma GCC diagnostic ignored "-Wpragmas"
615 #pragma GCC diagnostic ignored "-Wconversion"
616 #pragma GCC diagnostic ignored "-Wfloat-conversion"
617 #endif // gcc || clang
618 #endif //not using cuda < 8
619 #if defined(VTKM_MSVC)
620 #pragma warning(push)
621 #pragma warning(disable : 4244)
622 #endif
623 
625  template <typename OtherValueType, typename OtherDerivedType>
626  VTKM_EXEC_CONT explicit VecBase(const VecBase<OtherValueType, Size, OtherDerivedType>& src)
627  {
628  //DO NOT CHANGE THIS AND THE ABOVE PRAGMA'S UNLESS YOU FULLY UNDERSTAND THE
629  //ISSUE https://gitlab.kitware.com/vtk/vtk-m/-/issues/221
630  for (vtkm::IdComponent i = 0; i < Size; ++i)
631  {
632  this->Components[i] = src[i];
633  }
634  }
635 
636 public:
637  inline VTKM_EXEC_CONT constexpr vtkm::IdComponent GetNumberOfComponents() const
638  {
639  return NUM_COMPONENTS;
640  }
641 
642  inline VTKM_EXEC_CONT constexpr const ComponentType& operator[](vtkm::IdComponent idx) const
643  {
644  return this->Components[idx];
645  }
646 
647  inline VTKM_EXEC_CONT ComponentType& operator[](vtkm::IdComponent idx)
648  {
649  VTKM_ASSERT(idx >= 0);
650  VTKM_ASSERT(idx < NUM_COMPONENTS);
651  return this->Components[idx];
652  }
653 
655  template <typename OtherComponentType, typename OtherClass>
656  inline VTKM_EXEC_CONT DerivedClass
657  operator+(const VecBaseCommon<OtherComponentType, OtherClass>& other) const
658  {
659  const OtherClass& other_derived = static_cast<const OtherClass&>(other);
660  VTKM_ASSERT(NUM_COMPONENTS == other_derived.GetNumberOfComponents());
661 
662  DerivedClass result;
663  for (vtkm::IdComponent i = 0; i < NUM_COMPONENTS; ++i)
664  {
665  result[i] = this->Components[i] + static_cast<ComponentType>(other_derived[i]);
666  }
667  return result;
668  }
669 
671  template <typename OtherComponentType, typename OtherClass>
672  inline VTKM_EXEC_CONT DerivedClass
673  operator-(const VecBaseCommon<OtherComponentType, OtherClass>& other) const
674  {
675  const OtherClass& other_derived = static_cast<const OtherClass&>(other);
676  VTKM_ASSERT(NUM_COMPONENTS == other_derived.GetNumberOfComponents());
677 
678  DerivedClass result;
679  for (vtkm::IdComponent i = 0; i < NUM_COMPONENTS; ++i)
680  {
681  result[i] = this->Components[i] - static_cast<ComponentType>(other_derived[i]);
682  }
683  return result;
684  }
685 
687  template <typename OtherComponentType, typename OtherClass>
688  inline VTKM_EXEC_CONT DerivedClass
689  operator*(const VecBaseCommon<OtherComponentType, OtherClass>& other) const
690  {
691  const OtherClass& other_derived = static_cast<const OtherClass&>(other);
692  VTKM_ASSERT(NUM_COMPONENTS == other_derived.GetNumberOfComponents());
693 
694  DerivedClass result;
695  for (vtkm::IdComponent i = 0; i < NUM_COMPONENTS; ++i)
696  {
697  result[i] = this->Components[i] * static_cast<ComponentType>(other_derived[i]);
698  }
699  return result;
700  }
701 
703  template <typename OtherComponentType, typename OtherClass>
704  inline VTKM_EXEC_CONT DerivedClass
705  operator/(const VecBaseCommon<OtherComponentType, OtherClass>& other) const
706  {
707  const OtherClass& other_derived = static_cast<const OtherClass&>(other);
708  VTKM_ASSERT(NUM_COMPONENTS == other_derived.GetNumberOfComponents());
709 
710  DerivedClass result;
711  for (vtkm::IdComponent i = 0; i < NUM_COMPONENTS; ++i)
712  {
713  result[i] = this->Components[i] / static_cast<ComponentType>(other_derived[i]);
714  }
715  return result;
716  }
717 
718 #if (!(defined(VTKM_CUDA) && (__CUDACC_VER_MAJOR__ < 8)))
719 #if (defined(VTKM_GCC) || defined(VTKM_CLANG))
720 #pragma GCC diagnostic pop
721 #endif // gcc || clang
722 #endif // not using cuda < 8
723 #if defined(VTKM_MSVC)
724 #pragma warning(pop)
725 #endif
726 
727 protected:
728  ComponentType Components[NUM_COMPONENTS];
729 };
730 
731 #if (defined(VTKM_CUDA) && (__CUDACC_VER_MAJOR__ < 8))
732 #if (defined(VTKM_GCC) || defined(VTKM_CLANG))
733 #pragma GCC diagnostic pop
734 #endif // gcc || clang
735 #endif // use cuda < 8
736 
739 template <typename T, typename DerivedClass>
740 class VTKM_ALWAYS_EXPORT VecCBase : public vtkm::detail::VecBaseCommon<T, DerivedClass>
741 {
742 protected:
744  VecCBase() {}
745 };
746 
747 } // namespace detail
748 
749 //-----------------------------------------------------------------------------
750 
766 template <typename T, vtkm::IdComponent Size>
767 class VTKM_ALWAYS_EXPORT Vec : public detail::VecBase<T, Size, Vec<T, Size>>
768 {
769  using Superclass = detail::VecBase<T, Size, Vec<T, Size>>;
770 
771 public:
772 #ifdef VTKM_DOXYGEN_ONLY
773  using ComponentType = T;
774  static constexpr vtkm::IdComponent NUM_COMPONENTS = Size;
775 #endif
776 
777  using Superclass::Superclass;
778  Vec() = default;
779 #if defined(_MSC_VER) && _MSC_VER < 1910
780  template <typename... Ts>
781  constexpr Vec(T value, Ts&&... values)
782  : Superclass(value, std::forward<Ts>(values)...)
783  {
784  }
785 #endif
786 
787  inline VTKM_EXEC_CONT void CopyInto(Vec<T, Size>& dest) const { dest = *this; }
788 };
789 
790 //-----------------------------------------------------------------------------
791 // Specializations for common small tuples. We implement them a bit specially.
792 
793 // A vector of size 0 cannot use VecBase because it will try to create a
794 // zero length array which troubles compilers. Vecs of size 0 are a bit
795 // pointless but might occur in some generic functions or classes.
796 template <typename T>
798 {
799 public:
800  using ComponentType = T;
801  static constexpr vtkm::IdComponent NUM_COMPONENTS = 0;
802 
803  Vec() = default;
804  VTKM_EXEC_CONT explicit Vec(const ComponentType&) {}
805 
806  template <typename OtherType>
808  {
809  }
810 
813  {
814  return *this;
815  }
816 
818  {
819  return NUM_COMPONENTS;
820  }
821 
824  {
825  return ComponentType();
826  }
827 
829  bool operator==(const Vec<T, NUM_COMPONENTS>& vtkmNotUsed(other)) const { return true; }
831  bool operator!=(const Vec<T, NUM_COMPONENTS>& vtkmNotUsed(other)) const { return false; }
832 };
833 
834 // Vectors of size 1 should implicitly convert between the scalar and the
835 // vector. Otherwise, it should behave the same.
836 template <typename T>
837 class VTKM_ALWAYS_EXPORT Vec<T, 1> : public detail::VecBase<T, 1, Vec<T, 1>>
838 {
839  using Superclass = detail::VecBase<T, 1, Vec<T, 1>>;
840 
841 public:
842  Vec() = default;
843  VTKM_EXEC_CONT constexpr Vec(const T& value)
844  : Superclass(value)
845  {
846  }
847 
848  template <typename OtherType>
850  : Superclass(src)
851  {
852  }
853 };
854 
855 //-----------------------------------------------------------------------------
856 // Specializations for common tuple sizes (with special names).
857 
858 template <typename T>
859 class VTKM_ALWAYS_EXPORT Vec<T, 2> : public detail::VecBase<T, 2, Vec<T, 2>>
860 {
861  using Superclass = detail::VecBase<T, 2, Vec<T, 2>>;
862 
863 public:
864  Vec() = default;
865  VTKM_EXEC_CONT Vec(const T& value)
866  : Superclass(value)
867  {
868  }
869 
870  template <typename OtherType>
872  : Superclass(src)
873  {
874  }
875 
877  constexpr Vec(const T& x, const T& y)
878  : Superclass(x, y)
879  {
880  }
881 };
882 
886 
890 
897 
903 
909 
915 
921 
927 
933 
939 
944 #ifdef VTKM_USE_64BIT_IDS
946 #else
948 #endif
949 
955 
961 
967 
973 
974 template <typename T>
975 class VTKM_ALWAYS_EXPORT Vec<T, 3> : public detail::VecBase<T, 3, Vec<T, 3>>
976 {
977  using Superclass = detail::VecBase<T, 3, Vec<T, 3>>;
978 
979 public:
980  Vec() = default;
981  VTKM_EXEC_CONT Vec(const T& value)
982  : Superclass(value)
983  {
984  }
985 
986  template <typename OtherType>
988  : Superclass(src)
989  {
990  }
991 
993  constexpr Vec(const T& x, const T& y, const T& z)
994  : Superclass(x, y, z)
995  {
996  }
997 };
998 
1004 
1008 
1015 
1021 
1027 
1033 
1039 
1045 
1051 
1057 
1062 #ifdef VTKM_USE_64BIT_IDS
1064 #else
1066 #endif
1067 
1073 
1079 
1085 
1091 
1092 template <typename T>
1093 class VTKM_ALWAYS_EXPORT Vec<T, 4> : public detail::VecBase<T, 4, Vec<T, 4>>
1094 {
1095  using Superclass = detail::VecBase<T, 4, Vec<T, 4>>;
1096 
1097 public:
1098  Vec() = default;
1099  VTKM_EXEC_CONT Vec(const T& value)
1100  : Superclass(value)
1101  {
1102  }
1103 
1104  template <typename OtherType>
1106  : Superclass(src)
1107  {
1108  }
1109 
1111  constexpr Vec(const T& x, const T& y, const T& z, const T& w)
1112  : Superclass(x, y, z, w)
1113  {
1114  }
1115 };
1116 
1120 
1124 
1131 
1137 
1143 
1149 
1155 
1161 
1167 
1173 
1178 #ifdef VTKM_USE_64BIT_IDS
1180 #else
1182 #endif
1183 
1189 
1195 
1201 
1207 
1211 template <typename T, typename... Ts>
1212 VTKM_EXEC_CONT constexpr vtkm::Vec<T, vtkm::IdComponent(sizeof...(Ts) + 1)> make_Vec(T value0,
1213  Ts&&... args)
1214 {
1215  return vtkm::Vec<T, vtkm::IdComponent(sizeof...(Ts) + 1)>(value0, T(args)...);
1216 }
1217 
1236 template <typename T>
1237 class VTKM_ALWAYS_EXPORT VecC : public detail::VecCBase<T, VecC<T>>
1238 {
1239  using Superclass = detail::VecCBase<T, VecC<T>>;
1240 
1241  VTKM_STATIC_ASSERT_MSG(std::is_const<T>::value == false,
1242  "You cannot use VecC with a const type as its template argument. "
1243  "Use either const VecC or VecCConst.");
1244 
1245 public:
1246 #ifdef VTKM_DOXYGEN_ONLY
1247  using ComponentType = T;
1248 #endif
1249 
1252  : Components(nullptr)
1253  , NumberOfComponents(0)
1254  {
1255  }
1256 
1258  VecC(T* array, vtkm::IdComponent size)
1259  : Components(array)
1260  , NumberOfComponents(size)
1261  {
1262  }
1263 
1264  template <vtkm::IdComponent Size>
1266  : Components(src.GetPointer())
1267  , NumberOfComponents(Size)
1268  {
1269  }
1270 
1272  explicit VecC(T& src)
1273  : Components(&src)
1274  , NumberOfComponents(1)
1275  {
1276  }
1277 
1279  VecC(const VecC<T>& src)
1280  : Components(src.Components)
1281  , NumberOfComponents(src.NumberOfComponents)
1282  {
1283  }
1284 
1285  inline VTKM_EXEC_CONT const T& operator[](vtkm::IdComponent index) const
1286  {
1287  VTKM_ASSERT(index >= 0);
1288  VTKM_ASSERT(index < this->NumberOfComponents);
1289  return this->Components[index];
1290  }
1291 
1293  {
1294  VTKM_ASSERT(index >= 0);
1295  VTKM_ASSERT(index < this->NumberOfComponents);
1296  return this->Components[index];
1297  }
1298 
1300  {
1301  return this->NumberOfComponents;
1302  }
1303 
1306  {
1307  VTKM_ASSERT(this->NumberOfComponents == src.GetNumberOfComponents());
1308  for (vtkm::IdComponent index = 0; index < this->NumberOfComponents; index++)
1309  {
1310  (*this)[index] = src[index];
1311  }
1312 
1313  return *this;
1314  }
1315 
1316 private:
1317  T* const Components;
1319 };
1320 
1330 template <typename T>
1331 class VTKM_ALWAYS_EXPORT VecCConst : public detail::VecCBase<T, VecCConst<T>>
1332 {
1333  using Superclass = detail::VecCBase<T, VecCConst<T>>;
1334 
1335  VTKM_STATIC_ASSERT_MSG(std::is_const<T>::value == false,
1336  "You cannot use VecCConst with a const type as its template argument. "
1337  "Remove the const from the type.");
1338 
1339 public:
1340 #ifdef VTKM_DOXYGEN_ONLY
1341  using ComponentType = T;
1342 #endif
1343 
1346  : Components(nullptr)
1347  , NumberOfComponents(0)
1348  {
1349  }
1350 
1352  VecCConst(const T* array, vtkm::IdComponent size)
1353  : Components(array)
1354  , NumberOfComponents(size)
1355  {
1356  }
1357 
1358  template <vtkm::IdComponent Size>
1360  : Components(src.GetPointer())
1361  , NumberOfComponents(Size)
1362  {
1363  }
1364 
1366  explicit VecCConst(const T& src)
1367  : Components(&src)
1368  , NumberOfComponents(1)
1369  {
1370  }
1371 
1374  : Components(src.Components)
1375  , NumberOfComponents(src.NumberOfComponents)
1376  {
1377  }
1378 
1380  VecCConst(const VecC<T>& src)
1381  : Components(src.Components)
1382  , NumberOfComponents(src.NumberOfComponents)
1383  {
1384  }
1385 
1386  inline VTKM_EXEC_CONT const T& operator[](vtkm::IdComponent index) const
1387  {
1388  VTKM_ASSERT(index >= 0);
1389  VTKM_ASSERT(index < this->NumberOfComponents);
1390  return this->Components[index];
1391  }
1392 
1394  {
1395  return this->NumberOfComponents;
1396  }
1397 
1398 private:
1399  const T* const Components;
1401 
1402  // You are not allowed to assign to a VecCConst, so these operators are not
1403  // implemented and are disallowed.
1404  void operator=(const VecCConst<T>&) = delete;
1405  void operator+=(const VecCConst<T>&) = delete;
1406  void operator-=(const VecCConst<T>&) = delete;
1407  void operator*=(const VecCConst<T>&) = delete;
1408  void operator/=(const VecCConst<T>&) = delete;
1409 };
1410 
1413 template <typename T>
1414 static inline VTKM_EXEC_CONT vtkm::VecC<T> make_VecC(T* array, vtkm::IdComponent size)
1415 {
1416  return vtkm::VecC<T>(array, size);
1417 }
1418 
1421 template <typename T>
1422 static inline VTKM_EXEC_CONT vtkm::VecCConst<T> make_VecC(const T* array, vtkm::IdComponent size)
1423 {
1424  return vtkm::VecCConst<T>(array, size);
1425 }
1426 
1427 namespace detail
1428 {
1429 template <typename T>
1430 struct DotType
1431 {
1432  //results when < 32bit can be float if somehow we are using float16/float8, otherwise is
1433  // int32 or uint32 depending on if it signed or not.
1434  using float_type = vtkm::Float32;
1435  using integer_type =
1436  typename std::conditional<std::is_signed<T>::value, vtkm::Int32, vtkm::UInt32>::type;
1437  using promote_type =
1438  typename std::conditional<std::is_integral<T>::value, integer_type, float_type>::type;
1439  using type =
1440  typename std::conditional<(sizeof(T) < sizeof(vtkm::Float32)), promote_type, T>::type;
1441 };
1442 
1443 template <typename T>
1444 static inline VTKM_EXEC_CONT typename DotType<typename T::ComponentType>::type vec_dot(const T& a,
1445  const T& b)
1446 {
1447  using U = typename DotType<typename T::ComponentType>::type;
1448  U result = a[0] * b[0];
1449  for (vtkm::IdComponent i = 1; i < a.GetNumberOfComponents(); ++i)
1450  {
1451  result = result + a[i] * b[i];
1452  }
1453  return result;
1454 }
1455 template <typename T, vtkm::IdComponent Size>
1456 static inline VTKM_EXEC_CONT typename DotType<T>::type vec_dot(const vtkm::Vec<T, Size>& a,
1457  const vtkm::Vec<T, Size>& b)
1458 {
1459  using U = typename DotType<T>::type;
1460  U result = a[0] * b[0];
1461  for (vtkm::IdComponent i = 1; i < Size; ++i)
1462  {
1463  result = result + a[i] * b[i];
1464  }
1465  return result;
1466 }
1467 }
1468 
1469 template <typename T>
1470 static inline VTKM_EXEC_CONT auto Dot(const T& a, const T& b) -> decltype(detail::vec_dot(a, b))
1471 {
1472  return detail::vec_dot(a, b);
1473 }
1474 template <typename T>
1475 static inline VTKM_EXEC_CONT typename detail::DotType<T>::type Dot(const vtkm::Vec<T, 2>& a,
1476  const vtkm::Vec<T, 2>& b)
1477 {
1478  return (a[0] * b[0]) + (a[1] * b[1]);
1479 }
1480 template <typename T>
1481 static inline VTKM_EXEC_CONT typename detail::DotType<T>::type Dot(const vtkm::Vec<T, 3>& a,
1482  const vtkm::Vec<T, 3>& b)
1483 {
1484  return (a[0] * b[0]) + (a[1] * b[1]) + (a[2] * b[2]);
1485 }
1486 template <typename T>
1487 static inline VTKM_EXEC_CONT typename detail::DotType<T>::type Dot(const vtkm::Vec<T, 4>& a,
1488  const vtkm::Vec<T, 4>& b)
1489 {
1490  return (a[0] * b[0]) + (a[1] * b[1]) + (a[2] * b[2]) + (a[3] * b[3]);
1491 }
1492 // Integer types of a width less than an integer get implicitly casted to
1493 // an integer when doing a multiplication.
1494 #define VTK_M_SCALAR_DOT(stype) \
1495  static inline VTKM_EXEC_CONT detail::DotType<stype>::type dot(stype a, stype b) \
1496  { \
1497  return a * b; \
1498  } /* LEGACY */ \
1499  static inline VTKM_EXEC_CONT detail::DotType<stype>::type Dot(stype a, stype b) { return a * b; }
1506 VTK_M_SCALAR_DOT(vtkm::Int64)
1507 VTK_M_SCALAR_DOT(vtkm::UInt64)
1510 
1511 // v============ LEGACY =============v
1512 template <typename T>
1513 static inline VTKM_EXEC_CONT auto dot(const T& a, const T& b) -> decltype(detail::vec_dot(a, b))
1514 {
1515  return vtkm::Dot(a, b);
1516 }
1517 template <typename T>
1518 static inline VTKM_EXEC_CONT typename detail::DotType<T>::type dot(const vtkm::Vec<T, 2>& a,
1519  const vtkm::Vec<T, 2>& b)
1520 {
1521  return vtkm::Dot(a, b);
1522 }
1523 template <typename T>
1524 static inline VTKM_EXEC_CONT typename detail::DotType<T>::type dot(const vtkm::Vec<T, 3>& a,
1525  const vtkm::Vec<T, 3>& b)
1526 {
1527  return vtkm::Dot(a, b);
1528 }
1529 template <typename T>
1530 static inline VTKM_EXEC_CONT typename detail::DotType<T>::type dot(const vtkm::Vec<T, 4>& a,
1531  const vtkm::Vec<T, 4>& b)
1532 {
1533  return vtkm::Dot(a, b);
1534 }
1535 // ^============ LEGACY =============^
1536 
1537 template <typename T, vtkm::IdComponent Size>
1539 {
1540  T result = a[0];
1541  for (vtkm::IdComponent i = 1; i < Size; ++i)
1542  {
1543  result += a[i];
1544  }
1545  return result;
1546 }
1547 
1548 template <typename T>
1550 {
1551  return a[0] + a[1];
1552 }
1553 
1554 template <typename T>
1556 {
1557  return a[0] + a[1] + a[2];
1558 }
1559 
1560 template <typename T>
1562 {
1563  return a[0] + a[1] + a[2] + a[3];
1564 }
1565 
1566 template <typename T, vtkm::IdComponent Size>
1568 {
1569  T result = a[0];
1570  for (vtkm::IdComponent i = 1; i < Size; ++i)
1571  {
1572  result *= a[i];
1573  }
1574  return result;
1575 }
1576 
1577 template <typename T>
1579 {
1580  return a[0] * a[1];
1581 }
1582 
1583 template <typename T>
1585 {
1586  return a[0] * a[1] * a[2];
1587 }
1588 
1589 template <typename T>
1591 {
1592  return a[0] * a[1] * a[2] * a[3];
1593 }
1594 
1595 // A pre-declaration of vtkm::Pair so that classes templated on them can refer
1596 // to it. The actual implementation is in vtkm/Pair.h.
1597 template <typename U, typename V>
1598 struct Pair;
1599 
1602 template <typename T, vtkm::IdComponent Size>
1603 inline VTKM_CONT std::ostream& operator<<(std::ostream& stream, const vtkm::Vec<T, Size>& vec)
1604 {
1605  stream << "[";
1606  for (vtkm::IdComponent component = 0; component < Size - 1; component++)
1607  {
1608  stream << vec[component] << ",";
1609  }
1610  return stream << vec[Size - 1] << "]";
1611 }
1612 
1615 template <typename T, typename U>
1616 inline VTKM_EXEC_CONT std::ostream& operator<<(std::ostream& stream, const vtkm::Pair<T, U>& vec)
1617 {
1618  return stream << "[" << vec.first << "," << vec.second << "]";
1619 }
1620 
1621 } // End of namespace vtkm
1622 
1624 // Declared inside of vtkm namespace so that the operator work with ADL lookup
1625 #endif //vtk_m_Types_h
vtkm::Vec< T, 1 >::Superclass
detail::VecBase< T, 1, Vec< T, 1 > > Superclass
Definition: Types.h:839
vtkm::Divide
Definition: Types.h:282
vtkm::Add::operator()
VTKM_EXEC_CONT auto operator()(const T &a, const U &b) const -> decltype(a+b)
Definition: Types.h:225
vtkm::Vec::CopyInto
VTKM_EXEC_CONT void CopyInto(Vec< T, Size > &dest) const
Definition: Types.h:787
vtkm
Groups connected points that have the same field value.
Definition: Atomic.h:19
vtkm::Vec< T, 2 >::Vec
VTKM_EXEC_CONT Vec(const Vec< OtherType, 2 > &src)
Definition: Types.h:871
vtkm::Subtract
Definition: Types.h:242
VTKM_ASSERT
#define VTKM_ASSERT(condition)
Definition: Assert.h:43
VTKM_EXEC_CONT
#define VTKM_EXEC_CONT
Definition: ExportMacros.h:52
vtkm::VecCConst::VecCConst
VTKM_EXEC_CONT VecCConst(const vtkm::Vec< T, Size > &src)
Definition: Types.h:1359
vtkm::IdComponent
vtkm::Int32 IdComponent
Represents a component ID (index of component in a vector).
Definition: Types.h:168
vtkm::operator/
VTKM_EXEC_CONT vtkm::Vec< T, Size > operator/(vtkm::Vec< T, Size > a, const vtkm::Vec< T, Size > &b)
Definition: VecOperators.h:371
vtkm::Vec< T, 4 >::Vec
VTKM_EXEC_CONT Vec(const T &value)
Definition: Types.h:1099
vtkm::VecC::operator=
VTKM_EXEC_CONT VecC< T > & operator=(const VecC< T > &src)
Definition: Types.h:1305
vtkm::VecCConst::VecCConst
VTKM_EXEC_CONT VecCConst(const VecC< T > &src)
Definition: Types.h:1380
vtkm::Vec< T, 2 >::Vec
VTKM_EXEC_CONT Vec(const T &value)
Definition: Types.h:865
vtkm::Vec< T, 3 >::Superclass
detail::VecBase< T, 3, Vec< T, 3 > > Superclass
Definition: Types.h:977
vtkm::WordTypeDefault
vtkm::UInt32 WordTypeDefault
The default word size used for atomic bitwise operations.
Definition: Types.h:172
vtkm::VecC::VecC
VTKM_EXEC_CONT VecC(const VecC< T > &src)
Definition: Types.h:1279
vtkm::Vec< vtkm::Float32, 2 >::ComponentType
vtkm::Float32 ComponentType
Definition: Types.h:773
vtkm::Int16
int16_t Int16
Definition: Types.h:158
vtkm::operator*
VTKM_EXEC_CONT vtkm::Vec< T, Size > operator*(vtkm::Vec< T, Size > a, const vtkm::Vec< T, Size > &b)
Definition: VecOperators.h:185
Assert.h
vtkm::VecC::operator[]
VTKM_EXEC_CONT T & operator[](vtkm::IdComponent index)
Definition: Types.h:1292
vtkm::VecC::operator[]
const VTKM_EXEC_CONT T & operator[](vtkm::IdComponent index) const
Definition: Types.h:1285
vtkm::Vec< T, 3 >::Vec
VTKM_EXEC_CONT Vec(const Vec< OtherType, 3 > &src)
Definition: Types.h:987
vtkm::VecC::GetNumberOfComponents
VTKM_EXEC_CONT vtkm::IdComponent GetNumberOfComponents() const
Definition: Types.h:1299
vtkm::Vec
class VTKM_ALWAYS_EXPORT Vec
Definition: Types.h:319
vtkm::Subtract::operator()
VTKM_EXEC_CONT auto operator()(const T &a, const U &b) const -> decltype(a - b)
Definition: Types.h:245
vtkm::VecC::ComponentType
T ComponentType
Definition: Types.h:1247
vtkm::Id
vtkm::Int32 Id
Represents an ID (index into arrays).
Definition: Types.h:191
vtkm::Vec< vtkm::Float32, 2 >::Superclass
detail::VecBase< vtkm::Float32, Size, Vec< vtkm::Float32, Size > > Superclass
Definition: Types.h:769
VecOperators.h
vtkm::Vec< T, 0 >::operator==
VTKM_EXEC_CONT bool operator==(const Vec< T, NUM_COMPONENTS > &vtkmNotUsed(other)) const
Definition: Types.h:829
VTK_M_SCALAR_DOT
#define VTK_M_SCALAR_DOT(stype)
Definition: Types.h:1494
vtkm::Add
Definition: Types.h:222
ExportMacros.h
vtkm::operator+
VTKM_EXEC_CONT vtkm::Vec< T, Size > operator+(vtkm::Vec< T, Size > a, const vtkm::Vec< T, Size > &b)
Definition: VecOperators.h:92
vtkm::Vec< T, 4 >
Definition: Types.h:1093
vtkm::ReduceSum
VTKM_EXEC_CONT T ReduceSum(const vtkm::Vec< T, Size > &a)
Definition: Types.h:1538
vtkm::operator-
VTKM_EXEC_CONT std::enable_if<(std::is_floating_point< T >::value||std::is_signed< T >::value), vtkm::Vec< T, Size > >::type operator-(vtkm::Vec< T, Size > x)
Definition: VecOperators.h:41
vtkm::Vec< T, 4 >::Superclass
detail::VecBase< T, 4, Vec< T, 4 > > Superclass
Definition: Types.h:1095
VTKM_STATIC_ASSERT
#define VTKM_STATIC_ASSERT(condition)
Definition: StaticAssert.h:16
vtkm::VecC::Components
T *const Components
Definition: Types.h:1317
vtkm::Multiply
Definition: Types.h:262
vtkm::Int8
int8_t Int8
Definition: Types.h:156
vtkm::VecCConst
A const version of VecC.
Definition: Types.h:1331
vtkm::VecCConst::VecCConst
VTKM_EXEC_CONT VecCConst(const T *array, vtkm::IdComponent size)
Definition: Types.h:1352
vtkm::Vec< T, 0 >::operator=
VTKM_EXEC_CONT Vec< ComponentType, NUM_COMPONENTS > & operator=(const Vec< ComponentType, NUM_COMPONENTS > &)
Definition: Types.h:812
vtkm::Pair::first
FirstType first
The pair's first object.
Definition: Pair.h:50
VTKM_STATIC_ASSERT_MSG
#define VTKM_STATIC_ASSERT_MSG(condition, message)
Definition: StaticAssert.h:18
vtkm::Vec< T, 0 >::Vec
VTKM_EXEC_CONT Vec(const ComponentType &)
Definition: Types.h:804
vtkm::Vec< T, 2 >
Definition: Types.h:859
vtkm::Vec< T, 2 >::Vec
constexpr VTKM_EXEC_CONT Vec(const T &x, const T &y)
Definition: Types.h:877
vtkm::VecC::VecC
VTKM_EXEC_CONT VecC(vtkm::Vec< T, Size > &src)
Definition: Types.h:1265
vtkm::Vec< T, 4 >::Vec
VTKM_EXEC_CONT Vec(const Vec< OtherType, 4 > &src)
Definition: Types.h:1105
vtkm::operator<<
VTKM_CONT std::ostream & operator<<(std::ostream &stream, const vtkm::Bounds &bounds)
Helper function for printing bounds during testing.
Definition: Bounds.h:237
vtkm::VecC::VecC
VTKM_EXEC_CONT VecC(T &src)
Definition: Types.h:1272
VTKM_CONT
#define VTKM_CONT
Definition: ExportMacros.h:57
vtkm::VecCConst::GetNumberOfComponents
VTKM_EXEC_CONT vtkm::IdComponent GetNumberOfComponents() const
Definition: Types.h:1393
vtkm::operator==
VTKM_EXEC_CONT bool operator==(const vtkm::Matrix< T, NumRow, NumCol > &a, const vtkm::Matrix< T, NumRow, NumCol > &b)
Definition: Matrix.h:615
vtkm::VecCConst::Superclass
detail::VecCBase< T, VecCConst< T > > Superclass
Definition: Types.h:1333
vtkm::Multiply::operator()
VTKM_EXEC_CONT auto operator()(const T &a, const U &b) const -> decltype(a *b)
Definition: Types.h:265
vtkm::Vec< T, 3 >::Vec
VTKM_EXEC_CONT Vec(const T &value)
Definition: Types.h:981
vtkm::UInt8
uint8_t UInt8
Definition: Types.h:157
vtkm::make_Vec
constexpr VTKM_EXEC_CONT 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:1212
vtkmNotUsed
#define vtkmNotUsed(parameter_name)
Simple macro to identify a parameter as unused.
Definition: ExportMacros.h:128
vtkm::Vec< T, 0 >::operator[]
constexpr VTKM_EXEC_CONT ComponentType operator[](vtkm::IdComponent vtkmNotUsed(idx)) const
Definition: Types.h:823
vtkm::VecCConst::VecCConst
VTKM_EXEC_CONT VecCConst()
Definition: Types.h:1345
vtkm::ReduceProduct
VTKM_EXEC_CONT T ReduceProduct(const vtkm::Vec< T, Size > &a)
Definition: Types.h:1567
vtkm::Vec< T, 0 >::operator!=
VTKM_EXEC_CONT bool operator!=(const Vec< T, NUM_COMPONENTS > &vtkmNotUsed(other)) const
Definition: Types.h:831
vtkm::Divide::operator()
VTKM_EXEC_CONT auto operator()(const T &a, const U &b) const -> decltype(a/b)
Definition: Types.h:285
vtkm::VecCConst::operator[]
const VTKM_EXEC_CONT T & operator[](vtkm::IdComponent index) const
Definition: Types.h:1386
vtkm::VecCConst::ComponentType
T ComponentType
Definition: Types.h:1341
vtkm::Vec< T, 3 >
Definition: Types.h:975
vtkm::Vec
A short fixed-length array.
Definition: Types.h:767
vtkm::FloatDefault
vtkm::Float32 FloatDefault
The floating point type to use when no other precision is specified.
Definition: Types.h:198
vtkm::operator!=
VTKM_EXEC_CONT bool operator!=(const vtkm::Matrix< T, NumRow, NumCol > &a, const vtkm::Matrix< T, NumRow, NumCol > &b)
Definition: Matrix.h:629
vtkm::Vec< T, 3 >::Vec
constexpr VTKM_EXEC_CONT Vec(const T &x, const T &y, const T &z)
Definition: Types.h:993
vtkm::UInt32
uint32_t UInt32
Definition: Types.h:161
vtkm::Vec< T, 2 >::Superclass
detail::VecBase< T, 2, Vec< T, 2 > > Superclass
Definition: Types.h:861
StaticAssert.h
vtkm::VecCConst::VecCConst
VTKM_EXEC_CONT VecCConst(const VecCConst< T > &src)
Definition: Types.h:1373
vtkm::Float32
float Float32
Definition: Types.h:154
vtkm::Int32
int32_t Int32
Definition: Types.h:160
vtkm::Float64
double Float64
Definition: Types.h:155
vtkm::Vec< T, 4 >::Vec
constexpr VTKM_EXEC_CONT Vec(const T &x, const T &y, const T &z, const T &w)
Definition: Types.h:1111
vtkm::VecCConst::Components
const T *const Components
Definition: Types.h:1399
vtkm::VecC::VecC
VTKM_EXEC_CONT VecC(T *array, vtkm::IdComponent size)
Definition: Types.h:1258
vtkm::VecC::Superclass
detail::VecCBase< T, VecC< T > > Superclass
Definition: Types.h:1239
vtkm::VecC::VecC
VTKM_EXEC_CONT VecC()
Definition: Types.h:1251
vtkm::Negate::operator()
VTKM_EXEC_CONT T operator()(const T &x) const
Definition: Types.h:305
vtkm::VecCConst::NumberOfComponents
vtkm::IdComponent NumberOfComponents
Definition: Types.h:1400
vtkm::VecC::NumberOfComponents
vtkm::IdComponent NumberOfComponents
Definition: Types.h:1318
vtkm::VecC
A Vec-like representation for short arrays.
Definition: Types.h:1237
VTKM_ALWAYS_EXPORT
#define VTKM_ALWAYS_EXPORT
Definition: ExportMacros.h:92
vtkm::VecCConst::VecCConst
VTKM_EXEC_CONT VecCConst(const T &src)
Definition: Types.h:1366
vtkm::UInt16
uint16_t UInt16
Definition: Types.h:159
vtkm::Vec< T, 1 >::Vec
VTKM_EXEC_CONT Vec(const Vec< OtherType, 1 > &src)
Definition: Types.h:849
vtkm::Pair
A vtkm::Pair is essentially the same as an STL pair object except that the methods (constructors and ...
Definition: Pair.h:29
VTKM_SUPPRESS_EXEC_WARNINGS
#define VTKM_SUPPRESS_EXEC_WARNINGS
Definition: ExportMacros.h:53
vtkm::Vec< T, 1 >::Vec
constexpr VTKM_EXEC_CONT Vec(const T &value)
Definition: Types.h:843
vtkm::Pair::second
SecondType second
The pair's second object.
Definition: Pair.h:55
vtkm::Vec< T, 0 >::GetNumberOfComponents
constexpr VTKM_EXEC_CONT vtkm::IdComponent GetNumberOfComponents() const
Definition: Types.h:817
vtkm::Vec< T, 0 >::Vec
VTKM_EXEC_CONT Vec(const Vec< OtherType, NUM_COMPONENTS > &)
Definition: Types.h:807
vtkm::Vec< T, 0 >::ComponentType
T ComponentType
Definition: Types.h:800
vtkm::Negate
Definition: Types.h:302