[vtkusers] convert a multi-block structured grid into a single unstructured grid
Huayi Wei
weihuayi at xtu.edu.cn
Fri Jul 24 04:49:38 EDT 2015
Hi, There,
I have a multi-block grid and I want to convert it into a single
unstructured grid.
In the multi-block grid, the block size maybe different. I am trying to
use vtkAppendFilter
to do such thing.
```python
reader = vtk.vtkTecplotReader()
reader.SetFileName("mesh.dat")
reader.Update()
mesh = reader.GetOutput()
apd = vtk.vtkAppendFilter()
apd.MergePointsOn()
N = mesh.GetNumberOfBlocks()
for i in range(0, N):
apd.AddInputData(mesh.GetBlock(i))
apd.Update()
umesh = apd.GetOutput()
print umesh.GetNumberOfPoints()
print umesh.GetNumberOfCells()
```
For the first and second blocks, their sizes are same (30*5) ,
vtkAppendFilter can work well. But the third block size is 15*4 and the
fourth block size is 8*15. Then I get the following error message:
```
ERROR: In
/home/why/repositories/vtk/VTK/Common/ExecutionModel/vtkStreamingDemandDrivenPipeline.cxx,
line 857
vtkStreamingDemandDrivenPipeline (0x1f5e4c0): The update extent
specified in the information for output port 0 on algorithm
vtkTrivialProducer(0x1f5e090) is 0 30 0 5 0 0, which is outside the
whole extent 0 15 0 4 0 0.
ERROR: In
/home/why/repositories/vtk/VTK/Common/ExecutionModel/vtkStreamingDemandDrivenPipeline.cxx,
line 857
vtkStreamingDemandDrivenPipeline (0x1f5f070): The update extent
specified in the information for output port 0 on algorithm
vtkTrivialProducer(0x1f5ec40) is 0 30 0 5 0 0, which is outside the
whole extent 0 8 0 15 0 0.
```
So what is the mistake I made? I need your help and suggestions, thanks
very much.
Best
Huayi
More information about the vtkusers
mailing list