Charless can confirm, but I don't think that's the result of a
simulation. That's just the same x*y*z initial condition that I used
in the demo. The cell centers are located where they're located, so
that would come out right, but if the face-vertex ordering or face
orientation is botched (it appears to be), then I can't see how the
solutions would be right.

The cell values were set the same as in the demo code  (x*y*z)
Perhaps backface culling is somehow turned off in your vtk setup
so that you can't see the mis-ordered faces?

I still haven't been able to track down where in MayaviViewer the
vertex list for each face is getting incorrectly re-ordered.

For example, the following code does work fine on my system:

import pyvtk
import os
import tempfile
import mayavi
from fipy import *
from fipy.meshes.numMesh.gmshImport import GmshImporter2DIn3DSpace
mesh = GmshImporter2DIn3DSpace('6geom.msh')
c = mesh.getCellCenters()
x, y, z = c[...,0], c[...,1], c[...,2]
var = CellVariable(mesh=mesh, value=x*y*z, name="phi")
fv = mesh._getOrderedCellVertexIDs()
fv = fv.data
fv = fv[:,[1,0,2]]
grid = pyvtk.UnstructuredGrid(points = mesh.getVertexCoords(), triangle=fv)
celldata = pyvtk.CellData(pyvtk.Scalars(var,name="var",lookup_table='default'))
data = pyvtk.VtkData(grid,"mydata",celldata)
(f, fileName) = tempfile.mkstemp('.vtk')
data.tofile(fileName)
viewer = mayavi.mayavi()
viewer.open_vtk(fileName, config=0)

viewer.load_module('SurfaceMap', 0)
rw = viewer.get_render_window()
rw.z_plus_view()

os.close(f)

Reply via email to