nschloe / meshio Goto Github PK
View Code? Open in Web Editor NEW:spider_web: input/output for many mesh formats
License: MIT License
:spider_web: input/output for many mesh formats
License: MIT License
I get the following error with the attached simple 2D Exodus mesh:
Traceback (most recent call last):
File "/opt/miniconda3/envs/meshio/bin/meshio-convert", line 133, in <module>
_main()
File "/opt/miniconda3/envs/meshio/bin/meshio-convert", line 16, in _main
meshio.read(args.infile, file_format=args.input_format)
File "/opt/miniconda3/envs/meshio/lib/python3.6/site-packages/meshio/helpers.py", line 121, in read
out = exodus_io.read(filename)
File "/opt/miniconda3/envs/meshio/lib/python3.6/site-packages/meshio/exodus_io.py", line 72, in read
nc.variables['coordz'][:],
KeyError: 'coordz'
I just tried to output to xdmf, but got:
HDF5-DIAG: Error detected in HDF5 (1.8.16) thread 140140583401216:
#000: ../../../src/H5T.c line 1671 in H5Tcopy(): not a datatype or dataset
major: Invalid arguments to routine
minor: Inappropriate type
XDMF Error in /build/vtk6-YpT4yb/vtk6-6.2.0+dfsg1/ThirdParty/xdmf2/vtkxdmf2/libsrc/XdmfDataDesc.cxx line 492 (Error Creating Data Type)
HDF5-DIAG: Error detected in HDF5 (1.8.16) thread 140140583401216:
#000: ../../../src/H5T.c line 1671 in H5Tcopy(): not a datatype or dataset
major: Invalid arguments to routine
and a lot more error messages - is it possible to switch to ASCII only XDMF (i.e. pure XML). Although it may be less efficient in storage, it is less likely to cause a crash from conflicting library versions etc.
It seems that meshio inverts cells when converting from/to MED.
Here I attach an example. I first converted .msh to .med using meshio, then converted this by gmsh to .msh, and finally converted this back to .med by meshio.
The problem is obvious even from comparing the two gmsh-ascii files doublet-tet.1.msh
and doublet-tet.3-gmsh-med-meshio-msh.msh
.
cgns file format
(https://cgns.github.io/)
@nschloe, I wrote a manpage for meshio-convert
for the meshio-tools
Debian package. I'd be happy to forward it upstream if you are interested. It is written in Markdown and converted using pandoc
.
Please let me know.
(py)VTK is a pretty heavy-weight dependency, and at least for Ubuntu the package is Python 2 only.
Would it be possible to avoid the VTK dependency and still convert to VTK/XDMF? It would enhance portability.
The files *_facet_region.xml and *_obstacle_physical_region.xml are not created by meshio-convert. This means, that the information about the boundaries is lost during the conversion, right?
This happens with the file http://chunk.io/f/912249cf07d84274a9fa2fda779d667c.
When converting a 3D mesh to dolfin XML format, the following traceback appears.
Cell data: physical, geometrical
Traceback (most recent call last):
File "/usr/local/bin/meshio-convert", line 130, in <module>
_main()
File "/usr/local/bin/meshio-convert", line 70, in _main
field_data=field_data
File "/usr/local/lib/python3.5/dist-packages/meshio/helpers.py", line 170, in write
dolfin_io.write(filename, points, cells, cell_data=cell_data)
File "/usr/local/lib/python3.5/dist-packages/meshio/dolfin_io.py", line 245, in write
_write_mesh(filename, points, cell_type, cells)
File "/usr/local/lib/python3.5/dist-packages/meshio/dolfin_io.py", line 136, in _write_mesh
discarded_cells.remove(cell_type)
AttributeError: 'dict_keys' object has no attribute 'remove'
With the Python 2 version, it works fine. The crash happens when the message WARNING:root:DOLFIN XML can only handle one cell type at a time. Using tetra, discarding triangle.
should be printed instead.
If converting from gmsh to dolfin-xml works without a running installation of dolfin, the required package lxml should be added to install_requires in setup.py.
I have created my own build recipe using anaconda, I am using vtk 8.0 python bindings on latest tagged version 1.8.10
When I convert this mesh from gmsh format to vtu I get contiguous array error.
meshio-convert DSI020CALb.msh DSI020CALb.vtu
Number of points: 2116098
Elements:
Number of triangles: 1410720
Number of tetras: 11285760
Cell data: geometrical, physical
Traceback (most recent call last):
File "/home/ksansom/anaconda3/envs/meshio/bin/meshio-convert", line 4, in <module>
__import__('pkg_resources').run_script('meshio==1.8.10', 'meshio-convert')
File "/home/ksansom/anaconda3/envs/meshio/lib/python3.6/site-packages/setuptools-27.2.0-py3.6.egg/pkg_resources/__init__.py", line 744, in run_script
File "/home/ksansom/anaconda3/envs/meshio/lib/python3.6/site-packages/setuptools-27.2.0-py3.6.egg/pkg_resources/__init__.py", line 1506, in run_script
File "/home/ksansom/anaconda3/envs/meshio/lib/python3.6/site-packages/meshio-1.8.10-py3.6.egg/EGG-INFO/scripts/meshio-convert", line 130, in <module>
File "/home/ksansom/anaconda3/envs/meshio/lib/python3.6/site-packages/meshio-1.8.10-py3.6.egg/EGG-INFO/scripts/meshio-convert", line 70, in _main
File "/home/ksansom/anaconda3/envs/meshio/lib/python3.6/site-packages/meshio-1.8.10-py3.6.egg/meshio/helpers.py", line 187, in write
File "/home/ksansom/anaconda3/envs/meshio/lib/python3.6/site-packages/meshio-1.8.10-py3.6.egg/meshio/vtk_io.py", line 236, in write
File "/home/ksansom/anaconda3/envs/meshio/lib/python3.6/site-packages/meshio-1.8.10-py3.6.egg/meshio/vtk_io.py", line 335, in _generate_vtk_mesh
File "/home/ksansom/anaconda3/envs/meshio/lib/python3.6/site-packages/vtk/util/numpy_support.py", line 132, in numpy_to_vtk
assert z.flags.contiguous, 'Only contiguous arrays are supported.'
AssertionError: Only contiguous arrays are supported.
same kind of error when is use this command
./meshio-convert.py --input-format gmsh-binary --output-format vtu-binary DSI020CALb.msh DSI020CALb.vtu
Number of points: 2116098
Elements:
Number of triangles: 1410720
Number of tetras: 11285760
Cell data: geometrical, physical
Traceback (most recent call last):
File "./meshio-convert.py", line 130, in <module>
_main()
File "./meshio-convert.py", line 70, in _main
field_data=field_data
File "/home/ksansom/anaconda3/envs/meshio/lib/python3.6/site-packages/meshio-1.8.10-py3.6.egg/meshio/helpers.py", line 187, in write
File "/home/ksansom/anaconda3/envs/meshio/lib/python3.6/site-packages/meshio-1.8.10-py3.6.egg/meshio/vtk_io.py", line 236, in write
File "/home/ksansom/anaconda3/envs/meshio/lib/python3.6/site-packages/meshio-1.8.10-py3.6.egg/meshio/vtk_io.py", line 335, in _generate_vtk_mesh
File "/home/ksansom/anaconda3/envs/meshio/lib/python3.6/site-packages/vtk/util/numpy_support.py", line 132, in numpy_to_vtk
assert z.flags.contiguous, 'Only contiguous arrays are supported.
AssertionError: Only contiguous arrays are supported.
The loops in the PERMAS (and perhaps other) read/write routines are all in Python, e.g., here. This makes the I/O really slow. A better approach would be to reduce this to just one write(date)
command with an appropriate numpy.array
as data
.
Hi,
get the below error message on ubuntu 14.04. I get that kind of error message as well on python console. However the file is https://www.dropbox.com/sh/i259x4vmf7e8fjt/AADFpEbb7RWPwqUtraw5exeVa (in 'angle' directory)
readable by paraview. It is binary.
thats how I installed:
1637 apt-get install python-h5py
1638 pip install meshio
1639 apt-get install python-pyvtk
1640 apt-get install python-numpy
1641 apt-get install python-vtk
1642 history
Test:
meshio-convert /tmp/elmermesh/angle/case0001.vtu input.msh
Traceback (most recent call last):
File "/usr/local/bin/meshio-convert", line 64, in <module>
_main()
File "/usr/local/bin/meshio-convert", line 16, in _main
meshio.read(args.infile, timestep=args.timesteps)
File "/usr/local/lib/python2.7/dist-packages/meshio/__init__.py", line 40, in read
return vtk_io.read('vtu', filename)
File "/usr/local/lib/python2.7/dist-packages/meshio/vtk_io.py", line 35, in read
cells_nodes = _read_cells_nodes(vtk_mesh)
File "/usr/local/lib/python2.7/dist-packages/meshio/vtk_io.py", line 129, in _read_cells_nodes
assert all(array[::num_nodes_per_cell+1] == num_nodes_per_cell)
AssertionError
Btw:
"Requirements
MeshIO depends on
h5py,
NumPy, and
VTK."
VTK link points to a false url...
Maybe you can help. Tia
hi!
when using this command: mesh, point_data, field_data = voropy.reader.read(filename)
i'm getting this error
mesh, point_data, field_data = voropy.reader.read(filename)
File "C:\Users\imène\Anaconda3\lib\site-packages\voropy\reader.py", line 64, in read
if len(cells_nodes[0]) == 3:
KeyError: 0`
type of file is VTU and version of python is 3.5
can u help me please ?
best regards
Hello, I'm tying to convert the attached file with the command
meshio-convert mesh.xml mesh.msh
mesh.xml.zip
and I get the following error
File "src/lxml/lxml.etree.pyx", line 2452, in lxml.etree._Attrib.__getitem__ (src/lxml/lxml.etree.c:68665)
KeyError: 'z'
Hi,
I just tried your tool for converting a simple gmsh mesh to the XDMF format (for fenics). I get a segfault. Converting to, for example, VTK works though.
Any ideas?
Can I expect the converter to handle gmsh's physical groups?
Thanks!
Some Exodus files fail to read with the following traceback:
Traceback (most recent call last):
File "/opt/miniconda3/envs/meshio/bin/meshio-convert", line 133, in <module>
_main()
File "/opt/miniconda3/envs/meshio/bin/meshio-convert", line 16, in _main
meshio.read(args.infile, file_format=args.input_format)
File "/opt/miniconda3/envs/meshio/lib/python3.6/site-packages/meshio/helpers.py", line 114, in read
out = vtk_io.read('exodus', filename)
File "/opt/miniconda3/envs/meshio/lib/python3.6/site-packages/meshio/vtk_io.py", line 119, in read
vtk_mesh = _read_exodusii_mesh(reader)
File "/opt/miniconda3/envs/meshio/lib/python3.6/site-packages/meshio/vtk_io.py", line 208, in _read_exodusii_mesh
assert len(vtk_mesh) == 1, 'More than one \'vtkUnstructuredGrid\' found!'
AssertionError: More than one 'vtkUnstructuredGrid' found!
(sample file to reproduce: sevenside.exo.zip)
or
Traceback (most recent call last):
File "/opt/miniconda3/envs/meshio/bin/meshio-convert", line 133, in <module>
_main()
File "/opt/miniconda3/envs/meshio/bin/meshio-convert", line 16, in _main
meshio.read(args.infile, file_format=args.input_format)
File "/opt/miniconda3/envs/meshio/lib/python3.6/site-packages/meshio/helpers.py", line 114, in read
out = vtk_io.read('exodus', filename)
File "/opt/miniconda3/envs/meshio/lib/python3.6/site-packages/meshio/vtk_io.py", line 119, in read
vtk_mesh = _read_exodusii_mesh(reader)
File "/opt/miniconda3/envs/meshio/lib/python3.6/site-packages/meshio/vtk_io.py", line 207, in _read_exodusii_mesh
assert vtk_mesh, 'No \'vtkUnstructuredGrid\' found!'
AssertionError: No 'vtkUnstructuredGrid' found!
(sample file to reproduce: hex_2_2_2.exo.zip)
I'm getting the following problem with python3 and pip install on jupyter (specifically on notebooks.azure.com):
!pip install meshio
Collecting meshio
Using cached meshio-1.7.4.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-build-564tyt8x/meshio/setup.py", line 11, in <module>
exec(f.read(), about)
File "/home/nbcommon/anaconda3_410/lib/python3.5/encodings/ascii.py", line 26, in decode
return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 71: ordinal not in range(128)
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-564tyt8x/meshio/
Clearly some kind of UTF-8 issue?
The Debian builders do not have a unicode locale set, and therefore your setup.py
fails to run with the system python3
interpreter:
>>> python3 setup.py clean
running clean
>>> LC_ALL=C python3 setup.py clean
Traceback (most recent call last):
File "setup.py", line 11, in <module>
exec(f.read(), about)
File "/usr/lib/python3.5/encodings/ascii.py", line 26, in decode
return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 73: ordinal not in range(128)
It works fine with Python 2.
When loading a vtk file using python3, there is an iteritems() call in vtk_io.py
points, cells, point_data, cell_data, field_data = meshio.read('output_95.vtu')
Traceback (most recent call last):
File "", line 1, in
File "/usr/local/lib/python3.5/site-packages/meshio/init.py", line 83, in read
return vtk_io.read('vtu', filename)
File "/usr/local/lib/python3.5/site-packages/meshio/vtk_io.py", line 96, in read
)
File "/usr/local/lib/python3.5/site-packages/meshio/vtk_io.py", line 54, in _read_cells
#for vtk_type, meshio_type in vtk_to_meshio_type.iteritems():
AttributeError: 'dict' object has no attribute 'iteritems'
Maybe we could use the future library to make the code compatible with python2 and python3?
Hi Nico,
I'm writing some gmsh tests for a model I'm developing, and I thought you may be interested as well (w.r.t meshio anyway). I want to have some example models built into the testing, and instead of carrying around .msh files, I'm using tempfile.NameTemplateFile
s They work slightly better than text buffers, and are deleted after use automatically. This is a nice alternative to having .msh files lying around for me since I'm constantly writing over them - I thought you might be interested. This works on both py2 and py3 on my machine
Example:
import meshio
import tempfile
gmsh_buffer = '''\
$MeshFormat
2.2 0 8
$EndMeshFormat
$PhysicalNames
5
1 1 "lower"
1 2 "right"
1 3 "upper"
1 4 "left"
2 5 "domain"
$EndPhysicalNames
$Nodes
9
1 0 0 0
2 1 0 0
3 1 1 0
4 0 1 0
5 0.499999999998694 0 0
6 1 0.499999999998694 0
7 0.5000000000020591 1 0
8 0 0.5000000000020591 0
9 0.5000000000003766 0.5000000000003766 0
$EndNodes
$Elements
12
1 1 2 1 1 1 5
2 1 2 1 1 5 2
3 1 2 2 2 2 6
4 1 2 2 2 6 3
5 1 2 3 3 3 7
6 1 2 3 3 7 4
7 1 2 4 4 4 8
8 1 2 4 4 8 1
9 3 2 5 1 1 5 9 8
10 3 2 5 1 8 9 7 4
11 3 2 5 1 5 2 6 9
12 3 2 5 1 9 6 3 7
$EndElements
'''
# Remember to remove indentation if the multi-line string is in a function
import textwrap
gmsh_buffer = textwrap.dedent(gmsh_buffer)
with tempfile.NamedTemporaryFile(suffix='.msh') as temp:
temp.write(gmsh_buffer.encode('utf-8'))
print(temp.name)
temp.flush()
points, cells, point_data, cell_data, field_data = meshio.read(temp.name)
(do all the things)
Cheers,
Chris
Is there any way currently to read in tags from the mesh file? for example: when reading the following triangle from a .msh file
13137 2 2 0 30 9328 13513 16999
I need to be able to read the second tag, ie the fact it belongs to object 30
Can't find a way to do this using meshio, so i'm having to read the file twice to get this information.
Cheers.
When loading the linked vtk file below with meshio.read, only some of the data is loaded. When viewing the file in paraview, there are 3 cell data fields: cauchy_strain, cauchy_stress, and mat_id. When loading with meshio.read, the cell_data only contains mat_id and cauchy_strain. cauchy_stress is missing for some reason.
https://drive.google.com/file/d/0B268R4ggA2GQMGdnNjNxZlhOMWM/view?usp=sharing
Hi Nico,
May I know how to convert a structured mesh with an array of cells and nodes to a vtk file?
Let's say I have a mesh with 30x30x20
cells, so the arrays of cells and nodes are given as follows:
np.size(cellsarray) = (18000, 3)
np.size(nodesarray) = (20181, 3)
Thanks.
Title is self-explanatory: a flag to skip output of this complementary data would be convenient, speeding up the conversion and saving to delete them.
Implement more mesh formats, e.g.,
Although you have point_data and cell_data information, seems like you didn't really take care of that in your code (Mostly I mean Gmsh format). If you don't have plans to add this feature. I will do this myself. Basicly I want to transform between our own FEM format/.msh format/abaqus .inp format/VTK format.
One problem is that VTK can't handle element node data as is in the .msh format. My work-around is to add repeated points on shared nodes. But visualization tools such as Paraview can't handle it very well. Those filters tends to merge coincident points and average those points. Actually I found your project when searching for better solutions. Any suggestions would be appreciated.
Unfortunately I can't share the whole Fluent .msh file, but I can share the beginning at least:
(0 machine configuration:)
(4 (60 0 0 1 2 4 4 4 8 4 8))
(0 grid written by ANSYS Meshing
nodes: (10 (id start end type) (x y z ...))
faces: (13 (id start end type elemType)
(v-0 v-1 .. v-n right-cell left-cell ...))
cells: (12 (id start end type elemtype))
parent-face: (59 (start end parent child) (nchilds child0 child1 ...))
)
(2 3)
(10 (0 1 5406dd 0))
(13 (0 1 2202aa7 0))
(12 (0 1 ece71a 0))
(3010 (3 1 430529 1 3)
(<9b>ĎDŘHřČ?5QÁ^K.SÚżBÉEÔe<82>Ĺżü VęGŢČ?Qn^Yum_Úż6Ś<8f>^]Ţ<9c>Ĺż\<81>Ú˘b]É?^[D<88>x.^^ÚżÜç<80>T<8a>^DĹż^_Oţă/$É?x=ůŐ<9a>3ÚżšłßB^DKĹżtň#rÎ^RÉ?
There are two issues:
Conversion of the attached file results into an empty mesh.
It seems this holds for arbitrary output format.
meshio-convert --output-format vtk-ascii blockcylinder-50.exo blockcylinder-50.vtk
even fails with
ValueError: need at least one array to concatenate
nektar++ .xml format
file:///home/ksansom/Downloads/user-guide-4.4.0.pdf
section 3.1
The patch is trivial, if you prefer a PR, let me know and I'll submit one with the diff below.
diff --git a/meshio/gmsh_io.py b/meshio/gmsh_io.py
index fc53da2..36aa8a8 100644
--- a/meshio/gmsh_io.py
+++ b/meshio/gmsh_io.py
@@ -30,6 +30,7 @@ num_nodes_per_cell = {
'pyramid14': 14,
'line4': 4,
'quad16': 16,
+ 'hexahedron64': 64,
}
# Translate meshio types to gmsh codes
@@ -52,6 +53,7 @@ _gmsh_to_meshio_type = {
14: 'pyramid14',
26: 'line4',
36: 'quad16',
+ 92: 'hexahedron64',
}
_meshio_to_gmsh_type = {v: k for k, v in _gmsh_to_meshio_type.items()}
I would like to add support for writing $PhysicalNames
sections:
$PhysicalNames
number-of-names
physical-dimension physical-number "physical-name"
…
$EndPhysicalNames
However, the read()
function returns field_data
missing the physical-dimension
information. I'm not sure what to do here regarding backward compatibility. Right now field_data
is a dict {"physical-name": physical-number, ...}
.
We can either make a backward incompatible change to output {"physical-name": (physical-dimension, physical-number), ...}
.
Or append some sort or private-looking special key, let say __gmsh@physical_dimension
mapping to a dict {"physical-name": physical-dimension, ...}
.
Just take a decision according to your preference, and I'll contribute the PR.
PS: My use case is high order meshes. I generate high order meshes with Gmsh, then I use meshio
to read it, extract the low-order mesh (i.e just the topology or skeleton of the mesh) and write it back to disk alongside with the high-order coordinates of each cell. Then I can feed a high-order DG-like code with these two pieces of information. However, right now I have no easy way to write back the $PhysicalNames
section, as the read()
function does not return the full info.
from fenics import *
mesh=Mesh()
XDMF = XDMFFile(mpi_comm_world(), "test.xdmf")
XDMF.read(mesh)
*** Error: Unable to recognise cell type.
*** Reason: Unknown value "".
If tetrahedras and triangles are present in a msh file, only tetrahedra are returned by msh_io.py.
if len(elems['tetrahedra']) > 0:
cells = elems['tetrahedra']
elif len(elems['triangles']) > 0:
cells = elems['triangles']
else:
raise RuntimeError('Expected at least triangles.')
return points, cells
An example msh file is attached, i.e. t2.msh
http://chunk.io/f/ff39b563d5a84431bf51255d3f7834e4
Any plans to support higher-order elements? I tried converting a 10-node tetrahedron from gmsh to XDMF, and got the error
vtk_type = meshio_to_vtk_type[meshio_type]
KeyError: 'tetra10'
The Gmsh data format offers several of data fields, e.g., ElementData
, NodeData
etc. On top of that, there a "Physical Groups", effectively tagging entities. It's not quite clear yet where this information fits in with other mesh formats.
when using the gmsh reader I encounter many errors of this type
ValueError: Mixing iteration and read methods would lose data
See this gist for a test that fails on my configuration
https://gist.github.com/capitalaslash/cf6d5d14735e79b4e501b28a6696cf4f
the key factor is the use of physical tags in the mesh.
the error is caused by the use of islice
, e.g. gmsh_io.py:111
for k, line in enumerate(islice(f, num_phys_names)):
line = line.decode('utf-8')
since islice
is implemented with next
, see
https://docs.python.org/2/library/itertools.html#itertools.islice
(at least in python2).
a possible solution is to replace those loops with something like
for k in range(num_phys_names):
line = f.readline().decode('utf-8')
that ensures a uniform use of readline
everywhere.
I don't know if this would affect performance significantly.
would you accept a patch along this way?
meshio-convert screw.msh screw.vtu
Traceback (most recent call last):
File "/home/nils/local/bin/meshio-convert", line 64, in
_main()
File "/home/nils/local/bin/meshio-convert", line 25, in _main
field_data=field_data
File "/home/nils/local/lib/python2.7/site-packages/meshio/init.py", line 84, in write
field_data=field_data
File "/home/nils/local/lib/python2.7/site-packages/meshio/vtk_io.py", line 204, in write
writer.SetInput(vtk_mesh)
AttributeError: SetInput
Hello,
I get a "Memory Error" when converting an ansys .msh to a vtu-binary.
In fact, it's a 3d volume mesh, but the code output says: "number of triangles."
Is it possible that it's recognizing the wrong kind of mesh?
Thank You,
Vitaly
It would be nice to have support for MED/Salome format as it's maybe the only mesh format which can be loaded directly into a distributed mesh structure by PETSc.
For anybody familiar with PETSc: DMPlexCreateMedFromFile() function employs DMPlexCreateFromCellListParallel())
annulus-20.exo.zip
We currently need an easy way to convert exodus files to the MED (Salome) format. One possibility we have come across is to convert exodus to gmsh using your tool meshio and then convert gmsh to med using GMSH. But we have been not successful yet with the meshio part, see the error below. I attach the exodus file (distributed with PETSc); it's nevertheless the same with any other exodus file I tried. It's also the case for both Python 2.7.13 and 3.6.2.
Do you have any idea, what's the issue?
Thank you for this nice contribution to the community!
$ meshio-convert --input-format exodus --output-format gmsh-ascii annulus-20.exo bla.msh
Traceback (most recent call last):
File "/opt/miniconda3/envs/p2/bin/meshio-convert", line 133, in <module>
_main()
File "/opt/miniconda3/envs/p2/bin/meshio-convert", line 16, in _main
meshio.read(args.infile, file_format=args.input_format)
File "/opt/miniconda3/envs/p2/lib/python2.7/site-packages/meshio/helpers.py", line 114, in read
out = vtk_io.read('exodus', filename)
File "/opt/miniconda3/envs/p2/lib/python2.7/site-packages/meshio/vtk_io.py", line 119, in read
vtk_mesh = _read_exodusii_mesh(reader)
File "/opt/miniconda3/envs/p2/lib/python2.7/site-packages/meshio/vtk_io.py", line 204, in _read_exodusii_mesh
if sub_block.IsA('vtkUnstructuredGrid'):
AttributeError: 'NoneType' object has no attribute 'IsA'
mmg uses the medit mesh format which is specified in the appendix of,
https://hal.inria.fr/hal-00681813/file/RT-422.pdf
I have a structured mesh as a vtk file that contains only mesh points and there is no associated data in that file besides the nodes. Using meshio.read('mesh.vtk')
gives the following error that ties to line 123 in vtk_io.py
because it seeks GetData()
in a file that does not have any:
# Explicitly extract points, cells, point data, field data
points = numpy.copy(numpy_support.vtk_to_numpy(
vtk_mesh.GetPoints().GetData()
))
Any suggestion? Could you include the capability to read just the mesh file? I was interested in converting vtk mesh to gmsh...so, if you think there will be further problems during conversion because of missing associated data then I would be interested to know. Thanks.
Converting .msh to .vtu gives an abort. it looks like it was able to read the mesh but not write it to file?
meshio-convert mesh.msh mesh.vtu
Number of points: 540930
Elements:
Number of triangles: 406420
Number of tetras: 2058564
Cell data: physical, geometrical
Fatal Python error: PyThreadState_Get: no current thread
Abort trap: 6
Hello,
Does the meshio support ANSYS Fluent .msh files? The documentation says that it does, but it looks like it only supports .gmsh files by the in the _init.py.
Thank You,
Vitaly
Hi,
It seems there is a typo which makes meshio to read physical entity number only....
At line #245 in gmsh_io.py
output_cell_data[key]['geometrical'] = cell_data[key][:, 0]
should be
output_cell_data[key]['geometrical'] = cell_data[key][:, 1]
Thank you.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.