Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
jrmaddison committed May 28, 2024
1 parent 22da9bb commit e69455a
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions tlm_adjoint/block_system.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@
"""

from .interface import (
comm_dup_cached, packed, space_comm, space_default_space_type, space_eq,
space_new, var_assign, var_locked, var_zero)
Packed, comm_dup_cached, packed, space_comm, space_default_space_type,
space_eq, space_new, var_assign, var_locked, var_zero)
from .manager import manager_disabled
from .petsc import (
PETScOptions, PETScVec, PETScVecInterface, attach_destroy_finalizer)
Expand Down Expand Up @@ -113,7 +113,7 @@ def expand(e):

q = deque(map(expand, iterable))
while len(q) > 0:
e = packed(q.popleft())
e = Packed(q.popleft())
if e.is_packed:
e, = e
yield e
Expand All @@ -125,7 +125,7 @@ def tuple_sub(iterable, sequence):
iterator = iter_sub(iterable)

def tuple_sub(iterator, value):
value = packed(value)
value = Packed(value)
if value.is_packed:
return next(iterator)
else:
Expand Down Expand Up @@ -859,18 +859,20 @@ def solve(self, u, b, *,
the solution.
"""

u = packed(u)
b = packed(b)
u_packed = Packed(u)
b_packed = Packed(b)
u = tuple(u_packed)
b = tuple(b_packed)

pc_fn = self._pc_fn
if u.is_packed:
if u_packed.is_packed:
pc_fn_u = pc_fn

def pc_fn(u, b):
u, = tuple(iter_sub(u))
pc_fn_u(u, b)

if b.is_packed:
if b_packed.is_packed:
pc_fn_b = pc_fn

def pc_fn(u, b):
Expand Down

0 comments on commit e69455a

Please sign in to comment.