Skip to content

Commit

Permalink
misc: Tidy and investigations
Browse files Browse the repository at this point in the history
  • Loading branch information
EdCaunt committed Jan 3, 2025
1 parent 33fdceb commit ae0be23
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 13 deletions.
14 changes: 4 additions & 10 deletions devito/ir/equations/algorithms.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,6 @@ def _concretize_subdims(a, mapper, rebuilt, sregistry):
def _(v, mapper, rebuilt, sregistry):
for i in v:
_concretize_subdims(i, mapper, rebuilt, sregistry)
print()


@_concretize_subdims.register(Eq)
Expand All @@ -236,9 +235,6 @@ def _(expr, mapper, rebuilt, sregistry):
thicknesses = {i for i in expr.free_symbols if isinstance(i, Thickness)}
symbols = expr.free_symbols.difference(thicknesses)

# FIXME: Maybe this iteration sequence is still wonky
print("Iteration sequence", tuple(symbols) + tuple(thicknesses))

for d in tuple(symbols) + tuple(thicknesses):
_concretize_subdims(d, mapper, rebuilt, sregistry)

Expand Down Expand Up @@ -272,8 +268,6 @@ def _(d, mapper, rebuilt, sregistry):
# Already have a substitution for this dimension
return

print("ConditionalDimension", d, d.parent)

_concretize_subdims(d.parent, mapper, rebuilt, sregistry)

kwargs = {}
Expand All @@ -282,8 +276,6 @@ def _(d, mapper, rebuilt, sregistry):
if d.parent in mapper:
kwargs['parent'] = mapper[d.parent]

print("Mapper before", mapper)

# Condition may contain subdimensions
if d.condition is not None:
for v in d.condition.free_symbols:
Expand All @@ -294,10 +286,12 @@ def _(d, mapper, rebuilt, sregistry):
# Substitute into condition
kwargs['condition'] = d.condition.subs(mapper)

# NOTE: Seems like wrong symbol gets substituted here
# OR alternatively, the wrong symbol was injected into the
# conditional when the offset was originally introduced
print("Condition before", d.condition)
print("kwargs['condition']", kwargs['condition'])

print("Mapper after", mapper)

if kwargs:
# Rebuild if parent or condition need replacing
mapper[d] = d._rebuild(**kwargs)
Expand Down
6 changes: 3 additions & 3 deletions devito/operations/interpolators.py
Original file line number Diff line number Diff line change
Expand Up @@ -319,16 +319,16 @@ def _interp_idx(self, variables, implicit_dims=None, pos_only=()):
smapper = {}
# Substitution from ConditionalDimensions to rebuilt dimensions
cdmapper = {}
# Need to adjust bounds if Function defined on a SubDomain
if subdomain:
adjust_interp_indices(subdomain, mapper, smapper, cdmapper)

# Index substitution to make in variables
i_subs = {k: c + p for ((k, c), p) in zip(mapper.items(), pos)}
# FIXME: Looks like this isn't working as intended
if subdomain: # Add subdimension substitutions if necessary
# Need to adjust bounds if Function defined on a SubDomain
adjust_interp_indices(subdomain, mapper, smapper, cdmapper)
i_subs.update({k: c + p for ((k, c), p) in zip(smapper.items(), pos)})

print("mapper", mapper)
print("smapper", smapper)
print("i_subs", i_subs)

Expand Down

0 comments on commit ae0be23

Please sign in to comment.