Open Tsunyshka opened 4 years ago
fixed it with --output-format vtk --ascii
It should work either way. Reopening.
Hi! Is it possible to use meshio-convert in a .py script?
Hi! Is it possible to use meshio-convert in a .py script?
I’m trying to use smth like this, but it actually doesn’t work...
import meshio
in_file = "/path/to/test_mesh.msh"
out_file = "/path/to/test_mesh.ply"
mesh = meshio.read(in_file, file_format="msh") # works
mesh.write(out_file, file_format="ply") # error
Try
meshio.write(out_file, mesh)
@keileg Do you have an idea how to fix this? I'm getting
AssertionError: Incompatible cell data. 157 cell blocks, but 'gmsh:physical' has 16 blocks.
trying to read OP's input msh.
I think you need to store data on which CellBlock 'gmsh:physical'
belongs to; right now I think there is a (tacit) assumption that length of 'gmsh:physical'
equals the number of CellBlocks. I actually thought that gmsh only generates cells for objects decleared physical, but that may be a wrong or outdated assumption on my part.
I don't know if the best is to move 'gmsh:physical' to Mesh.cell_sets
?
I actually thought that gmsh only generates cells for objects decleared physical, but that may be a wrong or outdated assumption on my part.
@keileg I thought so too, but working with the Gmsh API it seems that this isn't the case. The data isn't really set data either. (This would be a list of indices into the points or cells array.) I would expect cell_data["gmsh:physical"]
to list None
for whenever a cell block has no associated data, such that len(cells) == len(datum)
for all cell_data
.
I agree, but would it not break the idea that cell_data are numpy arrays with one item per cell?
Well, if there is no data for a particular cell type, we have to do something. Setting it to None
makes pretty clear what's going on I think.
As long as it does not violate the assumptions in read/write functions, I think None
is a good option.
If .msh has two different regions, whether converting to the vtu format keeps or does not keep the tag name of the regions?
Hi! I am trying to convert .msh (gmsh ascii) to .vtk file format with the simple comand:
But i getting strange result in my output file... What should i do to fix this?
Attach input and output files mesh.zip