From 7acef6c31dcb5835860c06b97fc1c6ea643b1106 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Ravent=C3=B3s?= Date: Thu, 13 Jun 2024 09:23:56 +0200 Subject: [PATCH] Minor bug in new test_compute_mesh_spheres --- tests/test_mesh.py | 37 ++++++++++++++++++------------------- 1 file changed, 18 insertions(+), 19 deletions(-) diff --git a/tests/test_mesh.py b/tests/test_mesh.py index 3a435f1..1b64736 100644 --- a/tests/test_mesh.py +++ b/tests/test_mesh.py @@ -75,30 +75,29 @@ def test_move_mesh(self): for r in mesh.eradius: self.assertLessEqual(r, max_cell_circumradius * 1.001) + def test_compute_mesh_spheres(self): + + coord = np.array( + [ + [-1.3856244e02, 6.9698529e02, -2.9481543e02], + [5.1198740e02, 5.7321143e02, -1.3369661e01], + [-2.4491163e-01, -2.4171574e-01, 1.4720881e-01], + [2.7638666e02, 6.1436609e02, -3.7048819e02], + ] + ) -def test_compute_mesh_spheres(self): - - coord = np.array( - [ - [-1.3856244e02, 6.9698529e02, -2.9481543e02], - [5.1198740e02, 5.7321143e02, -1.3369661e01], - [-2.4491163e-01, -2.4171574e-01, 1.4720881e-01], - [2.7638666e02, 6.1436609e02, -3.7048819e02], - ] - ) - - enod = np.array([[0, 1, 2, 3]]) - mesh = TetraMesh.generate_mesh_from_vertices(coord, enod) + enod = np.array([[0, 1, 2, 3]]) + mesh = TetraMesh.generate_mesh_from_vertices(coord, enod) - theta = np.deg2rad(1e-4) - c, s = np.cos(theta), np.sin(theta) - R_z = np.array([[c, -s, 0], [s, c, 0], [0, 0, 1]]) + theta = np.deg2rad(1e-4) + c, s = np.cos(theta), np.sin(theta) + R_z = np.array([[c, -s, 0], [s, c, 0], [0, 0, 1]]) - rotated_coord = R_z.dot(mesh.coord.T).T + rotated_coord = R_z.dot(mesh.coord.T).T - eradius_rotated, _ = mesh._compute_mesh_spheres(rotated_coord, mesh.enod) + eradius_rotated, _ = mesh._compute_mesh_spheres(rotated_coord, mesh.enod) - self.assertAlmostEqual(mesh.eradius[0], eradius_rotated[0]) + self.assertAlmostEqual(mesh.eradius[0], eradius_rotated[0]) def test_update(self): rotation_axis = np.array([0, 0, 1.0])