Skip to content

Commit

Permalink
🐛 🔥 Initialize feature group
Browse files Browse the repository at this point in the history
The feature gropu should be initialized before initializing mixin group.
this is not an issue for single-instance simulator, but it will become
an issue for creating multiple simulator, because list are defined
class-wise.
  • Loading branch information
skim0119 committed Mar 10, 2022
1 parent d8f197d commit c51d280
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions elastica/wrappers/base_system.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,17 @@ class BaseSystemCollection(MutableSequence):
https://stackoverflow.com/q/3945940
"""

# Collection of functions. Each group is executed as a collection at the different steps.
# Each component (Forcing, Connection, etc.) registers the executable (callable) function
# in the group that that needs to be executed.
_feature_group_synchronize: Iterable[Callable[[float], None]] = []
_feature_group_constrain_values: Iterable[Callable[[float], None]] = []
_feature_group_constrain_rates: Iterable[Callable[[float], None]] = []
_feature_group_callback: Iterable[Callable[[float, int, AnyStr], None]] = []
_feature_group_finalize: Iterable[Callable] = []

def __init__(self):
# Collection of functions. Each group is executed as a collection at the different steps.
# Each component (Forcing, Connection, etc.) registers the executable (callable) function
# in the group that that needs to be executed. These should be initialized before mixin.
self._feature_group_synchronize: Iterable[Callable[[float], None]] = []
self._feature_group_constrain_values: Iterable[Callable[[float], None]] = []
self._feature_group_constrain_rates: Iterable[Callable[[float], None]] = []
self._feature_group_callback: Iterable[
Callable[[float, int, AnyStr], None]
] = []
self._feature_group_finalize: Iterable[Callable] = []
# We need to initialize our mixin classes
super(BaseSystemCollection, self).__init__()
# List of system types/bases that are allowed
Expand Down

0 comments on commit c51d280

Please sign in to comment.