Skip to content

Commit

Permalink
misc: Tidy up
Browse files Browse the repository at this point in the history
  • Loading branch information
EdCaunt committed Nov 11, 2024
1 parent abf00f8 commit 6e7c017
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions devito/types/dimension.py
Original file line number Diff line number Diff line change
Expand Up @@ -571,39 +571,36 @@ def value(self):
return self._value

def _arg_check(self, *args, **kwargs):
# TODO: Should check that the thickness isn't larger than the parent
# domain
pass

def _arg_values(self, grid=None, **kwargs):
# Allow override of thickness values to disable BCs
# However, arguments from the user are considered global
# So overriding the thickness to a nonzero value should not cause
# boundaries to exist between ranks where they did not before
r_tkn = kwargs.get(self.name, self.value)
rtkn = kwargs.get(self.name, self.value)
if grid is not None and grid.is_distributed(self.root):
# Get local thickness
if self.local:
# Dimension is of type `left`/`right` - compute the offset
# and then add 1 to get the appropriate thickness
if self.value is not None:
tkn = grid.distributor.glb_to_loc(self.root, r_tkn-1, self.side)
tkn = grid.distributor.glb_to_loc(self.root, rtkn-1, self.side)
tkn = tkn+1 if tkn is not None else 0
else:
tkn = 0
else:
# Dimension is of type `middle`
tkn = grid.distributor.glb_to_loc(self.root, r_tkn, self.side) or 0
tkn = grid.distributor.glb_to_loc(self.root, rtkn, self.side) or 0
else:
tkn = r_tkn or 0
tkn = rtkn or 0

return {self.name: tkn}

def _arg_finalize(self, *args, **kwargs):
return {}

def _arg_apply(self, *args, **kwargs):
# TODO: What is this actually for?
pass


Expand Down Expand Up @@ -756,9 +753,9 @@ def _symbolic_thickness(self, thickness=None):
'root': self.root, 'local': self.local}

names = ["%s_%stkn" % (self.parent.name, s) for s in ('l', 'r')]
sides = [LEFT, RIGHT]
return SubDimensionThickness(*[Thickness(name=n, side=s, value=t, **kwargs)
for n, s, t
in zip(names, (LEFT, RIGHT), thickness)])
for n, s, t in zip(names, sides, thickness)])

@cached_property
def _interval(self):
Expand Down

0 comments on commit 6e7c017

Please sign in to comment.