From ae0be237f27be30144ac5202f216dda9dd6c249a Mon Sep 17 00:00:00 2001 From: Edward Caunt Date: Fri, 3 Jan 2025 10:18:21 +0000 Subject: [PATCH] misc: Tidy and investigations --- devito/ir/equations/algorithms.py | 14 ++++---------- devito/operations/interpolators.py | 6 +++--- 2 files changed, 7 insertions(+), 13 deletions(-) diff --git a/devito/ir/equations/algorithms.py b/devito/ir/equations/algorithms.py index 9337a47102..f424bb0cc3 100644 --- a/devito/ir/equations/algorithms.py +++ b/devito/ir/equations/algorithms.py @@ -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) @@ -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) @@ -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 = {} @@ -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: @@ -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) diff --git a/devito/operations/interpolators.py b/devito/operations/interpolators.py index 2c02b69256..77ff6d378a 100644 --- a/devito/operations/interpolators.py +++ b/devito/operations/interpolators.py @@ -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)