Hi Gael,
thanks for your prompt reply. This is the junk of the code that
I wrote that generates the mesh:
for i in range(0,ncell):
cells_connectivity[0][i*9]=8
cells_type[0][i]= tvtk.Hexahedron().cell_type
cells_offset[0][i]=i*9
temperature[i]=variabledata[i][3]
for j in range(0,8):
cells_connectivity[0][i*9+j+1]=celldata[i][j+1]-1
cell_array = tvtk.CellArray()
cell_array.set_cells(ncell, cells_connectivity)
ug = tvtk.UnstructuredGrid(points=xyz)
ug.set_cells(cells_type, cells_offset, cell_array)
ug.cell_data.scalars = temperature
ug.cell_data.scalars.name = 'Temperature [K]'
variabledata and celldata are arrays containing the variable value
(temperature here) at the cells location, and the cells connectivity
information respectively.
This is the part of the code which takes care of visualizing my data:
@mayavi2.standalone
def display():
from enthought.mayavi.sources.vtk_data_source import VTKDataSource
from enthought.mayavi.modules.outline import Outline
from enthought.mayavi.modules.surface import Surface
from enthought.mayavi.modules.vectors import Vectors
from enthought.mayavi.modules.scalar_cut_plane import ScalarCutPlane
from enthought.mayavi import mlab
mayavi.new_scene()
src = VTKDataSource(data = ug)
mayavi.add_source(src)
mayavi.add_module(Outline())
cp=ScalarCutPlane()
mayavi.add_module(cp)
cp.implicit_plane.normal = 0,1,0
cp.implicit_plane.visible = False
mlab.view(90,-90,0.08)
if __name__ == '__main__':
from enthought.mayavi import mlab
display()
I tried to follow your suggestion, but it did not work
- still getting the wireframe mesh. I'd only like to
visualize the mesh bounding edges, together with
my scalar field plotted over a cut plane.
Thanks for your help!
Giulio
------------------------------------------------------------------------------
Achieve Improved Network Security with IP and DNS Reputation.
Defend against bad network traffic, including botnets, malware,
phishing sites, and compromised hosts - saving your company time,
money, and embarrassment. Learn More!
http://p.sf.net/sfu/hpdev2dev-nov
_______________________________________________
MayaVi-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mayavi-users