Skip to content

Commit

Permalink
fix for gmsh tag reads
Browse files Browse the repository at this point in the history
  • Loading branch information
nschloe committed Jun 11, 2018
1 parent 99817d1 commit 8c4c11d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
11 changes: 6 additions & 5 deletions meshio/gmsh_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,8 @@ def read(filename):
"""Reads a Gmsh msh file.
"""
with open(filename, "rb") as f:
out = read_buffer(f)
return out
mesh = read_buffer(f)
return mesh


def _read_header(f, int_size):
Expand Down Expand Up @@ -261,9 +261,10 @@ def _read_cells(f, cells, int_size, is_ascii):
# two tags (physical and elementary tags).
# <<<
num_tags = data[2]
if t not in cell_tags:
cell_tags[t] = []
cell_tags[t].append(data[3 : 3 + num_tags])
if num_tags > 0:
if t not in cell_tags:
cell_tags[t] = []
cell_tags[t].append(data[3 : 3 + num_tags])

# convert to numpy arrays
for key in cells:
Expand Down
2 changes: 1 addition & 1 deletion meshio/mesh.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def __repr__(self):
for cell_type in self.cell_data:
cell_data_keys = cell_data_keys.union(self.cell_data[cell_type].keys())
if cell_data_keys:
print("Cell data: {}".format(", ".join(cell_data_keys)))
lines.append("Cell data: {}".format(", ".join(cell_data_keys)))

return "\n".join(lines)

Expand Down

0 comments on commit 8c4c11d

Please sign in to comment.