Export to GitHub

sfepy - issue #95

Troubles loading vtk mesh file


Posted on Aug 13, 2009 by Quick Hippo

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 Hippo

SfePy 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 Hippo

One 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 Hippo

I 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

Attachments

Comment #4

Posted on Aug 13, 2009 by Quick Hippo

You 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.

Attachments

Comment #5

Posted on Aug 13, 2009 by Massive Hippo

I 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 Hippo

Try the attached patch, please.

Attachments

Comment #7

Posted on Aug 13, 2009 by Quick Hippo

With the patch, calling Mesh.from_file (in problemDef) does not raise the KeyError anymore. Thanks!

Comment #8

Posted on Aug 13, 2009 by Massive Hippo

Good, here is a better patch. If all works, you can close the issue :)

Attachments

Comment #9

Posted on Aug 13, 2009 by Quick Hippo

It seems to work too. At least it loads the mesh file without raising any error.

Comment #10

Posted on Aug 14, 2009 by Massive Hippo

Good, let's close this.

Comment #11

Posted on Jan 30, 2012 by Massive Hippo

Migrated to http://github.com/sfepy/sfepy/issues/97

Status: Migrated

Labels:
Type-Defect Priority-Medium