diff --git a/CMake/testing/VTKmCheckSourceInInstall.cmake b/CMake/testing/VTKmCheckSourceInInstall.cmake index d26020b43..ebe550df3 100644 --- a/CMake/testing/VTKmCheckSourceInInstall.cmake +++ b/CMake/testing/VTKmCheckSourceInInstall.cmake @@ -104,7 +104,7 @@ function(do_verify root_dir prefix) #Step 1. Setup the extensions to check, and all file and directory # extensions set(files_extensions - *.hpp #needed for diy and taotuple + *.hpp #needed for diy *.h *.hxx ) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3e24fd2a5..cf9b67ffc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -202,6 +202,7 @@ check_type_size("long long" VTKm_SIZE_LONG_LONG BUILTIN_TYPES_ONLY) #----------------------------------------------------------------------------- # Add subdirectories +add_subdirectory(vtkmstd) add_subdirectory(vtkm) #----------------------------------------------------------------------------- diff --git a/docs/changelog/std_porting_headers.md b/docs/changelog/std_porting_headers.md new file mode 100644 index 000000000..8570f9308 --- /dev/null +++ b/docs/changelog/std_porting_headers.md @@ -0,0 +1,14 @@ +# Porting layer for future std features + +Currently, VTK-m is using C++11. However, it is often useful to use +features in the `std` namespace that are defined for C++14 or later. We can +provide our own versions (sometimes), but it is preferable to use the +version provided by the compiler if available. + +There were already some examples of defining portable versions of C++14 and +C++17 classes in a `vtkmstd` namespace, but these were sprinkled around the +source code. + +There is now a top level `vtkmstd` directory and in it are header files +that provide portable versions of these future C++ classes. In each case, +preprocessor macros are used to select which version of the class to use. diff --git a/docs/changelog/tuple.md b/docs/changelog/tuple.md new file mode 100644 index 000000000..1103c0137 --- /dev/null +++ b/docs/changelog/tuple.md @@ -0,0 +1,220 @@ +# Add a vtkm::Tuple class + +This change added a `vtkm::Tuple` class that is very similar in nature to +`std::tuple`. This should replace our use of tao tuple. + +The motivation for this change was some recent attempts at removing objects +like `Invocation` and `FunctionInterface`. I expected these changes to +speed up the build, but in fact they ended up slowing down the build. I +believe the problem was that these required packing variable parameters +into a tuple. I was using the tao `tuple` class, but it seemed to slow down +the compile. (That is, compiling tao's `tuple` seemed much slower than +compiling the equivalent `FunctionInterface` class.) + +The implementation of `vtkm::Tuple` is using `pyexpander` to build lots of +simple template cases for the object (with a backup implementation for even +longer argument lists). I believe the compiler is better and parsing +through thousands of lines of simple templates than to employ clever MPL to +build general templates. + +## Usage + +The `vtkm::Tuple` class is defined in the `vtkm::Tuple.h` header file. A +`Tuple` is designed to behave much like a `std::tuple` with some minor +syntax differences to fit VTK-m coding standards. + +A tuple is declared with a list of template argument types. + +``` cpp +vtkm::Tuple> myTuple; +``` + +If given no arguments, a `vtkm::Tuple` will default-construct its contained +objects. A `vtkm::Tuple` can also be constructed with the initial values of +all contained objects. + +``` cpp +vtkm::Tuple> + myTuple(0, vtkm::Vec3f(0, 1, 2), array); +``` + +For convenience there is a `vtkm::MakeTuple` function that takes arguments +and packs them into a `Tuple` of the appropriate type. (There is also a +`vtkm::make_tuple` alias to the function to match the `std` version.) + +``` cpp +auto myTuple = vtkm::MakeTuple(0, vtkm::Vec3f(0, 1, 2), array); +``` + +Data is retrieved from a `Tuple` by using the `vtkm::Get` method. The `Get` +method is templated on the index to get the value from. The index is of +type `vtkm::IdComponent`. (There is also a `vtkm::get` that uses a +`std::size_t` as the index type as an alias to the function to match the +`std` version.) + +``` cpp +vtkm::Id a = vtkm::Get<0>(myTuple); +vtkm::Vec3f b = vtkm::Get<1>(myTuple); +vtkm::cont::ArrayHandle c = vtkm::Get<2>(myTuple); +``` + +Likewise `vtkm::TupleSize` and `vtkm::TupleElement` (and their aliases +`vtkm::Tuple_size`, `vtkm::tuple_element`, and `vtkm::tuple_element_t`) are +provided. + +## Extended Functionality + +The `vtkm::Tuple` class contains some functionality beyond that of +`std::tuple` to cover some common use cases in VTK-m that are tricky to +implement. In particular, these methods allow you to use a `Tuple` as you +would commonly use parameter packs. This allows you to stash parameter +packs in a `Tuple` and then get them back out again. + +### For Each + +`vtkm::Tuple::ForEach()` is a method that takes a function or functor and +calls it for each of the items in the tuple. Nothing is returned from +`ForEach` and any return value from the function is ignored. + +`ForEach` can be used to check the validity of each item. + +``` cpp +void CheckPositive(vtkm::Float64 x) +{ + if (x < 0) + { + throw vtkm::cont::ErrorBadValue("Values need to be positive."); + } +} + +// ... + + vtkm::Tuple tuple( + CreateValue1(), CreateValue2(), CreateValue3()); + + // Will throw an error if any of the values are negative. + tuple.ForEach(CheckPositive); +``` + +`ForEach` can also be used to aggregate values. + +``` cpp +struct SumFunctor +{ + vtkm::Float64 Sum = 0; + + template + void operator()(const T& x) + { + this->Sum = this->Sum + static_cast(x); + } +}; + +// ... + + vtkm::Tuple tuple( + CreateValue1(), CreateValue2(), CreateValue3()); + + SumFunctor sum; + tuple.ForEach(sum); + vtkm::Float64 average = sum.Sum / 3; +``` + +### Transform + +`vtkm::Tuple::Transform` is a method that builds a new `Tuple` by calling a +function or functor on each of the items. The return value is placed in the +corresponding part of the resulting `Tuple`, and the type is automatically +created from the return type of the function. + +``` cpp +struct GetReadPortalFunctor +{ + template + typename Array::ReadPortal operator()(const Array& array) const + { + VTKM_IS_ARRAY_HANDLE(Array); + return array.ReadPortal(); + } +}; + +// ... + + auto arrayTuple = vtkm::MakeTuple(array1, array2, array3); + + auto portalTuple = arrayTuple.Transform(GetReadPortalFunctor{}); +``` + +### Apply + +`vtkm::Tuple::Apply` is a method that calls a function or functor using the +objects in the `Tuple` as the arguments. If the function returns a value, +that value is returned from `Apply`. + +``` cpp +struct AddArraysFunctor +{ + template + vtkm::Id operator()(Array1 inArray1, Array2 inArray2, Array3 outArray) const + { + VTKM_IS_ARRAY_HANDLE(Array1); + VTKM_IS_ARRAY_HANDLE(Array2); + VTKM_IS_ARRAY_HANDLE(Array3); + + vtkm::Id length = inArray1.GetNumberOfValues(); + VTKM_ASSERT(inArray2.GetNumberOfValues() == length); + outArray.Allocate(length); + + auto inPortal1 = inArray1.ReadPortal(); + auto inPortal2 = inArray2.ReadPortal(); + auto outPortal = outArray.WritePortal(); + for (vtkm::Id index = 0; index < length; ++index) + { + outPortal.Set(index, inPortal1.Get(index) + inPortal2.Get(index)); + } + + return length; + } +}; + +// ... + + auto arrayTuple = vtkm::MakeTuple(array1, array2, array3); + + vtkm::Id arrayLength = arrayTuple.Apply(AddArraysFunctor{}); +``` + +If additional arguments are given to `Apply`, they are also passed to the +function (before the objects in the `Tuple`). This is helpful for passing +state to the function. (This feature is not available in either `ForEach` +or `Transform` for technical implementation reasons.) + +``` cpp +struct ScanArrayLengthFunctor +{ + template + std::array + operator()(const std::array& partialResult, + const Array& nextArray, + const Remaining&... remainingArrays) const + { + std::array nextResult; + std::copy(partialResult.begin(), partialResult.end(), nextResult.begin()); + nextResult[N] = nextResult[N - 1] + nextArray.GetNumberOfValues(); + return (*this)(nextResult, remainingArray); + } + + template + std::array operator()(const std::array& result) const + { + return result; + } +}; + +// ... + + auto arrayTuple = vtkm::MakeTuple(array1, array2, array3); + + std::array = + arrayTuple.Apply(ScanArrayLengthFunctor{}, std::array{ 0 }); +``` diff --git a/vtkm/CMakeLists.txt b/vtkm/CMakeLists.txt index dc0e5baed..c73635cc8 100644 --- a/vtkm/CMakeLists.txt +++ b/vtkm/CMakeLists.txt @@ -47,6 +47,7 @@ set(headers Swap.h TopologyElementTag.h Transform3D.h + Tuple.h TypeList.h TypeListTag.h Types.h @@ -67,6 +68,7 @@ set(template_sources ) vtkm_pyexpander_generated_file(Math.h) +vtkm_pyexpander_generated_file(Tuple.h) vtkm_declare_headers( ${headers} @@ -81,7 +83,6 @@ if(VTKm_ENABLE_LOGGING) add_subdirectory(thirdparty/loguru) endif() add_subdirectory(thirdparty/optionparser) -add_subdirectory(thirdparty/taotuple) add_subdirectory(thirdparty/lcl) add_subdirectory(testing) diff --git a/vtkm/Tuple.h b/vtkm/Tuple.h new file mode 100644 index 000000000..83444b850 --- /dev/null +++ b/vtkm/Tuple.h @@ -0,0 +1,4904 @@ +//============================================================================ +// Copyright (c) Kitware, Inc. +// All rights reserved. +// See LICENSE.txt for details. +// +// This software is distributed WITHOUT ANY WARRANTY; without even +// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +// PURPOSE. See the above copyright notice for more information. +//============================================================================ +// **** DO NOT EDIT THIS FILE!!! **** +// This file is automatically generated by Tuple.h.in + +#ifndef vtk_m_Tuple_h +#define vtk_m_Tuple_h + +#include + +#include +#include + + + +namespace vtkm +{ + +///@{ +/// \brief VTK-m replacement for std::tuple +/// +/// This function serves the same function as `std::tuple` and behaves similarly. However, this +/// version of `Tuple` works on devices that VTK-m supports. There are also some implementation +/// details that makes compiling faster for VTK-m use. We also provide some methods like `Apply` +/// and `ForEach` that are helpful for several VTK-m operations. +/// +template +class Tuple; + +/// \brief Get the size of a tuple. +/// +/// Given a `vtkm::Tuple` type, because a `std::integral_constant` of the type. +/// +template +using TupleSize = std::integral_constant; + +/// \brief Compatible with `std::tuple_size` for `vtkm::Tuple`. +/// +template +using tuple_size = std::integral_constant(TupleType::Size)>; + +namespace detail +{ + +template +struct TupleElementImpl +{ + using type = decltype(TupleType::ElementTypeI(vtkm::internal::IndexTag{})); +}; + +} // namespace detail + +/// \brief Becomes the type of the given index for the given `vtkm::Tuple`. +/// +template +using TupleElement = typename detail::TupleElementImpl::type; + +/// \brief Compatible with `std::tuple_element` for `vtkm::Tuple`. +/// +template +struct tuple_element +{ + using type = TupleElement(Index), TupleType>; +}; + +/// \brief Compatible with `std::tuple_element_t` for `vtkm::Tuple`. +/// +template +using tuple_element_t = typename tuple_element::type; + +///@{ +/// \brief Retrieve the object from a `vtkm::Tuple` at the given index. +/// +VTKM_SUPPRESS_EXEC_WARNINGS +template +VTKM_EXEC_CONT auto Get(const vtkm::Tuple& tuple) -> decltype(tuple.template Get()) +{ + return tuple.template Get(); +} + +VTKM_SUPPRESS_EXEC_WARNINGS +template +VTKM_EXEC_CONT auto Get(vtkm::Tuple& tuple) -> decltype(tuple.template Get()) +{ + return tuple.template Get(); +} +///@} + +///@{ +/// \brief Compatible with `std::get` for `vtkm::Tuple`. +/// +VTKM_SUPPRESS_EXEC_WARNINGS +template +VTKM_EXEC_CONT auto get(const vtkm::Tuple& tuple) + -> decltype(vtkm::Get(Index)>(tuple)) +{ + return vtkm::Get(Index)>(tuple); +} + +VTKM_SUPPRESS_EXEC_WARNINGS +template +VTKM_EXEC_CONT auto get(vtkm::Tuple& tuple) + -> decltype(vtkm::Get(Index)>(tuple)) +{ + return vtkm::Get(Index)>(tuple); +} +///@} + +/// \brief Creates a new `vtkm::Tuple` with the given types. +/// +VTKM_SUPPRESS_EXEC_WARNINGS +template +VTKM_EXEC_CONT auto MakeTuple(Ts&&... args) -> vtkm::Tuple::type...> +{ + return vtkm::Tuple::type...>(std::forward(args)...); +} + +/// \brief Compatible with `std::make_tuple` for `vtkm::Tuple`. +/// +VTKM_SUPPRESS_EXEC_WARNINGS +template +VTKM_EXEC_CONT auto make_tuple(Ts&&... args) -> decltype(vtkm::MakeTuple(std::forward(args)...)) +{ + return vtkm::MakeTuple(std::forward(args)...); +} + +namespace detail +{ +struct TupleTransformFunctor +{ + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT auto operator()(Function&& f, Ts&&... args) + -> decltype(vtkm::MakeTuple(f(std::forward(args))...)) + { + return vtkm::MakeTuple(f(std::forward(args))...); + } +}; + +VTKM_SUPPRESS_EXEC_WARNINGS +template +VTKM_EXEC_CONT auto TupleTransform(TupleType&& tuple, Function&& f) + -> decltype(tuple.Apply(TupleTransformFunctor{}, std::forward(f))) +{ + return tuple.Apply(TupleTransformFunctor{}, std::forward(f)); +} + +struct TupleForEachFunctor +{ + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT void operator()(Function&& f, Ts&&... args) + { + (void)std::initializer_list{ (f(std::forward(args)), false)... }; + } +}; + +VTKM_SUPPRESS_EXEC_WARNINGS +template +VTKM_EXEC_CONT auto TupleForEach(TupleType&& tuple, Function&& f) + -> decltype(tuple.Apply(TupleForEachFunctor{}, std::forward(f))) +{ + return tuple.Apply(TupleForEachFunctor{}, std::forward(f)); +} + +} // namespace detail + +template <> +class Tuple<> +{ +public: + static constexpr vtkm::IdComponent Size = 0; + + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT auto Apply(Function&& f, Args&&... args) + -> decltype(f(std::forward(args)...)) + { + return f(std::forward(args)...); + } + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT auto Apply(Function&& f, Args&&... args) const + -> decltype(f(std::forward(args)...)) + { + return f(std::forward(args)...); + } + + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT void ForEach(Function&&) const + { + } + + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT vtkm::Tuple<> Transform(Function&&) const + { + return vtkm::Tuple<>{}; + } +}; + +// clang-format off + +template +class Tuple +{ + T0 Value0; + static T0 ElementTypeI(vtkm::internal::IndexTag<0>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<0>) + { + return this->Value0; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<0>) const + { + return this->Value0; + } + + + // Invalid indices + template + static vtkm::internal::NullType ElementTypeI(vtkm::internal::IndexTag); + + template + friend struct detail::TupleElementImpl; + +public: + static constexpr vtkm::IdComponent Size = 1; + template + using ElementType = vtkm::TupleElement>; + + Tuple() = default; + Tuple(Tuple&&) = default; + Tuple(const Tuple&) = default; + ~Tuple() = default; + Tuple& operator=(Tuple&&) = default; + Tuple& operator=(const Tuple&) = default; + + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT Tuple(A0&& a0) + : Value0(std::forward(a0)) + { + } + + template + VTKM_EXEC_CONT auto Get() -> decltype(this->GetImpl(vtkm::internal::IndexTag{})) + { + return this->GetImpl(vtkm::internal::IndexTag{}); + } + + template + VTKM_EXEC_CONT auto Get() const -> decltype(this->GetImpl(vtkm::internal::IndexTag{})) + { + return this->GetImpl(vtkm::internal::IndexTag{}); + } + + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT + auto Apply(Function&& f, Args&&... args) + -> decltype(f(std::forward(args)..., Value0)) + { + return f(std::forward(args)..., Value0); + } + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT + auto Apply(Function&& f, Args&&... args) const + -> decltype(f(std::forward(args)..., Value0)) + { + return f(std::forward(args)..., Value0); + } + + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT void ForEach(Function&& f) + { + detail::TupleForEach(*this, std::forward(f)); + } + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT void ForEach(Function&& f) const + { + detail::TupleForEach(*this, std::forward(f)); + } + + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT auto Transform(Function&& f) + -> decltype(detail::TupleTransform(*this, std::forward(f))) + { + return detail::TupleTransform(*this, std::forward(f)); + } + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT auto Transform(Function&& f) const + -> decltype(detail::TupleTransform(*this, std::forward(f))) + { + return detail::TupleTransform(*this, std::forward(f)); + } +}; + +template +class Tuple +{ + T0 Value0; + static T0 ElementTypeI(vtkm::internal::IndexTag<0>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<0>) + { + return this->Value0; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<0>) const + { + return this->Value0; + } + + T1 Value1; + static T1 ElementTypeI(vtkm::internal::IndexTag<1>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<1>) + { + return this->Value1; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<1>) const + { + return this->Value1; + } + + + // Invalid indices + template + static vtkm::internal::NullType ElementTypeI(vtkm::internal::IndexTag); + + template + friend struct detail::TupleElementImpl; + +public: + static constexpr vtkm::IdComponent Size = 2; + template + using ElementType = vtkm::TupleElement>; + + Tuple() = default; + Tuple(Tuple&&) = default; + Tuple(const Tuple&) = default; + ~Tuple() = default; + Tuple& operator=(Tuple&&) = default; + Tuple& operator=(const Tuple&) = default; + + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT Tuple(A0&& a0, A1&& a1) + : Value0(std::forward(a0)) + , Value1(std::forward(a1)) + { + } + + template + VTKM_EXEC_CONT auto Get() -> decltype(this->GetImpl(vtkm::internal::IndexTag{})) + { + return this->GetImpl(vtkm::internal::IndexTag{}); + } + + template + VTKM_EXEC_CONT auto Get() const -> decltype(this->GetImpl(vtkm::internal::IndexTag{})) + { + return this->GetImpl(vtkm::internal::IndexTag{}); + } + + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT + auto Apply(Function&& f, Args&&... args) + -> decltype(f(std::forward(args)..., Value0, Value1)) + { + return f(std::forward(args)..., Value0, Value1); + } + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT + auto Apply(Function&& f, Args&&... args) const + -> decltype(f(std::forward(args)..., Value0, Value1)) + { + return f(std::forward(args)..., Value0, Value1); + } + + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT void ForEach(Function&& f) + { + detail::TupleForEach(*this, std::forward(f)); + } + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT void ForEach(Function&& f) const + { + detail::TupleForEach(*this, std::forward(f)); + } + + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT auto Transform(Function&& f) + -> decltype(detail::TupleTransform(*this, std::forward(f))) + { + return detail::TupleTransform(*this, std::forward(f)); + } + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT auto Transform(Function&& f) const + -> decltype(detail::TupleTransform(*this, std::forward(f))) + { + return detail::TupleTransform(*this, std::forward(f)); + } +}; + +template +class Tuple +{ + T0 Value0; + static T0 ElementTypeI(vtkm::internal::IndexTag<0>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<0>) + { + return this->Value0; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<0>) const + { + return this->Value0; + } + + T1 Value1; + static T1 ElementTypeI(vtkm::internal::IndexTag<1>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<1>) + { + return this->Value1; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<1>) const + { + return this->Value1; + } + + T2 Value2; + static T2 ElementTypeI(vtkm::internal::IndexTag<2>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<2>) + { + return this->Value2; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<2>) const + { + return this->Value2; + } + + + // Invalid indices + template + static vtkm::internal::NullType ElementTypeI(vtkm::internal::IndexTag); + + template + friend struct detail::TupleElementImpl; + +public: + static constexpr vtkm::IdComponent Size = 3; + template + using ElementType = vtkm::TupleElement>; + + Tuple() = default; + Tuple(Tuple&&) = default; + Tuple(const Tuple&) = default; + ~Tuple() = default; + Tuple& operator=(Tuple&&) = default; + Tuple& operator=(const Tuple&) = default; + + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT Tuple(A0&& a0, A1&& a1, A2&& a2) + : Value0(std::forward(a0)) + , Value1(std::forward(a1)) + , Value2(std::forward(a2)) + { + } + + template + VTKM_EXEC_CONT auto Get() -> decltype(this->GetImpl(vtkm::internal::IndexTag{})) + { + return this->GetImpl(vtkm::internal::IndexTag{}); + } + + template + VTKM_EXEC_CONT auto Get() const -> decltype(this->GetImpl(vtkm::internal::IndexTag{})) + { + return this->GetImpl(vtkm::internal::IndexTag{}); + } + + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT + auto Apply(Function&& f, Args&&... args) + -> decltype(f(std::forward(args)..., Value0, Value1, Value2)) + { + return f(std::forward(args)..., Value0, Value1, Value2); + } + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT + auto Apply(Function&& f, Args&&... args) const + -> decltype(f(std::forward(args)..., Value0, Value1, Value2)) + { + return f(std::forward(args)..., Value0, Value1, Value2); + } + + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT void ForEach(Function&& f) + { + detail::TupleForEach(*this, std::forward(f)); + } + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT void ForEach(Function&& f) const + { + detail::TupleForEach(*this, std::forward(f)); + } + + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT auto Transform(Function&& f) + -> decltype(detail::TupleTransform(*this, std::forward(f))) + { + return detail::TupleTransform(*this, std::forward(f)); + } + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT auto Transform(Function&& f) const + -> decltype(detail::TupleTransform(*this, std::forward(f))) + { + return detail::TupleTransform(*this, std::forward(f)); + } +}; + +template +class Tuple +{ + T0 Value0; + static T0 ElementTypeI(vtkm::internal::IndexTag<0>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<0>) + { + return this->Value0; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<0>) const + { + return this->Value0; + } + + T1 Value1; + static T1 ElementTypeI(vtkm::internal::IndexTag<1>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<1>) + { + return this->Value1; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<1>) const + { + return this->Value1; + } + + T2 Value2; + static T2 ElementTypeI(vtkm::internal::IndexTag<2>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<2>) + { + return this->Value2; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<2>) const + { + return this->Value2; + } + + T3 Value3; + static T3 ElementTypeI(vtkm::internal::IndexTag<3>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<3>) + { + return this->Value3; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<3>) const + { + return this->Value3; + } + + + // Invalid indices + template + static vtkm::internal::NullType ElementTypeI(vtkm::internal::IndexTag); + + template + friend struct detail::TupleElementImpl; + +public: + static constexpr vtkm::IdComponent Size = 4; + template + using ElementType = vtkm::TupleElement>; + + Tuple() = default; + Tuple(Tuple&&) = default; + Tuple(const Tuple&) = default; + ~Tuple() = default; + Tuple& operator=(Tuple&&) = default; + Tuple& operator=(const Tuple&) = default; + + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT Tuple(A0&& a0, A1&& a1, A2&& a2, A3&& a3) + : Value0(std::forward(a0)) + , Value1(std::forward(a1)) + , Value2(std::forward(a2)) + , Value3(std::forward(a3)) + { + } + + template + VTKM_EXEC_CONT auto Get() -> decltype(this->GetImpl(vtkm::internal::IndexTag{})) + { + return this->GetImpl(vtkm::internal::IndexTag{}); + } + + template + VTKM_EXEC_CONT auto Get() const -> decltype(this->GetImpl(vtkm::internal::IndexTag{})) + { + return this->GetImpl(vtkm::internal::IndexTag{}); + } + + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT + auto Apply(Function&& f, Args&&... args) + -> decltype(f(std::forward(args)..., Value0, Value1, Value2, Value3)) + { + return f(std::forward(args)..., Value0, Value1, Value2, Value3); + } + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT + auto Apply(Function&& f, Args&&... args) const + -> decltype(f(std::forward(args)..., Value0, Value1, Value2, Value3)) + { + return f(std::forward(args)..., Value0, Value1, Value2, Value3); + } + + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT void ForEach(Function&& f) + { + detail::TupleForEach(*this, std::forward(f)); + } + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT void ForEach(Function&& f) const + { + detail::TupleForEach(*this, std::forward(f)); + } + + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT auto Transform(Function&& f) + -> decltype(detail::TupleTransform(*this, std::forward(f))) + { + return detail::TupleTransform(*this, std::forward(f)); + } + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT auto Transform(Function&& f) const + -> decltype(detail::TupleTransform(*this, std::forward(f))) + { + return detail::TupleTransform(*this, std::forward(f)); + } +}; + +template +class Tuple +{ + T0 Value0; + static T0 ElementTypeI(vtkm::internal::IndexTag<0>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<0>) + { + return this->Value0; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<0>) const + { + return this->Value0; + } + + T1 Value1; + static T1 ElementTypeI(vtkm::internal::IndexTag<1>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<1>) + { + return this->Value1; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<1>) const + { + return this->Value1; + } + + T2 Value2; + static T2 ElementTypeI(vtkm::internal::IndexTag<2>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<2>) + { + return this->Value2; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<2>) const + { + return this->Value2; + } + + T3 Value3; + static T3 ElementTypeI(vtkm::internal::IndexTag<3>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<3>) + { + return this->Value3; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<3>) const + { + return this->Value3; + } + + T4 Value4; + static T4 ElementTypeI(vtkm::internal::IndexTag<4>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<4>) + { + return this->Value4; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<4>) const + { + return this->Value4; + } + + + // Invalid indices + template + static vtkm::internal::NullType ElementTypeI(vtkm::internal::IndexTag); + + template + friend struct detail::TupleElementImpl; + +public: + static constexpr vtkm::IdComponent Size = 5; + template + using ElementType = vtkm::TupleElement>; + + Tuple() = default; + Tuple(Tuple&&) = default; + Tuple(const Tuple&) = default; + ~Tuple() = default; + Tuple& operator=(Tuple&&) = default; + Tuple& operator=(const Tuple&) = default; + + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT Tuple(A0&& a0, A1&& a1, A2&& a2, A3&& a3, A4&& a4) + : Value0(std::forward(a0)) + , Value1(std::forward(a1)) + , Value2(std::forward(a2)) + , Value3(std::forward(a3)) + , Value4(std::forward(a4)) + { + } + + template + VTKM_EXEC_CONT auto Get() -> decltype(this->GetImpl(vtkm::internal::IndexTag{})) + { + return this->GetImpl(vtkm::internal::IndexTag{}); + } + + template + VTKM_EXEC_CONT auto Get() const -> decltype(this->GetImpl(vtkm::internal::IndexTag{})) + { + return this->GetImpl(vtkm::internal::IndexTag{}); + } + + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT + auto Apply(Function&& f, Args&&... args) + -> decltype(f(std::forward(args)..., Value0, Value1, Value2, Value3, Value4)) + { + return f(std::forward(args)..., Value0, Value1, Value2, Value3, Value4); + } + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT + auto Apply(Function&& f, Args&&... args) const + -> decltype(f(std::forward(args)..., Value0, Value1, Value2, Value3, Value4)) + { + return f(std::forward(args)..., Value0, Value1, Value2, Value3, Value4); + } + + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT void ForEach(Function&& f) + { + detail::TupleForEach(*this, std::forward(f)); + } + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT void ForEach(Function&& f) const + { + detail::TupleForEach(*this, std::forward(f)); + } + + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT auto Transform(Function&& f) + -> decltype(detail::TupleTransform(*this, std::forward(f))) + { + return detail::TupleTransform(*this, std::forward(f)); + } + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT auto Transform(Function&& f) const + -> decltype(detail::TupleTransform(*this, std::forward(f))) + { + return detail::TupleTransform(*this, std::forward(f)); + } +}; + +template +class Tuple +{ + T0 Value0; + static T0 ElementTypeI(vtkm::internal::IndexTag<0>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<0>) + { + return this->Value0; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<0>) const + { + return this->Value0; + } + + T1 Value1; + static T1 ElementTypeI(vtkm::internal::IndexTag<1>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<1>) + { + return this->Value1; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<1>) const + { + return this->Value1; + } + + T2 Value2; + static T2 ElementTypeI(vtkm::internal::IndexTag<2>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<2>) + { + return this->Value2; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<2>) const + { + return this->Value2; + } + + T3 Value3; + static T3 ElementTypeI(vtkm::internal::IndexTag<3>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<3>) + { + return this->Value3; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<3>) const + { + return this->Value3; + } + + T4 Value4; + static T4 ElementTypeI(vtkm::internal::IndexTag<4>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<4>) + { + return this->Value4; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<4>) const + { + return this->Value4; + } + + T5 Value5; + static T5 ElementTypeI(vtkm::internal::IndexTag<5>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<5>) + { + return this->Value5; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<5>) const + { + return this->Value5; + } + + + // Invalid indices + template + static vtkm::internal::NullType ElementTypeI(vtkm::internal::IndexTag); + + template + friend struct detail::TupleElementImpl; + +public: + static constexpr vtkm::IdComponent Size = 6; + template + using ElementType = vtkm::TupleElement>; + + Tuple() = default; + Tuple(Tuple&&) = default; + Tuple(const Tuple&) = default; + ~Tuple() = default; + Tuple& operator=(Tuple&&) = default; + Tuple& operator=(const Tuple&) = default; + + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT Tuple(A0&& a0, A1&& a1, A2&& a2, A3&& a3, A4&& a4, A5&& a5) + : Value0(std::forward(a0)) + , Value1(std::forward(a1)) + , Value2(std::forward(a2)) + , Value3(std::forward(a3)) + , Value4(std::forward(a4)) + , Value5(std::forward(a5)) + { + } + + template + VTKM_EXEC_CONT auto Get() -> decltype(this->GetImpl(vtkm::internal::IndexTag{})) + { + return this->GetImpl(vtkm::internal::IndexTag{}); + } + + template + VTKM_EXEC_CONT auto Get() const -> decltype(this->GetImpl(vtkm::internal::IndexTag{})) + { + return this->GetImpl(vtkm::internal::IndexTag{}); + } + + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT + auto Apply(Function&& f, Args&&... args) + -> decltype(f(std::forward(args)..., Value0, Value1, Value2, Value3, Value4, Value5)) + { + return f(std::forward(args)..., Value0, Value1, Value2, Value3, Value4, Value5); + } + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT + auto Apply(Function&& f, Args&&... args) const + -> decltype(f(std::forward(args)..., Value0, Value1, Value2, Value3, Value4, Value5)) + { + return f(std::forward(args)..., Value0, Value1, Value2, Value3, Value4, Value5); + } + + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT void ForEach(Function&& f) + { + detail::TupleForEach(*this, std::forward(f)); + } + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT void ForEach(Function&& f) const + { + detail::TupleForEach(*this, std::forward(f)); + } + + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT auto Transform(Function&& f) + -> decltype(detail::TupleTransform(*this, std::forward(f))) + { + return detail::TupleTransform(*this, std::forward(f)); + } + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT auto Transform(Function&& f) const + -> decltype(detail::TupleTransform(*this, std::forward(f))) + { + return detail::TupleTransform(*this, std::forward(f)); + } +}; + +template +class Tuple +{ + T0 Value0; + static T0 ElementTypeI(vtkm::internal::IndexTag<0>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<0>) + { + return this->Value0; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<0>) const + { + return this->Value0; + } + + T1 Value1; + static T1 ElementTypeI(vtkm::internal::IndexTag<1>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<1>) + { + return this->Value1; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<1>) const + { + return this->Value1; + } + + T2 Value2; + static T2 ElementTypeI(vtkm::internal::IndexTag<2>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<2>) + { + return this->Value2; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<2>) const + { + return this->Value2; + } + + T3 Value3; + static T3 ElementTypeI(vtkm::internal::IndexTag<3>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<3>) + { + return this->Value3; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<3>) const + { + return this->Value3; + } + + T4 Value4; + static T4 ElementTypeI(vtkm::internal::IndexTag<4>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<4>) + { + return this->Value4; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<4>) const + { + return this->Value4; + } + + T5 Value5; + static T5 ElementTypeI(vtkm::internal::IndexTag<5>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<5>) + { + return this->Value5; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<5>) const + { + return this->Value5; + } + + T6 Value6; + static T6 ElementTypeI(vtkm::internal::IndexTag<6>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<6>) + { + return this->Value6; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<6>) const + { + return this->Value6; + } + + + // Invalid indices + template + static vtkm::internal::NullType ElementTypeI(vtkm::internal::IndexTag); + + template + friend struct detail::TupleElementImpl; + +public: + static constexpr vtkm::IdComponent Size = 7; + template + using ElementType = vtkm::TupleElement>; + + Tuple() = default; + Tuple(Tuple&&) = default; + Tuple(const Tuple&) = default; + ~Tuple() = default; + Tuple& operator=(Tuple&&) = default; + Tuple& operator=(const Tuple&) = default; + + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT Tuple(A0&& a0, A1&& a1, A2&& a2, A3&& a3, A4&& a4, A5&& a5, A6&& a6) + : Value0(std::forward(a0)) + , Value1(std::forward(a1)) + , Value2(std::forward(a2)) + , Value3(std::forward(a3)) + , Value4(std::forward(a4)) + , Value5(std::forward(a5)) + , Value6(std::forward(a6)) + { + } + + template + VTKM_EXEC_CONT auto Get() -> decltype(this->GetImpl(vtkm::internal::IndexTag{})) + { + return this->GetImpl(vtkm::internal::IndexTag{}); + } + + template + VTKM_EXEC_CONT auto Get() const -> decltype(this->GetImpl(vtkm::internal::IndexTag{})) + { + return this->GetImpl(vtkm::internal::IndexTag{}); + } + + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT + auto Apply(Function&& f, Args&&... args) + -> decltype(f(std::forward(args)..., Value0, Value1, Value2, Value3, Value4, Value5, Value6)) + { + return f(std::forward(args)..., Value0, Value1, Value2, Value3, Value4, Value5, Value6); + } + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT + auto Apply(Function&& f, Args&&... args) const + -> decltype(f(std::forward(args)..., Value0, Value1, Value2, Value3, Value4, Value5, Value6)) + { + return f(std::forward(args)..., Value0, Value1, Value2, Value3, Value4, Value5, Value6); + } + + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT void ForEach(Function&& f) + { + detail::TupleForEach(*this, std::forward(f)); + } + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT void ForEach(Function&& f) const + { + detail::TupleForEach(*this, std::forward(f)); + } + + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT auto Transform(Function&& f) + -> decltype(detail::TupleTransform(*this, std::forward(f))) + { + return detail::TupleTransform(*this, std::forward(f)); + } + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT auto Transform(Function&& f) const + -> decltype(detail::TupleTransform(*this, std::forward(f))) + { + return detail::TupleTransform(*this, std::forward(f)); + } +}; + +template +class Tuple +{ + T0 Value0; + static T0 ElementTypeI(vtkm::internal::IndexTag<0>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<0>) + { + return this->Value0; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<0>) const + { + return this->Value0; + } + + T1 Value1; + static T1 ElementTypeI(vtkm::internal::IndexTag<1>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<1>) + { + return this->Value1; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<1>) const + { + return this->Value1; + } + + T2 Value2; + static T2 ElementTypeI(vtkm::internal::IndexTag<2>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<2>) + { + return this->Value2; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<2>) const + { + return this->Value2; + } + + T3 Value3; + static T3 ElementTypeI(vtkm::internal::IndexTag<3>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<3>) + { + return this->Value3; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<3>) const + { + return this->Value3; + } + + T4 Value4; + static T4 ElementTypeI(vtkm::internal::IndexTag<4>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<4>) + { + return this->Value4; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<4>) const + { + return this->Value4; + } + + T5 Value5; + static T5 ElementTypeI(vtkm::internal::IndexTag<5>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<5>) + { + return this->Value5; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<5>) const + { + return this->Value5; + } + + T6 Value6; + static T6 ElementTypeI(vtkm::internal::IndexTag<6>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<6>) + { + return this->Value6; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<6>) const + { + return this->Value6; + } + + T7 Value7; + static T7 ElementTypeI(vtkm::internal::IndexTag<7>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<7>) + { + return this->Value7; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<7>) const + { + return this->Value7; + } + + + // Invalid indices + template + static vtkm::internal::NullType ElementTypeI(vtkm::internal::IndexTag); + + template + friend struct detail::TupleElementImpl; + +public: + static constexpr vtkm::IdComponent Size = 8; + template + using ElementType = vtkm::TupleElement>; + + Tuple() = default; + Tuple(Tuple&&) = default; + Tuple(const Tuple&) = default; + ~Tuple() = default; + Tuple& operator=(Tuple&&) = default; + Tuple& operator=(const Tuple&) = default; + + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT Tuple(A0&& a0, A1&& a1, A2&& a2, A3&& a3, A4&& a4, A5&& a5, A6&& a6, A7&& a7) + : Value0(std::forward(a0)) + , Value1(std::forward(a1)) + , Value2(std::forward(a2)) + , Value3(std::forward(a3)) + , Value4(std::forward(a4)) + , Value5(std::forward(a5)) + , Value6(std::forward(a6)) + , Value7(std::forward(a7)) + { + } + + template + VTKM_EXEC_CONT auto Get() -> decltype(this->GetImpl(vtkm::internal::IndexTag{})) + { + return this->GetImpl(vtkm::internal::IndexTag{}); + } + + template + VTKM_EXEC_CONT auto Get() const -> decltype(this->GetImpl(vtkm::internal::IndexTag{})) + { + return this->GetImpl(vtkm::internal::IndexTag{}); + } + + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT + auto Apply(Function&& f, Args&&... args) + -> decltype(f(std::forward(args)..., Value0, Value1, Value2, Value3, Value4, Value5, Value6, Value7)) + { + return f(std::forward(args)..., Value0, Value1, Value2, Value3, Value4, Value5, Value6, Value7); + } + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT + auto Apply(Function&& f, Args&&... args) const + -> decltype(f(std::forward(args)..., Value0, Value1, Value2, Value3, Value4, Value5, Value6, Value7)) + { + return f(std::forward(args)..., Value0, Value1, Value2, Value3, Value4, Value5, Value6, Value7); + } + + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT void ForEach(Function&& f) + { + detail::TupleForEach(*this, std::forward(f)); + } + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT void ForEach(Function&& f) const + { + detail::TupleForEach(*this, std::forward(f)); + } + + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT auto Transform(Function&& f) + -> decltype(detail::TupleTransform(*this, std::forward(f))) + { + return detail::TupleTransform(*this, std::forward(f)); + } + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT auto Transform(Function&& f) const + -> decltype(detail::TupleTransform(*this, std::forward(f))) + { + return detail::TupleTransform(*this, std::forward(f)); + } +}; + +template +class Tuple +{ + T0 Value0; + static T0 ElementTypeI(vtkm::internal::IndexTag<0>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<0>) + { + return this->Value0; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<0>) const + { + return this->Value0; + } + + T1 Value1; + static T1 ElementTypeI(vtkm::internal::IndexTag<1>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<1>) + { + return this->Value1; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<1>) const + { + return this->Value1; + } + + T2 Value2; + static T2 ElementTypeI(vtkm::internal::IndexTag<2>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<2>) + { + return this->Value2; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<2>) const + { + return this->Value2; + } + + T3 Value3; + static T3 ElementTypeI(vtkm::internal::IndexTag<3>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<3>) + { + return this->Value3; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<3>) const + { + return this->Value3; + } + + T4 Value4; + static T4 ElementTypeI(vtkm::internal::IndexTag<4>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<4>) + { + return this->Value4; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<4>) const + { + return this->Value4; + } + + T5 Value5; + static T5 ElementTypeI(vtkm::internal::IndexTag<5>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<5>) + { + return this->Value5; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<5>) const + { + return this->Value5; + } + + T6 Value6; + static T6 ElementTypeI(vtkm::internal::IndexTag<6>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<6>) + { + return this->Value6; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<6>) const + { + return this->Value6; + } + + T7 Value7; + static T7 ElementTypeI(vtkm::internal::IndexTag<7>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<7>) + { + return this->Value7; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<7>) const + { + return this->Value7; + } + + T8 Value8; + static T8 ElementTypeI(vtkm::internal::IndexTag<8>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<8>) + { + return this->Value8; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<8>) const + { + return this->Value8; + } + + + // Invalid indices + template + static vtkm::internal::NullType ElementTypeI(vtkm::internal::IndexTag); + + template + friend struct detail::TupleElementImpl; + +public: + static constexpr vtkm::IdComponent Size = 9; + template + using ElementType = vtkm::TupleElement>; + + Tuple() = default; + Tuple(Tuple&&) = default; + Tuple(const Tuple&) = default; + ~Tuple() = default; + Tuple& operator=(Tuple&&) = default; + Tuple& operator=(const Tuple&) = default; + + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT Tuple(A0&& a0, A1&& a1, A2&& a2, A3&& a3, A4&& a4, A5&& a5, A6&& a6, A7&& a7, A8&& a8) + : Value0(std::forward(a0)) + , Value1(std::forward(a1)) + , Value2(std::forward(a2)) + , Value3(std::forward(a3)) + , Value4(std::forward(a4)) + , Value5(std::forward(a5)) + , Value6(std::forward(a6)) + , Value7(std::forward(a7)) + , Value8(std::forward(a8)) + { + } + + template + VTKM_EXEC_CONT auto Get() -> decltype(this->GetImpl(vtkm::internal::IndexTag{})) + { + return this->GetImpl(vtkm::internal::IndexTag{}); + } + + template + VTKM_EXEC_CONT auto Get() const -> decltype(this->GetImpl(vtkm::internal::IndexTag{})) + { + return this->GetImpl(vtkm::internal::IndexTag{}); + } + + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT + auto Apply(Function&& f, Args&&... args) + -> decltype(f(std::forward(args)..., Value0, Value1, Value2, Value3, Value4, Value5, Value6, Value7, Value8)) + { + return f(std::forward(args)..., Value0, Value1, Value2, Value3, Value4, Value5, Value6, Value7, Value8); + } + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT + auto Apply(Function&& f, Args&&... args) const + -> decltype(f(std::forward(args)..., Value0, Value1, Value2, Value3, Value4, Value5, Value6, Value7, Value8)) + { + return f(std::forward(args)..., Value0, Value1, Value2, Value3, Value4, Value5, Value6, Value7, Value8); + } + + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT void ForEach(Function&& f) + { + detail::TupleForEach(*this, std::forward(f)); + } + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT void ForEach(Function&& f) const + { + detail::TupleForEach(*this, std::forward(f)); + } + + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT auto Transform(Function&& f) + -> decltype(detail::TupleTransform(*this, std::forward(f))) + { + return detail::TupleTransform(*this, std::forward(f)); + } + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT auto Transform(Function&& f) const + -> decltype(detail::TupleTransform(*this, std::forward(f))) + { + return detail::TupleTransform(*this, std::forward(f)); + } +}; + +template +class Tuple +{ + T0 Value0; + static T0 ElementTypeI(vtkm::internal::IndexTag<0>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<0>) + { + return this->Value0; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<0>) const + { + return this->Value0; + } + + T1 Value1; + static T1 ElementTypeI(vtkm::internal::IndexTag<1>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<1>) + { + return this->Value1; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<1>) const + { + return this->Value1; + } + + T2 Value2; + static T2 ElementTypeI(vtkm::internal::IndexTag<2>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<2>) + { + return this->Value2; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<2>) const + { + return this->Value2; + } + + T3 Value3; + static T3 ElementTypeI(vtkm::internal::IndexTag<3>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<3>) + { + return this->Value3; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<3>) const + { + return this->Value3; + } + + T4 Value4; + static T4 ElementTypeI(vtkm::internal::IndexTag<4>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<4>) + { + return this->Value4; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<4>) const + { + return this->Value4; + } + + T5 Value5; + static T5 ElementTypeI(vtkm::internal::IndexTag<5>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<5>) + { + return this->Value5; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<5>) const + { + return this->Value5; + } + + T6 Value6; + static T6 ElementTypeI(vtkm::internal::IndexTag<6>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<6>) + { + return this->Value6; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<6>) const + { + return this->Value6; + } + + T7 Value7; + static T7 ElementTypeI(vtkm::internal::IndexTag<7>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<7>) + { + return this->Value7; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<7>) const + { + return this->Value7; + } + + T8 Value8; + static T8 ElementTypeI(vtkm::internal::IndexTag<8>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<8>) + { + return this->Value8; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<8>) const + { + return this->Value8; + } + + T9 Value9; + static T9 ElementTypeI(vtkm::internal::IndexTag<9>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<9>) + { + return this->Value9; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<9>) const + { + return this->Value9; + } + + + // Invalid indices + template + static vtkm::internal::NullType ElementTypeI(vtkm::internal::IndexTag); + + template + friend struct detail::TupleElementImpl; + +public: + static constexpr vtkm::IdComponent Size = 10; + template + using ElementType = vtkm::TupleElement>; + + Tuple() = default; + Tuple(Tuple&&) = default; + Tuple(const Tuple&) = default; + ~Tuple() = default; + Tuple& operator=(Tuple&&) = default; + Tuple& operator=(const Tuple&) = default; + + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT Tuple(A0&& a0, A1&& a1, A2&& a2, A3&& a3, A4&& a4, A5&& a5, A6&& a6, A7&& a7, A8&& a8, A9&& a9) + : Value0(std::forward(a0)) + , Value1(std::forward(a1)) + , Value2(std::forward(a2)) + , Value3(std::forward(a3)) + , Value4(std::forward(a4)) + , Value5(std::forward(a5)) + , Value6(std::forward(a6)) + , Value7(std::forward(a7)) + , Value8(std::forward(a8)) + , Value9(std::forward(a9)) + { + } + + template + VTKM_EXEC_CONT auto Get() -> decltype(this->GetImpl(vtkm::internal::IndexTag{})) + { + return this->GetImpl(vtkm::internal::IndexTag{}); + } + + template + VTKM_EXEC_CONT auto Get() const -> decltype(this->GetImpl(vtkm::internal::IndexTag{})) + { + return this->GetImpl(vtkm::internal::IndexTag{}); + } + + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT + auto Apply(Function&& f, Args&&... args) + -> decltype(f(std::forward(args)..., Value0, Value1, Value2, Value3, Value4, Value5, Value6, Value7, Value8, Value9)) + { + return f(std::forward(args)..., Value0, Value1, Value2, Value3, Value4, Value5, Value6, Value7, Value8, Value9); + } + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT + auto Apply(Function&& f, Args&&... args) const + -> decltype(f(std::forward(args)..., Value0, Value1, Value2, Value3, Value4, Value5, Value6, Value7, Value8, Value9)) + { + return f(std::forward(args)..., Value0, Value1, Value2, Value3, Value4, Value5, Value6, Value7, Value8, Value9); + } + + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT void ForEach(Function&& f) + { + detail::TupleForEach(*this, std::forward(f)); + } + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT void ForEach(Function&& f) const + { + detail::TupleForEach(*this, std::forward(f)); + } + + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT auto Transform(Function&& f) + -> decltype(detail::TupleTransform(*this, std::forward(f))) + { + return detail::TupleTransform(*this, std::forward(f)); + } + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT auto Transform(Function&& f) const + -> decltype(detail::TupleTransform(*this, std::forward(f))) + { + return detail::TupleTransform(*this, std::forward(f)); + } +}; + +template +class Tuple +{ + T0 Value0; + static T0 ElementTypeI(vtkm::internal::IndexTag<0>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<0>) + { + return this->Value0; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<0>) const + { + return this->Value0; + } + + T1 Value1; + static T1 ElementTypeI(vtkm::internal::IndexTag<1>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<1>) + { + return this->Value1; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<1>) const + { + return this->Value1; + } + + T2 Value2; + static T2 ElementTypeI(vtkm::internal::IndexTag<2>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<2>) + { + return this->Value2; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<2>) const + { + return this->Value2; + } + + T3 Value3; + static T3 ElementTypeI(vtkm::internal::IndexTag<3>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<3>) + { + return this->Value3; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<3>) const + { + return this->Value3; + } + + T4 Value4; + static T4 ElementTypeI(vtkm::internal::IndexTag<4>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<4>) + { + return this->Value4; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<4>) const + { + return this->Value4; + } + + T5 Value5; + static T5 ElementTypeI(vtkm::internal::IndexTag<5>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<5>) + { + return this->Value5; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<5>) const + { + return this->Value5; + } + + T6 Value6; + static T6 ElementTypeI(vtkm::internal::IndexTag<6>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<6>) + { + return this->Value6; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<6>) const + { + return this->Value6; + } + + T7 Value7; + static T7 ElementTypeI(vtkm::internal::IndexTag<7>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<7>) + { + return this->Value7; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<7>) const + { + return this->Value7; + } + + T8 Value8; + static T8 ElementTypeI(vtkm::internal::IndexTag<8>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<8>) + { + return this->Value8; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<8>) const + { + return this->Value8; + } + + T9 Value9; + static T9 ElementTypeI(vtkm::internal::IndexTag<9>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<9>) + { + return this->Value9; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<9>) const + { + return this->Value9; + } + + T10 Value10; + static T10 ElementTypeI(vtkm::internal::IndexTag<10>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<10>) + { + return this->Value10; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<10>) const + { + return this->Value10; + } + + + // Invalid indices + template + static vtkm::internal::NullType ElementTypeI(vtkm::internal::IndexTag); + + template + friend struct detail::TupleElementImpl; + +public: + static constexpr vtkm::IdComponent Size = 11; + template + using ElementType = vtkm::TupleElement>; + + Tuple() = default; + Tuple(Tuple&&) = default; + Tuple(const Tuple&) = default; + ~Tuple() = default; + Tuple& operator=(Tuple&&) = default; + Tuple& operator=(const Tuple&) = default; + + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT Tuple(A0&& a0, A1&& a1, A2&& a2, A3&& a3, A4&& a4, A5&& a5, A6&& a6, A7&& a7, A8&& a8, A9&& a9, A10&& a10) + : Value0(std::forward(a0)) + , Value1(std::forward(a1)) + , Value2(std::forward(a2)) + , Value3(std::forward(a3)) + , Value4(std::forward(a4)) + , Value5(std::forward(a5)) + , Value6(std::forward(a6)) + , Value7(std::forward(a7)) + , Value8(std::forward(a8)) + , Value9(std::forward(a9)) + , Value10(std::forward(a10)) + { + } + + template + VTKM_EXEC_CONT auto Get() -> decltype(this->GetImpl(vtkm::internal::IndexTag{})) + { + return this->GetImpl(vtkm::internal::IndexTag{}); + } + + template + VTKM_EXEC_CONT auto Get() const -> decltype(this->GetImpl(vtkm::internal::IndexTag{})) + { + return this->GetImpl(vtkm::internal::IndexTag{}); + } + + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT + auto Apply(Function&& f, Args&&... args) + -> decltype(f(std::forward(args)..., Value0, Value1, Value2, Value3, Value4, Value5, Value6, Value7, Value8, Value9, Value10)) + { + return f(std::forward(args)..., Value0, Value1, Value2, Value3, Value4, Value5, Value6, Value7, Value8, Value9, Value10); + } + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT + auto Apply(Function&& f, Args&&... args) const + -> decltype(f(std::forward(args)..., Value0, Value1, Value2, Value3, Value4, Value5, Value6, Value7, Value8, Value9, Value10)) + { + return f(std::forward(args)..., Value0, Value1, Value2, Value3, Value4, Value5, Value6, Value7, Value8, Value9, Value10); + } + + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT void ForEach(Function&& f) + { + detail::TupleForEach(*this, std::forward(f)); + } + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT void ForEach(Function&& f) const + { + detail::TupleForEach(*this, std::forward(f)); + } + + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT auto Transform(Function&& f) + -> decltype(detail::TupleTransform(*this, std::forward(f))) + { + return detail::TupleTransform(*this, std::forward(f)); + } + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT auto Transform(Function&& f) const + -> decltype(detail::TupleTransform(*this, std::forward(f))) + { + return detail::TupleTransform(*this, std::forward(f)); + } +}; + +template +class Tuple +{ + T0 Value0; + static T0 ElementTypeI(vtkm::internal::IndexTag<0>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<0>) + { + return this->Value0; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<0>) const + { + return this->Value0; + } + + T1 Value1; + static T1 ElementTypeI(vtkm::internal::IndexTag<1>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<1>) + { + return this->Value1; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<1>) const + { + return this->Value1; + } + + T2 Value2; + static T2 ElementTypeI(vtkm::internal::IndexTag<2>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<2>) + { + return this->Value2; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<2>) const + { + return this->Value2; + } + + T3 Value3; + static T3 ElementTypeI(vtkm::internal::IndexTag<3>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<3>) + { + return this->Value3; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<3>) const + { + return this->Value3; + } + + T4 Value4; + static T4 ElementTypeI(vtkm::internal::IndexTag<4>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<4>) + { + return this->Value4; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<4>) const + { + return this->Value4; + } + + T5 Value5; + static T5 ElementTypeI(vtkm::internal::IndexTag<5>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<5>) + { + return this->Value5; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<5>) const + { + return this->Value5; + } + + T6 Value6; + static T6 ElementTypeI(vtkm::internal::IndexTag<6>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<6>) + { + return this->Value6; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<6>) const + { + return this->Value6; + } + + T7 Value7; + static T7 ElementTypeI(vtkm::internal::IndexTag<7>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<7>) + { + return this->Value7; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<7>) const + { + return this->Value7; + } + + T8 Value8; + static T8 ElementTypeI(vtkm::internal::IndexTag<8>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<8>) + { + return this->Value8; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<8>) const + { + return this->Value8; + } + + T9 Value9; + static T9 ElementTypeI(vtkm::internal::IndexTag<9>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<9>) + { + return this->Value9; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<9>) const + { + return this->Value9; + } + + T10 Value10; + static T10 ElementTypeI(vtkm::internal::IndexTag<10>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<10>) + { + return this->Value10; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<10>) const + { + return this->Value10; + } + + T11 Value11; + static T11 ElementTypeI(vtkm::internal::IndexTag<11>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<11>) + { + return this->Value11; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<11>) const + { + return this->Value11; + } + + + // Invalid indices + template + static vtkm::internal::NullType ElementTypeI(vtkm::internal::IndexTag); + + template + friend struct detail::TupleElementImpl; + +public: + static constexpr vtkm::IdComponent Size = 12; + template + using ElementType = vtkm::TupleElement>; + + Tuple() = default; + Tuple(Tuple&&) = default; + Tuple(const Tuple&) = default; + ~Tuple() = default; + Tuple& operator=(Tuple&&) = default; + Tuple& operator=(const Tuple&) = default; + + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT Tuple(A0&& a0, A1&& a1, A2&& a2, A3&& a3, A4&& a4, A5&& a5, A6&& a6, A7&& a7, A8&& a8, A9&& a9, A10&& a10, A11&& a11) + : Value0(std::forward(a0)) + , Value1(std::forward(a1)) + , Value2(std::forward(a2)) + , Value3(std::forward(a3)) + , Value4(std::forward(a4)) + , Value5(std::forward(a5)) + , Value6(std::forward(a6)) + , Value7(std::forward(a7)) + , Value8(std::forward(a8)) + , Value9(std::forward(a9)) + , Value10(std::forward(a10)) + , Value11(std::forward(a11)) + { + } + + template + VTKM_EXEC_CONT auto Get() -> decltype(this->GetImpl(vtkm::internal::IndexTag{})) + { + return this->GetImpl(vtkm::internal::IndexTag{}); + } + + template + VTKM_EXEC_CONT auto Get() const -> decltype(this->GetImpl(vtkm::internal::IndexTag{})) + { + return this->GetImpl(vtkm::internal::IndexTag{}); + } + + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT + auto Apply(Function&& f, Args&&... args) + -> decltype(f(std::forward(args)..., Value0, Value1, Value2, Value3, Value4, Value5, Value6, Value7, Value8, Value9, Value10, Value11)) + { + return f(std::forward(args)..., Value0, Value1, Value2, Value3, Value4, Value5, Value6, Value7, Value8, Value9, Value10, Value11); + } + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT + auto Apply(Function&& f, Args&&... args) const + -> decltype(f(std::forward(args)..., Value0, Value1, Value2, Value3, Value4, Value5, Value6, Value7, Value8, Value9, Value10, Value11)) + { + return f(std::forward(args)..., Value0, Value1, Value2, Value3, Value4, Value5, Value6, Value7, Value8, Value9, Value10, Value11); + } + + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT void ForEach(Function&& f) + { + detail::TupleForEach(*this, std::forward(f)); + } + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT void ForEach(Function&& f) const + { + detail::TupleForEach(*this, std::forward(f)); + } + + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT auto Transform(Function&& f) + -> decltype(detail::TupleTransform(*this, std::forward(f))) + { + return detail::TupleTransform(*this, std::forward(f)); + } + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT auto Transform(Function&& f) const + -> decltype(detail::TupleTransform(*this, std::forward(f))) + { + return detail::TupleTransform(*this, std::forward(f)); + } +}; + +template +class Tuple +{ + T0 Value0; + static T0 ElementTypeI(vtkm::internal::IndexTag<0>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<0>) + { + return this->Value0; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<0>) const + { + return this->Value0; + } + + T1 Value1; + static T1 ElementTypeI(vtkm::internal::IndexTag<1>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<1>) + { + return this->Value1; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<1>) const + { + return this->Value1; + } + + T2 Value2; + static T2 ElementTypeI(vtkm::internal::IndexTag<2>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<2>) + { + return this->Value2; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<2>) const + { + return this->Value2; + } + + T3 Value3; + static T3 ElementTypeI(vtkm::internal::IndexTag<3>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<3>) + { + return this->Value3; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<3>) const + { + return this->Value3; + } + + T4 Value4; + static T4 ElementTypeI(vtkm::internal::IndexTag<4>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<4>) + { + return this->Value4; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<4>) const + { + return this->Value4; + } + + T5 Value5; + static T5 ElementTypeI(vtkm::internal::IndexTag<5>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<5>) + { + return this->Value5; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<5>) const + { + return this->Value5; + } + + T6 Value6; + static T6 ElementTypeI(vtkm::internal::IndexTag<6>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<6>) + { + return this->Value6; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<6>) const + { + return this->Value6; + } + + T7 Value7; + static T7 ElementTypeI(vtkm::internal::IndexTag<7>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<7>) + { + return this->Value7; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<7>) const + { + return this->Value7; + } + + T8 Value8; + static T8 ElementTypeI(vtkm::internal::IndexTag<8>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<8>) + { + return this->Value8; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<8>) const + { + return this->Value8; + } + + T9 Value9; + static T9 ElementTypeI(vtkm::internal::IndexTag<9>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<9>) + { + return this->Value9; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<9>) const + { + return this->Value9; + } + + T10 Value10; + static T10 ElementTypeI(vtkm::internal::IndexTag<10>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<10>) + { + return this->Value10; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<10>) const + { + return this->Value10; + } + + T11 Value11; + static T11 ElementTypeI(vtkm::internal::IndexTag<11>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<11>) + { + return this->Value11; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<11>) const + { + return this->Value11; + } + + T12 Value12; + static T12 ElementTypeI(vtkm::internal::IndexTag<12>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<12>) + { + return this->Value12; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<12>) const + { + return this->Value12; + } + + + // Invalid indices + template + static vtkm::internal::NullType ElementTypeI(vtkm::internal::IndexTag); + + template + friend struct detail::TupleElementImpl; + +public: + static constexpr vtkm::IdComponent Size = 13; + template + using ElementType = vtkm::TupleElement>; + + Tuple() = default; + Tuple(Tuple&&) = default; + Tuple(const Tuple&) = default; + ~Tuple() = default; + Tuple& operator=(Tuple&&) = default; + Tuple& operator=(const Tuple&) = default; + + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT Tuple(A0&& a0, A1&& a1, A2&& a2, A3&& a3, A4&& a4, A5&& a5, A6&& a6, A7&& a7, A8&& a8, A9&& a9, A10&& a10, A11&& a11, A12&& a12) + : Value0(std::forward(a0)) + , Value1(std::forward(a1)) + , Value2(std::forward(a2)) + , Value3(std::forward(a3)) + , Value4(std::forward(a4)) + , Value5(std::forward(a5)) + , Value6(std::forward(a6)) + , Value7(std::forward(a7)) + , Value8(std::forward(a8)) + , Value9(std::forward(a9)) + , Value10(std::forward(a10)) + , Value11(std::forward(a11)) + , Value12(std::forward(a12)) + { + } + + template + VTKM_EXEC_CONT auto Get() -> decltype(this->GetImpl(vtkm::internal::IndexTag{})) + { + return this->GetImpl(vtkm::internal::IndexTag{}); + } + + template + VTKM_EXEC_CONT auto Get() const -> decltype(this->GetImpl(vtkm::internal::IndexTag{})) + { + return this->GetImpl(vtkm::internal::IndexTag{}); + } + + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT + auto Apply(Function&& f, Args&&... args) + -> decltype(f(std::forward(args)..., Value0, Value1, Value2, Value3, Value4, Value5, Value6, Value7, Value8, Value9, Value10, Value11, Value12)) + { + return f(std::forward(args)..., Value0, Value1, Value2, Value3, Value4, Value5, Value6, Value7, Value8, Value9, Value10, Value11, Value12); + } + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT + auto Apply(Function&& f, Args&&... args) const + -> decltype(f(std::forward(args)..., Value0, Value1, Value2, Value3, Value4, Value5, Value6, Value7, Value8, Value9, Value10, Value11, Value12)) + { + return f(std::forward(args)..., Value0, Value1, Value2, Value3, Value4, Value5, Value6, Value7, Value8, Value9, Value10, Value11, Value12); + } + + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT void ForEach(Function&& f) + { + detail::TupleForEach(*this, std::forward(f)); + } + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT void ForEach(Function&& f) const + { + detail::TupleForEach(*this, std::forward(f)); + } + + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT auto Transform(Function&& f) + -> decltype(detail::TupleTransform(*this, std::forward(f))) + { + return detail::TupleTransform(*this, std::forward(f)); + } + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT auto Transform(Function&& f) const + -> decltype(detail::TupleTransform(*this, std::forward(f))) + { + return detail::TupleTransform(*this, std::forward(f)); + } +}; + +template +class Tuple +{ + T0 Value0; + static T0 ElementTypeI(vtkm::internal::IndexTag<0>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<0>) + { + return this->Value0; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<0>) const + { + return this->Value0; + } + + T1 Value1; + static T1 ElementTypeI(vtkm::internal::IndexTag<1>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<1>) + { + return this->Value1; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<1>) const + { + return this->Value1; + } + + T2 Value2; + static T2 ElementTypeI(vtkm::internal::IndexTag<2>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<2>) + { + return this->Value2; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<2>) const + { + return this->Value2; + } + + T3 Value3; + static T3 ElementTypeI(vtkm::internal::IndexTag<3>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<3>) + { + return this->Value3; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<3>) const + { + return this->Value3; + } + + T4 Value4; + static T4 ElementTypeI(vtkm::internal::IndexTag<4>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<4>) + { + return this->Value4; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<4>) const + { + return this->Value4; + } + + T5 Value5; + static T5 ElementTypeI(vtkm::internal::IndexTag<5>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<5>) + { + return this->Value5; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<5>) const + { + return this->Value5; + } + + T6 Value6; + static T6 ElementTypeI(vtkm::internal::IndexTag<6>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<6>) + { + return this->Value6; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<6>) const + { + return this->Value6; + } + + T7 Value7; + static T7 ElementTypeI(vtkm::internal::IndexTag<7>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<7>) + { + return this->Value7; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<7>) const + { + return this->Value7; + } + + T8 Value8; + static T8 ElementTypeI(vtkm::internal::IndexTag<8>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<8>) + { + return this->Value8; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<8>) const + { + return this->Value8; + } + + T9 Value9; + static T9 ElementTypeI(vtkm::internal::IndexTag<9>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<9>) + { + return this->Value9; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<9>) const + { + return this->Value9; + } + + T10 Value10; + static T10 ElementTypeI(vtkm::internal::IndexTag<10>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<10>) + { + return this->Value10; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<10>) const + { + return this->Value10; + } + + T11 Value11; + static T11 ElementTypeI(vtkm::internal::IndexTag<11>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<11>) + { + return this->Value11; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<11>) const + { + return this->Value11; + } + + T12 Value12; + static T12 ElementTypeI(vtkm::internal::IndexTag<12>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<12>) + { + return this->Value12; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<12>) const + { + return this->Value12; + } + + T13 Value13; + static T13 ElementTypeI(vtkm::internal::IndexTag<13>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<13>) + { + return this->Value13; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<13>) const + { + return this->Value13; + } + + + // Invalid indices + template + static vtkm::internal::NullType ElementTypeI(vtkm::internal::IndexTag); + + template + friend struct detail::TupleElementImpl; + +public: + static constexpr vtkm::IdComponent Size = 14; + template + using ElementType = vtkm::TupleElement>; + + Tuple() = default; + Tuple(Tuple&&) = default; + Tuple(const Tuple&) = default; + ~Tuple() = default; + Tuple& operator=(Tuple&&) = default; + Tuple& operator=(const Tuple&) = default; + + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT Tuple(A0&& a0, A1&& a1, A2&& a2, A3&& a3, A4&& a4, A5&& a5, A6&& a6, A7&& a7, A8&& a8, A9&& a9, A10&& a10, A11&& a11, A12&& a12, A13&& a13) + : Value0(std::forward(a0)) + , Value1(std::forward(a1)) + , Value2(std::forward(a2)) + , Value3(std::forward(a3)) + , Value4(std::forward(a4)) + , Value5(std::forward(a5)) + , Value6(std::forward(a6)) + , Value7(std::forward(a7)) + , Value8(std::forward(a8)) + , Value9(std::forward(a9)) + , Value10(std::forward(a10)) + , Value11(std::forward(a11)) + , Value12(std::forward(a12)) + , Value13(std::forward(a13)) + { + } + + template + VTKM_EXEC_CONT auto Get() -> decltype(this->GetImpl(vtkm::internal::IndexTag{})) + { + return this->GetImpl(vtkm::internal::IndexTag{}); + } + + template + VTKM_EXEC_CONT auto Get() const -> decltype(this->GetImpl(vtkm::internal::IndexTag{})) + { + return this->GetImpl(vtkm::internal::IndexTag{}); + } + + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT + auto Apply(Function&& f, Args&&... args) + -> decltype(f(std::forward(args)..., Value0, Value1, Value2, Value3, Value4, Value5, Value6, Value7, Value8, Value9, Value10, Value11, Value12, Value13)) + { + return f(std::forward(args)..., Value0, Value1, Value2, Value3, Value4, Value5, Value6, Value7, Value8, Value9, Value10, Value11, Value12, Value13); + } + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT + auto Apply(Function&& f, Args&&... args) const + -> decltype(f(std::forward(args)..., Value0, Value1, Value2, Value3, Value4, Value5, Value6, Value7, Value8, Value9, Value10, Value11, Value12, Value13)) + { + return f(std::forward(args)..., Value0, Value1, Value2, Value3, Value4, Value5, Value6, Value7, Value8, Value9, Value10, Value11, Value12, Value13); + } + + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT void ForEach(Function&& f) + { + detail::TupleForEach(*this, std::forward(f)); + } + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT void ForEach(Function&& f) const + { + detail::TupleForEach(*this, std::forward(f)); + } + + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT auto Transform(Function&& f) + -> decltype(detail::TupleTransform(*this, std::forward(f))) + { + return detail::TupleTransform(*this, std::forward(f)); + } + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT auto Transform(Function&& f) const + -> decltype(detail::TupleTransform(*this, std::forward(f))) + { + return detail::TupleTransform(*this, std::forward(f)); + } +}; + +template +class Tuple +{ + T0 Value0; + static T0 ElementTypeI(vtkm::internal::IndexTag<0>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<0>) + { + return this->Value0; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<0>) const + { + return this->Value0; + } + + T1 Value1; + static T1 ElementTypeI(vtkm::internal::IndexTag<1>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<1>) + { + return this->Value1; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<1>) const + { + return this->Value1; + } + + T2 Value2; + static T2 ElementTypeI(vtkm::internal::IndexTag<2>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<2>) + { + return this->Value2; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<2>) const + { + return this->Value2; + } + + T3 Value3; + static T3 ElementTypeI(vtkm::internal::IndexTag<3>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<3>) + { + return this->Value3; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<3>) const + { + return this->Value3; + } + + T4 Value4; + static T4 ElementTypeI(vtkm::internal::IndexTag<4>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<4>) + { + return this->Value4; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<4>) const + { + return this->Value4; + } + + T5 Value5; + static T5 ElementTypeI(vtkm::internal::IndexTag<5>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<5>) + { + return this->Value5; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<5>) const + { + return this->Value5; + } + + T6 Value6; + static T6 ElementTypeI(vtkm::internal::IndexTag<6>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<6>) + { + return this->Value6; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<6>) const + { + return this->Value6; + } + + T7 Value7; + static T7 ElementTypeI(vtkm::internal::IndexTag<7>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<7>) + { + return this->Value7; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<7>) const + { + return this->Value7; + } + + T8 Value8; + static T8 ElementTypeI(vtkm::internal::IndexTag<8>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<8>) + { + return this->Value8; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<8>) const + { + return this->Value8; + } + + T9 Value9; + static T9 ElementTypeI(vtkm::internal::IndexTag<9>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<9>) + { + return this->Value9; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<9>) const + { + return this->Value9; + } + + T10 Value10; + static T10 ElementTypeI(vtkm::internal::IndexTag<10>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<10>) + { + return this->Value10; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<10>) const + { + return this->Value10; + } + + T11 Value11; + static T11 ElementTypeI(vtkm::internal::IndexTag<11>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<11>) + { + return this->Value11; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<11>) const + { + return this->Value11; + } + + T12 Value12; + static T12 ElementTypeI(vtkm::internal::IndexTag<12>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<12>) + { + return this->Value12; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<12>) const + { + return this->Value12; + } + + T13 Value13; + static T13 ElementTypeI(vtkm::internal::IndexTag<13>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<13>) + { + return this->Value13; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<13>) const + { + return this->Value13; + } + + T14 Value14; + static T14 ElementTypeI(vtkm::internal::IndexTag<14>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<14>) + { + return this->Value14; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<14>) const + { + return this->Value14; + } + + + // Invalid indices + template + static vtkm::internal::NullType ElementTypeI(vtkm::internal::IndexTag); + + template + friend struct detail::TupleElementImpl; + +public: + static constexpr vtkm::IdComponent Size = 15; + template + using ElementType = vtkm::TupleElement>; + + Tuple() = default; + Tuple(Tuple&&) = default; + Tuple(const Tuple&) = default; + ~Tuple() = default; + Tuple& operator=(Tuple&&) = default; + Tuple& operator=(const Tuple&) = default; + + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT Tuple(A0&& a0, A1&& a1, A2&& a2, A3&& a3, A4&& a4, A5&& a5, A6&& a6, A7&& a7, A8&& a8, A9&& a9, A10&& a10, A11&& a11, A12&& a12, A13&& a13, A14&& a14) + : Value0(std::forward(a0)) + , Value1(std::forward(a1)) + , Value2(std::forward(a2)) + , Value3(std::forward(a3)) + , Value4(std::forward(a4)) + , Value5(std::forward(a5)) + , Value6(std::forward(a6)) + , Value7(std::forward(a7)) + , Value8(std::forward(a8)) + , Value9(std::forward(a9)) + , Value10(std::forward(a10)) + , Value11(std::forward(a11)) + , Value12(std::forward(a12)) + , Value13(std::forward(a13)) + , Value14(std::forward(a14)) + { + } + + template + VTKM_EXEC_CONT auto Get() -> decltype(this->GetImpl(vtkm::internal::IndexTag{})) + { + return this->GetImpl(vtkm::internal::IndexTag{}); + } + + template + VTKM_EXEC_CONT auto Get() const -> decltype(this->GetImpl(vtkm::internal::IndexTag{})) + { + return this->GetImpl(vtkm::internal::IndexTag{}); + } + + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT + auto Apply(Function&& f, Args&&... args) + -> decltype(f(std::forward(args)..., Value0, Value1, Value2, Value3, Value4, Value5, Value6, Value7, Value8, Value9, Value10, Value11, Value12, Value13, Value14)) + { + return f(std::forward(args)..., Value0, Value1, Value2, Value3, Value4, Value5, Value6, Value7, Value8, Value9, Value10, Value11, Value12, Value13, Value14); + } + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT + auto Apply(Function&& f, Args&&... args) const + -> decltype(f(std::forward(args)..., Value0, Value1, Value2, Value3, Value4, Value5, Value6, Value7, Value8, Value9, Value10, Value11, Value12, Value13, Value14)) + { + return f(std::forward(args)..., Value0, Value1, Value2, Value3, Value4, Value5, Value6, Value7, Value8, Value9, Value10, Value11, Value12, Value13, Value14); + } + + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT void ForEach(Function&& f) + { + detail::TupleForEach(*this, std::forward(f)); + } + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT void ForEach(Function&& f) const + { + detail::TupleForEach(*this, std::forward(f)); + } + + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT auto Transform(Function&& f) + -> decltype(detail::TupleTransform(*this, std::forward(f))) + { + return detail::TupleTransform(*this, std::forward(f)); + } + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT auto Transform(Function&& f) const + -> decltype(detail::TupleTransform(*this, std::forward(f))) + { + return detail::TupleTransform(*this, std::forward(f)); + } +}; + +template +class Tuple +{ + T0 Value0; + static T0 ElementTypeI(vtkm::internal::IndexTag<0>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<0>) + { + return this->Value0; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<0>) const + { + return this->Value0; + } + + T1 Value1; + static T1 ElementTypeI(vtkm::internal::IndexTag<1>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<1>) + { + return this->Value1; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<1>) const + { + return this->Value1; + } + + T2 Value2; + static T2 ElementTypeI(vtkm::internal::IndexTag<2>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<2>) + { + return this->Value2; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<2>) const + { + return this->Value2; + } + + T3 Value3; + static T3 ElementTypeI(vtkm::internal::IndexTag<3>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<3>) + { + return this->Value3; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<3>) const + { + return this->Value3; + } + + T4 Value4; + static T4 ElementTypeI(vtkm::internal::IndexTag<4>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<4>) + { + return this->Value4; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<4>) const + { + return this->Value4; + } + + T5 Value5; + static T5 ElementTypeI(vtkm::internal::IndexTag<5>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<5>) + { + return this->Value5; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<5>) const + { + return this->Value5; + } + + T6 Value6; + static T6 ElementTypeI(vtkm::internal::IndexTag<6>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<6>) + { + return this->Value6; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<6>) const + { + return this->Value6; + } + + T7 Value7; + static T7 ElementTypeI(vtkm::internal::IndexTag<7>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<7>) + { + return this->Value7; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<7>) const + { + return this->Value7; + } + + T8 Value8; + static T8 ElementTypeI(vtkm::internal::IndexTag<8>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<8>) + { + return this->Value8; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<8>) const + { + return this->Value8; + } + + T9 Value9; + static T9 ElementTypeI(vtkm::internal::IndexTag<9>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<9>) + { + return this->Value9; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<9>) const + { + return this->Value9; + } + + T10 Value10; + static T10 ElementTypeI(vtkm::internal::IndexTag<10>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<10>) + { + return this->Value10; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<10>) const + { + return this->Value10; + } + + T11 Value11; + static T11 ElementTypeI(vtkm::internal::IndexTag<11>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<11>) + { + return this->Value11; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<11>) const + { + return this->Value11; + } + + T12 Value12; + static T12 ElementTypeI(vtkm::internal::IndexTag<12>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<12>) + { + return this->Value12; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<12>) const + { + return this->Value12; + } + + T13 Value13; + static T13 ElementTypeI(vtkm::internal::IndexTag<13>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<13>) + { + return this->Value13; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<13>) const + { + return this->Value13; + } + + T14 Value14; + static T14 ElementTypeI(vtkm::internal::IndexTag<14>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<14>) + { + return this->Value14; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<14>) const + { + return this->Value14; + } + + T15 Value15; + static T15 ElementTypeI(vtkm::internal::IndexTag<15>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<15>) + { + return this->Value15; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<15>) const + { + return this->Value15; + } + + + // Invalid indices + template + static vtkm::internal::NullType ElementTypeI(vtkm::internal::IndexTag); + + template + friend struct detail::TupleElementImpl; + +public: + static constexpr vtkm::IdComponent Size = 16; + template + using ElementType = vtkm::TupleElement>; + + Tuple() = default; + Tuple(Tuple&&) = default; + Tuple(const Tuple&) = default; + ~Tuple() = default; + Tuple& operator=(Tuple&&) = default; + Tuple& operator=(const Tuple&) = default; + + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT Tuple(A0&& a0, A1&& a1, A2&& a2, A3&& a3, A4&& a4, A5&& a5, A6&& a6, A7&& a7, A8&& a8, A9&& a9, A10&& a10, A11&& a11, A12&& a12, A13&& a13, A14&& a14, A15&& a15) + : Value0(std::forward(a0)) + , Value1(std::forward(a1)) + , Value2(std::forward(a2)) + , Value3(std::forward(a3)) + , Value4(std::forward(a4)) + , Value5(std::forward(a5)) + , Value6(std::forward(a6)) + , Value7(std::forward(a7)) + , Value8(std::forward(a8)) + , Value9(std::forward(a9)) + , Value10(std::forward(a10)) + , Value11(std::forward(a11)) + , Value12(std::forward(a12)) + , Value13(std::forward(a13)) + , Value14(std::forward(a14)) + , Value15(std::forward(a15)) + { + } + + template + VTKM_EXEC_CONT auto Get() -> decltype(this->GetImpl(vtkm::internal::IndexTag{})) + { + return this->GetImpl(vtkm::internal::IndexTag{}); + } + + template + VTKM_EXEC_CONT auto Get() const -> decltype(this->GetImpl(vtkm::internal::IndexTag{})) + { + return this->GetImpl(vtkm::internal::IndexTag{}); + } + + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT + auto Apply(Function&& f, Args&&... args) + -> decltype(f(std::forward(args)..., Value0, Value1, Value2, Value3, Value4, Value5, Value6, Value7, Value8, Value9, Value10, Value11, Value12, Value13, Value14, Value15)) + { + return f(std::forward(args)..., Value0, Value1, Value2, Value3, Value4, Value5, Value6, Value7, Value8, Value9, Value10, Value11, Value12, Value13, Value14, Value15); + } + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT + auto Apply(Function&& f, Args&&... args) const + -> decltype(f(std::forward(args)..., Value0, Value1, Value2, Value3, Value4, Value5, Value6, Value7, Value8, Value9, Value10, Value11, Value12, Value13, Value14, Value15)) + { + return f(std::forward(args)..., Value0, Value1, Value2, Value3, Value4, Value5, Value6, Value7, Value8, Value9, Value10, Value11, Value12, Value13, Value14, Value15); + } + + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT void ForEach(Function&& f) + { + detail::TupleForEach(*this, std::forward(f)); + } + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT void ForEach(Function&& f) const + { + detail::TupleForEach(*this, std::forward(f)); + } + + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT auto Transform(Function&& f) + -> decltype(detail::TupleTransform(*this, std::forward(f))) + { + return detail::TupleTransform(*this, std::forward(f)); + } + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT auto Transform(Function&& f) const + -> decltype(detail::TupleTransform(*this, std::forward(f))) + { + return detail::TupleTransform(*this, std::forward(f)); + } +}; + +template +class Tuple +{ + T0 Value0; + static T0 ElementTypeI(vtkm::internal::IndexTag<0>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<0>) + { + return this->Value0; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<0>) const + { + return this->Value0; + } + + T1 Value1; + static T1 ElementTypeI(vtkm::internal::IndexTag<1>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<1>) + { + return this->Value1; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<1>) const + { + return this->Value1; + } + + T2 Value2; + static T2 ElementTypeI(vtkm::internal::IndexTag<2>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<2>) + { + return this->Value2; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<2>) const + { + return this->Value2; + } + + T3 Value3; + static T3 ElementTypeI(vtkm::internal::IndexTag<3>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<3>) + { + return this->Value3; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<3>) const + { + return this->Value3; + } + + T4 Value4; + static T4 ElementTypeI(vtkm::internal::IndexTag<4>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<4>) + { + return this->Value4; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<4>) const + { + return this->Value4; + } + + T5 Value5; + static T5 ElementTypeI(vtkm::internal::IndexTag<5>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<5>) + { + return this->Value5; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<5>) const + { + return this->Value5; + } + + T6 Value6; + static T6 ElementTypeI(vtkm::internal::IndexTag<6>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<6>) + { + return this->Value6; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<6>) const + { + return this->Value6; + } + + T7 Value7; + static T7 ElementTypeI(vtkm::internal::IndexTag<7>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<7>) + { + return this->Value7; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<7>) const + { + return this->Value7; + } + + T8 Value8; + static T8 ElementTypeI(vtkm::internal::IndexTag<8>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<8>) + { + return this->Value8; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<8>) const + { + return this->Value8; + } + + T9 Value9; + static T9 ElementTypeI(vtkm::internal::IndexTag<9>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<9>) + { + return this->Value9; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<9>) const + { + return this->Value9; + } + + T10 Value10; + static T10 ElementTypeI(vtkm::internal::IndexTag<10>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<10>) + { + return this->Value10; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<10>) const + { + return this->Value10; + } + + T11 Value11; + static T11 ElementTypeI(vtkm::internal::IndexTag<11>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<11>) + { + return this->Value11; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<11>) const + { + return this->Value11; + } + + T12 Value12; + static T12 ElementTypeI(vtkm::internal::IndexTag<12>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<12>) + { + return this->Value12; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<12>) const + { + return this->Value12; + } + + T13 Value13; + static T13 ElementTypeI(vtkm::internal::IndexTag<13>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<13>) + { + return this->Value13; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<13>) const + { + return this->Value13; + } + + T14 Value14; + static T14 ElementTypeI(vtkm::internal::IndexTag<14>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<14>) + { + return this->Value14; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<14>) const + { + return this->Value14; + } + + T15 Value15; + static T15 ElementTypeI(vtkm::internal::IndexTag<15>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<15>) + { + return this->Value15; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<15>) const + { + return this->Value15; + } + + T16 Value16; + static T16 ElementTypeI(vtkm::internal::IndexTag<16>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<16>) + { + return this->Value16; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<16>) const + { + return this->Value16; + } + + + // Invalid indices + template + static vtkm::internal::NullType ElementTypeI(vtkm::internal::IndexTag); + + template + friend struct detail::TupleElementImpl; + +public: + static constexpr vtkm::IdComponent Size = 17; + template + using ElementType = vtkm::TupleElement>; + + Tuple() = default; + Tuple(Tuple&&) = default; + Tuple(const Tuple&) = default; + ~Tuple() = default; + Tuple& operator=(Tuple&&) = default; + Tuple& operator=(const Tuple&) = default; + + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT Tuple(A0&& a0, A1&& a1, A2&& a2, A3&& a3, A4&& a4, A5&& a5, A6&& a6, A7&& a7, A8&& a8, A9&& a9, A10&& a10, A11&& a11, A12&& a12, A13&& a13, A14&& a14, A15&& a15, A16&& a16) + : Value0(std::forward(a0)) + , Value1(std::forward(a1)) + , Value2(std::forward(a2)) + , Value3(std::forward(a3)) + , Value4(std::forward(a4)) + , Value5(std::forward(a5)) + , Value6(std::forward(a6)) + , Value7(std::forward(a7)) + , Value8(std::forward(a8)) + , Value9(std::forward(a9)) + , Value10(std::forward(a10)) + , Value11(std::forward(a11)) + , Value12(std::forward(a12)) + , Value13(std::forward(a13)) + , Value14(std::forward(a14)) + , Value15(std::forward(a15)) + , Value16(std::forward(a16)) + { + } + + template + VTKM_EXEC_CONT auto Get() -> decltype(this->GetImpl(vtkm::internal::IndexTag{})) + { + return this->GetImpl(vtkm::internal::IndexTag{}); + } + + template + VTKM_EXEC_CONT auto Get() const -> decltype(this->GetImpl(vtkm::internal::IndexTag{})) + { + return this->GetImpl(vtkm::internal::IndexTag{}); + } + + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT + auto Apply(Function&& f, Args&&... args) + -> decltype(f(std::forward(args)..., Value0, Value1, Value2, Value3, Value4, Value5, Value6, Value7, Value8, Value9, Value10, Value11, Value12, Value13, Value14, Value15, Value16)) + { + return f(std::forward(args)..., Value0, Value1, Value2, Value3, Value4, Value5, Value6, Value7, Value8, Value9, Value10, Value11, Value12, Value13, Value14, Value15, Value16); + } + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT + auto Apply(Function&& f, Args&&... args) const + -> decltype(f(std::forward(args)..., Value0, Value1, Value2, Value3, Value4, Value5, Value6, Value7, Value8, Value9, Value10, Value11, Value12, Value13, Value14, Value15, Value16)) + { + return f(std::forward(args)..., Value0, Value1, Value2, Value3, Value4, Value5, Value6, Value7, Value8, Value9, Value10, Value11, Value12, Value13, Value14, Value15, Value16); + } + + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT void ForEach(Function&& f) + { + detail::TupleForEach(*this, std::forward(f)); + } + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT void ForEach(Function&& f) const + { + detail::TupleForEach(*this, std::forward(f)); + } + + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT auto Transform(Function&& f) + -> decltype(detail::TupleTransform(*this, std::forward(f))) + { + return detail::TupleTransform(*this, std::forward(f)); + } + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT auto Transform(Function&& f) const + -> decltype(detail::TupleTransform(*this, std::forward(f))) + { + return detail::TupleTransform(*this, std::forward(f)); + } +}; + +template +class Tuple +{ + T0 Value0; + static T0 ElementTypeI(vtkm::internal::IndexTag<0>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<0>) + { + return this->Value0; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<0>) const + { + return this->Value0; + } + + T1 Value1; + static T1 ElementTypeI(vtkm::internal::IndexTag<1>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<1>) + { + return this->Value1; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<1>) const + { + return this->Value1; + } + + T2 Value2; + static T2 ElementTypeI(vtkm::internal::IndexTag<2>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<2>) + { + return this->Value2; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<2>) const + { + return this->Value2; + } + + T3 Value3; + static T3 ElementTypeI(vtkm::internal::IndexTag<3>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<3>) + { + return this->Value3; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<3>) const + { + return this->Value3; + } + + T4 Value4; + static T4 ElementTypeI(vtkm::internal::IndexTag<4>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<4>) + { + return this->Value4; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<4>) const + { + return this->Value4; + } + + T5 Value5; + static T5 ElementTypeI(vtkm::internal::IndexTag<5>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<5>) + { + return this->Value5; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<5>) const + { + return this->Value5; + } + + T6 Value6; + static T6 ElementTypeI(vtkm::internal::IndexTag<6>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<6>) + { + return this->Value6; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<6>) const + { + return this->Value6; + } + + T7 Value7; + static T7 ElementTypeI(vtkm::internal::IndexTag<7>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<7>) + { + return this->Value7; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<7>) const + { + return this->Value7; + } + + T8 Value8; + static T8 ElementTypeI(vtkm::internal::IndexTag<8>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<8>) + { + return this->Value8; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<8>) const + { + return this->Value8; + } + + T9 Value9; + static T9 ElementTypeI(vtkm::internal::IndexTag<9>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<9>) + { + return this->Value9; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<9>) const + { + return this->Value9; + } + + T10 Value10; + static T10 ElementTypeI(vtkm::internal::IndexTag<10>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<10>) + { + return this->Value10; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<10>) const + { + return this->Value10; + } + + T11 Value11; + static T11 ElementTypeI(vtkm::internal::IndexTag<11>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<11>) + { + return this->Value11; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<11>) const + { + return this->Value11; + } + + T12 Value12; + static T12 ElementTypeI(vtkm::internal::IndexTag<12>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<12>) + { + return this->Value12; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<12>) const + { + return this->Value12; + } + + T13 Value13; + static T13 ElementTypeI(vtkm::internal::IndexTag<13>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<13>) + { + return this->Value13; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<13>) const + { + return this->Value13; + } + + T14 Value14; + static T14 ElementTypeI(vtkm::internal::IndexTag<14>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<14>) + { + return this->Value14; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<14>) const + { + return this->Value14; + } + + T15 Value15; + static T15 ElementTypeI(vtkm::internal::IndexTag<15>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<15>) + { + return this->Value15; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<15>) const + { + return this->Value15; + } + + T16 Value16; + static T16 ElementTypeI(vtkm::internal::IndexTag<16>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<16>) + { + return this->Value16; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<16>) const + { + return this->Value16; + } + + T17 Value17; + static T17 ElementTypeI(vtkm::internal::IndexTag<17>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<17>) + { + return this->Value17; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<17>) const + { + return this->Value17; + } + + + // Invalid indices + template + static vtkm::internal::NullType ElementTypeI(vtkm::internal::IndexTag); + + template + friend struct detail::TupleElementImpl; + +public: + static constexpr vtkm::IdComponent Size = 18; + template + using ElementType = vtkm::TupleElement>; + + Tuple() = default; + Tuple(Tuple&&) = default; + Tuple(const Tuple&) = default; + ~Tuple() = default; + Tuple& operator=(Tuple&&) = default; + Tuple& operator=(const Tuple&) = default; + + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT Tuple(A0&& a0, A1&& a1, A2&& a2, A3&& a3, A4&& a4, A5&& a5, A6&& a6, A7&& a7, A8&& a8, A9&& a9, A10&& a10, A11&& a11, A12&& a12, A13&& a13, A14&& a14, A15&& a15, A16&& a16, A17&& a17) + : Value0(std::forward(a0)) + , Value1(std::forward(a1)) + , Value2(std::forward(a2)) + , Value3(std::forward(a3)) + , Value4(std::forward(a4)) + , Value5(std::forward(a5)) + , Value6(std::forward(a6)) + , Value7(std::forward(a7)) + , Value8(std::forward(a8)) + , Value9(std::forward(a9)) + , Value10(std::forward(a10)) + , Value11(std::forward(a11)) + , Value12(std::forward(a12)) + , Value13(std::forward(a13)) + , Value14(std::forward(a14)) + , Value15(std::forward(a15)) + , Value16(std::forward(a16)) + , Value17(std::forward(a17)) + { + } + + template + VTKM_EXEC_CONT auto Get() -> decltype(this->GetImpl(vtkm::internal::IndexTag{})) + { + return this->GetImpl(vtkm::internal::IndexTag{}); + } + + template + VTKM_EXEC_CONT auto Get() const -> decltype(this->GetImpl(vtkm::internal::IndexTag{})) + { + return this->GetImpl(vtkm::internal::IndexTag{}); + } + + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT + auto Apply(Function&& f, Args&&... args) + -> decltype(f(std::forward(args)..., Value0, Value1, Value2, Value3, Value4, Value5, Value6, Value7, Value8, Value9, Value10, Value11, Value12, Value13, Value14, Value15, Value16, Value17)) + { + return f(std::forward(args)..., Value0, Value1, Value2, Value3, Value4, Value5, Value6, Value7, Value8, Value9, Value10, Value11, Value12, Value13, Value14, Value15, Value16, Value17); + } + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT + auto Apply(Function&& f, Args&&... args) const + -> decltype(f(std::forward(args)..., Value0, Value1, Value2, Value3, Value4, Value5, Value6, Value7, Value8, Value9, Value10, Value11, Value12, Value13, Value14, Value15, Value16, Value17)) + { + return f(std::forward(args)..., Value0, Value1, Value2, Value3, Value4, Value5, Value6, Value7, Value8, Value9, Value10, Value11, Value12, Value13, Value14, Value15, Value16, Value17); + } + + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT void ForEach(Function&& f) + { + detail::TupleForEach(*this, std::forward(f)); + } + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT void ForEach(Function&& f) const + { + detail::TupleForEach(*this, std::forward(f)); + } + + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT auto Transform(Function&& f) + -> decltype(detail::TupleTransform(*this, std::forward(f))) + { + return detail::TupleTransform(*this, std::forward(f)); + } + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT auto Transform(Function&& f) const + -> decltype(detail::TupleTransform(*this, std::forward(f))) + { + return detail::TupleTransform(*this, std::forward(f)); + } +}; + +template +class Tuple +{ + T0 Value0; + static T0 ElementTypeI(vtkm::internal::IndexTag<0>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<0>) + { + return this->Value0; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<0>) const + { + return this->Value0; + } + + T1 Value1; + static T1 ElementTypeI(vtkm::internal::IndexTag<1>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<1>) + { + return this->Value1; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<1>) const + { + return this->Value1; + } + + T2 Value2; + static T2 ElementTypeI(vtkm::internal::IndexTag<2>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<2>) + { + return this->Value2; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<2>) const + { + return this->Value2; + } + + T3 Value3; + static T3 ElementTypeI(vtkm::internal::IndexTag<3>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<3>) + { + return this->Value3; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<3>) const + { + return this->Value3; + } + + T4 Value4; + static T4 ElementTypeI(vtkm::internal::IndexTag<4>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<4>) + { + return this->Value4; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<4>) const + { + return this->Value4; + } + + T5 Value5; + static T5 ElementTypeI(vtkm::internal::IndexTag<5>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<5>) + { + return this->Value5; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<5>) const + { + return this->Value5; + } + + T6 Value6; + static T6 ElementTypeI(vtkm::internal::IndexTag<6>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<6>) + { + return this->Value6; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<6>) const + { + return this->Value6; + } + + T7 Value7; + static T7 ElementTypeI(vtkm::internal::IndexTag<7>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<7>) + { + return this->Value7; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<7>) const + { + return this->Value7; + } + + T8 Value8; + static T8 ElementTypeI(vtkm::internal::IndexTag<8>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<8>) + { + return this->Value8; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<8>) const + { + return this->Value8; + } + + T9 Value9; + static T9 ElementTypeI(vtkm::internal::IndexTag<9>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<9>) + { + return this->Value9; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<9>) const + { + return this->Value9; + } + + T10 Value10; + static T10 ElementTypeI(vtkm::internal::IndexTag<10>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<10>) + { + return this->Value10; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<10>) const + { + return this->Value10; + } + + T11 Value11; + static T11 ElementTypeI(vtkm::internal::IndexTag<11>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<11>) + { + return this->Value11; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<11>) const + { + return this->Value11; + } + + T12 Value12; + static T12 ElementTypeI(vtkm::internal::IndexTag<12>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<12>) + { + return this->Value12; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<12>) const + { + return this->Value12; + } + + T13 Value13; + static T13 ElementTypeI(vtkm::internal::IndexTag<13>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<13>) + { + return this->Value13; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<13>) const + { + return this->Value13; + } + + T14 Value14; + static T14 ElementTypeI(vtkm::internal::IndexTag<14>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<14>) + { + return this->Value14; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<14>) const + { + return this->Value14; + } + + T15 Value15; + static T15 ElementTypeI(vtkm::internal::IndexTag<15>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<15>) + { + return this->Value15; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<15>) const + { + return this->Value15; + } + + T16 Value16; + static T16 ElementTypeI(vtkm::internal::IndexTag<16>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<16>) + { + return this->Value16; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<16>) const + { + return this->Value16; + } + + T17 Value17; + static T17 ElementTypeI(vtkm::internal::IndexTag<17>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<17>) + { + return this->Value17; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<17>) const + { + return this->Value17; + } + + T18 Value18; + static T18 ElementTypeI(vtkm::internal::IndexTag<18>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<18>) + { + return this->Value18; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<18>) const + { + return this->Value18; + } + + + // Invalid indices + template + static vtkm::internal::NullType ElementTypeI(vtkm::internal::IndexTag); + + template + friend struct detail::TupleElementImpl; + +public: + static constexpr vtkm::IdComponent Size = 19; + template + using ElementType = vtkm::TupleElement>; + + Tuple() = default; + Tuple(Tuple&&) = default; + Tuple(const Tuple&) = default; + ~Tuple() = default; + Tuple& operator=(Tuple&&) = default; + Tuple& operator=(const Tuple&) = default; + + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT Tuple(A0&& a0, A1&& a1, A2&& a2, A3&& a3, A4&& a4, A5&& a5, A6&& a6, A7&& a7, A8&& a8, A9&& a9, A10&& a10, A11&& a11, A12&& a12, A13&& a13, A14&& a14, A15&& a15, A16&& a16, A17&& a17, A18&& a18) + : Value0(std::forward(a0)) + , Value1(std::forward(a1)) + , Value2(std::forward(a2)) + , Value3(std::forward(a3)) + , Value4(std::forward(a4)) + , Value5(std::forward(a5)) + , Value6(std::forward(a6)) + , Value7(std::forward(a7)) + , Value8(std::forward(a8)) + , Value9(std::forward(a9)) + , Value10(std::forward(a10)) + , Value11(std::forward(a11)) + , Value12(std::forward(a12)) + , Value13(std::forward(a13)) + , Value14(std::forward(a14)) + , Value15(std::forward(a15)) + , Value16(std::forward(a16)) + , Value17(std::forward(a17)) + , Value18(std::forward(a18)) + { + } + + template + VTKM_EXEC_CONT auto Get() -> decltype(this->GetImpl(vtkm::internal::IndexTag{})) + { + return this->GetImpl(vtkm::internal::IndexTag{}); + } + + template + VTKM_EXEC_CONT auto Get() const -> decltype(this->GetImpl(vtkm::internal::IndexTag{})) + { + return this->GetImpl(vtkm::internal::IndexTag{}); + } + + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT + auto Apply(Function&& f, Args&&... args) + -> decltype(f(std::forward(args)..., Value0, Value1, Value2, Value3, Value4, Value5, Value6, Value7, Value8, Value9, Value10, Value11, Value12, Value13, Value14, Value15, Value16, Value17, Value18)) + { + return f(std::forward(args)..., Value0, Value1, Value2, Value3, Value4, Value5, Value6, Value7, Value8, Value9, Value10, Value11, Value12, Value13, Value14, Value15, Value16, Value17, Value18); + } + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT + auto Apply(Function&& f, Args&&... args) const + -> decltype(f(std::forward(args)..., Value0, Value1, Value2, Value3, Value4, Value5, Value6, Value7, Value8, Value9, Value10, Value11, Value12, Value13, Value14, Value15, Value16, Value17, Value18)) + { + return f(std::forward(args)..., Value0, Value1, Value2, Value3, Value4, Value5, Value6, Value7, Value8, Value9, Value10, Value11, Value12, Value13, Value14, Value15, Value16, Value17, Value18); + } + + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT void ForEach(Function&& f) + { + detail::TupleForEach(*this, std::forward(f)); + } + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT void ForEach(Function&& f) const + { + detail::TupleForEach(*this, std::forward(f)); + } + + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT auto Transform(Function&& f) + -> decltype(detail::TupleTransform(*this, std::forward(f))) + { + return detail::TupleTransform(*this, std::forward(f)); + } + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT auto Transform(Function&& f) const + -> decltype(detail::TupleTransform(*this, std::forward(f))) + { + return detail::TupleTransform(*this, std::forward(f)); + } +}; + +template +class Tuple +{ + T0 Value0; + static T0 ElementTypeI(vtkm::internal::IndexTag<0>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<0>) + { + return this->Value0; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<0>) const + { + return this->Value0; + } + + T1 Value1; + static T1 ElementTypeI(vtkm::internal::IndexTag<1>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<1>) + { + return this->Value1; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<1>) const + { + return this->Value1; + } + + T2 Value2; + static T2 ElementTypeI(vtkm::internal::IndexTag<2>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<2>) + { + return this->Value2; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<2>) const + { + return this->Value2; + } + + T3 Value3; + static T3 ElementTypeI(vtkm::internal::IndexTag<3>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<3>) + { + return this->Value3; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<3>) const + { + return this->Value3; + } + + T4 Value4; + static T4 ElementTypeI(vtkm::internal::IndexTag<4>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<4>) + { + return this->Value4; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<4>) const + { + return this->Value4; + } + + T5 Value5; + static T5 ElementTypeI(vtkm::internal::IndexTag<5>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<5>) + { + return this->Value5; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<5>) const + { + return this->Value5; + } + + T6 Value6; + static T6 ElementTypeI(vtkm::internal::IndexTag<6>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<6>) + { + return this->Value6; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<6>) const + { + return this->Value6; + } + + T7 Value7; + static T7 ElementTypeI(vtkm::internal::IndexTag<7>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<7>) + { + return this->Value7; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<7>) const + { + return this->Value7; + } + + T8 Value8; + static T8 ElementTypeI(vtkm::internal::IndexTag<8>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<8>) + { + return this->Value8; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<8>) const + { + return this->Value8; + } + + T9 Value9; + static T9 ElementTypeI(vtkm::internal::IndexTag<9>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<9>) + { + return this->Value9; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<9>) const + { + return this->Value9; + } + + T10 Value10; + static T10 ElementTypeI(vtkm::internal::IndexTag<10>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<10>) + { + return this->Value10; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<10>) const + { + return this->Value10; + } + + T11 Value11; + static T11 ElementTypeI(vtkm::internal::IndexTag<11>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<11>) + { + return this->Value11; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<11>) const + { + return this->Value11; + } + + T12 Value12; + static T12 ElementTypeI(vtkm::internal::IndexTag<12>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<12>) + { + return this->Value12; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<12>) const + { + return this->Value12; + } + + T13 Value13; + static T13 ElementTypeI(vtkm::internal::IndexTag<13>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<13>) + { + return this->Value13; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<13>) const + { + return this->Value13; + } + + T14 Value14; + static T14 ElementTypeI(vtkm::internal::IndexTag<14>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<14>) + { + return this->Value14; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<14>) const + { + return this->Value14; + } + + T15 Value15; + static T15 ElementTypeI(vtkm::internal::IndexTag<15>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<15>) + { + return this->Value15; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<15>) const + { + return this->Value15; + } + + T16 Value16; + static T16 ElementTypeI(vtkm::internal::IndexTag<16>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<16>) + { + return this->Value16; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<16>) const + { + return this->Value16; + } + + T17 Value17; + static T17 ElementTypeI(vtkm::internal::IndexTag<17>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<17>) + { + return this->Value17; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<17>) const + { + return this->Value17; + } + + T18 Value18; + static T18 ElementTypeI(vtkm::internal::IndexTag<18>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<18>) + { + return this->Value18; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<18>) const + { + return this->Value18; + } + + T19 Value19; + static T19 ElementTypeI(vtkm::internal::IndexTag<19>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<19>) + { + return this->Value19; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<19>) const + { + return this->Value19; + } + + + // Invalid indices + template + static vtkm::internal::NullType ElementTypeI(vtkm::internal::IndexTag); + + template + friend struct detail::TupleElementImpl; + +public: + static constexpr vtkm::IdComponent Size = 20; + template + using ElementType = vtkm::TupleElement>; + + Tuple() = default; + Tuple(Tuple&&) = default; + Tuple(const Tuple&) = default; + ~Tuple() = default; + Tuple& operator=(Tuple&&) = default; + Tuple& operator=(const Tuple&) = default; + + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT Tuple(A0&& a0, A1&& a1, A2&& a2, A3&& a3, A4&& a4, A5&& a5, A6&& a6, A7&& a7, A8&& a8, A9&& a9, A10&& a10, A11&& a11, A12&& a12, A13&& a13, A14&& a14, A15&& a15, A16&& a16, A17&& a17, A18&& a18, A19&& a19) + : Value0(std::forward(a0)) + , Value1(std::forward(a1)) + , Value2(std::forward(a2)) + , Value3(std::forward(a3)) + , Value4(std::forward(a4)) + , Value5(std::forward(a5)) + , Value6(std::forward(a6)) + , Value7(std::forward(a7)) + , Value8(std::forward(a8)) + , Value9(std::forward(a9)) + , Value10(std::forward(a10)) + , Value11(std::forward(a11)) + , Value12(std::forward(a12)) + , Value13(std::forward(a13)) + , Value14(std::forward(a14)) + , Value15(std::forward(a15)) + , Value16(std::forward(a16)) + , Value17(std::forward(a17)) + , Value18(std::forward(a18)) + , Value19(std::forward(a19)) + { + } + + template + VTKM_EXEC_CONT auto Get() -> decltype(this->GetImpl(vtkm::internal::IndexTag{})) + { + return this->GetImpl(vtkm::internal::IndexTag{}); + } + + template + VTKM_EXEC_CONT auto Get() const -> decltype(this->GetImpl(vtkm::internal::IndexTag{})) + { + return this->GetImpl(vtkm::internal::IndexTag{}); + } + + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT + auto Apply(Function&& f, Args&&... args) + -> decltype(f(std::forward(args)..., Value0, Value1, Value2, Value3, Value4, Value5, Value6, Value7, Value8, Value9, Value10, Value11, Value12, Value13, Value14, Value15, Value16, Value17, Value18, Value19)) + { + return f(std::forward(args)..., Value0, Value1, Value2, Value3, Value4, Value5, Value6, Value7, Value8, Value9, Value10, Value11, Value12, Value13, Value14, Value15, Value16, Value17, Value18, Value19); + } + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT + auto Apply(Function&& f, Args&&... args) const + -> decltype(f(std::forward(args)..., Value0, Value1, Value2, Value3, Value4, Value5, Value6, Value7, Value8, Value9, Value10, Value11, Value12, Value13, Value14, Value15, Value16, Value17, Value18, Value19)) + { + return f(std::forward(args)..., Value0, Value1, Value2, Value3, Value4, Value5, Value6, Value7, Value8, Value9, Value10, Value11, Value12, Value13, Value14, Value15, Value16, Value17, Value18, Value19); + } + + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT void ForEach(Function&& f) + { + detail::TupleForEach(*this, std::forward(f)); + } + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT void ForEach(Function&& f) const + { + detail::TupleForEach(*this, std::forward(f)); + } + + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT auto Transform(Function&& f) + -> decltype(detail::TupleTransform(*this, std::forward(f))) + { + return detail::TupleTransform(*this, std::forward(f)); + } + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT auto Transform(Function&& f) const + -> decltype(detail::TupleTransform(*this, std::forward(f))) + { + return detail::TupleTransform(*this, std::forward(f)); + } +}; + + +// Fallback case for tuples with > 20 items. +template +class Tuple +{ + T0 Value0; + static T0 ElementTypeI(vtkm::internal::IndexTag<0>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<0>) + { + return this->Value0; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<0>) const + { + return this->Value0; + } + + T1 Value1; + static T1 ElementTypeI(vtkm::internal::IndexTag<1>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<1>) + { + return this->Value1; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<1>) const + { + return this->Value1; + } + + T2 Value2; + static T2 ElementTypeI(vtkm::internal::IndexTag<2>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<2>) + { + return this->Value2; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<2>) const + { + return this->Value2; + } + + T3 Value3; + static T3 ElementTypeI(vtkm::internal::IndexTag<3>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<3>) + { + return this->Value3; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<3>) const + { + return this->Value3; + } + + T4 Value4; + static T4 ElementTypeI(vtkm::internal::IndexTag<4>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<4>) + { + return this->Value4; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<4>) const + { + return this->Value4; + } + + T5 Value5; + static T5 ElementTypeI(vtkm::internal::IndexTag<5>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<5>) + { + return this->Value5; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<5>) const + { + return this->Value5; + } + + T6 Value6; + static T6 ElementTypeI(vtkm::internal::IndexTag<6>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<6>) + { + return this->Value6; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<6>) const + { + return this->Value6; + } + + T7 Value7; + static T7 ElementTypeI(vtkm::internal::IndexTag<7>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<7>) + { + return this->Value7; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<7>) const + { + return this->Value7; + } + + T8 Value8; + static T8 ElementTypeI(vtkm::internal::IndexTag<8>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<8>) + { + return this->Value8; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<8>) const + { + return this->Value8; + } + + T9 Value9; + static T9 ElementTypeI(vtkm::internal::IndexTag<9>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<9>) + { + return this->Value9; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<9>) const + { + return this->Value9; + } + + T10 Value10; + static T10 ElementTypeI(vtkm::internal::IndexTag<10>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<10>) + { + return this->Value10; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<10>) const + { + return this->Value10; + } + + T11 Value11; + static T11 ElementTypeI(vtkm::internal::IndexTag<11>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<11>) + { + return this->Value11; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<11>) const + { + return this->Value11; + } + + T12 Value12; + static T12 ElementTypeI(vtkm::internal::IndexTag<12>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<12>) + { + return this->Value12; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<12>) const + { + return this->Value12; + } + + T13 Value13; + static T13 ElementTypeI(vtkm::internal::IndexTag<13>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<13>) + { + return this->Value13; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<13>) const + { + return this->Value13; + } + + T14 Value14; + static T14 ElementTypeI(vtkm::internal::IndexTag<14>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<14>) + { + return this->Value14; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<14>) const + { + return this->Value14; + } + + T15 Value15; + static T15 ElementTypeI(vtkm::internal::IndexTag<15>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<15>) + { + return this->Value15; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<15>) const + { + return this->Value15; + } + + T16 Value16; + static T16 ElementTypeI(vtkm::internal::IndexTag<16>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<16>) + { + return this->Value16; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<16>) const + { + return this->Value16; + } + + T17 Value17; + static T17 ElementTypeI(vtkm::internal::IndexTag<17>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<17>) + { + return this->Value17; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<17>) const + { + return this->Value17; + } + + T18 Value18; + static T18 ElementTypeI(vtkm::internal::IndexTag<18>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<18>) + { + return this->Value18; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<18>) const + { + return this->Value18; + } + + T19 Value19; + static T19 ElementTypeI(vtkm::internal::IndexTag<19>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<19>) + { + return this->Value19; + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<19>) const + { + return this->Value19; + } + + + // Implement the "extra" objects in a sub-Tuple + using RemainingValuesType = vtkm::Tuple; + RemainingValuesType RemainingValues; + + template + static vtkm::TupleElement + ElementTypeI(vtkm::internal::IndexTag); + + template + VTKM_EXEC_CONT const vtkm::internal::remove_cvref>& + GetImpl(vtkm::internal::IndexTag) { return vtkm::Get(this->RemainingValues); } + template + VTKM_EXEC_CONT const vtkm::internal::remove_cvref>& + GetImpl(vtkm::internal::IndexTag) const { return vtkm::Get(this->RemainingValues); } + + template + friend struct detail::TupleElementImpl; + +public: + static constexpr vtkm::IdComponent Size = + 21 + static_cast(sizeof...(Ts)); + template + using ElementType = vtkm::TupleElement>; + + Tuple() = default; + Tuple(Tuple&&) = default; + Tuple(const Tuple&) = default; + ~Tuple() = default; + Tuple& operator=(Tuple&&) = default; + Tuple& operator=(const Tuple&) = default; + + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT Tuple(A0&& a0, A1&& a1, A2&& a2, A3&& a3, A4&& a4, A5&& a5, A6&& a6, A7&& a7, A8&& a8, A9&& a9, A10&& a10, A11&& a11, A12&& a12, A13&& a13, A14&& a14, A15&& a15, A16&& a16, A17&& a17, A18&& a18, A19&& a19, As&&... remainingArgs) + : Value0(std::forward(a0)) + , Value1(std::forward(a1)) + , Value2(std::forward(a2)) + , Value3(std::forward(a3)) + , Value4(std::forward(a4)) + , Value5(std::forward(a5)) + , Value6(std::forward(a6)) + , Value7(std::forward(a7)) + , Value8(std::forward(a8)) + , Value9(std::forward(a9)) + , Value10(std::forward(a10)) + , Value11(std::forward(a11)) + , Value12(std::forward(a12)) + , Value13(std::forward(a13)) + , Value14(std::forward(a14)) + , Value15(std::forward(a15)) + , Value16(std::forward(a16)) + , Value17(std::forward(a17)) + , Value18(std::forward(a18)) + , Value19(std::forward(a19)) + , RemainingValues(std::forward(remainingArgs)...) + { + } + + template + VTKM_EXEC_CONT auto Get() -> decltype(this->GetImpl(vtkm::internal::IndexTag{})) + { + return this->GetImpl(vtkm::internal::IndexTag{}); + } + + template + VTKM_EXEC_CONT auto Get() const -> decltype(this->GetImpl(vtkm::internal::IndexTag{})) + { + return this->GetImpl(vtkm::internal::IndexTag{}); + } + + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT + auto Apply(Function&& f, Args&&... args) + -> decltype(this->RemainingValues.Apply(std::forward(f), + std::forward(args)..., + this->Value0, + this->Value1, + this->Value2, + this->Value3, + this->Value4, + this->Value5, + this->Value6, + this->Value7, + this->Value8, + this->Value9, + this->Value10, + this->Value11, + this->Value12, + this->Value13, + this->Value14, + this->Value15, + this->Value16, + this->Value17, + this->Value18, + this->Value19)) + { + return this->RemainingValues.Apply(std::forward(f), + std::forward(args)..., + this->Value0, + this->Value1, + this->Value2, + this->Value3, + this->Value4, + this->Value5, + this->Value6, + this->Value7, + this->Value8, + this->Value9, + this->Value10, + this->Value11, + this->Value12, + this->Value13, + this->Value14, + this->Value15, + this->Value16, + this->Value17, + this->Value18, + this->Value19); + } + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT + auto Apply(Function&& f, Args&&... args) const + -> decltype(this->RemainingValues.Apply(std::forward(f), + std::forward(args)..., + this->Value0, + this->Value1, + this->Value2, + this->Value3, + this->Value4, + this->Value5, + this->Value6, + this->Value7, + this->Value8, + this->Value9, + this->Value10, + this->Value11, + this->Value12, + this->Value13, + this->Value14, + this->Value15, + this->Value16, + this->Value17, + this->Value18, + this->Value19)) + { + return this->RemainingValues.Apply(std::forward(f), + std::forward(args)..., + this->Value0, + this->Value1, + this->Value2, + this->Value3, + this->Value4, + this->Value5, + this->Value6, + this->Value7, + this->Value8, + this->Value9, + this->Value10, + this->Value11, + this->Value12, + this->Value13, + this->Value14, + this->Value15, + this->Value16, + this->Value17, + this->Value18, + this->Value19); + } + + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT void ForEach(Function&& f) + { + detail::TupleForEach(*this, std::forward(f)); + } + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT void ForEach(Function&& f) const + { + detail::TupleForEach(*this, std::forward(f)); + } + + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT auto Transform(Function&& f) + -> decltype(detail::TupleTransform(*this, std::forward(f))) + { + return detail::TupleTransform(*this, std::forward(f)); + } + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT auto Transform(Function&& f) const + -> decltype(detail::TupleTransform(*this, std::forward(f))) + { + return detail::TupleTransform(*this, std::forward(f)); + } +}; + +///@} + +// clang-format on + +} // namespace vtkm + +#endif //vtk_m_Tuple_h diff --git a/vtkm/Tuple.h.in b/vtkm/Tuple.h.in new file mode 100644 index 000000000..6a2ba23a5 --- /dev/null +++ b/vtkm/Tuple.h.in @@ -0,0 +1,504 @@ +//============================================================================ +// Copyright (c) Kitware, Inc. +// All rights reserved. +// See LICENSE.txt for details. +// +// This software is distributed WITHOUT ANY WARRANTY; without even +// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +// PURPOSE. See the above copyright notice for more information. +//============================================================================ +$# This file uses the pyexpander macro processing utility to build the +$# FunctionInterface facilities that use a variable number of arguments. +$# Information, documentation, and downloads for pyexpander can be found at: +$# +$# http://pyexpander.sourceforge.net/ +$# +$# To build the source code, execute the following (after installing +$# pyexpander, of course): +$# +$# expander.py VariantDetail.h.in > VariantDetail.h +$# +$# Ignore the following comment. It is meant for the generated file. +// **** DO NOT EDIT THIS FILE!!! **** +// This file is automatically generated by Tuple.h.in + +#ifndef vtk_m_Tuple_h +#define vtk_m_Tuple_h + +#include + +#include +#include + +$py(max_expanded=20)\ + +$# Python commands used in template expansion. +$py( +def type_list(num_params, name='T'): + if num_params < 1: + return '' + result = '%s0' % name + for param in range(1, num_params): + result += ', %s%d' % (name, param) + return result + +def typename_list(num_params, name='T'): + if num_params < 1: + return '' + result = 'typename %s0' % name + for param in range(1, num_params): + result += ', typename %s%d' % (name, param) + return result + +def perfect_param_list(num_params, classname='A', argname='a'): + if num_params < 1: + return '' + result = '%s0&& %s0' % (classname, argname) + for param in range(1, num_params): + result += ', %s%d&& %s%d' % (classname, param, argname, param) + return result +)\ +$# +$extend(type_list, typename_list, perfect_param_list)\ + +namespace vtkm +{ + +///@{ +/// \brief VTK-m replacement for std::tuple +/// +/// This function serves the same function as `std::tuple` and behaves similarly. However, this +/// version of `Tuple` works on devices that VTK-m supports. There are also some implementation +/// details that makes compiling faster for VTK-m use. We also provide some methods like `Apply` +/// and `ForEach` that are helpful for several VTK-m operations. +/// +template +class Tuple; + +/// \brief Get the size of a tuple. +/// +/// Given a `vtkm::Tuple` type, because a `std::integral_constant` of the type. +/// +template +using TupleSize = std::integral_constant; + +/// \brief Compatible with `std::tuple_size` for `vtkm::Tuple`. +/// +template +using tuple_size = std::integral_constant(TupleType::Size)>; + +namespace detail +{ + +template +struct TupleElementImpl +{ + using type = decltype(TupleType::ElementTypeI(vtkm::internal::IndexTag{})); +}; + +} // namespace detail + +/// \brief Becomes the type of the given index for the given `vtkm::Tuple`. +/// +template +using TupleElement = typename detail::TupleElementImpl::type; + +/// \brief Compatible with `std::tuple_element` for `vtkm::Tuple`. +/// +template +struct tuple_element +{ + using type = TupleElement(Index), TupleType>; +}; + +/// \brief Compatible with `std::tuple_element_t` for `vtkm::Tuple`. +/// +template +using tuple_element_t = typename tuple_element::type; + +///@{ +/// \brief Retrieve the object from a `vtkm::Tuple` at the given index. +/// +VTKM_SUPPRESS_EXEC_WARNINGS +template +VTKM_EXEC_CONT auto Get(const vtkm::Tuple& tuple) -> decltype(tuple.template Get()) +{ + return tuple.template Get(); +} + +VTKM_SUPPRESS_EXEC_WARNINGS +template +VTKM_EXEC_CONT auto Get(vtkm::Tuple& tuple) -> decltype(tuple.template Get()) +{ + return tuple.template Get(); +} +///@} + +///@{ +/// \brief Compatible with `std::get` for `vtkm::Tuple`. +/// +VTKM_SUPPRESS_EXEC_WARNINGS +template +VTKM_EXEC_CONT auto get(const vtkm::Tuple& tuple) + -> decltype(vtkm::Get(Index)>(tuple)) +{ + return vtkm::Get(Index)>(tuple); +} + +VTKM_SUPPRESS_EXEC_WARNINGS +template +VTKM_EXEC_CONT auto get(vtkm::Tuple& tuple) + -> decltype(vtkm::Get(Index)>(tuple)) +{ + return vtkm::Get(Index)>(tuple); +} +///@} + +/// \brief Creates a new `vtkm::Tuple` with the given types. +/// +VTKM_SUPPRESS_EXEC_WARNINGS +template +VTKM_EXEC_CONT auto MakeTuple(Ts&&... args) -> vtkm::Tuple::type...> +{ + return vtkm::Tuple::type...>(std::forward(args)...); +} + +/// \brief Compatible with `std::make_tuple` for `vtkm::Tuple`. +/// +VTKM_SUPPRESS_EXEC_WARNINGS +template +VTKM_EXEC_CONT auto make_tuple(Ts&&... args) -> decltype(vtkm::MakeTuple(std::forward(args)...)) +{ + return vtkm::MakeTuple(std::forward(args)...); +} + +namespace detail +{ +struct TupleTransformFunctor +{ + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT auto operator()(Function&& f, Ts&&... args) + -> decltype(vtkm::MakeTuple(f(std::forward(args))...)) + { + return vtkm::MakeTuple(f(std::forward(args))...); + } +}; + +VTKM_SUPPRESS_EXEC_WARNINGS +template +VTKM_EXEC_CONT auto TupleTransform(TupleType&& tuple, Function&& f) + -> decltype(tuple.Apply(TupleTransformFunctor{}, std::forward(f))) +{ + return tuple.Apply(TupleTransformFunctor{}, std::forward(f)); +} + +struct TupleForEachFunctor +{ + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT void operator()(Function&& f, Ts&&... args) + { + (void)std::initializer_list{ (f(std::forward(args)), false)... }; + } +}; + +VTKM_SUPPRESS_EXEC_WARNINGS +template +VTKM_EXEC_CONT auto TupleForEach(TupleType&& tuple, Function&& f) + -> decltype(tuple.Apply(TupleForEachFunctor{}, std::forward(f))) +{ + return tuple.Apply(TupleForEachFunctor{}, std::forward(f)); +} + +} // namespace detail + +template <> +class Tuple<> +{ +public: + static constexpr vtkm::IdComponent Size = 0; + + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT auto Apply(Function&& f, Args&&... args) + -> decltype(f(std::forward(args)...)) + { + return f(std::forward(args)...); + } + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT auto Apply(Function&& f, Args&&... args) const + -> decltype(f(std::forward(args)...)) + { + return f(std::forward(args)...); + } + + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT void ForEach(Function&&) const + { + } + + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT vtkm::Tuple<> Transform(Function&&) const + { + return vtkm::Tuple<>{}; + } +}; + +// clang-format off + +$for(num_params in range(1, max_expanded + 1))\ +template<$typename_list(num_params)> +class Tuple<$type_list(num_params)> +{ +$for(index in range(0, num_params))\ + T$(index) Value$(index); + static T$(index) ElementTypeI(vtkm::internal::IndexTag<$(index)>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<$(index)>) + { + return this->Value$(index); + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<$(index)>) const + { + return this->Value$(index); + } + +$endfor\ + + // Invalid indices + template + static vtkm::internal::NullType ElementTypeI(vtkm::internal::IndexTag); + + template + friend struct detail::TupleElementImpl; + +public: + static constexpr vtkm::IdComponent Size = $(num_params); + template + using ElementType = vtkm::TupleElement>; + + Tuple() = default; + Tuple(Tuple&&) = default; + Tuple(const Tuple&) = default; + ~Tuple() = default; + Tuple& operator=(Tuple&&) = default; + Tuple& operator=(const Tuple&) = default; + + VTKM_SUPPRESS_EXEC_WARNINGS + template <$typename_list(num_params, 'A')> + VTKM_EXEC_CONT Tuple($perfect_param_list(num_params, 'A', 'a')) + : Value0(std::forward(a0)) +$for(index in range(1, num_params))\ + , Value$(index)(std::forward(a$(index))) +$endfor\ + { + } + + template + VTKM_EXEC_CONT auto Get() -> decltype(this->GetImpl(vtkm::internal::IndexTag{})) + { + return this->GetImpl(vtkm::internal::IndexTag{}); + } + + template + VTKM_EXEC_CONT auto Get() const -> decltype(this->GetImpl(vtkm::internal::IndexTag{})) + { + return this->GetImpl(vtkm::internal::IndexTag{}); + } + + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT + auto Apply(Function&& f, Args&&... args) + -> decltype(f(std::forward(args)..., $type_list(num_params, "Value"))) + { + return f(std::forward(args)..., $type_list(num_params, "Value")); + } + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT + auto Apply(Function&& f, Args&&... args) const + -> decltype(f(std::forward(args)..., $type_list(num_params, "Value"))) + { + return f(std::forward(args)..., $type_list(num_params, "Value")); + } + + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT void ForEach(Function&& f) + { + detail::TupleForEach(*this, std::forward(f)); + } + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT void ForEach(Function&& f) const + { + detail::TupleForEach(*this, std::forward(f)); + } + + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT auto Transform(Function&& f) + -> decltype(detail::TupleTransform(*this, std::forward(f))) + { + return detail::TupleTransform(*this, std::forward(f)); + } + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT auto Transform(Function&& f) const + -> decltype(detail::TupleTransform(*this, std::forward(f))) + { + return detail::TupleTransform(*this, std::forward(f)); + } +}; + +$endfor\ + +// Fallback case for tuples with > $(max_expanded) items. +template<$typename_list(max_expanded + 1), typename... Ts> +class Tuple<$type_list(max_expanded + 1), Ts...> +{ +$for(index in range(0, max_expanded))\ + T$(index) Value$(index); + static T$(index) ElementTypeI(vtkm::internal::IndexTag<$(index)>); + VTKM_EXEC_CONT vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<$(index)>) + { + return this->Value$(index); + } + VTKM_EXEC_CONT const vtkm::internal::remove_cvref& GetImpl(vtkm::internal::IndexTag<$(index)>) const + { + return this->Value$(index); + } + +$endfor\ + + // Implement the "extra" objects in a sub-Tuple + using RemainingValuesType = vtkm::Tuple; + RemainingValuesType RemainingValues; + + template + static vtkm::TupleElement + ElementTypeI(vtkm::internal::IndexTag); + + template + VTKM_EXEC_CONT const vtkm::internal::remove_cvref>& + GetImpl(vtkm::internal::IndexTag) { return vtkm::Get(this->RemainingValues); } + template + VTKM_EXEC_CONT const vtkm::internal::remove_cvref>& + GetImpl(vtkm::internal::IndexTag) const { return vtkm::Get(this->RemainingValues); } + + template + friend struct detail::TupleElementImpl; + +public: + static constexpr vtkm::IdComponent Size = + $(max_expanded + 1) + static_cast(sizeof...(Ts)); + template + using ElementType = vtkm::TupleElement>; + + Tuple() = default; + Tuple(Tuple&&) = default; + Tuple(const Tuple&) = default; + ~Tuple() = default; + Tuple& operator=(Tuple&&) = default; + Tuple& operator=(const Tuple&) = default; + + VTKM_SUPPRESS_EXEC_WARNINGS + template <$typename_list(max_expanded, 'A'), typename... As> + VTKM_EXEC_CONT Tuple($perfect_param_list(max_expanded, 'A', 'a'), As&&... remainingArgs) + : Value0(std::forward(a0)) +$for(index in range(1, max_expanded))\ + , Value$(index)(std::forward(a$(index))) +$endfor\ + , RemainingValues(std::forward(remainingArgs)...) + { + } + + template + VTKM_EXEC_CONT auto Get() -> decltype(this->GetImpl(vtkm::internal::IndexTag{})) + { + return this->GetImpl(vtkm::internal::IndexTag{}); + } + + template + VTKM_EXEC_CONT auto Get() const -> decltype(this->GetImpl(vtkm::internal::IndexTag{})) + { + return this->GetImpl(vtkm::internal::IndexTag{}); + } + + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT + auto Apply(Function&& f, Args&&... args) + -> decltype(this->RemainingValues.Apply(std::forward(f), + std::forward(args)..., +$for(index in range(0, max_expanded - 1))\ + this->Value$(index), +$endfor\ + this->Value$(max_expanded - 1))) + { + return this->RemainingValues.Apply(std::forward(f), + std::forward(args)..., +$for(index in range(0, max_expanded - 1))\ + this->Value$(index), +$endfor\ + this->Value$(max_expanded - 1)); + } + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT + auto Apply(Function&& f, Args&&... args) const + -> decltype(this->RemainingValues.Apply(std::forward(f), + std::forward(args)..., +$for(index in range(0, max_expanded - 1))\ + this->Value$(index), +$endfor\ + this->Value$(max_expanded - 1))) + { + return this->RemainingValues.Apply(std::forward(f), + std::forward(args)..., +$for(index in range(0, max_expanded - 1))\ + this->Value$(index), +$endfor\ + this->Value$(max_expanded - 1)); + } + + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT void ForEach(Function&& f) + { + detail::TupleForEach(*this, std::forward(f)); + } + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT void ForEach(Function&& f) const + { + detail::TupleForEach(*this, std::forward(f)); + } + + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT auto Transform(Function&& f) + -> decltype(detail::TupleTransform(*this, std::forward(f))) + { + return detail::TupleTransform(*this, std::forward(f)); + } + VTKM_SUPPRESS_EXEC_WARNINGS + template + VTKM_EXEC_CONT auto Transform(Function&& f) const + -> decltype(detail::TupleTransform(*this, std::forward(f))) + { + return detail::TupleTransform(*this, std::forward(f)); + } +}; + +///@} + +// clang-format on + +} // namespace vtkm + +#endif //vtk_m_Tuple_h diff --git a/vtkm/cont/ArrayHandleCompositeVector.h b/vtkm/cont/ArrayHandleCompositeVector.h index 202dcf4dd..59791d97e 100644 --- a/vtkm/cont/ArrayHandleCompositeVector.h +++ b/vtkm/cont/ArrayHandleCompositeVector.h @@ -14,12 +14,13 @@ #include #include +#include #include -#include - #include +#include + #include namespace vtkm @@ -61,278 +62,162 @@ struct AllAreArrayHandles }; // GetValueType: --------------------------------------------------------------- -// Determines the output ValueType of the objects in TupleType, a vtkmstd::tuple -// which can contain ArrayHandles, ArrayPortals...anything with a ValueType -// defined, really. For example, if the input TupleType contains 3 types with -// Float32 ValueTypes, then the ValueType defined here will be Vec. -// This also validates that all members have the same ValueType. -template -struct GetValueTypeImpl; +// Determines the output `ValueType` of the set of `ArrayHandle` objects. For example, if the input +// set contains 3 types with `vtkm::Float32` ValueTypes, then the ValueType defined here will be +// `vtkm::Vec`. This also validates that all members have the same `ValueType`. -template -struct GetValueTypeImpl> +template +constexpr bool CheckValueType() { - using Type = typename Head::ValueType; - -private: - using Next = GetValueTypeImpl>; - VTKM_STATIC_ASSERT_MSG(VTKM_PASS_COMMAS(std::is_same::value), + VTKM_STATIC_ASSERT_MSG((std::is_same::value), "ArrayHandleCompositeVector must be built from " "ArrayHandles with the same ValueTypes."); -}; + return std::is_same::value; +} -template -struct GetValueTypeImpl> -{ - using Type = typename Head::ValueType; -}; - -template +template struct GetValueType { - VTKM_STATIC_ASSERT(vtkmstd::tuple_size::value >= 1); - - static const vtkm::IdComponent COUNT = - static_cast(vtkmstd::tuple_size::value); - using ComponentType = typename GetValueTypeImpl::Type; + static constexpr vtkm::IdComponent COUNT = + static_cast(sizeof...(ArrayTypes)) + 1; + using ComponentType = typename ArrayType0::ValueType; + static constexpr std::array ValueCheck{ + { true, CheckValueType()... } + }; using ValueType = vtkm::Vec; }; -// TupleTypePrepend: ----------------------------------------------------------- -// Prepend a type to a tuple, defining the new tuple in Type. -template -struct TupleTypePrepend; - -template -struct TupleTypePrepend> +// Special case for only one component +template +struct GetValueType { - using Type = vtkmstd::tuple; + static constexpr vtkm::IdComponent COUNT = 1; + using ComponentType = typename ArrayType::ValueType; + using ValueType = typename ArrayType::ValueType; }; -// ArrayTupleForEach: ---------------------------------------------------------- -// Collection of methods that iterate through the arrays in ArrayTuple to -// implement the ArrayHandle API. -template -struct ArrayTupleForEach +// ----------------------------------------------------------------------------- +// Functors to access Storage methods. This is used with vtkm::Tuple's +// ForEach and Transform methods. + +struct WritePortal { - using Next = ArrayTupleForEach; - - template - VTKM_CONT static void GetPortalTupleControl(ArrayTuple& arrays, PortalTuple& portals) + template + typename ArrayHandle::WritePortalType operator()(const ArrayHandle& array) const { - vtkmstd::get(portals) = vtkmstd::get(arrays).WritePortal(); - Next::GetPortalTupleControl(arrays, portals); - } - - template - VTKM_CONT static void GetPortalConstTupleControl(const ArrayTuple& arrays, PortalTuple& portals) - { - vtkmstd::get(portals) = vtkmstd::get(arrays).ReadPortal(); - Next::GetPortalConstTupleControl(arrays, portals); - } - - template - VTKM_CONT static void PrepareForInput(const ArrayTuple& arrays, - PortalTuple& portals, - vtkm::cont::Token& token) - { - vtkmstd::get(portals) = vtkmstd::get(arrays).PrepareForInput(DeviceTag(), token); - Next::template PrepareForInput(arrays, portals, token); - } - - template - VTKM_CONT static void PrepareForInPlace(ArrayTuple& arrays, - PortalTuple& portals, - vtkm::cont::Token& token) - { - vtkmstd::get(portals) = - vtkmstd::get(arrays).PrepareForInPlace(DeviceTag(), token); - Next::template PrepareForInPlace(arrays, portals, token); - } - - template - VTKM_CONT static void PrepareForOutput(ArrayTuple& arrays, - PortalTuple& portals, - vtkm::Id numValues, - vtkm::cont::Token& token) - { - vtkmstd::get(portals) = - vtkmstd::get(arrays).PrepareForOutput(numValues, DeviceTag(), token); - Next::template PrepareForOutput(arrays, portals, numValues, token); - } - - VTKM_CONT - static void Allocate(ArrayTuple& arrays, vtkm::Id numValues) - { - vtkmstd::get(arrays).Allocate(numValues); - Next::Allocate(arrays, numValues); - } - - VTKM_CONT - static void Shrink(ArrayTuple& arrays, vtkm::Id numValues) - { - vtkmstd::get(arrays).Shrink(numValues); - Next::Shrink(arrays, numValues); - } - - VTKM_CONT - static void ReleaseResources(ArrayTuple& arrays) - { - vtkmstd::get(arrays).ReleaseResources(); - Next::ReleaseResources(arrays); + return array.WritePortal(); } }; -template -struct ArrayTupleForEach +struct ReadPortal { - template - VTKM_CONT static void GetPortalTupleControl(ArrayTuple&, PortalTuple&) + template + typename ArrayHandle::ReadPortalType operator()(const ArrayHandle& array) const { + return array.ReadPortal(); } - - template - VTKM_CONT static void GetPortalConstTupleControl(const ArrayTuple&, PortalTuple&) - { - } - - template - VTKM_CONT static void PrepareForInput(const ArrayTuple&, PortalTuple&, vtkm::cont::Token&) - { - } - - template - VTKM_CONT static void PrepareForInPlace(ArrayTuple&, PortalTuple&, vtkm::cont::Token&) - { - } - - template - VTKM_CONT static void PrepareForOutput(ArrayTuple&, PortalTuple&, vtkm::Id, vtkm::cont::Token&) - { - } - - VTKM_CONT static void Allocate(ArrayTuple&, vtkm::Id) {} - - VTKM_CONT static void Shrink(ArrayTuple&, vtkm::Id) {} - - VTKM_CONT static void ReleaseResources(ArrayTuple&) {} }; -// PortalTupleTraits: ---------------------------------------------------------- -// Determine types of ArrayHandleCompositeVector portals and construct the -// portals from the input arrays. -template -struct PortalTupleTypeGeneratorImpl; - -template -struct PortalTupleTypeGeneratorImpl> +struct Allocate { - using Next = PortalTupleTypeGeneratorImpl>; - using PortalControlTuple = typename TupleTypePrepend::Type; - using PortalConstControlTuple = - typename TupleTypePrepend::Type; - - template - struct ExecutionTypes + vtkm::Id NumValues; + VTKM_CONT Allocate(vtkm::Id numValues) + : NumValues(numValues) { - using PortalTuple = typename TupleTypePrepend< - typename Head::template ExecutionTypes::Portal, - typename Next::template ExecutionTypes::PortalTuple>::Type; - using PortalConstTuple = typename TupleTypePrepend< - typename Head::template ExecutionTypes::PortalConst, - typename Next::template ExecutionTypes::PortalConstTuple>::Type; - }; + } + + template + VTKM_CONT void operator()(Array& array) + { + array.Allocate(this->NumValues); + } }; -template -struct PortalTupleTypeGeneratorImpl> +struct Shrink { - using PortalControlTuple = vtkmstd::tuple; - using PortalConstControlTuple = vtkmstd::tuple; - - template - struct ExecutionTypes + vtkm::Id NumValues; + VTKM_CONT Shrink(vtkm::Id numValues) + : NumValues(numValues) { - using PortalTuple = vtkmstd::tuple::Portal>; - using PortalConstTuple = - vtkmstd::tuple::PortalConst>; - }; + } + + template + VTKM_CONT void operator()(Array& array) + { + array.Shrink(this->NumValues); + } }; -template -struct PortalTupleTraits +struct ReleaseResources { -private: - using TypeGenerator = PortalTupleTypeGeneratorImpl; - using ForEachArray = ArrayTupleForEach<0, vtkmstd::tuple_size::value, ArrayTuple>; - -public: - using PortalTuple = typename TypeGenerator::PortalControlTuple; - using PortalConstTuple = typename TypeGenerator::PortalConstControlTuple; - - VTKM_STATIC_ASSERT(vtkmstd::tuple_size::value == - vtkmstd::tuple_size::value); - VTKM_STATIC_ASSERT(vtkmstd::tuple_size::value == - vtkmstd::tuple_size::value); - - template - struct ExecutionTypes + template + VTKM_CONT void operator()(Array& array) { - using PortalTuple = typename TypeGenerator::template ExecutionTypes::PortalTuple; - using PortalConstTuple = - typename TypeGenerator::template ExecutionTypes::PortalConstTuple; + array.ReleaseResources(); + } +}; - VTKM_STATIC_ASSERT(vtkmstd::tuple_size::value == - vtkmstd::tuple_size::value); - VTKM_STATIC_ASSERT(vtkmstd::tuple_size::value == - vtkmstd::tuple_size::value); - }; +// ----------------------------------------------------------------------------- +// Functors to access ArrayTransfer methods. This is used with vtkm::Tuple's +// ForEach and Transform methods. - VTKM_CONT - static const PortalTuple GetPortalTupleControl(ArrayTuple& arrays) +template +struct PrepareForInput +{ + vtkm::cont::Token& Token; + VTKM_CONT PrepareForInput(vtkm::cont::Token& token) + : Token(token) { - PortalTuple portals; - ForEachArray::GetPortalTupleControl(arrays, portals); - return portals; } - VTKM_CONT - static const PortalConstTuple GetPortalConstTupleControl(const ArrayTuple& arrays) + template + VTKM_CONT typename Array::template ExecutionTypes::PortalConst operator()( + const Array& array) + { + return array.PrepareForInput(Device{}, this->Token); + } +}; + +template +struct PrepareForInPlace +{ + vtkm::cont::Token& Token; + VTKM_CONT PrepareForInPlace(vtkm::cont::Token& token) + : Token(token) { - PortalConstTuple portals; - ForEachArray::GetPortalConstTupleControl(arrays, portals); - return portals; } - template - VTKM_CONT static const typename ExecutionTypes::PortalConstTuple PrepareForInput( - const ArrayTuple& arrays, - vtkm::cont::Token& token) + template + VTKM_CONT typename Array::template ExecutionTypes::Portal operator()(Array& array) + { + return array.PrepareForInPlace(Device{}, this->Token); + } +}; + +template +struct PrepareForOutput +{ + vtkm::Id NumValues; + vtkm::cont::Token& Token; + VTKM_CONT PrepareForOutput(vtkm::Id numValues, vtkm::cont::Token& token) + : NumValues(numValues) + , Token(token) { - typename ExecutionTypes::PortalConstTuple portals; - ForEachArray::template PrepareForInput(arrays, portals, token); - return portals; } - template - VTKM_CONT static const typename ExecutionTypes::PortalTuple PrepareForInPlace( - ArrayTuple& arrays, - vtkm::cont::Token& token) + template + VTKM_CONT typename Array::template ExecutionTypes::Portal operator()(Array& array) { - typename ExecutionTypes::PortalTuple portals; - ForEachArray::template PrepareForInPlace(arrays, portals, token); - return portals; + return array.PrepareForOutput(this->NumValues, Device{}, this->Token); } +}; - template - VTKM_CONT static const typename ExecutionTypes::PortalTuple - PrepareForOutput(ArrayTuple& arrays, vtkm::Id numValues, vtkm::cont::Token& token) +struct ReleaseResourcesExecution +{ + template + VTKM_CONT void operator()(Array& array) { - typename ExecutionTypes::PortalTuple portals; - ForEachArray::template PrepareForOutput(arrays, portals, numValues, token); - return portals; + array.ReleaseResourcesExecution(); } }; @@ -347,7 +232,7 @@ struct ArraySizeValidatorImpl VTKM_CONT static bool Exec(const TupleType& tuple, vtkm::Id numVals) { - return vtkmstd::get(tuple).GetNumberOfValues() == numVals && Next::Exec(tuple, numVals); + return vtkm::Get(tuple).GetNumberOfValues() == numVals && Next::Exec(tuple, numVals); } }; @@ -364,113 +249,96 @@ struct ArraySizeValidator VTKM_CONT static bool Exec(const TupleType& tuple, vtkm::Id numVals) { - return ArraySizeValidatorImpl<0, vtkmstd::tuple_size::value, TupleType>::Exec( - tuple, numVals); + return ArraySizeValidatorImpl<0, vtkm::TupleSize::value, TupleType>::Exec(tuple, + numVals); } }; -template +template using AllPortalsAreWritable = - typename brigand::all, brigand::bind>::type; +// GetFromPortals: ------------------------------------------------------------- +// Given a set of array portals as arguments, returns a Vec comprising the values +// at the provided index. +VTKM_SUPPRESS_EXEC_WARNINGS +template +VTKM_EXEC_CONT typename GetValueType::ValueType GetFromPortals( + vtkm::Id index, + const Portals&... portals) +{ + return { portals.Get(index)... }; +} + +// SetToPortals: --------------------------------------------------------------- +// Given a Vec-like object, and index, and a set of array portals, sets each of +// the portals to the respective component of the Vec. +VTKM_SUPPRESS_EXEC_WARNINGS +template +VTKM_EXEC_CONT void SetToPortalsImpl(vtkm::Id index, + const ValueType& value, + vtkmstd::integer_sequence, + const Portals&... portals) +{ + using Traits = vtkm::VecTraits; + (void)std::initializer_list{ (portals.Set(index, Traits::GetComponent(value, I)), + false)... }; +} + +VTKM_SUPPRESS_EXEC_WARNINGS +template +VTKM_EXEC_CONT void SetToPortals(vtkm::Id index, const ValueType& value, const Portals&... portals) +{ + SetToPortalsImpl( + index, + value, + vtkmstd::make_integer_sequence{}, + portals...); +} + } // end namespace compvec -template +template class VTKM_ALWAYS_EXPORT ArrayPortalCompositeVector { - using Writable = compvec::AllPortalsAreWritable; + using Writable = compvec::AllPortalsAreWritable; + using TupleType = vtkm::Tuple; + TupleType Portals; public: - using ValueType = typename compvec::GetValueType::ValueType; + using ValueType = typename compvec::GetValueType::ValueType; -private: - using Traits = vtkm::VecTraits; - - // Get: ---------------------------------------------------------------------- - template - struct GetImpl; - - template - struct GetImpl> - { - using Next = GetImpl>; - - VTKM_EXEC_CONT - static void Exec(const PortalTuple& portals, ValueType& vec, vtkm::Id arrayIndex) - { - Traits::SetComponent(vec, VectorIndex, vtkmstd::get(portals).Get(arrayIndex)); - Next::Exec(portals, vec, arrayIndex); - } - }; - - template - struct GetImpl> - { - VTKM_EXEC_CONT - static void Exec(const PortalTuple& portals, ValueType& vec, vtkm::Id arrayIndex) - { - Traits::SetComponent(vec, VectorIndex, vtkmstd::get(portals).Get(arrayIndex)); - } - }; - - // Set: ---------------------------------------------------------------------- - template - struct SetImpl; - - template - struct SetImpl> - { - using Next = SetImpl>; - - VTKM_EXEC_CONT - static void Exec(const PortalTuple& portals, const ValueType& vec, vtkm::Id arrayIndex) - { - vtkmstd::get(portals).Set(arrayIndex, Traits::GetComponent(vec, VectorIndex)); - Next::Exec(portals, vec, arrayIndex); - } - }; - - template - struct SetImpl> - { - VTKM_EXEC_CONT - static void Exec(const PortalTuple& portals, const ValueType& vec, vtkm::Id arrayIndex) - { - vtkmstd::get(portals).Set(arrayIndex, Traits::GetComponent(vec, VectorIndex)); - } - }; - -public: VTKM_EXEC_CONT ArrayPortalCompositeVector() {} VTKM_CONT - ArrayPortalCompositeVector(const PortalTuple& portals) + ArrayPortalCompositeVector(const PortalTypes&... portals) + : Portals(portals...) + { + } + + VTKM_CONT + ArrayPortalCompositeVector(const TupleType& portals) : Portals(portals) { } VTKM_EXEC_CONT - vtkm::Id GetNumberOfValues() const { return vtkmstd::get<0>(this->Portals).GetNumberOfValues(); } + vtkm::Id GetNumberOfValues() const { return vtkm::Get<0>(this->Portals).GetNumberOfValues(); } VTKM_EXEC_CONT ValueType Get(vtkm::Id index) const { - ValueType result; - GetImpl<0, PortalTuple>::Exec(this->Portals, result, index); - return result; + return this->Portals.Apply(compvec::GetFromPortals, index); } template ::type> VTKM_EXEC_CONT void Set(vtkm::Id index, const ValueType& value) const { - SetImpl<0, PortalTuple>::Exec(this->Portals, value, index); + this->Portals.Apply(compvec::SetToPortals, index, value); } - -private: - PortalTuple Portals; }; } // namespace internal @@ -483,12 +351,6 @@ struct VTKM_ALWAYS_EXPORT StorageTagCompositeVec namespace internal { -template -struct VTKM_ALWAYS_EXPORT VTKM_DEPRECATED(1.6, "Use StorageTagCompositeVec instead.") - StorageTagCompositeVector -{ -}; - template struct CompositeVectorTraits { @@ -499,38 +361,27 @@ struct CompositeVectorTraits "Template parameters for ArrayHandleCompositeVector " "must be a list of ArrayHandle types."); - using ValueType = typename compvec::GetValueType>::ValueType; + using ValueType = typename compvec::GetValueType::ValueType; using StorageTag = vtkm::cont::StorageTagCompositeVec; using StorageType = Storage; using Superclass = ArrayHandle; }; -VTKM_DEPRECATED_SUPPRESS_BEGIN -template -class Storage>::ValueType, - StorageTagCompositeVector>> - : CompositeVectorTraits::StorageType -{ - using Superclass = typename CompositeVectorTraits::StorageType; - using Superclass::Superclass; -}; -VTKM_DEPRECATED_SUPPRESS_END - template class Storage(sizeof...(StorageTags))>, vtkm::cont::StorageTagCompositeVec> { - using ArrayTuple = vtkmstd::tuple...>; - using ForEachArray = - compvec::ArrayTupleForEach<0, vtkmstd::tuple_size::value, ArrayTuple>; - using PortalTypes = compvec::PortalTupleTraits; - using PortalTupleType = typename PortalTypes::PortalTuple; - using PortalConstTupleType = typename PortalTypes::PortalConstTuple; + using ArrayTuple = vtkm::Tuple...>; + + ArrayTuple Arrays; + bool Valid; public: - using ValueType = typename compvec::GetValueType::ValueType; - using PortalType = ArrayPortalCompositeVector; - using PortalConstType = ArrayPortalCompositeVector; + using ValueType = vtkm::Vec(sizeof...(StorageTags))>; + using PortalType = ArrayPortalCompositeVector< + typename vtkm::cont::ArrayHandle::WritePortalType...>; + using PortalConstType = + ArrayPortalCompositeVector::ReadPortalType...>; VTKM_CONT Storage() @@ -538,18 +389,6 @@ public: { } - VTKM_CONT - Storage(const ArrayTuple& arrays) - : Arrays(arrays) - , Valid(true) - { - using SizeValidator = compvec::ArraySizeValidator; - if (!SizeValidator::Exec(this->Arrays, this->GetNumberOfValues())) - { - throw ErrorBadValue("All arrays must have the same number of values."); - } - } - template VTKM_CONT Storage(const ArrayTypes&... arrays) : Arrays(arrays...) @@ -566,42 +405,44 @@ public: PortalType GetPortal() { VTKM_ASSERT(this->Valid); - return PortalType(PortalTypes::GetPortalTupleControl(this->Arrays)); + return this->Arrays.Transform(compvec::WritePortal{}); } + void TypeCheck(int) const; VTKM_CONT PortalConstType GetPortalConst() const { VTKM_ASSERT(this->Valid); - return PortalConstType(PortalTypes::GetPortalConstTupleControl(this->Arrays)); + this->Arrays.Transform(compvec::ReadPortal{}); + return this->Arrays.Transform(compvec::ReadPortal{}); } VTKM_CONT vtkm::Id GetNumberOfValues() const { VTKM_ASSERT(this->Valid); - return vtkmstd::get<0>(this->Arrays).GetNumberOfValues(); + return vtkm::Get<0>(this->Arrays).GetNumberOfValues(); } VTKM_CONT void Allocate(vtkm::Id numValues) { VTKM_ASSERT(this->Valid); - ForEachArray::Allocate(this->Arrays, numValues); + this->Arrays.ForEach(compvec::Allocate{ numValues }); } VTKM_CONT void Shrink(vtkm::Id numValues) { VTKM_ASSERT(this->Valid); - ForEachArray::Shrink(this->Arrays, numValues); + this->Arrays.ForEach(compvec::Shrink{ numValues }); } VTKM_CONT void ReleaseResources() { VTKM_ASSERT(this->Valid); - ForEachArray::ReleaseResources(this->Arrays); + this->Arrays.ForEach(compvec::ReleaseResources{}); } VTKM_CONT @@ -617,28 +458,25 @@ public: VTKM_ASSERT(this->Valid); return this->Arrays; } - -private: - ArrayTuple Arrays; - bool Valid; }; -VTKM_DEPRECATED_SUPPRESS_BEGIN -template -struct ArrayTransfer>::ValueType, - StorageTagCompositeVector>, - DeviceTag> - : ArrayTransfer>::ValueType, - typename CompositeVectorTraits::StorageType, - DeviceTag> +// Special case for single component. Just defer to the original storage. +template +class Storage> : public Storage { - using Superclass = - ArrayTransfer>::ValueType, - typename CompositeVectorTraits::StorageType, - DeviceTag>; - using Superclass::Superclass; + using ArrayType = vtkm::cont::ArrayHandle; + using TupleType = vtkm::Tuple; + +public: + Storage() = default; + Storage(const ArrayType& array) + : Storage(array.GetStorage()) + { + } + + VTKM_CONT + const TupleType GetArrayTuple() const { return TupleType(ArrayType(this->GetStoragea())); } }; -VTKM_DEPRECATED_SUPPRESS_END template class ArrayTransfer(sizeof...(StorageTags))>, @@ -647,26 +485,27 @@ class ArrayTransfer(sizeof...(Storag { VTKM_IS_DEVICE_ADAPTER_TAG(DeviceTag); - using ArrayTuple = vtkmstd::tuple...>; + using ArrayTuple = vtkm::Tuple...>; public: - using ValueType = typename compvec::GetValueType::ValueType; + using ValueType = vtkm::Vec(sizeof...(StorageTags))>; private: - using ForEachArray = - compvec::ArrayTupleForEach<0, vtkmstd::tuple_size::value, ArrayTuple>; using StorageTag = vtkm::cont::StorageTagCompositeVec; using StorageType = internal::Storage; - using ControlTraits = compvec::PortalTupleTraits; - using ExecutionTraits = typename ControlTraits::template ExecutionTypes; + + StorageType* Storage; public: - using PortalControl = ArrayPortalCompositeVector; - using PortalConstControl = ArrayPortalCompositeVector; + using PortalControl = typename StorageType::PortalType; + using PortalConstControl = typename StorageType::PortalConstType; - using PortalExecution = ArrayPortalCompositeVector; + using PortalExecution = ArrayPortalCompositeVector< + typename vtkm::cont::ArrayHandle::template ExecutionTypes::Portal...>; using PortalConstExecution = - ArrayPortalCompositeVector; + ArrayPortalCompositeVector:: + template ExecutionTypes::PortalConst...>; VTKM_CONT ArrayTransfer(StorageType* storage) @@ -680,22 +519,20 @@ public: VTKM_CONT PortalConstExecution PrepareForInput(bool vtkmNotUsed(updateData), vtkm::cont::Token& token) const { - return PortalConstExecution( - ControlTraits::template PrepareForInput(this->GetArrayTuple(), token)); + return this->GetArrayTuple().Transform(compvec::PrepareForInput{ token }); } VTKM_CONT PortalExecution PrepareForInPlace(bool vtkmNotUsed(updateData), vtkm::cont::Token& token) { - return PortalExecution( - ControlTraits::template PrepareForInPlace(this->GetArrayTuple(), token)); + return this->GetArrayTuple().Transform(compvec::PrepareForInPlace{ token }); } VTKM_CONT PortalExecution PrepareForOutput(vtkm::Id numValues, vtkm::cont::Token& token) { - return PortalExecution( - ControlTraits::template PrepareForOutput(this->GetArrayTuple(), numValues, token)); + return this->GetArrayTuple().Transform( + compvec::PrepareForOutput{ numValues, token }); } VTKM_CONT @@ -707,17 +544,14 @@ public: } VTKM_CONT - void Shrink(vtkm::Id numValues) { ForEachArray::Shrink(this->GetArrayTuple(), numValues); } + void Shrink(vtkm::Id numValues) { this->GetArrayTuple().ForEach(compvec::Shrink{ numValues }); } VTKM_CONT - void ReleaseResources() { ForEachArray::ReleaseResources(this->GetArrayTuple()); } + void ReleaseResources() { this->GetArrayTuple().ForEach(compvec::ReleaseResourcesExecution{}); } VTKM_CONT const ArrayTuple& GetArrayTuple() const { return this->Storage->GetArrayTuple(); } ArrayTuple& GetArrayTuple() { return this->Storage->GetArrayTuple(); } - -private: - StorageType* Storage; }; } // namespace internal @@ -742,7 +576,7 @@ class ArrayHandleCompositeVector { private: using Traits = internal::CompositeVectorTraits; - using TupleType = vtkmstd::tuple; + using TupleType = vtkm::Tuple; using StorageType = typename Traits::StorageType; public: @@ -798,59 +632,12 @@ struct SerializableTypeString< vtkm::cont::ArrayHandleCompositeVector...>> { }; - -VTKM_DEPRECATED_SUPPRESS_BEGIN -template -struct SerializableTypeString>::ValueType, - vtkm::cont::internal::StorageTagCompositeVector>>> - : SerializableTypeString> -{ -}; -VTKM_DEPRECATED_SUPPRESS_END } } // vtkm::cont namespace mangled_diy_namespace { -namespace internal -{ - -template -inline void TupleForEachImpl(TupleType&& t, - std::integral_constant, - Functor&& f, - Args&&... args) -{ - f(vtkmstd::get<0>(t), std::forward(args)...); -} - -template -inline void TupleForEachImpl(TupleType&& t, - std::integral_constant, - Functor&& f, - Args&&... args) -{ - TupleForEachImpl(std::forward(t), - std::integral_constant{}, - std::forward(f), - std::forward(args)...); - f(vtkmstd::get(t), std::forward(args)...); -} - -template -inline void TupleForEach(TupleType&& t, Functor&& f, Args&&... args) -{ - constexpr auto size = vtkmstd::tuple_size::type>::value; - - TupleForEachImpl(std::forward(t), - std::integral_constant{}, - std::forward(f), - std::forward(args)...); -} -} // internal - template struct Serialization> { @@ -860,33 +647,47 @@ private: struct SaveFunctor { - template - void operator()(const AH& ah, BinaryBuffer& bb) const + BinaryBuffer& Buffer; + SaveFunctor(BinaryBuffer& bb) + : Buffer(bb) { - vtkmdiy::save(bb, ah); + } + + template + void operator()(const AH& ah) const + { + vtkmdiy::save(this->Buffer, ah); } }; struct LoadFunctor { - template - void operator()(AH& ah, BinaryBuffer& bb) const + BinaryBuffer& Buffer; + LoadFunctor(BinaryBuffer& bb) + : Buffer(bb) { - vtkmdiy::load(bb, ah); + } + + template + void operator()(AH& ah) const + { + vtkmdiy::load(this->Buffer, ah); } }; + static BaseType Create(const AHs&... arrays) { return Type(arrays...); } + public: static VTKM_CONT void save(BinaryBuffer& bb, const BaseType& obj) { - internal::TupleForEach(obj.GetStorage().GetArrayTuple(), SaveFunctor{}, bb); + obj.GetStorage().GetArrayTuple().ForEach(SaveFunctor{ bb }); } static VTKM_CONT void load(BinaryBuffer& bb, BaseType& obj) { - vtkmstd::tuple arrayTuple; - internal::TupleForEach(arrayTuple, LoadFunctor{}, bb); - obj = BaseType(typename BaseType::StorageType(arrayTuple)); + vtkm::Tuple tuple; + tuple.ForEach(LoadFunctor{ bb }); + obj = tuple.Apply(Create); } }; @@ -897,16 +698,6 @@ struct Serialization< : Serialization...>> { }; - -VTKM_DEPRECATED_SUPPRESS_BEGIN -template -struct Serialization>::ValueType, - vtkm::cont::internal::StorageTagCompositeVector>>> - : Serialization> -{ -}; -VTKM_DEPRECATED_SUPPRESS_END } // diy /// @endcond SERIALIZATION diff --git a/vtkm/cont/ArrayHandleDecorator.h b/vtkm/cont/ArrayHandleDecorator.h index 4c8c3775f..9eafb1aa4 100644 --- a/vtkm/cont/ArrayHandleDecorator.h +++ b/vtkm/cont/ArrayHandleDecorator.h @@ -15,29 +15,18 @@ #include #include +#include #include #include #include -#include -#include +#include #include #include -// Some compilers like brigand's integer sequences. -// Some compilers prefer tao's. -// Brigand seems to have more support, so we'll use that as default and fallback -// to tao when brigand fails. With C++14, we'll be able to just use the STL. -#if !defined(VTKM_CUDA_DEVICE_PASS) && \ - (defined(VTKM_GCC) || \ - (defined(__apple_build_version__) && (__apple_build_version__ >= 10000000)) || \ - (defined(VTKM_CLANG) && (__clang_major__ >= 5))) -#define VTKM_USE_TAO_SEQ -#endif - namespace vtkm { namespace cont @@ -407,14 +396,10 @@ struct DecoratorStorageTraits "ArrayHandleDecorator must be a list of ArrayHandle " "types."); - using ArrayTupleType = vtkmstd::tuple; + using ArrayTupleType = vtkm::Tuple; -// size_t integral constants that index ArrayTs: -#ifndef VTKM_USE_TAO_SEQ - using IndexList = brigand::make_sequence, sizeof...(ArrayTs)>; -#else // VTKM_USE_TAO_SEQ - using IndexList = tao::seq::make_index_sequence; -#endif // VTKM_USE_TAO_SEQ + // size_t integral constants that index ArrayTs: + using IndexList = vtkmstd::make_index_sequence; // true_type/false_type depending on whether the decorator supports Allocate/Shrink: using IsAllocatable = IsDecoratorAllocatable; @@ -532,186 +517,83 @@ struct DecoratorStorageTraits } -#ifndef VTKM_USE_TAO_SEQ // Portal construction methods. These actually create portals. - template