Pass Fields and CoordinateSystems to Dispatcher::Invoke
Now that we can handle scheduling Fields and CoordinateSystems, do
This commit is contained in:
parent
146d800968
commit
31138293f9
@ -78,7 +78,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
timer.Reset();
|
||||
vtkm::cont::DynamicArrayHandle coords =
|
||||
clip.ProcessField(input.GetCoordinateSystem(0).GetData());
|
||||
clip.ProcessField(input.GetCoordinateSystem(0));
|
||||
vtkm::Float64 processCoordinatesTime = timer.GetElapsedTime();
|
||||
output.AddCoordinateSystem(vtkm::cont::CoordinateSystem("coordinates", coords));
|
||||
|
||||
|
@ -148,7 +148,7 @@ void displayCall()
|
||||
vtkm::cont::CellSetExplicit<> cellSet;
|
||||
outDataSet.GetCellSet(0).CopyTo(cellSet);
|
||||
const vtkm::cont::DynamicArrayHandleCoordinateSystem &coordArray =
|
||||
outDataSet.GetCoordinateSystem(0).GetData();
|
||||
outDataSet.GetCoordinateSystem(0);
|
||||
|
||||
vtkm::Id numberOfCells = cellSet.GetNumberOfCells();
|
||||
vtkm::Id numberOfPoints = coordArray.GetNumberOfValues();
|
||||
|
@ -206,7 +206,7 @@ void displayCall()
|
||||
|
||||
// Get the coordinate system and coordinate data
|
||||
const vtkm::cont::DynamicArrayHandleCoordinateSystem coordArray =
|
||||
outDataSet.GetCoordinateSystem(0).GetData();
|
||||
outDataSet.GetCoordinateSystem(0);
|
||||
|
||||
// Need the actual vertex points from a static cast of the dynamic array but can't get it right
|
||||
// So use cast and call on a functor that stores that dynamic array into static array we created
|
||||
|
@ -171,7 +171,7 @@ void displayCall()
|
||||
vtkm::cont::CellSetSingleType<> cellSet;
|
||||
tetDataSet.GetCellSet(0).CopyTo(cellSet);
|
||||
const vtkm::cont::DynamicArrayHandleCoordinateSystem &coordArray =
|
||||
tetDataSet.GetCoordinateSystem(0).GetData();
|
||||
tetDataSet.GetCoordinateSystem(0);
|
||||
|
||||
// Need the actual vertex points from a static cast of the dynamic array but can't get it right
|
||||
// So use cast and call on a functor that stores that dynamic array into static array we created
|
||||
|
@ -178,7 +178,7 @@ void displayCall()
|
||||
|
||||
// Get the coordinate system and coordinate data
|
||||
const vtkm::cont::DynamicArrayHandleCoordinateSystem coordArray =
|
||||
outDataSet.GetCoordinateSystem(0).GetData();
|
||||
outDataSet.GetCoordinateSystem(0);
|
||||
|
||||
// Need the actual vertex points from a static cast of the dynamic array but can't get it right
|
||||
// So use cast and call on a functor that stores that dynamic array into static array we created
|
||||
|
@ -133,7 +133,7 @@ void displayCall()
|
||||
vtkm::cont::CellSetSingleType<> cellSet;
|
||||
tetDataSet.GetCellSet(0).CopyTo(cellSet);
|
||||
const vtkm::cont::DynamicArrayHandleCoordinateSystem &coordArray =
|
||||
tetDataSet.GetCoordinateSystem(0).GetData();
|
||||
tetDataSet.GetCoordinateSystem(0);
|
||||
|
||||
// Need the actual vertex points from a static cast of the dynamic array but can't get it right
|
||||
// So use cast and call on a functor that stores that dynamic array into static array we created
|
||||
|
@ -146,7 +146,7 @@ private:
|
||||
vtkm::cont::ArrayHandle<vtkm::Float32> result;
|
||||
vtkm::worklet::DispatcherMapTopology<
|
||||
vtkm::worklet::CellAverage,DeviceAdapterTag> dispatcher;
|
||||
dispatcher.Invoke(dataSet.GetField("pointvar").GetData(),
|
||||
dispatcher.Invoke(dataSet.GetField("pointvar"),
|
||||
cellset,
|
||||
result);
|
||||
|
||||
|
@ -125,7 +125,7 @@ void TestDataSet_Explicit()
|
||||
//run a basic for-each topology algorithm on this
|
||||
vtkm::cont::ArrayHandle<vtkm::Float32> result;
|
||||
vtkm::worklet::DispatcherMapTopology<vtkm::worklet::CellAverage> dispatcher;
|
||||
dispatcher.Invoke(dataSet.GetField("pointvar").GetData(),
|
||||
dispatcher.Invoke(dataSet.GetField("pointvar"),
|
||||
subset,
|
||||
result);
|
||||
|
||||
@ -173,7 +173,7 @@ void TestDataSet_Structured2D()
|
||||
//run a basic for-each topology algorithm on this
|
||||
vtkm::cont::ArrayHandle<vtkm::Float32> result;
|
||||
vtkm::worklet::DispatcherMapTopology<vtkm::worklet::CellAverage> dispatcher;
|
||||
dispatcher.Invoke(dataSet.GetField("pointvar").GetData(),
|
||||
dispatcher.Invoke(dataSet.GetField("pointvar"),
|
||||
subset,
|
||||
result);
|
||||
|
||||
@ -218,7 +218,7 @@ void TestDataSet_Structured3D()
|
||||
//run a basic for-each topology algorithm on this
|
||||
vtkm::cont::ArrayHandle<vtkm::Float32> result;
|
||||
vtkm::worklet::DispatcherMapTopology<vtkm::worklet::CellAverage> dispatcher;
|
||||
dispatcher.Invoke(dataSet.GetField("pointvar").GetData(),
|
||||
dispatcher.Invoke(dataSet.GetField("pointvar"),
|
||||
subset,
|
||||
result);
|
||||
|
||||
|
@ -158,24 +158,6 @@ ThreeDimRectilinearTest()
|
||||
|
||||
vtkm::cont::DataSet dataSet = testDataSet.Make3DRectilinearDataSet0();
|
||||
|
||||
/*
|
||||
dataSet.PrintSummary(std::cout);
|
||||
vtkm::cont::CoordinateSystem cs = dataSet.GetCoordinateSystem();
|
||||
vtkm::cont::DynamicArrayHandleCoordinateSystem dcs = cs.GetData();
|
||||
vtkm::cont::ArrayHandleCartesianProduct<
|
||||
vtkm::cont::ArrayHandle<vtkm::Float32>,
|
||||
vtkm::cont::ArrayHandle<vtkm::Float32>,
|
||||
vtkm::cont::ArrayHandle<vtkm::Float32> > coords;
|
||||
dcs.CastToArrayHandle(coords);
|
||||
vtkm::Id n = dcs.GetNumberOfValues();
|
||||
vtkm::Vec<vtkm::Float32, 3> pt(0,0,0);
|
||||
for (int i = 0; i < n; i++)
|
||||
{
|
||||
pt = coords.GetPortalConstControl().Get(i);
|
||||
std::cout<<i<<": ["<<pt[0]<<" "<<pt[1]<<" "<<pt[2]<<"]"<<std::endl;
|
||||
}
|
||||
*/
|
||||
|
||||
vtkm::cont::CellSetStructured<3> cellSet;
|
||||
dataSet.GetCellSet(0).CopyTo(cellSet);
|
||||
|
||||
|
@ -259,7 +259,7 @@ public:
|
||||
rays.U,
|
||||
rays.V,
|
||||
rays.Scalar,
|
||||
scalarField->GetData());
|
||||
*scalarField);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -268,7 +268,7 @@ public:
|
||||
vtkm::Float32(scalarRange.Max)) )
|
||||
.Invoke(rays.HitIdx,
|
||||
rays.Scalar,
|
||||
scalarField->GetData());
|
||||
*scalarField);
|
||||
}
|
||||
} // Run
|
||||
|
||||
|
@ -1014,7 +1014,7 @@ class SamplerCellAssocRect : public vtkm::worklet::WorkletMapField
|
||||
Rays.MinDistance,
|
||||
Rays.MaxDistance,
|
||||
camera.FrameBuffer,
|
||||
ScalarField->GetData());
|
||||
*ScalarField);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1029,7 +1029,7 @@ class SamplerCellAssocRect : public vtkm::worklet::WorkletMapField
|
||||
Rays.MinDistance,
|
||||
Rays.MaxDistance,
|
||||
camera.FrameBuffer,
|
||||
ScalarField->GetData());
|
||||
*ScalarField);
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -1050,7 +1050,7 @@ class SamplerCellAssocRect : public vtkm::worklet::WorkletMapField
|
||||
Rays.MinDistance,
|
||||
Rays.MaxDistance,
|
||||
camera.FrameBuffer,
|
||||
ScalarField->GetData());
|
||||
*ScalarField);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1065,7 +1065,7 @@ class SamplerCellAssocRect : public vtkm::worklet::WorkletMapField
|
||||
Rays.MinDistance,
|
||||
Rays.MaxDistance,
|
||||
camera.FrameBuffer,
|
||||
ScalarField->GetData());
|
||||
*ScalarField);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -119,7 +119,7 @@ public:
|
||||
|
||||
ThresholdWorklet worklet(predicate);
|
||||
DispatcherMapTopology<ThresholdWorklet, DeviceAdapter> dispatcher(worklet);
|
||||
dispatcher.Invoke(cellSet, field.GetData(), passFlags);
|
||||
dispatcher.Invoke(cellSet, field, passFlags);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -129,7 +129,7 @@ public:
|
||||
|
||||
ThresholdWorklet worklet(predicate);
|
||||
DispatcherMapTopology<ThresholdWorklet, DeviceAdapter> dispatcher(worklet);
|
||||
dispatcher.Invoke(cellSet, field.GetData(), passFlags);
|
||||
dispatcher.Invoke(cellSet, field, passFlags);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -40,7 +40,7 @@ void TestCellAverageUniform3D()
|
||||
vtkm::cont::ArrayHandle<vtkm::Float32> result;
|
||||
|
||||
vtkm::worklet::DispatcherMapTopology<vtkm::worklet::CellAverage> dispatcher;
|
||||
dispatcher.Invoke(dataSet.GetField("pointvar").GetData(),
|
||||
dispatcher.Invoke(dataSet.GetField("pointvar"),
|
||||
dataSet.GetCellSet(),
|
||||
result);
|
||||
|
||||
@ -63,7 +63,7 @@ void TestCellAverageUniform2D()
|
||||
vtkm::cont::ArrayHandle<vtkm::Float32> result;
|
||||
|
||||
vtkm::worklet::DispatcherMapTopology<vtkm::worklet::CellAverage> dispatcher;
|
||||
dispatcher.Invoke(dataSet.GetField("pointvar").GetData(),
|
||||
dispatcher.Invoke(dataSet.GetField("pointvar"),
|
||||
dataSet.GetCellSet(),
|
||||
result);
|
||||
|
||||
@ -86,7 +86,7 @@ void TestCellAverageExplicit()
|
||||
vtkm::cont::ArrayHandle<vtkm::Float32> result;
|
||||
|
||||
vtkm::worklet::DispatcherMapTopology<vtkm::worklet::CellAverage> dispatcher;
|
||||
dispatcher.Invoke(dataSet.GetField("pointvar").GetData(),
|
||||
dispatcher.Invoke(dataSet.GetField("pointvar"),
|
||||
dataSet.GetCellSet(),
|
||||
result);
|
||||
|
||||
|
@ -120,7 +120,9 @@ void TestClippingExplicit()
|
||||
|
||||
vtkm::worklet::Clip<DeviceAdapter> clip;
|
||||
vtkm::cont::CellSetExplicit<> outputCellSet =
|
||||
clip.Run(ds.GetCellSet(0), ds.GetField("scalars").GetData(), clipValue);
|
||||
clip.Run(ds.GetCellSet(0),
|
||||
ds.GetField("scalars").GetData(),
|
||||
clipValue);
|
||||
|
||||
|
||||
vtkm::cont::DynamicArrayHandle coords =
|
||||
@ -169,7 +171,9 @@ void TestClippingStrucutred()
|
||||
|
||||
vtkm::worklet::Clip<DeviceAdapter> clip;
|
||||
vtkm::cont::CellSetExplicit<> outputCellSet =
|
||||
clip.Run(ds.GetCellSet(0), ds.GetField("scalars").GetData(), clipValue);
|
||||
clip.Run(ds.GetCellSet(0),
|
||||
ds.GetField("scalars").GetData(),
|
||||
clipValue);
|
||||
|
||||
|
||||
vtkm::cont::DynamicArrayHandle coords =
|
||||
|
@ -308,7 +308,7 @@ void TestMarchingCubesExplicit()
|
||||
|
||||
marchingCubes.Run(contourValue,
|
||||
cellSet,
|
||||
dataSet.GetCoordinateSystem().GetData(),
|
||||
dataSet.GetCoordinateSystem(),
|
||||
contourArray,
|
||||
vertices,
|
||||
normals,
|
||||
|
@ -90,7 +90,7 @@ void TestPointElevation()
|
||||
|
||||
vtkm::worklet::DispatcherMapField<vtkm::worklet::PointElevation>
|
||||
dispatcher(pointElevationWorklet);
|
||||
dispatcher.Invoke(dataSet.GetCoordinateSystem().GetData(),
|
||||
dispatcher.Invoke(dataSet.GetCoordinateSystem(),
|
||||
result);
|
||||
|
||||
vtkm::cont::ArrayHandle<vtkm::Vec<vtkm::Float32,3> > coordinates;
|
||||
|
@ -154,8 +154,8 @@ TestMaxPointOrCell()
|
||||
|
||||
vtkm::worklet::DispatcherMapTopology< ::test_explicit::MaxPointOrCellValue >
|
||||
dispatcher;
|
||||
dispatcher.Invoke(dataSet.GetField("cellvar").GetData(),
|
||||
dataSet.GetField("pointvar").GetData(),
|
||||
dispatcher.Invoke(dataSet.GetField("cellvar"),
|
||||
dataSet.GetField("pointvar"),
|
||||
dataSet.GetCellSet(0),
|
||||
result);
|
||||
|
||||
@ -177,7 +177,7 @@ TestAvgPointToCell()
|
||||
vtkm::cont::ArrayHandle<vtkm::Float32> result;
|
||||
|
||||
vtkm::worklet::DispatcherMapTopology< ::test_explicit::AveragePointToCellValue > dispatcher;
|
||||
dispatcher.Invoke(dataSet.GetField("pointvar").GetData(),
|
||||
dispatcher.Invoke(dataSet.GetField("pointvar"),
|
||||
dataSet.GetCellSet(),
|
||||
result);
|
||||
|
||||
@ -200,7 +200,7 @@ TestAvgCellToPoint()
|
||||
|
||||
|
||||
vtkm::worklet::DispatcherMapTopology< ::test_explicit::AverageCellToPointValue > dispatcher;
|
||||
dispatcher.Invoke(dataSet.GetField("cellvar").GetData(),
|
||||
dispatcher.Invoke(dataSet.GetField("cellvar"),
|
||||
dataSet.GetCellSet(),
|
||||
result);
|
||||
|
||||
|
@ -181,8 +181,8 @@ TestMaxPointOrCell()
|
||||
vtkm::cont::ArrayHandle<vtkm::Float32> result;
|
||||
|
||||
vtkm::worklet::DispatcherMapTopology< ::test_uniform::MaxPointOrCellValue > dispatcher;
|
||||
dispatcher.Invoke(dataSet.GetField("cellvar").GetData(),
|
||||
dataSet.GetField("pointvar").GetData(),
|
||||
dispatcher.Invoke(dataSet.GetField("cellvar"),
|
||||
dataSet.GetField("pointvar"),
|
||||
// We know that the cell set is a structured 2D grid and
|
||||
// The worklet does not work with general types because
|
||||
// of the way we get cell indices. We need to make that
|
||||
@ -209,7 +209,7 @@ TestAvgPointToCell()
|
||||
vtkm::cont::ArrayHandle<vtkm::Float32> result;
|
||||
|
||||
vtkm::worklet::DispatcherMapTopology< ::test_uniform::AveragePointToCellValue > dispatcher;
|
||||
dispatcher.Invoke(dataSet.GetField("pointvar").GetData(),
|
||||
dispatcher.Invoke(dataSet.GetField("pointvar"),
|
||||
// We know that the cell set is a structured 2D grid and
|
||||
// The worklet does not work with general types because
|
||||
// of the way we get cell indices. We need to make that
|
||||
@ -236,7 +236,7 @@ TestAvgCellToPoint()
|
||||
vtkm::cont::ArrayHandle<vtkm::Float32> result;
|
||||
|
||||
vtkm::worklet::DispatcherMapTopology< ::test_uniform::AverageCellToPointValue > dispatcher;
|
||||
dispatcher.Invoke(dataSet.GetField("cellvar").GetData(),
|
||||
dispatcher.Invoke(dataSet.GetField("cellvar"),
|
||||
// We know that the cell set is a structured 2D grid and
|
||||
// The worklet does not work with general types because
|
||||
// of the way we get cell indices. We need to make that
|
||||
@ -265,11 +265,11 @@ TestStructuredUniformPointCoords()
|
||||
|
||||
vtkm::cont::DataSet dataSet3D = testDataSet.Make3DUniformDataSet0();
|
||||
dispatcher.Invoke(dataSet3D.GetCellSet(),
|
||||
dataSet3D.GetCoordinateSystem().GetData());
|
||||
dataSet3D.GetCoordinateSystem());
|
||||
|
||||
vtkm::cont::DataSet dataSet2D = testDataSet.Make2DUniformDataSet0();
|
||||
dispatcher.Invoke(dataSet2D.GetCellSet(),
|
||||
dataSet2D.GetCoordinateSystem().GetData());
|
||||
dataSet2D.GetCoordinateSystem());
|
||||
}
|
||||
|
||||
} // anonymous namespace
|
||||
|
Loading…
Reference in New Issue
Block a user