From c029ac113d5ecb0d631ef9ffa34a593a27135637 Mon Sep 17 00:00:00 2001 From: Kenneth Moreland Date: Tue, 1 Nov 2022 07:52:41 -0600 Subject: [PATCH] Expose the Variant helper class For several versions, VTK-m has had a `Variant` templated class. This acts like a templated union where the object will store one of a list of types specified as the template arguments. (There are actually 2 versions for the control and execution environments, respectively.) Because this is a complex class that required several iterations to work through performance and compiler issues, `Variant` was placed in the `internal` namespace to avoid complications with backward compatibility. However, the class has been stable for a while, so let us expose this helpful tool for wider use. --- docs/changelog/expose-variant.md | 12 + vtkm/ImplicitFunction.h | 4 +- vtkm/cont/ArrayHandleMultiplexer.h | 10 +- vtkm/cont/CMakeLists.txt | 1 + vtkm/cont/CellLocatorGeneral.h | 4 +- vtkm/cont/{internal => }/Variant.h | 0 vtkm/cont/internal/CMakeLists.txt | 1 - vtkm/exec/CMakeLists.txt | 1 + vtkm/exec/CellLocatorMultiplexer.h | 6 +- vtkm/exec/{internal => }/Variant.h | 0 vtkm/exec/internal/CMakeLists.txt | 1 - vtkm/exec/testing/UnitTestVariant.cxx | 258 +++++++++--------- .../NewFilterParticleAdvectionSteadyState.cxx | 6 +- vtkm/filter/flow/internal/DataSetIntegrator.h | 21 +- vtkm/internal/VariantImpl.h | 23 +- vtkm/internal/VariantImplDetail.h | 5 +- vtkm/internal/VariantImplDetail.h.in | 5 +- vtkm/rendering/raytracing/MeshConnectivity.h | 4 +- 18 files changed, 178 insertions(+), 184 deletions(-) create mode 100644 docs/changelog/expose-variant.md rename vtkm/cont/{internal => }/Variant.h (100%) rename vtkm/exec/{internal => }/Variant.h (100%) diff --git a/docs/changelog/expose-variant.md b/docs/changelog/expose-variant.md new file mode 100644 index 000000000..8e7358a79 --- /dev/null +++ b/docs/changelog/expose-variant.md @@ -0,0 +1,12 @@ +# Expose the Variant helper class + +For several versions, VTK-m has had a `Variant` templated class. This acts +like a templated union where the object will store one of a list of types +specified as the template arguments. (There are actually 2 versions for the +control and execution environments, respectively.) + +Because this is a complex class that required several iterations to work +through performance and compiler issues, `Variant` was placed in the +`internal` namespace to avoid complications with backward compatibility. +However, the class has been stable for a while, so let us expose this +helpful tool for wider use. diff --git a/vtkm/ImplicitFunction.h b/vtkm/ImplicitFunction.h index 364efcbab..a5810af25 100644 --- a/vtkm/ImplicitFunction.h +++ b/vtkm/ImplicitFunction.h @@ -15,7 +15,7 @@ #include #include -#include +#include // For interface class only. #include @@ -729,7 +729,7 @@ class ImplicitFunctionMultiplexer : public vtkm::internal::ImplicitFunctionBase< ImplicitFunctionMultiplexer> { - vtkm::exec::internal::Variant Variant; + vtkm::exec::Variant Variant; using Superclass = vtkm::internal::ImplicitFunctionBase>; diff --git a/vtkm/cont/ArrayHandleMultiplexer.h b/vtkm/cont/ArrayHandleMultiplexer.h index 1819c1d7c..c46795eca 100644 --- a/vtkm/cont/ArrayHandleMultiplexer.h +++ b/vtkm/cont/ArrayHandleMultiplexer.h @@ -19,8 +19,8 @@ #include #include -#include -#include +#include +#include namespace vtkm { @@ -90,7 +90,7 @@ private: template struct ArrayPortalMultiplexer { - using PortalVariantType = vtkm::exec::internal::Variant; + using PortalVariantType = vtkm::exec::Variant; PortalVariantType PortalVariant; using ValueType = typename PortalVariantType::template TypeAt<0>::ValueType; @@ -214,7 +214,7 @@ struct MultiplexerCreateWritePortalFunctor template struct MultiplexerArrayHandleVariantFunctor { - using VariantType = vtkm::cont::internal::Variant...>; + using VariantType = vtkm::cont::Variant...>; template VTKM_CONT VariantType operator()(vtkm::cont::internal::Storage, @@ -232,7 +232,7 @@ class Storage> template using StorageFor = vtkm::cont::internal::Storage; - using StorageVariant = vtkm::cont::internal::Variant...>; + using StorageVariant = vtkm::cont::Variant...>; VTKM_CONT static StorageVariant Variant(const std::vector& buffers) { diff --git a/vtkm/cont/CMakeLists.txt b/vtkm/cont/CMakeLists.txt index 485c8ae2e..9146798a5 100644 --- a/vtkm/cont/CMakeLists.txt +++ b/vtkm/cont/CMakeLists.txt @@ -125,6 +125,7 @@ set(headers UncertainCellSet.h UnknownArrayHandle.h UnknownCellSet.h + Variant.h VariantArrayHandle.h # Deprecated, replaces with Unknown/UncertainArrayHandle.h ) diff --git a/vtkm/cont/CellLocatorGeneral.h b/vtkm/cont/CellLocatorGeneral.h index cf4461478..85b4d63f6 100644 --- a/vtkm/cont/CellLocatorGeneral.h +++ b/vtkm/cont/CellLocatorGeneral.h @@ -16,7 +16,7 @@ #include -#include +#include #include #include @@ -60,7 +60,7 @@ public: vtkm::cont::Token& token) const; private: - vtkm::cont::internal::ListAsVariant LocatorImpl; + vtkm::cont::ListAsVariant LocatorImpl; friend Superclass; VTKM_CONT void Build(); diff --git a/vtkm/cont/internal/Variant.h b/vtkm/cont/Variant.h similarity index 100% rename from vtkm/cont/internal/Variant.h rename to vtkm/cont/Variant.h diff --git a/vtkm/cont/internal/CMakeLists.txt b/vtkm/cont/internal/CMakeLists.txt index 0e36b0e76..0b4cf6f55 100644 --- a/vtkm/cont/internal/CMakeLists.txt +++ b/vtkm/cont/internal/CMakeLists.txt @@ -41,7 +41,6 @@ set(headers RuntimeDeviceOption.h StorageDeprecated.h StorageError.h - Variant.h ) vtkm_declare_headers(${headers}) diff --git a/vtkm/exec/CMakeLists.txt b/vtkm/exec/CMakeLists.txt index 7c91b070f..7a3bdadfe 100644 --- a/vtkm/exec/CMakeLists.txt +++ b/vtkm/exec/CMakeLists.txt @@ -32,6 +32,7 @@ set(headers ParametricCoordinates.h PointLocatorSparseGrid.h TaskBase.h + Variant.h ) set(header_impls diff --git a/vtkm/exec/CellLocatorMultiplexer.h b/vtkm/exec/CellLocatorMultiplexer.h index 619ae0a9c..3192b3a7f 100644 --- a/vtkm/exec/CellLocatorMultiplexer.h +++ b/vtkm/exec/CellLocatorMultiplexer.h @@ -13,7 +13,7 @@ #include #include -#include +#include namespace vtkm { @@ -55,12 +55,12 @@ struct FindCellFunctor template class VTKM_ALWAYS_EXPORT CellLocatorMultiplexer { - vtkm::exec::internal::Variant Locators; + vtkm::exec::Variant Locators; public: CellLocatorMultiplexer() = default; - using LastCell = vtkm::exec::internal::Variant; + using LastCell = vtkm::exec::Variant; template VTKM_CONT CellLocatorMultiplexer(const Locator& locator) diff --git a/vtkm/exec/internal/Variant.h b/vtkm/exec/Variant.h similarity index 100% rename from vtkm/exec/internal/Variant.h rename to vtkm/exec/Variant.h diff --git a/vtkm/exec/internal/CMakeLists.txt b/vtkm/exec/internal/CMakeLists.txt index 591325e60..dcc478a97 100644 --- a/vtkm/exec/internal/CMakeLists.txt +++ b/vtkm/exec/internal/CMakeLists.txt @@ -14,7 +14,6 @@ set(headers ReduceByKeyLookup.h TaskSingular.h TwoLevelUniformGridExecutionObject.h - Variant.h WorkletInvokeFunctorDetail.h ) diff --git a/vtkm/exec/testing/UnitTestVariant.cxx b/vtkm/exec/testing/UnitTestVariant.cxx index 5fbc9d6c5..e7168cb94 100644 --- a/vtkm/exec/testing/UnitTestVariant.cxx +++ b/vtkm/exec/testing/UnitTestVariant.cxx @@ -8,7 +8,7 @@ // PURPOSE. See the above copyright notice for more information. //============================================================================ -#include +#include #include @@ -93,7 +93,7 @@ void TestSize() { std::cout << "Test size" << std::endl; - using VariantType = vtkm::exec::internal::Variant; + using VariantType = vtkm::exec::Variant; constexpr size_t variantSize = sizeof(VariantType); @@ -106,36 +106,36 @@ void TestIndexing() { std::cout << "Test indexing" << std::endl; - using VariantType = vtkm::exec::internal::Variant, - TypePlaceholder<1>, - TypePlaceholder<2>, - TypePlaceholder<3>, - TypePlaceholder<4>, - TypePlaceholder<5>, - TypePlaceholder<6>, - TypePlaceholder<7>, - TypePlaceholder<8>, - TypePlaceholder<9>, - TypePlaceholder<10>, - TypePlaceholder<11>, - TypePlaceholder<12>, - TypePlaceholder<13>, - TypePlaceholder<14>, - TypePlaceholder<15>, - TypePlaceholder<16>, - TypePlaceholder<17>, - TypePlaceholder<18>, - TypePlaceholder<19>, - TypePlaceholder<20>, - TypePlaceholder<21>, - TypePlaceholder<22>, - TypePlaceholder<23>, - TypePlaceholder<24>, - TypePlaceholder<25>, - TypePlaceholder<26>, - TypePlaceholder<27>, - TypePlaceholder<28>, - TypePlaceholder<29>>; + using VariantType = vtkm::exec::Variant, + TypePlaceholder<1>, + TypePlaceholder<2>, + TypePlaceholder<3>, + TypePlaceholder<4>, + TypePlaceholder<5>, + TypePlaceholder<6>, + TypePlaceholder<7>, + TypePlaceholder<8>, + TypePlaceholder<9>, + TypePlaceholder<10>, + TypePlaceholder<11>, + TypePlaceholder<12>, + TypePlaceholder<13>, + TypePlaceholder<14>, + TypePlaceholder<15>, + TypePlaceholder<16>, + TypePlaceholder<17>, + TypePlaceholder<18>, + TypePlaceholder<19>, + TypePlaceholder<20>, + TypePlaceholder<21>, + TypePlaceholder<22>, + TypePlaceholder<23>, + TypePlaceholder<24>, + TypePlaceholder<25>, + TypePlaceholder<26>, + TypePlaceholder<27>, + TypePlaceholder<28>, + TypePlaceholder<29>>; VariantType variant; @@ -256,51 +256,48 @@ void TestTriviallyCopyable() VTKM_STATIC_ASSERT(!vtkmstd::is_trivial::value); // A variant of trivially constructable things should be trivially constructable - VTKM_STATIC_ASSERT((vtkmstd::is_trivially_constructible< - vtkm::exec::internal::detail::VariantUnion>::value)); VTKM_STATIC_ASSERT( - (vtkmstd::is_trivially_constructible>::value)); + (vtkmstd::is_trivially_constructible>::value)); + VTKM_STATIC_ASSERT((vtkmstd::is_trivially_constructible>::value)); // A variant of trivially copyable things should be trivially copyable VTKM_STATIC_ASSERT((vtkmstd::is_trivially_copyable< - vtkm::exec::internal::detail::VariantUnion>::value)); - VTKM_STATIC_ASSERT(( - vtkmstd::is_trivially_copyable>::value)); + vtkm::exec::detail::VariantUnion>::value)); + VTKM_STATIC_ASSERT( + (vtkmstd::is_trivially_copyable>::value)); // A variant of any non-trivially constructable things is not trivially copyable VTKM_STATIC_ASSERT((!vtkmstd::is_trivially_constructible< - vtkm::exec::internal::detail::VariantUnion>::value)); + vtkm::exec::detail::VariantUnion>::value)); VTKM_STATIC_ASSERT((!vtkmstd::is_trivially_constructible< - vtkm::exec::internal::detail::VariantUnion>::value)); + vtkm::exec::detail::VariantUnion>::value)); VTKM_STATIC_ASSERT((!vtkmstd::is_trivially_constructible< - vtkm::exec::internal::detail::VariantUnion>::value)); - VTKM_STATIC_ASSERT((!vtkmstd::is_trivially_constructible< - vtkm::exec::internal::Variant>::value)); - VTKM_STATIC_ASSERT((!vtkmstd::is_trivially_constructible< - vtkm::exec::internal::Variant>::value)); - VTKM_STATIC_ASSERT((!vtkmstd::is_trivially_constructible< - vtkm::exec::internal::Variant>::value)); + vtkm::exec::detail::VariantUnion>::value)); + VTKM_STATIC_ASSERT( + (!vtkmstd::is_trivially_constructible>::value)); + VTKM_STATIC_ASSERT( + (!vtkmstd::is_trivially_constructible>::value)); + VTKM_STATIC_ASSERT( + (!vtkmstd::is_trivially_constructible>::value)); // A variant of any non-trivially copyable things is not trivially copyable VTKM_STATIC_ASSERT((!vtkmstd::is_trivially_copyable< - vtkm::exec::internal::detail::VariantUnion>::value)); + vtkm::exec::detail::VariantUnion>::value)); VTKM_STATIC_ASSERT((!vtkmstd::is_trivially_copyable< - vtkm::exec::internal::detail::VariantUnion>::value)); + vtkm::exec::detail::VariantUnion>::value)); VTKM_STATIC_ASSERT((!vtkmstd::is_trivially_copyable< - vtkm::exec::internal::detail::VariantUnion>::value)); - VTKM_STATIC_ASSERT(( - !vtkmstd::is_trivially_copyable>::value)); - VTKM_STATIC_ASSERT(( - !vtkmstd::is_trivially_copyable>::value)); - VTKM_STATIC_ASSERT(( - !vtkmstd::is_trivially_copyable>::value)); + vtkm::exec::detail::VariantUnion>::value)); + VTKM_STATIC_ASSERT( + (!vtkmstd::is_trivially_copyable>::value)); + VTKM_STATIC_ASSERT( + (!vtkmstd::is_trivially_copyable>::value)); + VTKM_STATIC_ASSERT( + (!vtkmstd::is_trivially_copyable>::value)); // A variant of trivial things should be trivial - VTKM_STATIC_ASSERT((vtkmstd::is_trivial>::value)); - VTKM_STATIC_ASSERT( - (!vtkmstd::is_trivial>::value)); - VTKM_STATIC_ASSERT( - (!vtkmstd::is_trivial>::value)); + VTKM_STATIC_ASSERT((vtkmstd::is_trivial>::value)); + VTKM_STATIC_ASSERT((!vtkmstd::is_trivial>::value)); + VTKM_STATIC_ASSERT((!vtkmstd::is_trivial>::value)); #endif // VTKM_USE_STD_IS_TRIVIAL } @@ -329,36 +326,36 @@ void TestGet() { std::cout << "Test Get" << std::endl; - using VariantType = vtkm::exec::internal::Variant, - TypePlaceholder<1>, - vtkm::Id, - TypePlaceholder<3>, - TypePlaceholder<4>, - TypePlaceholder<5>, - TypePlaceholder<6>, - TypePlaceholder<7>, - TypePlaceholder<8>, - TypePlaceholder<9>, - TypePlaceholder<10>, - TypePlaceholder<11>, - TypePlaceholder<12>, - TypePlaceholder<13>, - TypePlaceholder<14>, - TypePlaceholder<15>, - TypePlaceholder<16>, - TypePlaceholder<17>, - TypePlaceholder<18>, - TypePlaceholder<19>, - TypePlaceholder<20>, - TypePlaceholder<21>, - TypePlaceholder<22>, - TypePlaceholder<23>, - TypePlaceholder<24>, - TypePlaceholder<25>, - TypePlaceholder<26>, - vtkm::Float32, - TypePlaceholder<28>, - TypePlaceholder<29>>; + using VariantType = vtkm::exec::Variant, + TypePlaceholder<1>, + vtkm::Id, + TypePlaceholder<3>, + TypePlaceholder<4>, + TypePlaceholder<5>, + TypePlaceholder<6>, + TypePlaceholder<7>, + TypePlaceholder<8>, + TypePlaceholder<9>, + TypePlaceholder<10>, + TypePlaceholder<11>, + TypePlaceholder<12>, + TypePlaceholder<13>, + TypePlaceholder<14>, + TypePlaceholder<15>, + TypePlaceholder<16>, + TypePlaceholder<17>, + TypePlaceholder<18>, + TypePlaceholder<19>, + TypePlaceholder<20>, + TypePlaceholder<21>, + TypePlaceholder<22>, + TypePlaceholder<23>, + TypePlaceholder<24>, + TypePlaceholder<25>, + TypePlaceholder<26>, + vtkm::Float32, + TypePlaceholder<28>, + TypePlaceholder<29>>; { const vtkm::Id expectedValue = TestValue(3, vtkm::Id{}); @@ -392,36 +389,36 @@ void TestCastAndCall() { std::cout << "Test CastAndCall" << std::endl; - using VariantType = vtkm::exec::internal::Variant, - TypePlaceholder<1>, - TypePlaceholder<2>, - TypePlaceholder<3>, - TypePlaceholder<4>, - TypePlaceholder<5>, - TypePlaceholder<6>, - TypePlaceholder<7>, - TypePlaceholder<8>, - TypePlaceholder<9>, - TypePlaceholder<10>, - TypePlaceholder<11>, - TypePlaceholder<12>, - TypePlaceholder<13>, - TypePlaceholder<14>, - TypePlaceholder<15>, - TypePlaceholder<16>, - TypePlaceholder<17>, - TypePlaceholder<18>, - TypePlaceholder<19>, - TypePlaceholder<20>, - TypePlaceholder<21>, - TypePlaceholder<22>, - TypePlaceholder<23>, - TypePlaceholder<24>, - TypePlaceholder<25>, - TypePlaceholder<26>, - TypePlaceholder<27>, - TypePlaceholder<28>, - TypePlaceholder<29>>; + using VariantType = vtkm::exec::Variant, + TypePlaceholder<1>, + TypePlaceholder<2>, + TypePlaceholder<3>, + TypePlaceholder<4>, + TypePlaceholder<5>, + TypePlaceholder<6>, + TypePlaceholder<7>, + TypePlaceholder<8>, + TypePlaceholder<9>, + TypePlaceholder<10>, + TypePlaceholder<11>, + TypePlaceholder<12>, + TypePlaceholder<13>, + TypePlaceholder<14>, + TypePlaceholder<15>, + TypePlaceholder<16>, + TypePlaceholder<17>, + TypePlaceholder<18>, + TypePlaceholder<19>, + TypePlaceholder<20>, + TypePlaceholder<21>, + TypePlaceholder<22>, + TypePlaceholder<23>, + TypePlaceholder<24>, + TypePlaceholder<25>, + TypePlaceholder<26>, + TypePlaceholder<27>, + TypePlaceholder<28>, + TypePlaceholder<29>>; vtkm::FloatDefault result; VariantType variant0{ TypePlaceholder<0>{} }; @@ -454,7 +451,7 @@ void TestCopyInvalid() { std::cout << "Test copy invalid variant" << std::endl; - using VariantType = vtkm::exec::internal::Variant, NonTrivial>; + using VariantType = vtkm::exec::Variant, NonTrivial>; VariantType source; source.Reset(); @@ -488,11 +485,11 @@ void TestCopyDestroy() { std::cout << "Test copy destroy" << std::endl; - using VariantType = vtkm::exec::internal::Variant, - TypePlaceholder<1>, - CountConstructDestruct, - TypePlaceholder<3>, - TypePlaceholder<4>>; + using VariantType = vtkm::exec::Variant, + TypePlaceholder<1>, + CountConstructDestruct, + TypePlaceholder<3>, + TypePlaceholder<4>>; #ifdef VTKM_USE_STD_IS_TRIVIAL VTKM_STATIC_ASSERT(!vtkmstd::is_trivially_copyable::value); #endif // VTKM_USE_STD_IS_TRIVIAL @@ -545,7 +542,7 @@ void TestEmplace() { std::cout << "Test Emplace" << std::endl; - using VariantType = vtkm::exec::internal::Variant>; + using VariantType = vtkm::exec::Variant>; VariantType variant; variant.Emplace(TestValue(0, vtkm::Id{})); @@ -577,7 +574,7 @@ void TestConstructDestruct() g_NonTrivialCount = 0; - using VariantType = vtkm::exec::internal::Variant; + using VariantType = vtkm::exec::Variant; { VariantType variant1 = NonTrivial{}; @@ -597,8 +594,7 @@ void TestCopySelf() { std::cout << "Make sure copying a Variant to itself works" << std::endl; - using VariantType = - vtkm::exec::internal::Variant, NonTrivial, TypePlaceholder<2>>; + using VariantType = vtkm::exec::Variant, NonTrivial, TypePlaceholder<2>>; VariantType variant{ NonTrivial{} }; VariantType& variantRef = variant; diff --git a/vtkm/filter/flow/NewFilterParticleAdvectionSteadyState.cxx b/vtkm/filter/flow/NewFilterParticleAdvectionSteadyState.cxx index 70c6c27e9..46c91663a 100644 --- a/vtkm/filter/flow/NewFilterParticleAdvectionSteadyState.cxx +++ b/vtkm/filter/flow/NewFilterParticleAdvectionSteadyState.cxx @@ -26,8 +26,7 @@ namespace VTKM_CONT std::vector CreateDataSetIntegrators( const vtkm::cont::PartitionedDataSet& input, - const vtkm::cont::internal::Variant>& - activeField, + const vtkm::cont::Variant>& activeField, const vtkm::filter::flow::internal::BoundsMap& boundsMap, const vtkm::filter::flow::IntegrationSolverType solverType, const vtkm::filter::flow::VectorFieldType vecFieldType, @@ -69,8 +68,7 @@ VTKM_CONT vtkm::cont::PartitionedDataSet NewFilterParticleAdvectionSteadyState:: using DSIType = vtkm::filter::flow::internal::DataSetIntegratorSteadyState; this->ValidateOptions(); - using VariantType = - vtkm::cont::internal::Variant>; + using VariantType = vtkm::cont::Variant>; VariantType variant; if (this->VecFieldType == vtkm::filter::flow::VectorFieldType::VELOCITY_FIELD_TYPE) diff --git a/vtkm/filter/flow/internal/DataSetIntegrator.h b/vtkm/filter/flow/internal/DataSetIntegrator.h index 3f2d21881..0356e8628 100644 --- a/vtkm/filter/flow/internal/DataSetIntegrator.h +++ b/vtkm/filter/flow/internal/DataSetIntegrator.h @@ -22,7 +22,7 @@ #include #include -#include +#include namespace vtkm { @@ -54,8 +54,8 @@ public: std::vector TermIdx, TermID; }; -using DSIHelperInfoType = vtkm::cont::internal::Variant, - DSIHelperInfo>; +using DSIHelperInfoType = + vtkm::cont::Variant, DSIHelperInfo>; template class DataSetIntegrator @@ -65,14 +65,13 @@ public: using ElectroMagneticFieldNameType = std::pair; protected: - using FieldNameType = - vtkm::cont::internal::Variant; + using FieldNameType = vtkm::cont::Variant; - using RType = vtkm::cont::internal::Variant< - vtkm::worklet::flow::ParticleAdvectionResult, - vtkm::worklet::flow::ParticleAdvectionResult, - vtkm::worklet::flow::StreamlineResult, - vtkm::worklet::flow::StreamlineResult>; + using RType = + vtkm::cont::Variant, + vtkm::worklet::flow::ParticleAdvectionResult, + vtkm::worklet::flow::StreamlineResult, + vtkm::worklet::flow::StreamlineResult>; public: DataSetIntegrator(vtkm::Id id, @@ -128,7 +127,7 @@ protected: DSIHelperInfo& dsiInfo) const; //Data members. - vtkm::cont::internal::Variant FieldName; + vtkm::cont::Variant FieldName; vtkm::Id Id; vtkm::filter::flow::IntegrationSolverType SolverType; diff --git a/vtkm/internal/VariantImpl.h b/vtkm/internal/VariantImpl.h index f22b5458b..09d949b70 100644 --- a/vtkm/internal/VariantImpl.h +++ b/vtkm/internal/VariantImpl.h @@ -26,8 +26,6 @@ namespace vtkm { namespace VTK_M_NAMESPACE { -namespace internal -{ // Forward declaration template @@ -126,8 +124,7 @@ template struct VariantTriviallyCopyable; template -struct VariantTriviallyCopyable> - : AllTriviallyCopyable +struct VariantTriviallyCopyable> : AllTriviallyCopyable { }; @@ -135,7 +132,7 @@ template struct VariantTriviallyConstructible; template -struct VariantTriviallyConstructible> +struct VariantTriviallyConstructible> : AllTriviallyConstructible { }; @@ -205,9 +202,8 @@ struct VariantConstructorImpl; // Can trivially construct, deconstruct, and copy all data. (Probably all trivial classes.) template -struct VariantConstructorImpl, - std::true_type, - std::true_type> : VariantStorageImpl +struct VariantConstructorImpl, std::true_type, std::true_type> + : VariantStorageImpl { VariantConstructorImpl() = default; ~VariantConstructorImpl() = default; @@ -221,7 +217,7 @@ struct VariantConstructorImpl, // Can trivially copy, but cannot trivially construct. Common if a class is simple but // initializes itself. template -struct VariantConstructorImpl, +struct VariantConstructorImpl, std::false_type, std::true_type> : VariantStorageImpl { @@ -242,7 +238,7 @@ struct VariantConstructorImpl, // Cannot trivially copy. We assume we cannot trivially construct/destruct. template -struct VariantConstructorImpl, +struct VariantConstructorImpl, construct_type, std::false_type> : VariantStorageImpl { @@ -555,15 +551,14 @@ template using ListTagAsVariant VTKM_DEPRECATED( 1.6, "vtkm::ListTag is no longer supported. Use vtkm::List instead.") = - vtkm::ListApply; + vtkm::ListApply; /// \brief Convert a `List` to a `Variant`. /// template -using ListAsVariant = vtkm::ListApply; +using ListAsVariant = vtkm::ListApply; } -} -} // namespace vtkm::VTK_M_NAMESPACE::internal +} // namespace vtkm::VTK_M_NAMESPACE #undef VTK_M_DEVICE #undef VTK_M_NAMESPACE diff --git a/vtkm/internal/VariantImplDetail.h b/vtkm/internal/VariantImplDetail.h index 61d957997..896c75ed5 100644 --- a/vtkm/internal/VariantImplDetail.h +++ b/vtkm/internal/VariantImplDetail.h @@ -32,8 +32,6 @@ namespace vtkm { namespace VTK_M_NAMESPACE { -namespace internal -{ namespace detail { @@ -1010,5 +1008,4 @@ VTK_M_DEVICE inline auto VariantCastAndCallImpl( } } -} -} // vtkm::VTK_M_NAMESPACE::internal::detail +} // vtkm::VTK_M_NAMESPACE::detail diff --git a/vtkm/internal/VariantImplDetail.h.in b/vtkm/internal/VariantImplDetail.h.in index 823db4170..546cde5fb 100644 --- a/vtkm/internal/VariantImplDetail.h.in +++ b/vtkm/internal/VariantImplDetail.h.in @@ -65,8 +65,6 @@ namespace vtkm { namespace VTK_M_NAMESPACE { -namespace internal -{ namespace detail { @@ -354,5 +352,4 @@ VTK_M_DEVICE inline auto VariantCastAndCallImpl( } } -} -} // vtkm::VTK_M_NAMESPACE::internal::detail +} // vtkm::VTK_M_NAMESPACE::detail diff --git a/vtkm/rendering/raytracing/MeshConnectivity.h b/vtkm/rendering/raytracing/MeshConnectivity.h index 7eea2d799..6ea6d93bb 100644 --- a/vtkm/rendering/raytracing/MeshConnectivity.h +++ b/vtkm/rendering/raytracing/MeshConnectivity.h @@ -13,7 +13,7 @@ #include #include #include -#include +#include #include #include #include @@ -250,7 +250,7 @@ public: /// \brief General version of mesh connectivity that can be used for all supported mesh types. class VTKM_ALWAYS_EXPORT MeshConnectivity { - using ConnectivityType = vtkm::exec::internal:: + using ConnectivityType = vtkm::exec:: Variant; ConnectivityType Connectivity;