Skip to content

Commit

Permalink
dsl: fixed occasional None in KeyError
Browse files Browse the repository at this point in the history
  • Loading branch information
EdCaunt committed Oct 27, 2023
1 parent 24ddcd9 commit 1fd7fe1
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions devito/types/grid.py
Original file line number Diff line number Diff line change
Expand Up @@ -559,11 +559,17 @@ def __subdomain_finalize__(self, grid, **kwargs):
**{dim.symbolic_max: sha-1 for dim, sha in zip(grid.dimensions,
grid.shape)}}

sdim_interval = {dim: (sdim._interval.subs({**sdim._thickness_map,
**bounds_map})
if sdim.is_Sub else None)
sdim_interval = {dim:
(sdim._interval.subs({**{k: v for k, v
in sdim._thickness_map.items()
if v is not None},
**bounds_map})
if sdim.is_Sub else None)
for dim, sdim in self.dimension_map.items()}

# If the grid is set up with conditional dimensions, then dist_interval
# and sdim_interval end up keyed with actual dimensions I would guess?
# And grid.dimensions don't match
intervals = tuple((dist_interval[dim] if sdim_interval[dim] is None
else dist_interval[dim].intersect(sdim_interval[dim]))
for dim in grid.dimensions)
Expand Down

0 comments on commit 1fd7fe1

Please sign in to comment.