From d733ca1dd691229a4861c6cd6b584baf72310308 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?HUANG=20Lihao=20=28=E9=BB=84=E7=AB=8B=E6=98=8A=29?=
 <vincent.skywalker@outlook.com>
Date: Mon, 27 Nov 2023 15:20:19 +0100
Subject: [PATCH] Abaqus only allows 16 integer per line in the element
 definition part.

Abaqus only allows 16 integer per line in the element definition part.
---
 src/meshio/abaqus/_abaqus.py | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

Index: python-meshio/src/meshio/abaqus/_abaqus.py
===================================================================
--- python-meshio.orig/src/meshio/abaqus/_abaqus.py	2024-10-24 10:39:22.125622324 +0200
+++ python-meshio/src/meshio/abaqus/_abaqus.py	2024-10-24 10:39:22.121622285 +0200
@@ -411,6 +411,7 @@
         for k, x in enumerate(mesh.points):
             f.write(fmt.format(k + 1, *x))
         eid = 0
+        nnl = 16
         for cell_block in mesh.cells:
             cell_type = cell_block.type
             node_idcs = cell_block.data
@@ -420,8 +421,17 @@
             f.write(f"*ELEMENT, TYPE={name}\n")
             for row in node_idcs:
                 eid += 1
-                nids_strs = (str(nid + 1) for nid in row.tolist())
-                f.write(str(eid) + "," + ",".join(nids_strs) + "\n")
+                eid_nids_strs = [str(eid)]
+                eid_nids_strs.extend(
+                    str(nid + 1) for nid in row.tolist()
+                )
+                f.write(
+                    ",\n".join(
+                        ",".join(eid_nids_strs[i : i + nnl])
+                        for i in range(0, len(eid_nids_strs), nnl)
+                    )
+                    + "\n"
+                )
 
         nnl = 8
         offset = 0
