I am sorry, but I noticed that some lines of my previous e-mail
have been cut so I post it again.

I apologize,
n.




Dear all,
    I am an almost-new user of MayaVi. Essentially, what I want to do is 
plotting
 streamlines for a given vector field and put the values along the field lines
(positions, magnetic magnitude, density...) in a file. 

I am able to do this with arrays defined by myself through the "flow" command.

This is the problem I am facing now. I have a VTK file containing an 
unstructured
grid (I have not created this file, it has been given to me). I searched on 
this forum
 and on other webpages, but I did not manage to find the solution.
This is what I am able to do:

from enthought.tvtk.api import tvtk
r = tvtk.UnstructuredGridReader()
r.file_name = 'file001.vtk'
r.update()

ug = r.output

In ug.points there are all the tuples related to the positions. Besides, doing

print ug

this is the output

vtkUnstructuredGrid (0x22b686e0)
 Debug: Off
 Modified Time: 260
 Reference Count: 2
 Registered Events: 
   Registered Observers:
     vtkObserver (0x22b6cd80)
       Event: 33
       EventName: ModifiedEvent
       Command: 0x22b6fb30
       Priority: 0
       Tag: 1
 Source: (none)
 Information: 0x22b68810
 Data Released: False
 Global Release Data: Off
 UpdateTime: 262
 Release Data: Off
 UpdateExtent: Not Initialized
 UpdateExtent: 0, -1, 0, -1, 0, -1
 Update Number Of Pieces: 1
 Update Piece: 0
 Update Ghost Level: 0
 WholeExtent: 0, -1, 0, -1, 0, -1
 MaximumNumberOfPieces: 1
 RequestExactExtent: Off
  Field Data:
   Debug: Off
   Modified Time: 220
   Reference Count: 1
   Registered Events: (none)
   Number Of Arrays: 1
   Array 0 name = TIME
   Number Of Components: 1
   Number Of Tuples: 1
 Number Of Points: 4541728
 Number Of Cells: 567716
 Cell Data:
   Debug: Off
   Modified Time: 260
   Reference Count: 1
   Registered Events: (none)
   Number Of Arrays: 4
   Array 0 name = density
   Array 1 name = velocity
   Array 2 name = magnetic
   Array 3 name = pressure
   Number Of Components: 8
   Number Of Tuples: 567716
   Copy Tuple Flags: ( 1 1 1 1 1 0 1 )
   Interpolate Flags: ( 1 1 1 1 1 0 0 )
   Pass Through Flags: ( 1 1 1 1 1 1 1 )
   Scalars: 
     Debug: Off
     Modified Time: 238
     Reference Count: 1
     Registered Events: (none)
     Name: density
     Data type: double
     Size: 567716
     MaxId: 567715
     NumberOfComponents: 1
     Information: 0
     Name: density
     Number Of Components: 1
     Number Of Tuples: 567716
     Size: 567716
     MaxId: 567715
     LookupTable: (none)
     Array: 0x27050000
   Vectors: 
     Debug: Off
     Modified Time: 244
     Reference Count: 1
     Registered Events: (none)
     Name: velocity
     Data type: double
     Size: 1703148
     MaxId: 1703147
     NumberOfComponents: 3
     Information: 0
     Name: velocity
     Number Of Components: 3
     Number Of Tuples: 567716
     Size: 1703148
     MaxId: 1703147
     LookupTable: (none)
     Array: 0x292f6000
   Normals: (none)
   TCoords: (none)
   Tensors: (none)
   GlobalIds: (none)
   PedigreeIds: (none)
 Point Data:
   Debug: Off
   Modified Time: 212
   Reference Count: 2
   Registered Events: 
     Registered Observers:
       vtkObserver (0x22d195a0)
         Event: 33
         EventName: ModifiedEvent
         Command: 0x22d17e20
         Priority: 0
         Tag: 1
   Number Of Arrays: 0
   Number Of Components: 0
   Number Of Tuples: 0
   Copy Tuple Flags: ( 1 1 1 1 1 0 1 )
   Interpolate Flags: ( 1 1 1 1 1 0 0 )
   Pass Through Flags: ( 1 1 1 1 1 1 1 )
   Scalars: (none)
   Vectors: (none)
   Normals: (none)
   TCoords: (none)
   Tensors: (none)
   GlobalIds: (none)
   PedigreeIds: (none)
 Bounds: 
   Xmin,Xmax: (-0.00483349, 0.00483349)
   Ymin,Ymax: (-0.00483349, 0.00483349)
   Zmin,Zmax: (-0.00483349, 0.00483349)
 Compute Time: 282
 Number Of Points: 4541728
 Point Coordinates: 0x22b5b890
 Locator: 0
 Number Of Pieces: 1
 Piece: 0
 Ghost Level: 0


I would need to retrieve the "density" scalar array (in order to plot e.g.
isosurfaces) and the "magnetic" vector array (in order to plot streamlines).
I am stucked here, may anyone give me some suggestions?

Cheers,
n.

P.S. Opening this VTK file in VisIt, I am able to plot the streamlines,
but I would definitely like to work with MayaVi since after plotting
streamlines, I (should) know how to export the values of density
and magnetic magnitude along each field line to a file.

------------------------------------------------------------------------------
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. ON SALE this month only -- learn more at:
http://p.sf.net/sfu/learnnow-d2d
_______________________________________________
MayaVi-users mailing list
MayaVi-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mayavi-users

Reply via email to