diff --git a/data/NX simulation output.uff b/data/NX simulation output.uff index b99bcc4..49eb920 100644 --- a/data/NX simulation output.uff +++ b/data/NX simulation output.uff @@ -16,7 +16,7 @@ NX: Correlation -1 -1 2400 - 13 7 +1 0 + 13 7 -1 0 Fem1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 diff --git a/pyuff/pyuff.py b/pyuff/pyuff.py index 939f4f5..7946640 100644 --- a/pyuff/pyuff.py +++ b/pyuff/pyuff.py @@ -186,7 +186,16 @@ def refresh(self): ind = data.find(b' -1', ind + 1) if ind == -1: break - block_ind.append(ind) + if ind+6 == data_len: + block_ind.append(ind) + # Check if the block is valid and ends with LF or CR + elif ind+6 < data_len and data[ind+6] in [10, 13]: + block_ind.append(ind) + # Check the line continues with blanks up to character 80 + elif ind+80 < data_len and data[ind+6:ind+80] == \ + b' ': + block_ind.append(ind) + block_ind = np.asarray(block_ind, dtype='int64') # Constructs block indices of start and end values; each pair diff --git a/tests/test_58.py b/tests/test_58.py index 2370cc3..53dbe39 100644 --- a/tests/test_58.py +++ b/tests/test_58.py @@ -288,8 +288,7 @@ def test_write_read_func_type_0(): if __name__ == '__main__': - test_read_write_read_given_data() - test_write_read_func_type_0() + test_fix_58b() if __name__ == '__mains__': np.testing.run_module_suite() \ No newline at end of file