On Thu, May 7, 2009 at 9:20 AM, Jonathan Guyer <[email protected]> wrote: > > > On May 6, 2009, at 11:03 AM, david wende wrote: > >> How could I export (write to file) the Cellvariable result >> as vtk data. > > The code in mayaviViewer.py is as close as you're going to get to any direct > vtk export from FiPy right now.
Take a look at this <http://matforge.org/fipy/browser/trunk/fipy/viewers/mayaviViewer/mayaviViewer.py#L132> I think the lines from 132 to 143 are the important ones. > We'd welcome a vtk exporter if you improve on what we have there. The > current implementation has a number of rough edges, and I've got to think > that there's a more efficient way to do things than the list comprehension: > > celldata = pyvtk.CellData(pyvtk.Scalars([float(val) for val in var()], name > = name, lookup_table = 'default')) > > although I seem to remember that pyvtk was very picky about whether it got > lists or arrays or the exact data types or something. I wrote it that way a > couple of years ago in r2055 and r2056, but my svn comments aren't enough of > a clue as to why it has to be like that. I'd think that much better > performance could be had with array manipulations. > > > -- Daniel Wheeler
