diff --git a/vtkm/cont/ArrayHandle.h b/vtkm/cont/ArrayHandle.h index fa3d5a9a0..e314f0f89 100644 --- a/vtkm/cont/ArrayHandle.h +++ b/vtkm/cont/ArrayHandle.h @@ -527,7 +527,7 @@ public: } ///@} - /// Deprecate this. + VTKM_DEPRECATED(1.6, "Use Allocate(n, vtkm::CopyFlag::On) instead of Shrink(n).") VTKM_CONT void Shrink(vtkm::Id numberOfValues) { this->Allocate(numberOfValues, vtkm::CopyFlag::On); diff --git a/vtkm/cont/CellSetExplicit.hxx b/vtkm/cont/CellSetExplicit.hxx index 4007b85cc..f47964e9d 100644 --- a/vtkm/cont/CellSetExplicit.hxx +++ b/vtkm/cont/CellSetExplicit.hxx @@ -325,7 +325,7 @@ VTKM_CONT void CellSetExplicit::CompleteAddingCells(vtkm::Id numPoints) { this->Data->NumberOfPoints = numPoints; - this->Data->CellPointIds.Connectivity.Shrink(this->Data->ConnectivityAdded); + this->Data->CellPointIds.Connectivity.Allocate(this->Data->ConnectivityAdded, vtkm::CopyFlag::On); this->Data->CellPointIds.ElementsValid = true; if (this->Data->NumberOfCellsAdded != this->GetNumberOfCells()) diff --git a/vtkm/cont/CellSetSingleType.h b/vtkm/cont/CellSetSingleType.h index 9ea73d6e2..16e904a04 100644 --- a/vtkm/cont/CellSetSingleType.h +++ b/vtkm/cont/CellSetSingleType.h @@ -159,7 +159,7 @@ public: void CompleteAddingCells(vtkm::Id numPoints) { this->Data->NumberOfPoints = numPoints; - this->CellPointIds.Connectivity.Shrink(this->ConnectivityAdded); + this->CellPointIds.Connectivity.Allocate(this->ConnectivityAdded, vtkm::CopyFlag::On); vtkm::Id numCells = this->NumberOfCellsAdded; diff --git a/vtkm/cont/StorageVirtual.hxx b/vtkm/cont/StorageVirtual.hxx index 9a0ef3880..b2f37580d 100644 --- a/vtkm/cont/StorageVirtual.hxx +++ b/vtkm/cont/StorageVirtual.hxx @@ -134,7 +134,7 @@ template void StorageVirtualImpl::Shrink(vtkm::Id numberOfValues) { this->DropAllPortals(); - this->Handle.Shrink(numberOfValues); + this->Handle.Allocate(numberOfValues, vtkm::CopyFlag::On); } struct PortalWrapperToDevice diff --git a/vtkm/cont/cuda/internal/DeviceAdapterAlgorithmCuda.h b/vtkm/cont/cuda/internal/DeviceAdapterAlgorithmCuda.h index 4d62be8a5..282c9207f 100644 --- a/vtkm/cont/cuda/internal/DeviceAdapterAlgorithmCuda.h +++ b/vtkm/cont/cuda/internal/DeviceAdapterAlgorithmCuda.h @@ -1094,7 +1094,7 @@ public: numBits = BitFieldToUnorderedSetPortal(bitsPortal, indicesPortal); } - indices.Shrink(numBits); + indices.Allocate(numBits, vtkm::CopyFlag::On); return numBits; } @@ -1107,7 +1107,7 @@ public: const vtkm::Id inSize = input.GetNumberOfValues(); if (inSize <= 0) { - output.Shrink(inSize); + output.Allocate(inSize, vtkm::CopyFlag::On); return; } vtkm::cont::Token token; @@ -1125,7 +1125,7 @@ public: vtkm::Id size = stencil.GetNumberOfValues(); if (size <= 0) { - output.Shrink(size); + output.Allocate(size, vtkm::CopyFlag::On); return; } @@ -1140,7 +1140,7 @@ public: ::vtkm::NotZeroInitialized()); //yes on the stencil } - output.Shrink(newSize); + output.Allocate(newSize, vtkm::CopyFlag::On); } template @@ -1154,7 +1154,7 @@ public: vtkm::Id size = stencil.GetNumberOfValues(); if (size <= 0) { - output.Shrink(size); + output.Allocate(size, vtkm::CopyFlag::On); return; } @@ -1168,7 +1168,7 @@ public: unary_predicate); } - output.Shrink(newSize); + output.Allocate(newSize, vtkm::CopyFlag::On); } template @@ -1364,8 +1364,8 @@ public: binary_functor); } - keys_output.Shrink(reduced_size); - values_output.Shrink(reduced_size); + keys_output.Allocate(reduced_size, vtkm::CopyFlag::On); + values_output.Allocate(reduced_size, vtkm::CopyFlag::On); } template @@ -1782,7 +1782,7 @@ public: newSize = UniquePortal(values.PrepareForInPlace(DeviceAdapterTagCuda(), token)); } - values.Shrink(newSize); + values.Allocate(newSize, vtkm::CopyFlag::On); } template @@ -1798,7 +1798,7 @@ public: UniquePortal(values.PrepareForInPlace(DeviceAdapterTagCuda(), token), binary_compare); } - values.Shrink(newSize); + values.Allocate(newSize, vtkm::CopyFlag::On); } template diff --git a/vtkm/cont/internal/DeviceAdapterAlgorithmGeneral.h b/vtkm/cont/internal/DeviceAdapterAlgorithmGeneral.h index 3b00928a2..55778a12f 100644 --- a/vtkm/cont/internal/DeviceAdapterAlgorithmGeneral.h +++ b/vtkm/cont/internal/DeviceAdapterAlgorithmGeneral.h @@ -146,7 +146,7 @@ public: numBits = static_cast(popCount.load(std::memory_order_seq_cst)); - indices.Shrink(numBits); + indices.Allocate(numBits, vtkm::CopyFlag::On); return numBits; } @@ -458,7 +458,7 @@ public: VTKM_LOG_SCOPE_FUNCTION(vtkm::cont::LogLevel::Perf); if (numValues == 0) { - handle.Shrink(0); + handle.ReleaseResources(); return; } @@ -680,7 +680,7 @@ public: vtkm::Id numValues = input.GetNumberOfValues(); if (numValues <= 0) { - output.Shrink(0); + output.ReleaseResources(); return initialValue; } diff --git a/vtkm/cont/kokkos/internal/DeviceAdapterAlgorithmKokkos.h b/vtkm/cont/kokkos/internal/DeviceAdapterAlgorithmKokkos.h index 571456b0a..f35aaf42c 100644 --- a/vtkm/cont/kokkos/internal/DeviceAdapterAlgorithmKokkos.h +++ b/vtkm/cont/kokkos/internal/DeviceAdapterAlgorithmKokkos.h @@ -501,7 +501,7 @@ public: vtkm::Id length = input.GetNumberOfValues(); if (length == 0) { - output.Shrink(0); + output.ReleaseResources(); return initialValue; } if (length == 1) diff --git a/vtkm/cont/openmp/internal/DeviceAdapterAlgorithmOpenMP.h b/vtkm/cont/openmp/internal/DeviceAdapterAlgorithmOpenMP.h index 252e8c537..0d4b0ad97 100644 --- a/vtkm/cont/openmp/internal/DeviceAdapterAlgorithmOpenMP.h +++ b/vtkm/cont/openmp/internal/DeviceAdapterAlgorithmOpenMP.h @@ -116,7 +116,7 @@ public: vtkm::Id numValues = helper.Reduce(outIter); token.DetachFromAll(); - output.Shrink(numValues); + output.Allocate(numValues, vtkm::CopyFlag::On); } @@ -357,7 +357,7 @@ public: Uniqifier uniquifier(iter, portal.GetNumberOfValues(), binary_compare); vtkm::Id outSize = uniquifier.Execute(); token.DetachFromAll(); - values.Shrink(outSize); + values.Allocate(outSize, vtkm::CopyFlag::On); } VTKM_CONT_EXPORT static void ScheduleTask(vtkm::exec::openmp::internal::TaskTiling1D& functor, diff --git a/vtkm/cont/openmp/internal/FunctorsOpenMP.h b/vtkm/cont/openmp/internal/FunctorsOpenMP.h index 472c0ea65..4df28e0ca 100644 --- a/vtkm/cont/openmp/internal/FunctorsOpenMP.h +++ b/vtkm/cont/openmp/internal/FunctorsOpenMP.h @@ -614,8 +614,8 @@ void ReduceByKeyHelper(KeysInArray keysInArray, token.DetachFromAll(); - keysOutArray.Shrink(outIdx); - valuesOutArray.Shrink(outIdx); + keysOutArray.Allocate(outIdx, vtkm::CopyFlag::On); + valuesOutArray.Allocate(outIdx, vtkm::CopyFlag::On); } template diff --git a/vtkm/cont/serial/internal/DeviceAdapterAlgorithmSerial.h b/vtkm/cont/serial/internal/DeviceAdapterAlgorithmSerial.h index 86b670194..396691784 100644 --- a/vtkm/cont/serial/internal/DeviceAdapterAlgorithmSerial.h +++ b/vtkm/cont/serial/internal/DeviceAdapterAlgorithmSerial.h @@ -139,7 +139,7 @@ public: } } - output.Shrink(writePos); + output.Allocate(writePos, vtkm::CopyFlag::On); } template @@ -263,8 +263,8 @@ public: VTKM_ASSERT(numberOfKeys == values.GetNumberOfValues()); if (numberOfKeys == 0) { - keys_output.Shrink(0); - values_output.Shrink(0); + keys_output.ReleaseResources(); + values_output.ReleaseResources(); return; } @@ -300,8 +300,8 @@ public: //now we need to shrink to the correct number of keys/values //writePos is zero-based so add 1 to get correct length - keys_output.Shrink(writePos + 1); - values_output.Shrink(writePos + 1); + keys_output.Allocate(writePos + 1, vtkm::CopyFlag::On); + values_output.Allocate(writePos + 1, vtkm::CopyFlag::On); } template @@ -545,7 +545,7 @@ public: auto end = std::unique(iterators.GetBegin(), iterators.GetEnd(), wrappedCompare); vtkm::Id newSize = static_cast(end - iterators.GetBegin()); token.DetachFromAll(); - values.Shrink(newSize); + values.Allocate(newSize, vtkm::CopyFlag::On); } VTKM_CONT static void Synchronize() diff --git a/vtkm/cont/tbb/internal/DeviceAdapterAlgorithmTBB.h b/vtkm/cont/tbb/internal/DeviceAdapterAlgorithmTBB.h index 894678525..9f8daaa39 100644 --- a/vtkm/cont/tbb/internal/DeviceAdapterAlgorithmTBB.h +++ b/vtkm/cont/tbb/internal/DeviceAdapterAlgorithmTBB.h @@ -80,7 +80,7 @@ public: output.PrepareForOutput(inputSize, DeviceAdapterTagTBB(), token), unary_predicate); token.DetachFromAll(); - output.Shrink(outputSize); + output.Allocate(outputSize, vtkm::CopyFlag::On); } template @@ -191,8 +191,8 @@ public: values_output.PrepareForOutput(inputSize, DeviceAdapterTagTBB(), token), binary_functor); token.DetachFromAll(); - keys_output.Shrink(outputSize); - values_output.Shrink(outputSize); + keys_output.Allocate(outputSize, vtkm::CopyFlag::On); + values_output.Allocate(outputSize, vtkm::CopyFlag::On); } template @@ -338,7 +338,7 @@ public: outputSize = tbb::UniquePortals(values.PrepareForInPlace(DeviceAdapterTagTBB(), token), binary_compare); } - values.Shrink(outputSize); + values.Allocate(outputSize, vtkm::CopyFlag::On); } VTKM_CONT static void Synchronize() diff --git a/vtkm/cont/testing/TestingArrayHandles.h b/vtkm/cont/testing/TestingArrayHandles.h index d2d78fb4a..f75930b68 100644 --- a/vtkm/cont/testing/TestingArrayHandles.h +++ b/vtkm/cont/testing/TestingArrayHandles.h @@ -172,7 +172,7 @@ private: "Uninitialized array does not give portal with zero values."); vtkm::cont::Token token; arrayHandle = vtkm::cont::ArrayHandle(); - arrayHandle.Shrink(0); + arrayHandle.Allocate(0, vtkm::CopyFlag::On); arrayHandle = vtkm::cont::ArrayHandle(); arrayHandle.ReleaseResourcesExecution(); arrayHandle = vtkm::cont::ArrayHandle(); @@ -526,7 +526,7 @@ private: array_handle_testing::CheckArray(arrayHandle); std::cout << "Try shrinking the array." << std::endl; - arrayHandle.Shrink(ARRAY_SIZE); + arrayHandle.Allocate(ARRAY_SIZE, vtkm::CopyFlag::On); VTKM_TEST_ASSERT(arrayHandle.GetNumberOfValues() == ARRAY_SIZE, "Array size did not shrink correctly."); array_handle_testing::CheckArray(arrayHandle); diff --git a/vtkm/cont/testing/TestingDeviceAdapter.h b/vtkm/cont/testing/TestingDeviceAdapter.h index 555b08fb6..a861e6213 100644 --- a/vtkm/cont/testing/TestingDeviceAdapter.h +++ b/vtkm/cont/testing/TestingDeviceAdapter.h @@ -919,8 +919,8 @@ private: } std::cout << " CopyIf on zero size arrays." << std::endl; - array.Shrink(0); - stencil.Shrink(0); + array.ReleaseResources(); + stencil.ReleaseResources(); Algorithm::CopyIf(array, stencil, result); VTKM_TEST_ASSERT(result.GetNumberOfValues() == 0, "result of CopyIf has an incorrect size"); } @@ -1044,7 +1044,7 @@ private: } //Try zero sized array - sorted.Shrink(0); + sorted.Allocate(0); Algorithm::Sort(sorted); } @@ -1339,10 +1339,10 @@ private: std::cout << " Inclusive scan to check" << std::endl; vtkm::Id inclusive_sum = Algorithm::ScanInclusive(array, array); std::cout << " Reduce with 1 value." << std::endl; - array.Shrink(1); + array.Allocate(1, vtkm::CopyFlag::On); vtkm::Id reduce_sum_one_value = Algorithm::Reduce(array, vtkm::Id(0)); std::cout << " Reduce with 0 values." << std::endl; - array.Shrink(0); + array.Allocate(0); vtkm::Id reduce_sum_no_values = Algorithm::Reduce(array, vtkm::Id(0)); VTKM_TEST_ASSERT(reduce_sum == OFFSET * ARRAY_SIZE, "Got bad sum from Reduce"); VTKM_TEST_ASSERT(reduce_sum_with_intial_value == reduce_sum + ARRAY_SIZE, @@ -1939,14 +1939,14 @@ private: } std::cout << " size 1" << std::endl; - array.Shrink(1); + array.Allocate(1, vtkm::CopyFlag::On); sum = Algorithm::ScanInclusive(array, array); VTKM_TEST_ASSERT(sum == OFFSET, "Incorrect partial sum"); const vtkm::Id value = array.ReadPortal().Get(0); VTKM_TEST_ASSERT(value == OFFSET, "Incorrect partial sum"); std::cout << " size 0" << std::endl; - array.Shrink(0); + array.Allocate(0); sum = Algorithm::ScanInclusive(array, array); VTKM_TEST_ASSERT(sum == 0, "Incorrect partial sum"); } @@ -2082,7 +2082,7 @@ private: } std::cout << " size 1" << std::endl; - array.Shrink(1); + array.Allocate(1, vtkm::CopyFlag::On); array.WritePortal().Set(0, OFFSET); sum = Algorithm::ScanExclusive(array, array); VTKM_TEST_ASSERT(sum == OFFSET, "Incorrect partial sum"); @@ -2090,7 +2090,7 @@ private: VTKM_TEST_ASSERT(value == 0, "Incorrect partial sum"); std::cout << " size 0" << std::endl; - array.Shrink(0); + array.Allocate(0); sum = Algorithm::ScanExclusive(array, array); VTKM_TEST_ASSERT(sum == 0, "Incorrect partial sum"); } @@ -2187,7 +2187,7 @@ private: } std::cout << " size 1" << std::endl; - array.Shrink(1); + array.Allocate(1, vtkm::CopyFlag::On); array.WritePortal().Set(0, OFFSET); Algorithm::ScanExtended(array, array); VTKM_TEST_ASSERT(array.GetNumberOfValues() == 2); @@ -2198,7 +2198,7 @@ private: } std::cout << " size 0" << std::endl; - array.Shrink(0); + array.Allocate(0); Algorithm::ScanExtended(array, array); VTKM_TEST_ASSERT(array.GetNumberOfValues() == 1); { diff --git a/vtkm/cont/testing/UnitTestArrayHandleDecorator.cxx b/vtkm/cont/testing/UnitTestArrayHandleDecorator.cxx index a50d2727d..68c200db9 100644 --- a/vtkm/cont/testing/UnitTestArrayHandleDecorator.cxx +++ b/vtkm/cont/testing/UnitTestArrayHandleDecorator.cxx @@ -475,7 +475,7 @@ struct DecoratorTests VTKM_TEST_ASSERT(test_equal(a2Portal.Get(4), 7)); } - decor.Shrink(3); + decor.Allocate(3, vtkm::CopyFlag::On); VTKM_TEST_ASSERT(decor.GetNumberOfValues() == 3); { auto decorPortal = decor.ReadPortal(); @@ -554,8 +554,8 @@ struct ResizableDecorImpl else { // Resize each to 2*newSize: - a1.Shrink(2 * newSize); - a2.Shrink(2 * newSize); + a1.Allocate(2 * newSize, vtkm::CopyFlag::On); + a2.Allocate(2 * newSize, vtkm::CopyFlag::On); } } }; @@ -624,7 +624,7 @@ void ResizeTest() threw = false; try { - decor.Shrink(3); + decor.Allocate(3, vtkm::CopyFlag::On); } catch (vtkm::cont::ErrorBadType& e) { diff --git a/vtkm/worklet/VertexClustering.h b/vtkm/worklet/VertexClustering.h index 606a34616..dc458eec5 100644 --- a/vtkm/worklet/VertexClustering.h +++ b/vtkm/worklet/VertexClustering.h @@ -501,8 +501,8 @@ public: if (cells > 0 && pointId3Array.ReadPortal().Get(cells - 1)[2] >= nPoints) { cells--; - pointId3Array.Shrink(cells); - this->CellIdMap.Shrink(cells); + pointId3Array.Allocate(cells, vtkm::CopyFlag::On); + this->CellIdMap.Allocate(cells, vtkm::CopyFlag::On); } /// output diff --git a/vtkm/worklet/contour/FlyingEdges.h b/vtkm/worklet/contour/FlyingEdges.h index 8037af54e..ab8598ab9 100644 --- a/vtkm/worklet/contour/FlyingEdges.h +++ b/vtkm/worklet/contour/FlyingEdges.h @@ -89,9 +89,9 @@ vtkm::cont::CellSetSingleType<> execute( // Since sharedState can be re-used between invocations of contour, // we need to make sure we reset the size of the Interpolation // arrays so we don't execute Pass5 over an array that is too large - sharedState.InterpolationEdgeIds.Shrink(0); - sharedState.InterpolationWeights.Shrink(0); - sharedState.CellIdMap.Shrink(0); + sharedState.InterpolationEdgeIds.ReleaseResources(); + sharedState.InterpolationWeights.ReleaseResources(); + sharedState.CellIdMap.ReleaseResources(); vtkm::cont::ArrayHandle triangle_topology; for (std::size_t i = 0; i < isovalues.size(); ++i) diff --git a/vtkm/worklet/contourtree_augmented/ActiveGraph.h b/vtkm/worklet/contourtree_augmented/ActiveGraph.h index 000733c80..e6f105a6f 100644 --- a/vtkm/worklet/contourtree_augmented/ActiveGraph.h +++ b/vtkm/worklet/contourtree_augmented/ActiveGraph.h @@ -787,9 +787,9 @@ inline void ActiveGraph::SetSuperArcs(MergeTree& tree) inline void ActiveGraph::SetHyperArcs(MergeTree& tree) { // SetHyperArcs() // 1. Allocate memory for hypertree - tree.Hypernodes.Shrink( - this - ->NumHypernodes); // Has been allocated previously. The values are needed but the size may be too large. + tree.Hypernodes.Allocate( + this->NumHypernodes, // Has been allocated previously. + vtkm::CopyFlag::On); // The values are needed but the size may be too large. tree.Hyperarcs.ReleaseResources(); tree.Hyperarcs.Allocate(this->NumHypernodes); // Has not been allocated yet diff --git a/vtkm/worklet/contourtree_augmented/ArrayTransforms.h b/vtkm/worklet/contourtree_augmented/ArrayTransforms.h index e85902b08..52ba04a45 100644 --- a/vtkm/worklet/contourtree_augmented/ArrayTransforms.h +++ b/vtkm/worklet/contourtree_augmented/ArrayTransforms.h @@ -90,7 +90,7 @@ inline void PermuteArray(const ArrayType& input, IdArrayType& permute, ArrayType } else if (permNumValues < outNumValues) { - output.Shrink(permNumValues); + output.Allocate(permNumValues, vtkm::CopyFlag::On); } // else the output has already the correct size // The following is equivalent to doing the following in serial diff --git a/vtkm/worklet/contourtree_augmented/ContourTreeMaker.h b/vtkm/worklet/contourtree_augmented/ContourTreeMaker.h index 9ba784e6d..9f69796a3 100644 --- a/vtkm/worklet/contourtree_augmented/ContourTreeMaker.h +++ b/vtkm/worklet/contourtree_augmented/ContourTreeMaker.h @@ -648,7 +648,7 @@ inline void ContourTreeMaker::AugmentMergeTrees() splitSort.ReleaseResources(); // 4. Resize the supernode array accordingly - this->ContourTreeResult.Supernodes.Shrink(nSupernodes); + this->ContourTreeResult.Supernodes.Allocate(nSupernodes, vtkm::CopyFlag::On); */ // 1. Allocate an array that is guaranteed to be big enough diff --git a/vtkm/worklet/contourtree_distributed/BoundaryTreeMaker.h b/vtkm/worklet/contourtree_distributed/BoundaryTreeMaker.h index 6cbba66a4..537ea7e69 100644 --- a/vtkm/worklet/contourtree_distributed/BoundaryTreeMaker.h +++ b/vtkm/worklet/contourtree_distributed/BoundaryTreeMaker.h @@ -1223,7 +1223,7 @@ void BoundaryTreeMaker::CompressRegularisedNo this->BoundaryTreeData->VertexIndex); // now copy the this->BoundaryTreeData->Superarcs - this->BoundaryTreeData->Superarcs.Shrink(this->NumKept); + this->BoundaryTreeData->Superarcs.Allocate(this->NumKept, vtkm::CopyFlag::On); auto fillBoundaryTreeSuperarcsWorklet = bract_maker::CompressRegularisedNodesFillBoundaryTreeSuperarcsWorklet(); this->Invoke(fillBoundaryTreeSuperarcsWorklet, diff --git a/vtkm/worklet/testing/UnitTestWorkletMapField.cxx b/vtkm/worklet/testing/UnitTestWorkletMapField.cxx index 077934bda..7260541ec 100644 --- a/vtkm/worklet/testing/UnitTestWorkletMapField.cxx +++ b/vtkm/worklet/testing/UnitTestWorkletMapField.cxx @@ -88,7 +88,7 @@ struct DoStaticTestWorklet CheckPortal(inoutHandleAsPtr.ReadPortal()); std::cout << "Try to invoke with an input array of the wrong size." << std::endl; - inputHandle.Shrink(ARRAY_SIZE / 2); + inputHandle.Allocate(ARRAY_SIZE / 2, vtkm::CopyFlag::On); bool exceptionThrown = false; try { diff --git a/vtkm/worklet/wavelets/WaveletDWT.h b/vtkm/worklet/wavelets/WaveletDWT.h index 84fb02f95..a6d5cdcf4 100644 --- a/vtkm/worklet/wavelets/WaveletDWT.h +++ b/vtkm/worklet/wavelets/WaveletDWT.h @@ -1488,7 +1488,7 @@ public: vtkm::Float64 elapsedTime = timer.GetElapsedTime(); //VTKM_ASSERT( L[0] + L[1] <= coeffOut.GetNumberOfValues() ); - coeffOut.Shrink(L[0] + L[1]); + coeffOut.Allocate(L[0] + L[1], vtkm::CopyFlag::On); return elapsedTime; } @@ -1658,7 +1658,7 @@ public: elapsedTime = timer.GetElapsedTime(); } - sigOut.Shrink(L[2]); + sigOut.Allocate(L[2], vtkm::CopyFlag::On); return elapsedTime; }