format & lint
@@ -8,7 +8,6 @@ from itertools import chain, islice
import numpy
from .._common import _pick_first_int_data
-
from .._exceptions import ReadError
from .._files import open_file
from .._helpers import register
@@ -76,15 +75,12 @@ def read_buffer(f):
try:
name, rest_of_line = line.split("=")
- except:
+ except ValueError:
logging.warning(
- "meshio could not parse line\n {}\n skipping....."
- .format(line)
+ "meshio could not parse line\n {}\n skipping.....".format(line)
)
continue
-
-
if name == "NDIME":
dim = int(rest_of_line)
if dim != 2 and dim != 3:
@@ -116,7 +112,6 @@ def read_buffer(f):
# add the first line we read separately
points = numpy.vstack([first_line, points])
-
elif name == "NELEM" or name == "MARKER_ELEMS":
# we cannot? read at onece using numpy becasue we do not know the
# total size. Read, instead next num_elems as is and re-use the
@@ -149,7 +144,9 @@ def read_buffer(f):
for eltype, data in cells_.items():
cells.append(CellBlock(eltype, data))
if name == "NELEM":
- cell_data["su2:tag"].append(numpy.full(num_elems, 0,dtype=numpy.int32))
+ cell_data["su2:tag"].append(
+ numpy.full(num_elems, 0, dtype=numpy.int32)
+ )
else:
tags = numpy.full(num_elems, next_tag_id, dtype=numpy.int32)
cell_data["su2:tag"].append(tags)
@@ -170,9 +167,12 @@ def read_buffer(f):
)
markers_found += 1
-
- #if markers_found > 0 and markers_found == expected_nmarkers :
- # break
+ if markers_found != markers_found == expected_nmarkers:
+ logging.warning(
+ "expected {} markes according to NMARK value but found only {}".format(
+ expected_nmarkers, markers_found
+ )
+ )
return Mesh(points, cells, cell_data=cell_data)
@@ -293,7 +293,6 @@ def write(filename, mesh):
f.write("NMARK= {}\n".format(len(tags_per_cell_block)).encode("utf-8"))
-
# write the blocks you found in previous step
for tag, count in tags_per_cell_block.items():
