Open SBFRF opened 4 years ago
So i've dug a little deeper, it doesn't seem like the meshio.read actually reads the files appropriately. I've written this to solve my problem, but i'm not sure if it's helpful for the library as a whole (as i don't throughly know the gmsh conventions, but thought i'd leave it here in case it is. (based on one of your old stack posts) https://stackoverflow.com/questions/41641505/read-formatted-data-from-part-of-a-file-fast-gmsh-mesh-format
####################
f = open(fname)
f.readline() # '$MeshFormat\n'
f.readline() # '2.2 0 8\n'
f.readline() # '$EndMeshFormat\n'
f.readline() # '$Nodes\n'
n_nodes = int(f.readline()) # '8\n'
nodes = np.fromfile(f,count=n_nodes*4, sep=" ").reshape((n_nodes,4))
f.readline() # '$EndNodes\n'
f.readline() # '$Elements\n'
n_elems = int(f.readline()) # '2\n'
boundary, internalTriangles = [], []
for ee in range(n_elems):
data = f.readline().split()
if len(data) is 6:
# if boundary will have only
boundary.append(np.array(data, dtype=int))
elif len(data) is 9:
internalTriangles.append(np.array(data, dtype=int))
assert f.readline() is '$EndElements\n', "File didn't read properly"
boundary = np.array(boundary)
internalTriangles = np.array(internalTriangles)
So I've looked at the mesh now, trying to find out if this is still an issue. Turns out that not even Gmsh itself can read the file. Error:
Error : Wrong node index 0
Error : Error loading '/tmp/Mesh_interp_Mar2018.msh'
Info : Done reading '/tmp/Mesh_interp_Mar2018.msh'
The tags of the triangles are also weird:
# idx type num_tags tag1 tag2 tag3 point_indices
2950 2 3 0 44 0 13666 2532 2533
2951 2 3 0 45 0 17054 2902 2903
2952 2 3 0 46 0 31565 71067 71496
2953 2 3 0 47 0 22182 22181 2906
2954 2 3 0 48 0 21467 21250 41879
2955 2 3 0 49 0 17022 34885 4330
2956 2 3 0 50 0 22181 35162 22179
2957 2 3 0 51 0 2901 46456 2900
The second tag ("geometrical entity") is different for every single triangle? That seems wrong.
Anyway, can't say if this is/was an actual meshio issue. If OP can shed some light on this, that'd be great. If not, I'll close this at some point.
@Thesser1 Do you know anything more about the gmsh file for ww3 that would be helpful here?
@Thesser1 Do you know anything more about the gmsh file for ww3 that would be helpful here?
I'm trying to read a mesh in, then write it. I use meshio to read the file in then i go to write it out and get the below error.
PR #524 has the same error output, and the response suggests that the capability is not supported yet. I'm not too familiar with the different mesh types or conventions associated. Hopefully I'm not duplicating, but I used to be able to write them out so I'm thinking that something else is going on or I'm wondering if something has changed in the package (or maybe there is something else I'm missing). I've attached the mesh in a tarball.
Mesh_interp_Mar2018.msh.tar.gz
I appreciate any help!