From 1e395ab59d46b09a39ae09cef5d4af6badabec0c Mon Sep 17 00:00:00 2001 From: Seung Hyun Kim Date: Tue, 25 Jun 2024 07:45:27 -0500 Subject: [PATCH] revert: catenary case --- examples/CatenaryCase/catenary.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/examples/CatenaryCase/catenary.py b/examples/CatenaryCase/catenary.py index 6a2d9e88..d6fd787b 100644 --- a/examples/CatenaryCase/catenary.py +++ b/examples/CatenaryCase/catenary.py @@ -1,6 +1,5 @@ import numpy as np from elastica import * -from elastica.typing import SystemType, SystemCollectionType, SymplecticStepperProtocol from post_processing import ( plot_video, @@ -12,7 +11,7 @@ class CatenarySimulator(BaseSystemCollection, Constraints, Forcing, Damping, Cal pass -catenary_sim: SystemCollectionType = CatenarySimulator() +catenary_sim = CatenarySimulator() final_time = 10 damping_constant = 0.3 time_step = 1e-4 @@ -38,7 +37,7 @@ class CatenarySimulator(BaseSystemCollection, Constraints, Forcing, Damping, Cal poisson_ratio = 0.5 shear_modulus = E / (poisson_ratio + 1.0) -base_rod: SystemType = CosseratRod.straight_rod( +base_rod = CosseratRod.straight_rod( n_elem, start, direction, @@ -77,11 +76,11 @@ class CatenaryCallBack(CallBackBaseClass): """ def __init__(self, step_skip: int, callback_params: dict): - super().__init__() + CallBackBaseClass.__init__(self) self.every = step_skip self.callback_params = callback_params - def make_callback(self, system: SystemType, time: float, current_step: int) -> None: + def make_callback(self, system, time, current_step: int): if current_step % self.every == 0: @@ -94,7 +93,7 @@ def make_callback(self, system: SystemType, time: float, current_step: int) -> N return -pp_list: dict = defaultdict(list) +pp_list = defaultdict(list) catenary_sim.collect_diagnostics(base_rod).using( CatenaryCallBack, step_skip=step_skip, callback_params=pp_list ) @@ -103,7 +102,7 @@ def make_callback(self, system: SystemType, time: float, current_step: int) -> N catenary_sim.finalize() -timestepper: SymplecticStepperProtocol = PositionVerlet() +timestepper = PositionVerlet() integrate(timestepper, catenary_sim, final_time, total_steps) position = np.array(pp_list["position"])