restrict test to reasonable values
This commit is contained in:
parent
a0e6742197
commit
8d93079801
|
@ -129,10 +129,12 @@ class TestMechanics:
|
||||||
@pytest.mark.parametrize('vectorized,single',[(mechanics.strain,strain)])
|
@pytest.mark.parametrize('vectorized,single',[(mechanics.strain,strain)])
|
||||||
def test_vectorize_strain(self,vectorized,single):
|
def test_vectorize_strain(self,vectorized,single):
|
||||||
F = np.random.rand(self.n,3,3)
|
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))
|
F_vec = np.reshape(F,(self.n//10,10,3,3))
|
||||||
t = ['V','U'][np.random.randint(0,2)]
|
t = ['V','U'][np.random.randint(0,2)]
|
||||||
m = np.random.random()*10.0 -5.0
|
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)):
|
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)
|
assert np.allclose(single(F[i],t,m),v)
|
||||||
|
|
||||||
@pytest.mark.parametrize('function',[mechanics.stress_Cauchy,
|
@pytest.mark.parametrize('function',[mechanics.stress_Cauchy,
|
||||||
|
|
Loading…
Reference in New Issue