Skip to content

Commit

Permalink
Merge pull request #1099 from Spectre5/nastran-long-support
Browse files Browse the repository at this point in the history
Nastran long support
  • Loading branch information
nschloe authored May 8, 2021
2 parents d0cac27 + 5b5f3a7 commit d900512
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/meshio/nastran/_nastran.py
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ def _chunk_line(line):
chunks = line.split(",")
else: # fixed format
CHUNK_SIZE = 8
chunks = [line[i : CHUNK_SIZE + i] for i in range(0, len(line), CHUNK_SIZE)]
chunks = [line[i : CHUNK_SIZE + i] for i in range(0, 72, CHUNK_SIZE)]
# everything after the 9th chunk is ignored
return chunks[:9]

Expand Down
16 changes: 16 additions & 0 deletions tests/test_nastran.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import io
import pathlib

import helpers
Expand Down Expand Up @@ -46,3 +47,18 @@ def test_reference_file(filename):
"tetra": 5309,
}
assert {k: v.sum() for k, v in mesh.cells} == ref_num_cells


def test_long_format():
filename = io.StringIO(
"BEGIN BULK\n"
"GRID* 43 1.50000000000000 0.0\n"
"* 0.\n"
"ENDDATA\n"
)

mesh = meshio.read(filename, "nastran")

# points
assert len(mesh.points) == 1
assert np.isclose(mesh.points.sum(), 1.5)

0 comments on commit d900512

Please sign in to comment.