[Paraview] Paraview crashes on .vtu file load
Karl König
kkoenig11 at web.de
Fri Aug 2 03:53:41 EDT 2013
Alice,
Your sample file provides 1874 points and 8577 cells, but each cell data
set consists of merely 1874 values, not 8577 values. In your script change
fo.write('<CellData Scalars=\'scalars\'>\n')
...
fo.write('</CellData>\n')
to
fo.write('<PointData Scalars=\'scalars\'>\n')
...
fo.write('</PointData>\n')
regenerate your vtu file and ParaView won't segfault any more.
Hope that helps,
Karl
Alice Gabriel wrote, On 02.08.2013 09:22:
> Dear Paraview-user and developers,
>
> Paraview crashes immediately once I try to load ascii .vtu files I
> self-wrote with a small python wrapper.
> No error messages are parsed and I am lost in finding the reason for the
> crash.
>
> An example .vtu file causing the crash I uploaded here:
> https://dl.dropboxusercontent.com/u/12694118/sample_unstruct_tet.vtu
>
> Thank you very much,
> Alice Gabriel
>
> Here the python wrapper:
>
> [...]
>
> fo.write('<VTKFile type=\'UnstructuredGrid\' version=\'0.1\'
> byte_order=\'BigEndian\'>\n')
> fo.write('<UnstructuredGrid>\n')
> fo.write('<Piece NumberOfPoints=\'' + str(npts) + '\' NumberOfCells=\''
> + str(nelem) + '\'>\n')
> fo.write('<Points>\n')
> fo.write('<DataArray type=\'Float64\' NumberOfComponents=\'3\'
> Format=\'ascii\'>\n')
>
> for i in range(npts):
> fo.write(' ' + str('{: .16E}'.format(data[0,i])) + ' ' + str('{:
> .16E}'.format(data[1,i])) + ' ' + str('{: .16E}'.format(data[2,i])) +
> '\n')
>
> fo.write('</DataArray>\n')
> fo.write('</Points>\n')
> fo.write('<Cells>\n')
> fo.write('<DataArray type=\'Int32\' Name=\'connectivity\'
> Format=\'ascii\'>\n')
>
> for i in range(nelem):
> fo.write(' ' + str('{:6d}'.format(elems[0,i])) + ' ' +
> str('{:6d}'.format(elems[1,i])) + ' ' + str('{:6d}'.format(elems[2,i]))
> + ' ' + str('{:6d}'.format(elems[3,i])) + '\n')
> fo.write('</DataArray>\n')
> fo.write('<DataArray type=\'Int32\' Name=\'offsets\' Format=\'ascii\'>\n')
>
> for i in range(nelem):
> fo.write(' ' + str('{:6d}'.format((i+1)*4)) + '\n')
>
> fo.write('</DataArray>\n')
> fo.write('<DataArray type=\'UInt8\' Name=\'types\' Format=\'ascii\'>\n')
>
> for i in range(nelem):
> fo.write(' ' + str('{:6d}'.format(10)) + '\n')
>
> fo.write('</DataArray>\n')
> fo.write('</Cells>\n')
>
> fo.write('<CellData Scalars=\'scalars\'>\n')
>
> for j, var in enumerate(vars[3:]):
>
> fo.write('<DataArray type=\'Float64\' Name=\'' + var + '\'
> Format=\'ascii\'>\n')
>
> for i in range(npts):
> fo.write(' ' + str('{: .16E}'.format(data[j+3,i])) + '\n')
>
> fo.write('</DataArray>\n')
>
>
> fo.write('</CellData>\n')
> fo.write('</Piece>\n')
> fo.write('</UnstructuredGrid>\n')
> fo.write('</VTKFile>\n')
> fo.close()
More information about the ParaView
mailing list