Commit a9656475 authored by Cory Quammen's avatar Cory Quammen

Append Datasets and Merge Blocks: add tests for output type

Test that the output type is vtkPolyData if all inputs to "Append
Datasets" are vtkPolyData and vtkUnstructuredGrid otherwise. Test the
same and if all leaf blocks in composite dataset input to "Merge
Blocks" are vtkPolyData and vtkUnstructuredGrid otherwise.
parent 633ef5c2
#### Verify that Append Datasets produces polydata output when inputs are polydata
from paraview.simple import *
from vtkmodules.util import vtkConstants
# create a new 'Sphere'
sphere1 = Sphere()
sphere2 = Sphere()
sphere2.Center = [1.0, 0.0, 0.0]
# create a new 'Append Datasets'
appendDatasets = AppendDatasets(Input=[sphere1, sphere2])
appendDatasets.UpdatePipeline()
# By default the output data type of appendDatasets is vtkUnstructuredGrid
assert(appendDatasets.GetDataInformation().GetDataSetTypeAsString() == 'vtkUnstructuredGrid')
# Ensure that the output data type of appendDatasets is vtkPolyData
appendDatasets.OutputDataSetType = vtkConstants.VTK_POLY_DATA
appendDatasets.UpdatePipeline()
assert(appendDatasets.GetDataInformation().GetDataSetTypeAsString() == 'vtkPolyData')
# Now add in a non-polydata source. It will be skipped in the append
unstructured = UnstructuredCellTypes()
appendDatasets.Input = [sphere1, sphere2, unstructured]
appendDatasets.UpdatePipeline()
# Ensure that the output data type of appendDatasets is still vtkPolyData
assert(appendDatasets.GetDataInformation().GetDataSetTypeAsString() == 'vtkPolyData')
# Ensure output number of cells is the sum of the number of cells in the vtkPolyData input.
# The unstructured grid will be skipped when appending blocks.
sphere1NumCells = sphere1.GetDataInformation().GetNumberOfCells()
sphere2NumCells = sphere2.GetDataInformation().GetNumberOfCells()
outputNumCells = appendDatasets.GetDataInformation().GetNumberOfCells()
assert(sphere1NumCells + sphere2NumCells == outputNumCells)
......@@ -70,8 +70,10 @@ paraview_add_test_python(
paraview_add_test_python(
NO_DATA NO_VALID NO_OUTPUT NO_RT
TestResetProperty.py
AppendDatasetsPolyData.py
MergeBlocksPolyData.py
PointPicking.py
TestResetProperty.py
)
paraview_add_test_python(
......
#### Verify that Merge Blocks produces polydata output when inputs are polydata
from paraview.simple import *
from vtkmodules.util import vtkConstants
# create a new 'Sphere'
sphere1 = Sphere()
sphere2 = Sphere()
sphere2.Center = [1.0, 0.0, 0.0]
# create a new 'Group Datasets'
groupDatasets = GroupDatasets(Input=[sphere1, sphere2])
# create a new 'Merge Blocks'
mergeBlocks = MergeBlocks(Input=groupDatasets)
mergeBlocks.UpdatePipeline()
# By default the output data type of appendDatasets is vtkUnstructuredGrid
assert(mergeBlocks.GetDataInformation().GetDataSetTypeAsString() == 'vtkUnstructuredGrid')
# Ensure that the output data type of mergeBlocks is vtkPolyData
mergeBlocks.OutputDataSetType = vtkConstants.VTK_POLY_DATA
mergeBlocks.UpdatePipeline()
assert(mergeBlocks.GetDataInformation().GetDataSetTypeAsString() == 'vtkPolyData')
# Now add in a non-polydata source
unstructured = UnstructuredCellTypes()
groupDatasets.Input = [sphere1, sphere2, unstructured]
groupDatasets.UpdatePipeline()
mergeBlocks.UpdatePipeline()
# Ensure that the output data type of appendDatasets is still vtkPolyData
assert(mergeBlocks.GetDataInformation().GetDataSetTypeAsString() == 'vtkPolyData')
# Ensure output number of cells is the sum of the number of cells in the vtkPolyData input.
# The unstructured grid will be skipped when merging blocks.
sphere1NumCells = sphere1.GetDataInformation().GetNumberOfCells()
sphere2NumCells = sphere2.GetDataInformation().GetNumberOfCells()
outputNumCells = mergeBlocks.GetDataInformation().GetNumberOfCells()
assert(sphere1NumCells + sphere2NumCells == outputNumCells)
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