wip: test case for compute_additional_segment
@@ -11,9 +11,10 @@ from elastica.rod.data_structures import (
)
from elastica.utils import MaxDimension
-from test_rod.test_rods import MockTestRod
+from test_rods import MockTestRod
from elastica.rod.rod_base import RodBase
+from elastica.rod.knot_theory import _compute_additional_segment
@pytest.fixture
@@ -54,3 +55,49 @@ def test_knot_theory_mixin_methods_with_no_radius(knot_theory):
rod.compute_writhe()
with pytest.raises(AttributeError) as e_info:
rod.compute_link()
+
+
+@pytest.mark.parametrize("timesteps", [1, 5, 10])
+@pytest.mark.parametrize("n_elem", [1, 3, 8])
+@pytest.mark.parametrize("segment_length", [1.0, 10.0, 100.0])
+def test_knot_theory_compute_additional_segment_next_tangent_case(
+ timesteps, n_elem, segment_length
+):
+ ...
+
+
+@pytest.mark.parametrize("timesteps", [1, 5, 10])
+@pytest.mark.parametrize("n_elem", [1, 3, 8])
+@pytest.mark.parametrize("segment_length", [1.0, 10.0, 100.0])
+def test_knot_theory_compute_additional_segment_end_to_end_case(
+ timesteps, n_elem, segment_length
+):
+ ...
+
+
+@pytest.mark.parametrize("timesteps", [1, 5, 10])
+@pytest.mark.parametrize("n_elem", [1, 3, 8])
+@pytest.mark.parametrize("segment_length", [1.0, 10.0, 100.0])
+def test_knot_theory_compute_additional_segment_net_tangent_case(
+ timesteps, n_elem, segment_length
+):
+ ...
+
+
+@pytest.mark.parametrize("timesteps", [1, 5, 10])
+@pytest.mark.parametrize("n_elem", [1, 3, 8])
+@pytest.mark.parametrize("segment_length", [1.0, 10.0, 100.0])
+def test_knot_theory_compute_additional_segment_none_case(
+ timesteps, n_elem, segment_length
+):
+ center_line = np.random.random([timesteps, 3, n_elem])
+ new_center_line, beginning_direction, end_direction = _compute_additional_segment(
+ center_line, segment_length, None
+ )
+
+ assert_allclose(new_center_line, center_line)
+ assert_allclose(beginning_direction, 0.0)
+ assert_allclose(end_direction, 0.0)
+ assert_allclose(new_center_line.shape, [timesteps, 3, n_elem])
+ assert_allclose(beginning_direction.shape[0], timesteps)
+ assert_allclose(end_direction.shape[0], timesteps)
