Commit e3961b9c authored by Utkarsh Ayachit's avatar Utkarsh Ayachit

update examples after filter API changes.

parent 9cf5be2f
......@@ -115,15 +115,13 @@ int main(int argc, char* argv[])
vtkm::cont::DataSetFieldAdd dsf;
dsf.AddPointField(inDataSet, "values", values);
// Output data set is pairs of saddle and peak vertex IDs
vtkm::filter::Result result;
// Convert 2D mesh of values into contour tree, pairs of vertex ids
vtkm::filter::ContourTreeMesh2D filter;
filter.SetActiveField("values");
result = filter.Execute(inDataSet);
vtkm::cont::Field resultField = result.GetField();
// Output data set is pairs of saddle and peak vertex IDs
vtkm::cont::DataSet output = filter.Execute(inDataSet);
vtkm::cont::Field resultField = output.GetField("saddlePeak");
;
vtkm::cont::ArrayHandle<vtkm::Pair<vtkm::Id, vtkm::Id>> saddlePeak;
resultField.GetData().CopyTo(saddlePeak);
......
......@@ -116,15 +116,13 @@ int main(int argc, char* argv[])
vtkm::cont::DataSetFieldAdd dsf;
dsf.AddPointField(inDataSet, "values", values);
// Output data set is pairs of saddle and peak vertex IDs
vtkm::filter::Result result;
// Convert 3D mesh of values into contour tree, pairs of vertex ids
vtkm::filter::ContourTreeMesh3D filter;
filter.SetActiveField("values");
result = filter.Execute(inDataSet);
// Output data set is pairs of saddle and peak vertex IDs
vtkm::cont::DataSet output = filter.Execute(inDataSet);
vtkm::cont::Field resultField = result.GetField();
vtkm::cont::Field resultField = output.GetField("saddlePeak");
vtkm::cont::ArrayHandle<vtkm::Pair<vtkm::Id, vtkm::Id>> saddlePeak;
resultField.GetData().CopyTo(saddlePeak);
......
......@@ -166,6 +166,16 @@ public:
return vtkm::filter::Result(output);
}
template <typename T, typename StorageType, typename DerivedPolicy, typename DeviceAdapter>
VTKM_CONT bool DoMapField(vtkm::filter::Result&,
const vtkm::cont::ArrayHandle<T, StorageType>&,
const vtkm::filter::FieldMetadata&,
const vtkm::filter::PolicyBase<DerivedPolicy>&,
DeviceAdapter)
{
return false;
}
};
struct UploadData
......@@ -368,11 +378,11 @@ int main(int argc, char** argv)
glutDisplayFunc([]() {
const vtkm::Float32 c = static_cast<vtkm::Float32>(gTimer.GetElapsedTime());
vtkm::filter::Result rdata = gFilter->Execute(*gData, GameOfLifePolicy());
gRenderer->render(rdata.GetDataSet());
vtkm::cont::DataSet oData = gFilter->Execute(*gData, GameOfLifePolicy());
gRenderer->render(oData);
glutSwapBuffers();
*gData = rdata.GetDataSet();
*gData = oData;
if (c > 120)
{
......
......@@ -246,13 +246,11 @@ int main(int argc, char* argv[])
filter.SetGenerateNormals(true);
filter.SetMergeDuplicatePoints(false);
filter.SetIsoValue(0, 0.1);
vtkm::filter::Result result = filter.Execute(dataSet, dataSet.GetField("nodevar"));
filter.SetActiveField("nodevar");
filter.MapFieldOntoOutput(result, dataSet.GetField("nodevar"));
vtkm::cont::DataSet outputData = filter.Execute(dataSet, { "nodevar" });
//need to extract vertices, normals, and scalars
vtkm::cont::DataSet& outputData = result.GetDataSet();
using VertType = vtkm::cont::ArrayHandle<vtkm::Vec<vtkm::Float32, 3>>;
vtkm::cont::CoordinateSystem coords = outputData.GetCoordinateSystem();
......
......@@ -272,9 +272,7 @@ int main(int argc, char* argv[])
// Convert cells to tetrahedra
vtkm::filter::Tetrahedralize tetrahedralize;
vtkm::filter::Result result = tetrahedralize.Execute(inDataSet);
outDataSet = result.GetDataSet();
outDataSet = tetrahedralize.Execute(inDataSet);
// Render the output dataset of tets
lastx = lasty = 0;
......
......@@ -254,9 +254,7 @@ int main(int argc, char* argv[])
vtkm::cont::DataSet inDataSet = MakeTetrahedralizeTestDataSet(dims);
vtkm::filter::Tetrahedralize tetrahedralize;
vtkm::filter::Result result = tetrahedralize.Execute(inDataSet);
tetDataSet = result.GetDataSet();
tetDataSet = tetrahedralize.Execute(inDataSet);
// Render the output dataset of tets
lastx = lasty = 0;
......
......@@ -192,8 +192,7 @@ int main(int argc, char* argv[])
// Convert 2D explicit cells to triangles
vtkm::filter::Triangulate triangulate;
vtkm::filter::Result result = triangulate.Execute(inDataSet);
outDataSet = result.GetDataSet();
outDataSet = triangulate.Execute(inDataSet);
// Render the output dataset of tets
glutInit(&argc, argv);
......
......@@ -159,9 +159,7 @@ int main(int argc, char* argv[])
// Convert uniform quad to triangle
vtkm::filter::Triangulate triangulate;
vtkm::filter::Result result = triangulate.Execute(inDataSet);
triDataSet = result.GetDataSet();
triDataSet = triangulate.Execute(inDataSet);
// Render the output dataset of tets
glutInit(&argc, argv);
......
Markdown is supported
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