forked from GazzolaLab/PyElastica
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request GazzolaLab#372 from skim0119/typing/timestepper
Typing: timestepper module
- Loading branch information
Showing
20 changed files
with
556 additions
and
341 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
__doc__ = """Base class for elastica system""" | ||
|
||
from typing import Protocol | ||
|
||
from elastica.typing import StateType | ||
from elastica.rod.data_structures import _KinematicState, _DynamicState | ||
|
||
import numpy as np | ||
from numpy.typing import NDArray | ||
|
||
|
||
class SystemProtocol(Protocol): | ||
""" | ||
Protocol for all elastica system | ||
""" | ||
|
||
@property | ||
def n_nodes(self) -> int: ... | ||
|
||
@property | ||
def position_collection(self) -> NDArray: ... | ||
|
||
@property | ||
def velocity_collection(self) -> NDArray: ... | ||
|
||
@property | ||
def acceleration_collection(self) -> NDArray: ... | ||
|
||
@property | ||
def omega_collection(self) -> NDArray: ... | ||
|
||
@property | ||
def alpha_collection(self) -> NDArray: ... | ||
|
||
@property | ||
def external_forces(self) -> NDArray: ... | ||
|
||
@property | ||
def external_torques(self) -> NDArray: ... | ||
|
||
|
||
class SymplecticSystemProtocol(SystemProtocol, Protocol): | ||
""" | ||
Protocol for system with symplectic state variables | ||
""" | ||
|
||
@property | ||
def kinematic_states(self) -> _KinematicState: ... | ||
|
||
@property | ||
def dynamic_states(self) -> _DynamicState: ... | ||
|
||
@property | ||
def rate_collection(self) -> NDArray: ... | ||
|
||
@property | ||
def dvdt_dwdt_collection(self) -> NDArray: ... | ||
|
||
def kinematic_rates( | ||
self, time: np.floating, prefac: np.floating | ||
) -> tuple[NDArray, NDArray]: ... | ||
|
||
def dynamic_rates( | ||
self, time: np.floating, prefac: np.floating | ||
) -> tuple[NDArray]: ... | ||
|
||
def update_internal_forces_and_torques(self, time: np.floating) -> None: ... | ||
|
||
|
||
class ExplicitSystemProtocol(SystemProtocol, Protocol): | ||
# TODO: Temporarily made to handle explicit stepper. | ||
# Need to be refactored as the explicit stepper is further developed. | ||
def __call__(self, time: np.floating, dt: np.floating) -> np.floating: ... | ||
@property | ||
def state(self) -> StateType: ... | ||
@state.setter | ||
def state(self, state: StateType) -> None: ... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.