Skip to content

Commit

Permalink
wip: testing functional operator listing
Browse files Browse the repository at this point in the history
  • Loading branch information
skim0119 committed Jun 30, 2024
1 parent cddfa60 commit 271c0fc
Showing 1 changed file with 5 additions and 18 deletions.
23 changes: 5 additions & 18 deletions elastica/modules/contact.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,13 @@
from typing_extensions import Self
from elastica.typing import (
SystemIdxType,
OperatorFinalizeType,
OperatorType,
StaticSystemType,
SystemType,
)
from .protocol import SystemCollectionProtocol, ModuleProtocol

import logging
import functools

import numpy as np

Expand Down Expand Up @@ -79,17 +78,6 @@ def _finalize_contact(self: SystemCollectionProtocol) -> None:
# (first_rod_idx, second_rod_idx)
# to apply the contacts to

def apply_contact(
time: np.float64,
contact_instance: NoContact,
first_sys_idx: SystemIdxType,
second_sys_idx: SystemIdxType,
) -> None:
contact_instance.apply_contact(
system_one=self[first_sys_idx],
system_two=self[second_sys_idx],
)

for contact in self._contacts:
first_sys_idx, second_sys_idx = contact.id()
contact_instance = contact.instantiate()
Expand All @@ -98,12 +86,11 @@ def apply_contact(
self[first_sys_idx],
self[second_sys_idx],
)
func = functools.partial(
apply_contact,
contact_instance=contact_instance,
first_sys_idx=first_sys_idx,
second_sys_idx=second_sys_idx,
func: OperatorType = lambda time: contact_instance.apply_contact(
system_one=self[first_sys_idx],
system_two=self[second_sys_idx],
)

self._feature_group_synchronize.add_operators(contact, [func])

if not self._feature_group_synchronize.is_last(contact):
Expand Down

0 comments on commit 271c0fc

Please sign in to comment.