I am trying to load a mesh written by gmesh (see attached) but it fails because the first cell in the cells list is type 1, causing vtk_dims[cell_types[0,0]] raise a KeyError in meshio.py as vtk_dims = {3 : 2, 9 : 2, 5 : 2, 3 : 3, 10 : 3, 12 : 3} does not handle single point cells. I don't know is these single point cells are a bug in gmesh or a feature that sfepy does not care about.
Comment #1
Posted on Aug 13, 2009 by Massive HippoSfePy currently supports only triangles, quads, tetrahedrons and hexahedrons. What are those single point cells used for? Would it be enough to modify the mesh reader so that it ignores the unknown cell types?
Comment #2
Posted on Aug 13, 2009 by Massive HippoOne more thing - your mesh is a 3D surface (nice!), but in 3D, sfepy needs a volume mesh (e.g. of tetrahedrons).
Comment #3
Posted on Aug 13, 2009 by Quick HippoI don't know why Gmesh adds those singular cells in vtk file and not in the other formats it supports (msh and medit for example). Would it be difficult not to load them ? Just an idea : in VTKMeshIO.read, when the 'while 1' loop ends, pop the lines of the array that has undesirable value in the first column, count the dropped cells and adjust n_el and n_val
- test_bast.msh 56.82KB
- test_bast.vtk 41.78KB
Comment #4
Posted on Aug 13, 2009 by Quick HippoYou are right about the 3D surface, but I have the same problem with a 3D volume mesh (see cylindre.vtk). I attached in the original bugreport a lightweight vtk file showing singular cells that the sfepy does not handle.
- cylindre.vtk 166.77KB
Comment #5
Posted on Aug 13, 2009 by Massive HippoI can now read the mesh, but there are also some line segment cells - the computation will not work with that (no bar elements in sfepy), so we should probably ignore any cells besides those with the highest dimension.
Comment #6
Posted on Aug 13, 2009 by Massive HippoTry the attached patch, please.
- vtk_read.patch 1.9KB
Comment #7
Posted on Aug 13, 2009 by Quick HippoWith the patch, calling Mesh.from_file (in problemDef) does not raise the KeyError anymore. Thanks!
Comment #8
Posted on Aug 13, 2009 by Massive HippoGood, here is a better patch. If all works, you can close the issue :)
- vtk_read.patch 3.31KB
Comment #9
Posted on Aug 13, 2009 by Quick HippoIt seems to work too. At least it loads the mesh file without raising any error.
Comment #10
Posted on Aug 14, 2009 by Massive HippoGood, let's close this.
Comment #11
Posted on Jan 30, 2012 by Massive HippoMigrated to http://github.com/sfepy/sfepy/issues/97
Status: Migrated
Labels:
Type-Defect
Priority-Medium