diff --git a/vtkm/cont/arg/CMakeLists.txt b/vtkm/cont/arg/CMakeLists.txt index 890bd9a85..1e879a951 100644 --- a/vtkm/cont/arg/CMakeLists.txt +++ b/vtkm/cont/arg/CMakeLists.txt @@ -27,7 +27,9 @@ set(headers TransportTagWholeArrayInOut.h TransportTagWholeArrayOut.h TypeCheck.h - TypeCheckTagArray.h + TypeCheckTagArrayIn.h + TypeCheckTagArrayInOut.h + TypeCheckTagArrayOut.h TypeCheckTagAtomicArray.h TypeCheckTagBitField.h TypeCheckTagCellSet.h diff --git a/vtkm/cont/arg/TypeCheckTagArray.h b/vtkm/cont/arg/TypeCheckTagArray.h deleted file mode 100644 index 29705bab3..000000000 --- a/vtkm/cont/arg/TypeCheckTagArray.h +++ /dev/null @@ -1,42 +0,0 @@ -//============================================================================ -// 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. -//============================================================================ -#ifndef vtk_m_cont_arg_TypeCheckTagArray_h -#define vtk_m_cont_arg_TypeCheckTagArray_h - -#include - -#include - -#include - -namespace vtkm -{ -namespace cont -{ -namespace arg -{ - -/// The Array type check passes for any object that behaves like an \c -/// ArrayHandle class and can be passed to the ArrayIn and ArrayOut transports. -/// -struct TypeCheckTagArray -{ -}; - -template -struct TypeCheck -{ - static constexpr bool value = vtkm::cont::internal::ArrayHandleCheck::type::value; -}; -} -} -} // namespace vtkm::cont::arg - -#endif //vtk_m_cont_arg_TypeCheckTagArray_h diff --git a/vtkm/cont/arg/TypeCheckTagArrayIn.h b/vtkm/cont/arg/TypeCheckTagArrayIn.h new file mode 100644 index 000000000..0a258c40f --- /dev/null +++ b/vtkm/cont/arg/TypeCheckTagArrayIn.h @@ -0,0 +1,66 @@ +//============================================================================ +// 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. +//============================================================================ +#ifndef vtk_m_cont_arg_TypeCheckTagArrayIn_h +#define vtk_m_cont_arg_TypeCheckTagArrayIn_h + +#include + +#include + +#include + +#include + +namespace vtkm +{ +namespace cont +{ +namespace arg +{ + +/// The Array type check passes for any object that behaves like an \c +/// ArrayHandle class and can be passed to the ArrayIn transport. +/// +struct TypeCheckTagArrayIn +{ +}; + +namespace detail +{ + +template ::type::value> +struct IsArrayHandleIn; + +template +struct IsArrayHandleIn +{ + static constexpr bool value = + vtkm::internal::PortalSupportsGets::value; +}; + +template +struct IsArrayHandleIn +{ + static constexpr bool value = false; +}; + +} // namespace detail + +template +struct TypeCheck +{ + static constexpr bool value = detail::IsArrayHandleIn::value; +}; +} +} +} // namespace vtkm::cont::arg + +#endif //vtk_m_cont_arg_TypeCheckTagArray_h diff --git a/vtkm/cont/arg/TypeCheckTagArrayInOut.h b/vtkm/cont/arg/TypeCheckTagArrayInOut.h new file mode 100644 index 000000000..823f8bae9 --- /dev/null +++ b/vtkm/cont/arg/TypeCheckTagArrayInOut.h @@ -0,0 +1,67 @@ +//============================================================================ +// 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. +//============================================================================ +#ifndef vtk_m_cont_arg_TypeCheckTagArrayInOut_h +#define vtk_m_cont_arg_TypeCheckTagArrayInOut_h + +#include + +#include + +#include + +#include + +namespace vtkm +{ +namespace cont +{ +namespace arg +{ + +/// The Array type check passes for any object that behaves like an +/// `ArrayHandle` class and can be passed to the ArrayInOut transport. +/// +struct TypeCheckTagArrayInOut +{ +}; + +namespace detail +{ + +template ::type::value> +struct IsArrayHandleInOut; + +template +struct IsArrayHandleInOut +{ + static constexpr bool value = + (vtkm::internal::PortalSupportsGets::value && + vtkm::internal::PortalSupportsSets::value); +}; + +template +struct IsArrayHandleInOut +{ + static constexpr bool value = false; +}; + +} // namespace detail + +template +struct TypeCheck +{ + static constexpr bool value = detail::IsArrayHandleInOut::value; +}; +} +} +} // namespace vtkm::cont::arg + +#endif //vtk_m_cont_arg_TypeCheckTagArray_h diff --git a/vtkm/cont/arg/TypeCheckTagArrayOut.h b/vtkm/cont/arg/TypeCheckTagArrayOut.h new file mode 100644 index 000000000..f694b4c11 --- /dev/null +++ b/vtkm/cont/arg/TypeCheckTagArrayOut.h @@ -0,0 +1,67 @@ +//============================================================================ +// 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. +//============================================================================ +#ifndef vtk_m_cont_arg_TypeCheckTagArrayOut_h +#define vtk_m_cont_arg_TypeCheckTagArrayOut_h + +#include + +#include + +#include + +#include + +namespace vtkm +{ +namespace cont +{ +namespace arg +{ + +/// The Array type check passes for any object that behaves like an +/// `ArrayHandle` class and can be passed to the ArrayOut transport. +/// +struct TypeCheckTagArrayOut +{ +}; + +namespace detail +{ + +template ::type::value> +struct IsArrayHandleOut; + +template +struct IsArrayHandleOut +{ + static constexpr bool value = + (vtkm::internal::PortalSupportsGets::value && + vtkm::internal::PortalSupportsSets::value); +}; + +template +struct IsArrayHandleOut +{ + static constexpr bool value = false; +}; + +} // namespace detail + +template +struct TypeCheck +{ + static constexpr bool value = detail::IsArrayHandleOut::value; +}; +} +} +} // namespace vtkm::cont::arg + +#endif //vtk_m_cont_arg_TypeCheckTagArray_h diff --git a/vtkm/cont/arg/TypeCheckTagCellSetStructured.h b/vtkm/cont/arg/TypeCheckTagCellSetStructured.h index 45d9431ba..0d9bdb393 100644 --- a/vtkm/cont/arg/TypeCheckTagCellSetStructured.h +++ b/vtkm/cont/arg/TypeCheckTagCellSetStructured.h @@ -12,7 +12,7 @@ #include -#include +#include namespace vtkm { diff --git a/vtkm/cont/arg/testing/UnitTestTypeCheckArray.cxx b/vtkm/cont/arg/testing/UnitTestTypeCheckArray.cxx index cb3200b64..1fcedcf44 100644 --- a/vtkm/cont/arg/testing/UnitTestTypeCheckArray.cxx +++ b/vtkm/cont/arg/testing/UnitTestTypeCheckArray.cxx @@ -8,7 +8,9 @@ // PURPOSE. See the above copyright notice for more information. //============================================================================ -#include +#include +#include +#include #include #include @@ -26,27 +28,50 @@ struct TryArraysOfType void operator()(T) const { using vtkm::cont::arg::TypeCheck; - using vtkm::cont::arg::TypeCheckTagArray; + using vtkm::cont::arg::TypeCheckTagArrayIn; + using vtkm::cont::arg::TypeCheckTagArrayInOut; + using vtkm::cont::arg::TypeCheckTagArrayOut; using StandardArray = vtkm::cont::ArrayHandle; - VTKM_TEST_ASSERT((TypeCheck::value), + VTKM_TEST_ASSERT((TypeCheck::value), + "Standard array type check failed."); + VTKM_TEST_ASSERT((TypeCheck::value), + "Standard array type check failed."); + VTKM_TEST_ASSERT((TypeCheck::value), "Standard array type check failed."); using CountingArray = vtkm::cont::ArrayHandleCounting; - VTKM_TEST_ASSERT((TypeCheck::value), + VTKM_TEST_ASSERT((TypeCheck::value), + "Counting array type check failed."); + VTKM_TEST_ASSERT((!TypeCheck::value), + "Counting array type check failed."); + VTKM_TEST_ASSERT((!TypeCheck::value), "Counting array type check failed."); - using CompositeArray = vtkm::cont::ArrayHandleCompositeVector; - VTKM_TEST_ASSERT((TypeCheck::value), + using CompositeArray = vtkm::cont::ArrayHandleCompositeVector; + VTKM_TEST_ASSERT((TypeCheck::value), "Composite array type check failed."); + VTKM_TEST_ASSERT((TypeCheck::value), + "Counting array type check failed."); + VTKM_TEST_ASSERT((TypeCheck::value), + "Counting array type check failed."); // Just some type that is not a valid array. using NotAnArray = typename StandardArray::WritePortalType; - VTKM_TEST_ASSERT(!(TypeCheck::value), + VTKM_TEST_ASSERT(!(TypeCheck::value), + "Not an array type check failed."); + VTKM_TEST_ASSERT(!(TypeCheck::value), + "Not an array type check failed."); + VTKM_TEST_ASSERT(!(TypeCheck::value), "Not an array type check failed."); // Another type that is not a valid array. - VTKM_TEST_ASSERT(!(TypeCheck::value), "Not an array type check failed."); + VTKM_TEST_ASSERT(!(TypeCheck::value), + "Not an array type check failed."); + VTKM_TEST_ASSERT(!(TypeCheck::value), + "Not an array type check failed."); + VTKM_TEST_ASSERT(!(TypeCheck::value), + "Not an array type check failed."); } }; diff --git a/vtkm/worklet/WorkletMapField.h b/vtkm/worklet/WorkletMapField.h index 4ce40558d..7af385610 100644 --- a/vtkm/worklet/WorkletMapField.h +++ b/vtkm/worklet/WorkletMapField.h @@ -16,7 +16,9 @@ #include #include #include -#include +#include +#include +#include #include #include @@ -47,7 +49,7 @@ public: /// struct FieldIn : vtkm::cont::arg::ControlSignatureTagBase { - using TypeCheckTag = vtkm::cont::arg::TypeCheckTagArray; + using TypeCheckTag = vtkm::cont::arg::TypeCheckTagArrayIn; using TransportTag = vtkm::cont::arg::TransportTagArrayIn; using FetchTag = vtkm::exec::arg::FetchTagArrayDirectIn; }; @@ -58,7 +60,7 @@ public: /// struct FieldOut : vtkm::cont::arg::ControlSignatureTagBase { - using TypeCheckTag = vtkm::cont::arg::TypeCheckTagArray; + using TypeCheckTag = vtkm::cont::arg::TypeCheckTagArrayOut; using TransportTag = vtkm::cont::arg::TransportTagArrayOut; using FetchTag = vtkm::exec::arg::FetchTagArrayDirectOut; }; @@ -69,7 +71,7 @@ public: /// struct FieldInOut : vtkm::cont::arg::ControlSignatureTagBase { - using TypeCheckTag = vtkm::cont::arg::TypeCheckTagArray; + using TypeCheckTag = vtkm::cont::arg::TypeCheckTagArrayInOut; using TransportTag = vtkm::cont::arg::TransportTagArrayInOut; using FetchTag = vtkm::exec::arg::FetchTagArrayDirectInOut; }; diff --git a/vtkm/worklet/WorkletMapTopology.h b/vtkm/worklet/WorkletMapTopology.h index d989160f9..6d3009f07 100644 --- a/vtkm/worklet/WorkletMapTopology.h +++ b/vtkm/worklet/WorkletMapTopology.h @@ -19,7 +19,9 @@ #include #include #include -#include +#include +#include +#include #include #include @@ -75,7 +77,7 @@ public: /// struct FieldInVisit : vtkm::cont::arg::ControlSignatureTagBase { - using TypeCheckTag = vtkm::cont::arg::TypeCheckTagArray; + using TypeCheckTag = vtkm::cont::arg::TypeCheckTagArrayIn; using TransportTag = vtkm::cont::arg::TransportTagTopologyFieldIn; using FetchTag = vtkm::exec::arg::FetchTagArrayDirectIn; }; @@ -85,7 +87,7 @@ public: /// struct FieldInIncident : vtkm::cont::arg::ControlSignatureTagBase { - using TypeCheckTag = vtkm::cont::arg::TypeCheckTagArray; + using TypeCheckTag = vtkm::cont::arg::TypeCheckTagArrayIn; using TransportTag = vtkm::cont::arg::TransportTagTopologyFieldIn; using FetchTag = vtkm::exec::arg::FetchTagArrayTopologyMapIn; }; @@ -97,7 +99,7 @@ public: /// struct FieldOut : vtkm::cont::arg::ControlSignatureTagBase { - using TypeCheckTag = vtkm::cont::arg::TypeCheckTagArray; + using TypeCheckTag = vtkm::cont::arg::TypeCheckTagArrayOut; using TransportTag = vtkm::cont::arg::TransportTagArrayOut; using FetchTag = vtkm::exec::arg::FetchTagArrayDirectOut; }; @@ -107,7 +109,7 @@ public: /// struct FieldInOut : vtkm::cont::arg::ControlSignatureTagBase { - using TypeCheckTag = vtkm::cont::arg::TypeCheckTagArray; + using TypeCheckTag = vtkm::cont::arg::TypeCheckTagArrayInOut; using TransportTag = vtkm::cont::arg::TransportTagArrayInOut; using FetchTag = vtkm::exec::arg::FetchTagArrayDirectInOut; }; diff --git a/vtkm/worklet/WorkletPointNeighborhood.h b/vtkm/worklet/WorkletPointNeighborhood.h index 0b4b274e4..f57431597 100644 --- a/vtkm/worklet/WorkletPointNeighborhood.h +++ b/vtkm/worklet/WorkletPointNeighborhood.h @@ -25,7 +25,9 @@ #include #include #include -#include +#include +#include +#include #include #include @@ -110,7 +112,7 @@ public: /// struct FieldIn : vtkm::cont::arg::ControlSignatureTagBase { - using TypeCheckTag = vtkm::cont::arg::TypeCheckTagArray; + using TypeCheckTag = vtkm::cont::arg::TypeCheckTagArrayIn; using TransportTag = vtkm::cont::arg::TransportTagArrayIn; using FetchTag = vtkm::exec::arg::FetchTagArrayDirectIn; }; @@ -122,7 +124,7 @@ public: /// struct FieldOut : vtkm::cont::arg::ControlSignatureTagBase { - using TypeCheckTag = vtkm::cont::arg::TypeCheckTagArray; + using TypeCheckTag = vtkm::cont::arg::TypeCheckTagArrayOut; using TransportTag = vtkm::cont::arg::TransportTagArrayOut; using FetchTag = vtkm::exec::arg::FetchTagArrayDirectOut; }; @@ -134,7 +136,7 @@ public: /// struct FieldInOut : vtkm::cont::arg::ControlSignatureTagBase { - using TypeCheckTag = vtkm::cont::arg::TypeCheckTagArray; + using TypeCheckTag = vtkm::cont::arg::TypeCheckTagArrayInOut; using TransportTag = vtkm::cont::arg::TransportTagArrayInOut; using FetchTag = vtkm::exec::arg::FetchTagArrayDirectInOut; }; @@ -166,7 +168,7 @@ public: /// struct FieldInNeighborhood : vtkm::cont::arg::ControlSignatureTagBase { - using TypeCheckTag = vtkm::cont::arg::TypeCheckTagArray; + using TypeCheckTag = vtkm::cont::arg::TypeCheckTagArrayIn; using TransportTag = vtkm::cont::arg::TransportTagArrayIn; using FetchTag = vtkm::exec::arg::FetchTagArrayNeighborhoodIn; }; diff --git a/vtkm/worklet/WorkletReduceByKey.h b/vtkm/worklet/WorkletReduceByKey.h index 6f2ff2ea1..4f0156a34 100644 --- a/vtkm/worklet/WorkletReduceByKey.h +++ b/vtkm/worklet/WorkletReduceByKey.h @@ -19,7 +19,9 @@ #include #include #include -#include +#include +#include +#include #include #include @@ -69,7 +71,7 @@ public: /// struct ValuesIn : vtkm::cont::arg::ControlSignatureTagBase { - using TypeCheckTag = vtkm::cont::arg::TypeCheckTagArray; + using TypeCheckTag = vtkm::cont::arg::TypeCheckTagArrayIn; using TransportTag = vtkm::cont::arg::TransportTagKeyedValuesIn; using FetchTag = vtkm::exec::arg::FetchTagArrayDirectIn; }; @@ -85,7 +87,7 @@ public: /// struct ValuesInOut : vtkm::cont::arg::ControlSignatureTagBase { - using TypeCheckTag = vtkm::cont::arg::TypeCheckTagArray; + using TypeCheckTag = vtkm::cont::arg::TypeCheckTagArrayInOut; using TransportTag = vtkm::cont::arg::TransportTagKeyedValuesInOut; using FetchTag = vtkm::exec::arg::FetchTagArrayDirectIn; }; @@ -101,7 +103,7 @@ public: /// struct ValuesOut : vtkm::cont::arg::ControlSignatureTagBase { - using TypeCheckTag = vtkm::cont::arg::TypeCheckTagArray; + using TypeCheckTag = vtkm::cont::arg::TypeCheckTagArrayOut; using TransportTag = vtkm::cont::arg::TransportTagKeyedValuesOut; using FetchTag = vtkm::exec::arg::FetchTagArrayDirectIn; }; @@ -118,7 +120,7 @@ public: /// struct ReducedValuesIn : vtkm::cont::arg::ControlSignatureTagBase { - using TypeCheckTag = vtkm::cont::arg::TypeCheckTagArray; + using TypeCheckTag = vtkm::cont::arg::TypeCheckTagArrayIn; using TransportTag = vtkm::cont::arg::TransportTagArrayIn; using FetchTag = vtkm::exec::arg::FetchTagArrayDirectIn; }; @@ -135,7 +137,7 @@ public: /// struct ReducedValuesInOut : vtkm::cont::arg::ControlSignatureTagBase { - using TypeCheckTag = vtkm::cont::arg::TypeCheckTagArray; + using TypeCheckTag = vtkm::cont::arg::TypeCheckTagArrayInOut; using TransportTag = vtkm::cont::arg::TransportTagArrayInOut; using FetchTag = vtkm::exec::arg::FetchTagArrayDirectInOut; }; @@ -149,7 +151,7 @@ public: /// struct ReducedValuesOut : vtkm::cont::arg::ControlSignatureTagBase { - using TypeCheckTag = vtkm::cont::arg::TypeCheckTagArray; + using TypeCheckTag = vtkm::cont::arg::TypeCheckTagArrayOut; using TransportTag = vtkm::cont::arg::TransportTagArrayOut; using FetchTag = vtkm::exec::arg::FetchTagArrayDirectOut; }; diff --git a/vtkm/worklet/internal/WorkletBase.h b/vtkm/worklet/internal/WorkletBase.h index 943f4bd6b..77f0fbd7c 100644 --- a/vtkm/worklet/internal/WorkletBase.h +++ b/vtkm/worklet/internal/WorkletBase.h @@ -32,7 +32,9 @@ #include #include #include -#include +#include +#include +#include #include #include #include @@ -140,7 +142,7 @@ public: /// struct WholeArrayIn : vtkm::cont::arg::ControlSignatureTagBase { - using TypeCheckTag = vtkm::cont::arg::TypeCheckTagArray; + using TypeCheckTag = vtkm::cont::arg::TypeCheckTagArrayIn; using TransportTag = vtkm::cont::arg::TransportTagWholeArrayIn; using FetchTag = vtkm::exec::arg::FetchTagExecObject; }; @@ -158,7 +160,7 @@ public: /// struct WholeArrayOut : vtkm::cont::arg::ControlSignatureTagBase { - using TypeCheckTag = vtkm::cont::arg::TypeCheckTagArray; + using TypeCheckTag = vtkm::cont::arg::TypeCheckTagArrayOut; using TransportTag = vtkm::cont::arg::TransportTagWholeArrayOut; using FetchTag = vtkm::exec::arg::FetchTagExecObject; }; @@ -177,7 +179,7 @@ public: /// struct WholeArrayInOut : vtkm::cont::arg::ControlSignatureTagBase { - using TypeCheckTag = vtkm::cont::arg::TypeCheckTagArray; + using TypeCheckTag = vtkm::cont::arg::TypeCheckTagArrayInOut; using TransportTag = vtkm::cont::arg::TransportTagWholeArrayInOut; using FetchTag = vtkm::exec::arg::FetchTagExecObject; };