Skip to content

Commit

Permalink
types: Updated dimension tagging for SubDomainSet
Browse files Browse the repository at this point in the history
  • Loading branch information
EdCaunt committed Nov 10, 2023
1 parent 6e3f274 commit 66abbc5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
1 change: 0 additions & 1 deletion devito/types/dimension.py
Original file line number Diff line number Diff line change
Expand Up @@ -589,7 +589,6 @@ class SubDimension(DerivedDimension):
__rkwargs__ = ()

def __init_finalize__(self, name, parent, left, right, thickness, local, **kwargs):
print(name, parent, left, right, thickness)
super().__init_finalize__(name, parent)
self._interval = sympy.Interval(left, right)
self._thickness = Thickness(*thickness)
Expand Down
14 changes: 7 additions & 7 deletions devito/types/grid.py
Original file line number Diff line number Diff line change
Expand Up @@ -544,7 +544,7 @@ class MultiSubDimension(SubDimension):
A special SubDimension for graceful lowering of MultiSubDomains.
"""

def __init_finalize__(self, name, parent, msd):
def __init_finalize__(self, name, parent, msd, tag=''):
# NOTE: a MultiSubDimension stashes a reference to the originating MultiSubDomain.
# This creates a circular pattern as the `msd` itself carries references to
# its MultiSubDimensions. This is currently necessary because during compilation
Expand All @@ -553,7 +553,7 @@ def __init_finalize__(self, name, parent, msd):
# definitely possible, but not straightforward
self.msd = msd

lst, rst = self._symbolic_thickness(name)
lst, rst = self._symbolic_thickness(name, tag=tag)
left = parent.symbolic_min + lst
right = parent.symbolic_max - rst

Expand Down Expand Up @@ -716,13 +716,15 @@ def __init__(self, **kwargs):
except AttributeError:
pass

def __subdomain_finalize__(self, grid, counter=0, **kwargs):
def __subdomain_finalize__(self, grid, **kwargs):
self._grid = grid
self._dtype = grid.dtype

tag = str(kwargs.get('tag', ''))

# Create the SubDomainSet SubDimensions
self._dimensions = tuple(
MultiSubDimension('%si%d' % (d.name, counter), d, self)
MultiSubDimension(d.name, d, self, tag=tag)
for d in grid.dimensions
)

Expand Down Expand Up @@ -761,9 +763,7 @@ def __subdomain_finalize__(self, grid, counter=0, **kwargs):

# Associate the `_local_bounds` to suitable symbolic objects that the
# compiler can use to generate code
n = counter - npresets
assert n >= 0
self._implicit_dimension = i_dim = Dimension(name='n%d' % n)
self._implicit_dimension = i_dim = Dimension(name='n%s' % tag)
functions = []
for j in range(len(self._local_bounds)):
index = floor(j/2)
Expand Down

0 comments on commit 66abbc5

Please sign in to comment.