From 2703e039596380f99a59c2b2f7e1e5412755e5f0 Mon Sep 17 00:00:00 2001 From: David Date: Thu, 18 Jan 2024 15:57:59 +0100 Subject: [PATCH] Ensure no Overflow for get_nodes_with_one_face function --- saenopy/multigrid_helper.py | 1 + 1 file changed, 1 insertion(+) diff --git a/saenopy/multigrid_helper.py b/saenopy/multigrid_helper.py index aecbe0f1..2364d408 100644 --- a/saenopy/multigrid_helper.py +++ b/saenopy/multigrid_helper.py @@ -93,6 +93,7 @@ def get_nodes_with_one_face(tetrahedra): faces = np.sort(np.array(tetrahedra[:, [[0, 1, 2], [0, 1, 3], [0, 2, 3], [1, 2, 3]]]).reshape(-1, 3), axis=1) # encode the faces as integers maxi = np.max(faces) + 1 + assert maxi<=(np.iinfo(faces.dtype).max)**(1/3) face_index = faces[:, 0] * maxi ** 2 + faces[:, 1] * maxi ** 1 + faces[:, 2] # count how often each face is present face_counts = pd.Series(face_index).value_counts()