[vtkusers] Re: What's Wrong With This?!?
Andrea Gavana
andrea.gavana at gmail.com
Thu Mar 23 13:00:10 EST 2006
Hello Charl,
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...
However, I found a couple of things:
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:
"Unhandled exception at 0x019e30db (vtkCommon.dll) in Python.exe"
This line says:
for(int j=0; j < this->NumberOfComponents; ++j)
{
this->Tuple[j] = static_cast<double>(t[j]);
}
return this->Tuple;
2) Doing the 2-steps method:
a) vtks = pyvtk.VtkData(pyvtk.StructuredGrid([nx, ny, nz], MyMatrix))
vtks.tofile("MyFile.vtk", "ascii")
b) grid = vtk.vtkStructuredGridReader()
grid.SetFileName("MyFile.vtk")
surfaceMapper = vtk.vtkDataSetMapper()
surfaceMapper.SetInput(grid.GetOutput())
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)...
Is there other things I could try?
Thank you very much for your suggestions and help.
Andrea.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20060323/4b8789b3/attachment.htm>
More information about the vtkusers
mailing list