From 4bcdc66633e33cd10dfc3d029bae5eae1f647e18 Mon Sep 17 00:00:00 2001 From: Oliver Ruebel Date: Wed, 28 Jul 2021 21:38:06 -0700 Subject: [PATCH] Specialze PrintDataType to correctly print id ArrayHandles --- .../contourtree_augmented/PrintVectors.h | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/vtkm/worklet/contourtree_augmented/PrintVectors.h b/vtkm/worklet/contourtree_augmented/PrintVectors.h index 00cc7e0a8..195dd6c1e 100644 --- a/vtkm/worklet/contourtree_augmented/PrintVectors.h +++ b/vtkm/worklet/contourtree_augmented/PrintVectors.h @@ -128,6 +128,13 @@ inline void PrintSeparatingBar(vtkm::Id howMany, std::ostream& outStream = std:: } // PrintSeparatingBar() +// routine to print out a single index +inline void PrintIndexType(vtkm::Id index, std::ostream& outStream = std::cout) +{ // PrintIndexType + outStream << std::setw(PRINT_WIDTH - 6) << MaskedIndex(index) << " " << FlagString(index); +} // PrintIndexType + + // routine to print out a single value template inline void PrintDataType(T value, std::ostream& outStream = std::cout) @@ -136,11 +143,13 @@ inline void PrintDataType(T value, std::ostream& outStream = std::cout) } // PrintDataType -// routine to print out a single index -inline void PrintIndexType(vtkm::Id index, std::ostream& outStream = std::cout) -{ // PrintIndexType - outStream << std::setw(PRINT_WIDTH - 6) << MaskedIndex(index) << " " << FlagString(index); -} // PrintIndexType +// Specialization of PrintDataType for vtkm::Id to use PrintIndexType instead so we can properly +// print Id arrays using the PrintArrayHandle function, e.g,. to pint permutted Id arrays. +template <> +inline void PrintDataType(vtkm::Id value, std::ostream& outStream) +{ + PrintIndexType(value, outStream); +} // header line