Commit 8b133288 authored by Kenneth Moreland's avatar Kenneth Moreland
Browse files

Fix deprecation warnings

There was an error that caused deprecation warnings in VTK-m to be
suppressed, which meant that many uses of deprecated features went
unnoticed. This fixes those deprecation warnings.

The majority of the warnings were caused by the use of the deprecated
`Cast`, `CopyTo`, and `ResetTypes` methods of `UnknownArrayHandle` (or
`VariantArrayHandle`). Both `Cast` and `CopyTo` have been subsumed by
`AsArrayHandle` (to make the functionality more clear). `ResetTypes` now
requires a second template argument to define the storage types to try.

Also fixed some issues with `SerializableField` being deprecated.
This class is no longer necessary because `Field` can now be directly
serialized.
parent b085cde3
Pipeline #210875 passed with stage
in 0 seconds
......@@ -112,7 +112,7 @@ int main(int argc, char* argv[])
vtkm::cont::Field resultField = output.GetField("saddlePeak");
;
vtkm::cont::ArrayHandle<vtkm::Pair<vtkm::Id, vtkm::Id>> saddlePeak;
resultField.GetData().CopyTo(saddlePeak);
resultField.GetData().AsArrayHandle(saddlePeak);
return 0;
}
......@@ -113,7 +113,7 @@ int main(int argc, char* argv[])
vtkm::cont::Field resultField = output.GetField("saddlePeak");
vtkm::cont::ArrayHandle<vtkm::Pair<vtkm::Id, vtkm::Id>> saddlePeak;
resultField.GetData().CopyTo(saddlePeak);
resultField.GetData().AsArrayHandle(saddlePeak);
return 0;
}
......@@ -762,14 +762,13 @@ int main(int argc, char* argv[])
if (numLevels > 0) // if compute isovalues
{
// Get the data values for computing the explicit branch decomposition
// TODO Can we cast the handle we get from GetData() instead of doing a CopyTo?
#ifdef WITH_MPI
vtkm::cont::ArrayHandle<ValueType> dataField;
result.GetPartitions()[0].GetField(0).GetData().CopyTo(dataField);
result.GetPartitions()[0].GetField(0).GetData().AsArrayHandle(dataField);
bool dataFieldIsSorted = true;
#else
vtkm::cont::ArrayHandle<ValueType> dataField;
useDataSet.GetField(0).GetData().CopyTo(dataField);
useDataSet.GetField(0).GetData().AsArrayHandle(dataField);
bool dataFieldIsSorted = false;
#endif
......@@ -844,7 +843,7 @@ int main(int argc, char* argv[])
//vtkm::cont::Field resultField = result.GetField();
//vtkm::cont::ArrayHandle<vtkm::Pair<vtkm::Id, vtkm::Id> > saddlePeak;
//resultField.GetData().CopyTo(saddlePeak);
//resultField.GetData().AsArrayHandle(saddlePeak);
// Dump out contour tree for comparison
if (rank == 0 && printContourTree)
......
......@@ -96,7 +96,7 @@ int main(int argc, char** argv)
auto dataSet = SpinField({ 5, 5 });
vtkm::cont::ArrayHandle<vtkm::Float32> spins;
dataSet.GetCellField("spins").GetData().CopyTo(spins);
dataSet.GetCellField("spins").GetData().AsArrayHandle(spins);
vtkm::rendering::Scene scene;
vtkm::rendering::Actor actor(dataSet.GetCellSet(),
......
......@@ -66,10 +66,11 @@ void TubeThatSpiral(vtkm::FloatDefault radius, vtkm::Id numLineSegments, vtkm::I
// This generates a new pointset, and new cell set.
vtkm::cont::ArrayHandle<vtkm::Vec3f> tubePoints;
vtkm::cont::CellSetSingleType<> tubeCells;
tubeWorklet.Run(ds.GetCoordinateSystem().GetData().Cast<vtkm::cont::ArrayHandle<vtkm::Vec3f>>(),
ds.GetCellSet(),
tubePoints,
tubeCells);
tubeWorklet.Run(
ds.GetCoordinateSystem().GetData().AsArrayHandle<vtkm::cont::ArrayHandle<vtkm::Vec3f>>(),
ds.GetCellSet(),
tubePoints,
tubeCells);
vtkm::cont::DataSet tubeDataset;
tubeDataset.AddCoordinateSystem(vtkm::cont::CoordinateSystem("coords", tubePoints));
......
......@@ -100,7 +100,7 @@ class Redistributor
vtkm::Id currentIdx) const
{
vtkm::cont::ArrayHandle<T> farray =
field.GetData().template Cast<vtkm::cont::ArrayHandle<T>>();
field.GetData().template AsArrayHandle<vtkm::cont::ArrayHandle<T>>();
vtkm::cont::Algorithm::CopySubRange(data, 0, data.GetNumberOfValues(), farray, currentIdx);
}
};
......
......@@ -95,7 +95,7 @@ const vtkm::exec::CellLocator* CellLocatorRectilinearGrid::PrepareForExecution(
this->PlaneSize,
this->RowSize,
this->GetCellSet().template Cast<Structured3DType>(),
this->GetCoordinates().GetData().template Cast<RectilinearType>());
this->GetCoordinates().GetData().template AsArrayHandle<RectilinearType>());
}
else
{
......@@ -107,7 +107,7 @@ const vtkm::exec::CellLocator* CellLocatorRectilinearGrid::PrepareForExecution(
this->PlaneSize,
this->RowSize,
this->GetCellSet().template Cast<Structured2DType>(),
this->GetCoordinates().GetData().template Cast<RectilinearType>());
this->GetCoordinates().GetData().template AsArrayHandle<RectilinearType>());
}
if (!success)
{
......
......@@ -53,7 +53,7 @@ void CellLocatorUniformGrid::Build()
throw vtkm::cont::ErrorBadType("Cells are not 2D or 3D structured type.");
}
UniformType uniformCoords = coords.GetData().Cast<UniformType>();
UniformType uniformCoords = coords.GetData().AsArrayHandle<UniformType>();
auto coordsPortal = uniformCoords.ReadPortal();
this->Origin = coordsPortal.GetOrigin();
......
......@@ -72,7 +72,7 @@ CoordinateSystem::GetData() const
VTKM_CONT vtkm::cont::CoordinateSystem::MultiplexerArrayType
CoordinateSystem::GetDataAsMultiplexer() const
{
return this->GetData().AsMultiplexer<MultiplexerArrayType>();
return this->GetData().AsArrayHandle<MultiplexerArrayType>();
}
VTKM_CONT
......
......@@ -338,7 +338,7 @@ public:
vtkmdiy::save(bb, numberOfFields);
for (vtkm::IdComponent i = 0; i < numberOfFields; ++i)
{
vtkmdiy::save(bb, vtkm::cont::SerializableField<FieldTypeList>(dataset.GetField(i)));
vtkmdiy::save(bb, dataset.GetField(i));
}
}
......@@ -364,9 +364,9 @@ public:
vtkmdiy::load(bb, numberOfFields);
for (vtkm::IdComponent i = 0; i < numberOfFields; ++i)
{
vtkm::cont::SerializableField<FieldTypeList> field;
vtkm::cont::Field field;
vtkmdiy::load(bb, field);
dataset.AddField(field.Field);
dataset.AddField(field);
}
}
};
......
......@@ -468,10 +468,8 @@ inline VTKM_CONT TestEqualResult test_equal_CellSets(const CellSet1& cellset1,
return result;
}
template <typename FieldTypeList = VTKM_DEFAULT_TYPE_LIST>
inline VTKM_CONT TestEqualResult test_equal_Fields(const vtkm::cont::Field& f1,
const vtkm::cont::Field& f2,
FieldTypeList fTtypes = FieldTypeList())
const vtkm::cont::Field& f2)
{
TestEqualResult result;
......@@ -487,8 +485,7 @@ inline VTKM_CONT TestEqualResult test_equal_Fields(const vtkm::cont::Field& f1,
return result;
}
result =
test_equal_ArrayHandles(f1.GetData().ResetTypes(fTtypes), f2.GetData().ResetTypes(fTtypes));
result = test_equal_ArrayHandles(f1.GetData(), f2.GetData());
if (!result)
{
result.PushMessage("data doesn't match");
......@@ -497,12 +494,10 @@ inline VTKM_CONT TestEqualResult test_equal_Fields(const vtkm::cont::Field& f1,
return result;
}
template <typename CellSetTypes = VTKM_DEFAULT_CELL_SET_LIST,
typename FieldTypeList = VTKM_DEFAULT_TYPE_LIST>
template <typename CellSetTypes = VTKM_DEFAULT_CELL_SET_LIST>
inline VTKM_CONT TestEqualResult test_equal_DataSets(const vtkm::cont::DataSet& ds1,
const vtkm::cont::DataSet& ds2,
CellSetTypes ctypes = CellSetTypes(),
FieldTypeList fTtypes = FieldTypeList())
CellSetTypes ctypes = CellSetTypes())
{
TestEqualResult result;
if (ds1.GetNumberOfCoordinateSystems() != ds2.GetNumberOfCoordinateSystems())
......@@ -537,7 +532,7 @@ inline VTKM_CONT TestEqualResult test_equal_DataSets(const vtkm::cont::DataSet&
}
for (vtkm::IdComponent i = 0; i < ds1.GetNumberOfFields(); ++i)
{
result = test_equal_Fields(ds1.GetField(i), ds2.GetField(i), fTtypes);
result = test_equal_Fields(ds1.GetField(i), ds2.GetField(i));
if (!result)
{
result.PushMessage(std::string("fields don't match at index ") + std::to_string(i));
......
......@@ -185,7 +185,7 @@ public:
vtkm::cont::ArrayHandle<bool> match;
vtkm::cont::Token token;
LocatorWorklet<DeviceAdapter> worklet(
bounds, dims, coords.GetData().template Cast<RectilinearType>(), token);
bounds, dims, coords.GetData().template AsArrayHandle<RectilinearType>(), token);
vtkm::worklet::DispatcherMapField<LocatorWorklet<DeviceAdapter>> dispatcher(worklet);
dispatcher.SetDevice(DeviceAdapter());
......
......@@ -97,7 +97,7 @@ vtkm::cont::DataSet MakeTestDataSet(const vtkm::Vec<vtkm::Id, DIMENSIONS>& dims)
std::uniform_real_distribution<vtkm::FloatDefault> warpFactor(-0.10f, 0.10f);
auto inPointsPortal = uniformDs.GetCoordinateSystem()
.GetData()
.template Cast<vtkm::cont::ArrayHandleUniformPointCoordinates>()
.template AsArrayHandle<vtkm::cont::ArrayHandleUniformPointCoordinates>()
.ReadPortal();
vtkm::cont::ArrayHandle<PointType> points;
points.Allocate(inPointsPortal.GetNumberOfValues());
......
......@@ -124,9 +124,9 @@ void DataSet_Compare(vtkm::cont::DataSet& leftDataSet, vtkm::cont::DataSet& righ
for (vtkm::Id j = 0; j < leftDataSet.GetNumberOfFields(); j++)
{
vtkm::cont::ArrayHandle<vtkm::Float32> lDataArray;
leftDataSet.GetField(j).GetData().CopyTo(lDataArray);
leftDataSet.GetField(j).GetData().AsArrayHandle(lDataArray);
vtkm::cont::ArrayHandle<vtkm::Float32> rDataArray;
rightDataSet.GetField(j).GetData().CopyTo(rDataArray);
rightDataSet.GetField(j).GetData().AsArrayHandle(rDataArray);
VTKM_TEST_ASSERT(lDataArray == rDataArray, "field value info incorrect");
}
return;
......
......@@ -26,7 +26,7 @@ using DataSetWrapper = vtkm::cont::SerializableDataSet<FieldTypeList, CellSetTyp
VTKM_CONT void TestEqualDataSet(const DataSetWrapper& ds1, const DataSetWrapper& ds2)
{
VTKM_TEST_ASSERT(test_equal_DataSets(ds1.DataSet, ds2.DataSet, CellSetTypes{}, FieldTypeList{}));
VTKM_TEST_ASSERT(test_equal_DataSets(ds1.DataSet, ds2.DataSet, CellSetTypes{}));
}
void RunTest(const vtkm::cont::DataSet& ds)
......
......@@ -299,7 +299,9 @@ VTKM_CONT void ContourTreeAugmented::DoPostExecute(
currBlock.GetField(this->GetActiveFieldName(), this->GetActiveFieldAssociation());
//const vtkm::cont::ArrayHandle<T,StorageType> &fieldData = currField.GetData().Cast<vtkm::cont::ArrayHandle<T,StorageType> >();
vtkm::cont::ArrayHandle<T> fieldData;
vtkm::cont::ArrayCopy(currField.GetData().template ResetTypes<vtkm::List<T>>(), fieldData);
vtkm::cont::ArrayCopy(
currField.GetData().template ResetTypes<vtkm::List<T>, VTKM_DEFAULT_STORAGE_LIST>(),
fieldData);
auto currContourTreeMesh = vtkm::worklet::contourtree_distributed::MultiBlockContourTreeHelper::
ComputeLocalContourTreeMesh<T>(
this->MultiBlockTreeHelper->MultiBlockSpatialDecomposition.LocalBlockOrigins.ReadPortal()
......
......@@ -680,7 +680,9 @@ VTKM_CONT void ContourTreeUniformDistributed::DoPostExecute(
auto currField =
currBlock.GetField(this->GetActiveFieldName(), this->GetActiveFieldAssociation());
vtkm::cont::ArrayHandle<FieldType> fieldData;
vtkm::cont::ArrayCopy(currField.GetData().ResetTypes(vtkm::List<FieldType>{}), fieldData);
vtkm::cont::ArrayCopy(
currField.GetData().ResetTypes(vtkm::List<FieldType>{}, VTKM_DEFAULT_STORAGE_LIST{}),
fieldData);
// ... compute and store the actual mesh
localDataBlocks[bi]->ContourTreeMeshes.emplace_back(this->LocalBoundaryTrees[bi].VertexIndex,
......@@ -914,7 +916,9 @@ VTKM_CONT void ContourTreeUniformDistributed::DoPostExecute(
auto currField =
currBlock.GetField(this->GetActiveFieldName(), this->GetActiveFieldAssociation());
vtkm::cont::ArrayHandle<FieldType> fieldData;
vtkm::cont::ArrayCopy(currField.GetData().ResetTypes(vtkm::List<FieldType>{}), fieldData);
vtkm::cont::ArrayCopy(
currField.GetData().ResetTypes(vtkm::List<FieldType>{}, VTKM_DEFAULT_STORAGE_LIST{}),
fieldData);
auto localToGlobalIdRelabeler = vtkm::worklet::contourtree_augmented::mesh_dem::IdRelabeler(
this->MultiBlockSpatialDecomposition.LocalBlockOrigins.ReadPortal().Get(
blockData->BlockIndex),
......
......@@ -35,6 +35,14 @@ struct DeduceFilterFieldTypes
using PList = typename DerivedPolicy::FieldTypeList;
using TypeList = vtkm::ListIntersect<ListOfTypes, PList>;
};
template <typename DerivedPolicy, typename ListOfStorage>
struct DeduceFilterFieldStorage
{
using PList = typename DerivedPolicy::StorageList;
using StorageList = vtkm::ListAppend<ListOfStorage, PList>;
};
}
}
......
......@@ -86,7 +86,8 @@ public:
void SetLocalHistogram(vtkm::Id index, const vtkm::cont::Field& field)
{
this->SetLocalHistogram(index, field.GetData().Cast<vtkm::cont::ArrayHandle<vtkm::Id>>());
this->SetLocalHistogram(index,
field.GetData().AsArrayHandle<vtkm::cont::ArrayHandle<vtkm::Id>>());
}
vtkm::cont::ArrayHandle<vtkm::Id> ReduceAll() const
......
......@@ -89,8 +89,7 @@ inline VTKM_CONT vtkm::cont::DataSet ImageDifference::DoExecute(
{
VTKM_LOG_S(vtkm::cont::LogLevel::Info, "Not performing average");
primaryOutput = primary;
secondaryOutput =
secondaryField.GetData().template Cast<vtkm::cont::ArrayHandle<T, StorageType>>();
secondaryField.GetData().AsArrayHandle(secondaryOutput);
}
if (this->PixelShiftRadius > 0)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment