Deprecate ArrayHandle::Shrink
This method has been subsumed by Allocate with vtkm::CopyFlag::On.
This commit is contained in:
parent
eb90a6080c
commit
34412ff298
@ -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);
|
||||
|
@ -325,7 +325,7 @@ VTKM_CONT
|
||||
void CellSetExplicit<SST, CST, OST>::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())
|
||||
|
@ -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;
|
||||
|
||||
|
@ -134,7 +134,7 @@ template <typename T, typename S>
|
||||
void StorageVirtualImpl<T, S>::Shrink(vtkm::Id numberOfValues)
|
||||
{
|
||||
this->DropAllPortals();
|
||||
this->Handle.Shrink(numberOfValues);
|
||||
this->Handle.Allocate(numberOfValues, vtkm::CopyFlag::On);
|
||||
}
|
||||
|
||||
struct PortalWrapperToDevice
|
||||
|
@ -1094,7 +1094,7 @@ public:
|
||||
numBits = BitFieldToUnorderedSetPortal<vtkm::UInt64>(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 <typename T, typename U, class SIn, class SStencil, class SOut, class UnaryPredicate>
|
||||
@ -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 <typename T, typename U, class SIn, class SOut>
|
||||
@ -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 <typename T, class SIn, class SOut>
|
||||
@ -1782,7 +1782,7 @@ public:
|
||||
newSize = UniquePortal(values.PrepareForInPlace(DeviceAdapterTagCuda(), token));
|
||||
}
|
||||
|
||||
values.Shrink(newSize);
|
||||
values.Allocate(newSize, vtkm::CopyFlag::On);
|
||||
}
|
||||
|
||||
template <typename T, class Storage, class BinaryCompare>
|
||||
@ -1798,7 +1798,7 @@ public:
|
||||
UniquePortal(values.PrepareForInPlace(DeviceAdapterTagCuda(), token), binary_compare);
|
||||
}
|
||||
|
||||
values.Shrink(newSize);
|
||||
values.Allocate(newSize, vtkm::CopyFlag::On);
|
||||
}
|
||||
|
||||
template <typename T, class SIn, class SVal, class SOut>
|
||||
|
@ -146,7 +146,7 @@ public:
|
||||
|
||||
numBits = static_cast<vtkm::Id>(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;
|
||||
}
|
||||
|
||||
|
@ -501,7 +501,7 @@ public:
|
||||
vtkm::Id length = input.GetNumberOfValues();
|
||||
if (length == 0)
|
||||
{
|
||||
output.Shrink(0);
|
||||
output.ReleaseResources();
|
||||
return initialValue;
|
||||
}
|
||||
if (length == 1)
|
||||
|
@ -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,
|
||||
|
@ -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 <typename IterT, typename RawPredicateT>
|
||||
|
@ -139,7 +139,7 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
output.Shrink(writePos);
|
||||
output.Allocate(writePos, vtkm::CopyFlag::On);
|
||||
}
|
||||
|
||||
template <typename T, typename U, class CIn, class COut>
|
||||
@ -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 <typename T, class CIn, class COut, class BinaryFunctor>
|
||||
@ -545,7 +545,7 @@ public:
|
||||
auto end = std::unique(iterators.GetBegin(), iterators.GetEnd(), wrappedCompare);
|
||||
vtkm::Id newSize = static_cast<vtkm::Id>(end - iterators.GetBegin());
|
||||
token.DetachFromAll();
|
||||
values.Shrink(newSize);
|
||||
values.Allocate(newSize, vtkm::CopyFlag::On);
|
||||
}
|
||||
|
||||
VTKM_CONT static void Synchronize()
|
||||
|
@ -80,7 +80,7 @@ public:
|
||||
output.PrepareForOutput(inputSize, DeviceAdapterTagTBB(), token),
|
||||
unary_predicate);
|
||||
token.DetachFromAll();
|
||||
output.Shrink(outputSize);
|
||||
output.Allocate(outputSize, vtkm::CopyFlag::On);
|
||||
}
|
||||
|
||||
template <typename T, typename U, class CIn, class COut>
|
||||
@ -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 <typename T, class CIn, class COut>
|
||||
@ -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()
|
||||
|
@ -172,7 +172,7 @@ private:
|
||||
"Uninitialized array does not give portal with zero values.");
|
||||
vtkm::cont::Token token;
|
||||
arrayHandle = vtkm::cont::ArrayHandle<T>();
|
||||
arrayHandle.Shrink(0);
|
||||
arrayHandle.Allocate(0, vtkm::CopyFlag::On);
|
||||
arrayHandle = vtkm::cont::ArrayHandle<T>();
|
||||
arrayHandle.ReleaseResourcesExecution();
|
||||
arrayHandle = vtkm::cont::ArrayHandle<T>();
|
||||
@ -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);
|
||||
|
@ -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);
|
||||
{
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -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
|
||||
|
@ -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<vtkm::Id> triangle_topology;
|
||||
for (std::size_t i = 0; i < isovalues.size(); ++i)
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -1223,7 +1223,7 @@ void BoundaryTreeMaker<MeshType, MeshBoundaryExecObjType>::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,
|
||||
|
@ -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
|
||||
{
|
||||
|
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user