def test_calc_j_tensor(self, d_type): E = np.ones((10, 3)) s = np.tile((1, 0, 0, 0, 0.1, 0, 0, 0, 0.01), (10, 1)) J = fem.calc_J(d_type(E), d_type(s)) assert np.allclose(J[:, 0], 1) assert np.allclose(J[:, 1], 0.1) assert np.allclose(J[:, 2], 0.01)
def test_calc_j_scalar(self, d_type): E = np.ones((10, 3)) s = np.arange(10) J = fem.calc_J(d_type(E), d_type(s)) assert np.allclose(J, np.tile(np.arange(10), (3, 1)).T)