<div>Hello Charl,</div>
<div>&nbsp;</div>
<div>&nbsp;&nbsp;&nbsp; thank you for your answer. Ok, I am using Numpy to generate the grid, and this is not good. Well, how am I supposed to actually represent the data? My real data comes from a grid file built externally by another application: I simply read it in a matrix and try to pass it to VTK as a matrix. What a VTK user should do instead? Should I always pass through the construction of a vtk file (using pyvtk) and then re-read it into memory? This would be quite slow...
</div>
<div>&nbsp;</div>
<div>However, I found a couple of things:</div>
<div>&nbsp;</div>
<div>1) As Charl suggested, using the debug build of VTK, I found that the error comes from line 328 of vtkdataarraytemplate.txx, in which I get:</div>
<div>&nbsp;</div>
<div>&quot;Unhandled exception at 0x019e30db (vtkCommon.dll) in Python.exe&quot;</div>
<div>&nbsp;</div>
<div>This line says:</div>
<div>&nbsp;</div>
<div>&nbsp; for(int j=0; j &lt; this-&gt;NumberOfComponents; ++j)<br>&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp; this-&gt;Tuple[j] = static_cast&lt;double&gt;(t[j]);<br>&nbsp;&nbsp;&nbsp; }<br>&nbsp; return this-&gt;Tuple;</div>
<div>&nbsp;<br>&nbsp;</div>
<div>2) Doing the 2-steps method:</div>
<div>&nbsp;</div>
<div>a) vtks = pyvtk.VtkData(pyvtk.StructuredGrid([nx, ny, nz], MyMatrix))</div>
<div>&nbsp;&nbsp;&nbsp; vtks.tofile(&quot;MyFile.vtk&quot;, &quot;ascii&quot;)</div>
<div>&nbsp;</div>
<div>b) grid = vtk.vtkStructuredGridReader()</div>
<div>&nbsp;&nbsp;&nbsp; grid.SetFileName(&quot;MyFile.vtk&quot;)</div>
<div>&nbsp;&nbsp;&nbsp; surfaceMapper = vtk.vtkDataSetMapper()</div>
<div>&nbsp;&nbsp;&nbsp; surfaceMapper.SetInput(grid.GetOutput())</div>
<div>&nbsp;</div>
<div>works: VTK doesn't crash. But this method may become very slow if I have, say, 200,000 cells or more (and I have them)...</div>
<div>&nbsp;</div>
<div>Is there other things I could try? </div>
<div>&nbsp;</div>
<div>Thank you very much for your suggestions and help.</div>
<div>&nbsp;</div>
<div>Andrea.</div>