mirror of
https://gitlab.kitware.com/vtk/vtk-m
synced 2024-09-20 02:55:47 +00:00
Update the output coordinates for the clip filter.
The clip worklet will change the number of points in the result set by adding points at the clip boundaries. The filter was updating the clipped scalar array to reflect the new points, but not the actual coordinate array. This patch will cause the clip filter's result dataset to contain the correct number of points and no longer automatically map the scalar array onto the output, since this is easily done via the filter API.
This commit is contained in:
parent
ccf73f3e6e
commit
14f216d58e
@ -18,9 +18,11 @@
|
||||
// this software.
|
||||
//============================================================================
|
||||
|
||||
#include <vtkm/cont/DynamicCellSet.h>
|
||||
#include <vtkm/cont/ArrayHandlePermutation.h>
|
||||
#include <vtkm/cont/CellSetPermutation.h>
|
||||
#include <vtkm/cont/CoordinateSystem.h>
|
||||
#include <vtkm/cont/DynamicArrayHandle.h>
|
||||
#include <vtkm/cont/DynamicCellSet.h>
|
||||
|
||||
#include <vtkm/worklet/DispatcherMapTopology.h>
|
||||
|
||||
@ -74,11 +76,15 @@ vtkm::filter::ResultDataSet Clip::DoExecute(const vtkm::cont::DataSet& input,
|
||||
//create the output data
|
||||
vtkm::cont::DataSet output;
|
||||
output.AddCellSet( outputCellSet );
|
||||
output.AddCoordinateSystem( inputCoords );
|
||||
|
||||
//add the mapped field to the output
|
||||
// Compute the new boundary points and add them to the output:
|
||||
vtkm::cont::DynamicArrayHandle outputCoordsArray =
|
||||
this->Worklet.ProcessField(
|
||||
vtkm::filter::ApplyPolicy(inputCoords, policy), device);
|
||||
vtkm::cont::CoordinateSystem outputCoords(inputCoords.GetName(),
|
||||
outputCoordsArray);
|
||||
output.AddCoordinateSystem(outputCoords);
|
||||
vtkm::filter::ResultDataSet result(output);
|
||||
this->DoMapField(result, field, fieldMeta, policy, device);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
@ -79,6 +79,12 @@ void TestClipExplicit()
|
||||
VTKM_TEST_ASSERT(outputData.GetNumberOfCoordinateSystems() == 1,
|
||||
"Wrong number of coordinate systems in the output dataset");
|
||||
|
||||
VTKM_TEST_ASSERT(outputData.GetNumberOfFields() == 0,
|
||||
"Wrong number of fields in the output dataset");
|
||||
|
||||
VTKM_TEST_ASSERT(clip.MapFieldOntoOutput(result, ds.GetPointField("scalars")),
|
||||
"MapFieldOntoOutput failed.");
|
||||
|
||||
VTKM_TEST_ASSERT(outputData.GetNumberOfFields() == 1,
|
||||
"Wrong number of fields in the output dataset");
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user