[Paraview] Paraview crashes on .vtu file load

Alice Gabriel gabriel at geophysik.uni-muenchen.de
Fri Aug 2 09:39:19 EDT 2013


Thank you for the fast responses!

The bugfix suggested by Karl worked fine for me, thanks for picking up 
on that!

Marco Nawjin pointed me towards using the Python VTK binding classes and 
then use the corresponding VTK XML writer to create the vtu file, which 
I will try for binary output.
Best regards,
Alice


On 02.08.2013 09:53, Karl König wrote:
> 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()


-- 

Dr. Alice-Agnes Gabriel

http://mercalli.ethz.ch/~agabriel/

gabriel at geophysik.uni-muenchen.de

Tel.  : +49 (0)89 2180 4214
Fax   : +49 (0)89 2180 4205

Geophysics
Department of Earth and Environmental Sciences
Ludwig-Maximilians-Universität München
Theresienstrasse 41
80333 München
Germany



More information about the ParaView mailing list