AbstractMesh is abstract. It makes no assumptions about geometry, topology, or 
dimensionality. Forcing it to render as VTK_POLYGON, an intrinsically 2D 
object, is not appropriate.

> On Feb 23, 2020, at 8:43 AM, A A <[email protected]> wrote:
> 
> Dear All,
> 
> This question is loosely related to 
> https://github.com/usnistgov/fipy/issues/312 but might perhaps not be exactly 
> the same. I ran some tests in which I tried to plot a "broken" mesh by 
> resetting the cell type of the underlying tvtk object the same way fipy's 
> VTKCellDataSet method does:
> 
> from fipy import Grid2D
> import pyvista
> 
> # Create Mesh
> mesh = Grid2D(dx = 1.0, dy = 1.0, nx = 2, ny = 2)
> ug = mesh.VTKCellDataSet
> #ug.set_cells([7,7,7,7], ug.cell_locations_array.to_array(), ug.get_cells()) 
> # overwrite to
> ugrid= pyvista.UnstructuredGrid(ug._vtk_obj)
> 
> # Plot Mesh
> plotter = pyvista.Plotter()
> plotter.set_background('white')
> plotter.add_mesh(ugrid, style='wireframe', color='black')
> plotter.add_bounding_box(color='red')
> 
> plotter.view_xy()
> plotter.show()
> 
> Uncommenting line 7 of the above code reveals that resetting the cell type 
> from 41 to 7 of the UniformGrid2D's underlying tvtk object allows the mesh to 
> appear in the plotter. 
> 
> I recall from previous discussions that failure of cell type 41 to plot was 
> attributed to incorrect ordering of the cell vertices, but this would be in 
> contradiction with the results of the code above.
> 
> I then looked through fipy's source code and came up with the following 
> inheritance diagram:
> <unnamed0.jpg>
> 
> The _VTKCellType method in AbstractMesh returns 
> tvtk.ConvexPointSet().cell_type while the  _VTKCellType method in Mesh2D 
> returns tvtk.Polygon().cell_type. I am quite sure that forcing AbstractMesh 
> to return  tvtk.Polygon().cell_type would cause the UniformGrid2D object to 
> appear in pyvista/mayavi, though I am not sure whether this is a viable 
> solution. Any thoughts?
> 
> Regards,
> 
> Amine
> 
> _______________________________________________
> fipy mailing list
> [email protected]
> http://www.ctcms.nist.gov/fipy
>  [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]


_______________________________________________
fipy mailing list
[email protected]
http://www.ctcms.nist.gov/fipy
  [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]

Reply via email to