From 6ce47382a33e801806a61f9e0c01bf1f36a92443 Mon Sep 17 00:00:00 2001 From: Ali-7800 <47090295+Ali-7800@users.noreply.github.com> Date: Mon, 2 Oct 2023 17:12:50 -0500 Subject: [PATCH] fixed contact test issue --- elastica/contact_forces.py | 6 +++--- elastica/contact_utils.py | 4 ++-- tests/test_contact_classes.py | 6 +++--- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/elastica/contact_forces.py b/elastica/contact_forces.py index 274723b12..7cf4f0688 100644 --- a/elastica/contact_forces.py +++ b/elastica/contact_forces.py @@ -753,8 +753,8 @@ def apply_contact( system_one.lengths, system_two.position_collection, system_two.director_collection, - system_two.radius, - system_two.length, + system_two.radius[0], + system_two.length[0], ): return @@ -945,7 +945,7 @@ def apply_contact(self, system_one: RodType, system_two: SystemType): system_one.lengths, system_two.position_collection, system_two.director_collection, - system_two.radius, + system_two.radius[0], ): return diff --git a/elastica/contact_utils.py b/elastica/contact_utils.py index 027ae4818..58e76829f 100644 --- a/elastica/contact_utils.py +++ b/elastica/contact_utils.py @@ -136,7 +136,7 @@ def _prune_using_aabbs_rod_cylinder( # d^T @ Q cylinder_dimensions_in_local_FOR = np.array( [cylinder_radius, cylinder_radius, 0.5 * cylinder_length] - ).reshape(3) + ) cylinder_dimensions_in_world_FOR = np.zeros_like(cylinder_dimensions_in_local_FOR) for i in range(3): for j in range(3): @@ -213,7 +213,7 @@ def _prune_using_aabbs_rod_sphere( sphere_dimensions_in_local_FOR = np.array( [sphere_radius, sphere_radius, sphere_radius] - ).reshape(3) + ) sphere_dimensions_in_world_FOR = np.zeros_like(sphere_dimensions_in_local_FOR) for i in range(3): for j in range(3): diff --git a/tests/test_contact_classes.py b/tests/test_contact_classes.py index 58b34e902..0c347a12a 100644 --- a/tests/test_contact_classes.py +++ b/tests/test_contact_classes.py @@ -53,11 +53,11 @@ def mock_sphere_init(self): "Details of initialization are given in test_contact_specific_functions.py" self.n_elems = 1 - self.position = np.array([[0], [0], [0]]) - self.director = np.array( + self.position_collection = np.array([[0], [0], [0]]) + self.director_collection = np.array( [[[1.0], [0.0], [0.0]], [[0.0], [1.0], [0.0]], [[0.0], [0.0], [1.0]]] ) - self.radius = 1.0 + self.radius = np.array([1.0]) self.velocity_collection = np.array([[0.0], [0.0], [0.0]]) self.external_forces = np.array([[0.0], [0.0], [0.0]]) self.external_torques = np.array([[0.0], [0.0], [0.0]])