From 8d93079801ec9d84c2907077bb83705d37047524 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Mon, 29 Jan 2024 16:20:28 +0100 Subject: [PATCH] restrict test to reasonable values --- python/tests/test_mechanics.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/python/tests/test_mechanics.py b/python/tests/test_mechanics.py index 8557587fe..00fc71f10 100644 --- a/python/tests/test_mechanics.py +++ b/python/tests/test_mechanics.py @@ -129,10 +129,12 @@ class TestMechanics: @pytest.mark.parametrize('vectorized,single',[(mechanics.strain,strain)]) def test_vectorize_strain(self,vectorized,single): F = np.random.rand(self.n,3,3) + F = np.einsum('...ij,...jk',F,F) # positive determinant F_vec = np.reshape(F,(self.n//10,10,3,3)) t = ['V','U'][np.random.randint(0,2)] m = np.random.random()*10.0 -5.0 for i,v in enumerate(np.reshape(vectorized(F_vec,t,m),vectorized(F,t,m).shape)): + if np.linalg.det(F[i]) < 1.e-10: continue assert np.allclose(single(F[i],t,m),v) @pytest.mark.parametrize('function',[mechanics.stress_Cauchy,