That looks easy enough. We really need to get on this and write a
simple viewer for mayavi2.

On Thu, May 7, 2009 at 9:34 AM, david wende <[email protected]> wrote:
> I managed to export solution variable (phi) from 3D mesh as follows:
>          z=phi.getValue()
>          pd=pyvtk.PointData(pyvtk.Scalars(z))
>          grid=pyvtk.StructuredPoints((10,10,10))
>          data=pyvtk.VtkData(grid,pd)
>          data.tofile("filename")
>
> And mayavi2 seems to read the filename OK.
> I can't say that I understand every step above but it seems to work for me.
> thanks for your reply.
> David
> On Thu, May 7, 2009 at 4:20 PM, 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.
>>
>> 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.
>>
>>
>
>
>
> --
> David Wende
> home +972-8-9353488
> work +972-2-5886116
> mobile +972-54-234-6479
>



-- 
Daniel Wheeler

Reply via email to