Open tricaric opened 2 years ago
The format specification says that the data is int:
If the region attribute in the first line is '1', each tetrahedra has an additional region attribute (an integer) in the last column.
In tetgen.h (v1.6.0) we have (line 210 and following):
// 'tetrahedronattributelist': An array of tetrahedron attributes. Each // tetrahedron's attributes occupy 'numberoftetrahedronattributes' REALs.
and then:
REAL *tetrahedronattributelist; int numberoftetrahedronattributes;
The tetrahedron attributes can be used to define regions, in which case it can take integer values, but in general, and for any positive number of attributes, the attributes can take REAL values, as appropriate for general physical quantities. Importing the converted vtk mesh example into ParaView (after removing the "dtype=int" as described above) confirms that the tetrahedron attribute is a double with values in [1, 1.5].
When converting a tetgen mesh to another format (vtk in my case), meshio reads the .ele file setting dtype=int, but the attribute columns are of type REAL as defined in tetgen.h code of the tetgen library.
To Reproduce For example, with mesh.node as:
and mesh.ele as:
when you run: meshio convert mesh.node mesh.vtk the output is:
Diagnose The relevant meshio code seems to be at line 75 of meshio/tetgen/_tetgen.py. A quick fix seems to be to remove "dtype=int" from that line, but perhaps that is not entirely correct and a better fix is needed.
Thanks!