Skip to content

Commit

Permalink
misc: tidy up and fixed notebook
Browse files Browse the repository at this point in the history
  • Loading branch information
Edward Caunt committed Nov 30, 2023
1 parent f7ddfb5 commit a0742f0
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 59 deletions.
16 changes: 7 additions & 9 deletions devito/types/grid.py
Original file line number Diff line number Diff line change
Expand Up @@ -445,15 +445,11 @@ def grid(self):

@property
def distributor(self):
if self.has_grid:
try:
return self.grid._distributor
else:
except AttributeError:
return None

@property
def has_grid(self):
return self._grid is not None


class SubDomain(AbstractSubDomain):

Expand Down Expand Up @@ -502,16 +498,18 @@ class SubDomain(AbstractSubDomain):
"""

def __subdomain_finalize__(self, grid, **kwargs):
if self.has_grid:
raise ValueError("`SubDomain` has already been attached to a `Grid`")
if self.grid is not None:
raise ValueError("`SubDomain` %s has already been attached to a `Grid`"
% self)

self._grid = grid

# Create the SubDomain's SubDimensions
sub_dimensions = []
sdshape = []
counter = kwargs.get('counter', 0) - 1

for k, v, s in zip(self.define(self.grid.dimensions).keys(),
for k, v, s in zip(self.define(self.grid.dimensions),
self.define(self.grid.dimensions).values(), grid.shape):
if isinstance(v, Dimension):
sub_dimensions.append(v)
Expand Down
Loading

0 comments on commit a0742f0

Please sign in to comment.