Skip to content

Commit

Permalink
misc: Fix up class names
Browse files Browse the repository at this point in the history
  • Loading branch information
EdCaunt committed Oct 18, 2024
1 parent 821f336 commit 1d056ab
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 18 deletions.
4 changes: 2 additions & 2 deletions devito/ir/equations/algorithms.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
ConditionalDimension)
from devito.types.array import Array
from devito.types.basic import AbstractFunction
from devito.types.dimension import MultiSubDimension, SubDimensionThickness
from devito.types.dimension import MultiSubDimension, Thickness
from devito.data.allocators import DataReference
from devito.logger import warning

Expand Down Expand Up @@ -213,7 +213,7 @@ def _(expr, mapper, rebuilt, sregistry):
_concretize_subdims(expr.implicit_dims, mapper, rebuilt, sregistry)


@_concretize_subdims.register(SubDimensionThickness)
@_concretize_subdims.register(Thickness)
def _(tkn, mapper, rebuilt, sregistry):
if tkn in mapper:
# Already have a substitution for this thickness
Expand Down
6 changes: 3 additions & 3 deletions devito/operator/operator.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
split, timed_pass, timed_region, contains_val)
from devito.types import (Buffer, Grid, Evaluable, host_layer, device_layer,
disk_layer)
from devito.types.dimension import SubDimensionThickness
from devito.types.dimension import Thickness


__all__ = ['Operator']
Expand Down Expand Up @@ -642,9 +642,9 @@ def _prepare_arguments(self, autotune=None, **kwargs):
for d in reversed(toposort):
args.update(d._arg_values(self._dspace[d], grid, **kwargs))

# Process SubDimensionThicknesses
# Process Thicknesses
for p in self.parameters:
if isinstance(p, SubDimensionThickness):
if isinstance(p, Thickness):
args.update(p._arg_values(grid=grid, **kwargs))

# Process Objects
Expand Down
23 changes: 10 additions & 13 deletions devito/types/dimension.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
'VirtualDimension', 'Spacing', 'dimensions']


Thickness = namedtuple('Thickness', 'left right')
SubDimensionThickness = namedtuple('SubDimensionThickness', 'left right')


class Dimension(ArgProvider):
Expand Down Expand Up @@ -535,16 +535,12 @@ def _arg_check(self, *args, **kwargs):
# The Dimensions below are exposed in the user API. They can only be created by
# the user

class SubDimensionThickness(DataSymbol):
class Thickness(DataSymbol):
"""A DataSymbol to represent a thickness of a SubDimension"""

__rkwargs__ = DataSymbol.__rkwargs__ + ('root', 'side', 'local', 'value')

def __new__(cls, *args, **kwargs):
root = kwargs.pop('root')
side = kwargs.pop('side')
local = kwargs.pop('local')

def __new__(cls, *args, root=None, side=None, local=False, **kwargs):
newobj = super().__new__(cls, *args, **kwargs)
newobj._root = root
newobj._side = side
Expand Down Expand Up @@ -633,7 +629,7 @@ def __init_finalize__(self, name, parent, thickness, **kwargs):
super().__init_finalize__(name, parent)
thickness = thickness or (None, None)
if any(isinstance(tkn, self._thickness_type) for tkn in thickness):
self._thickness = Thickness(*thickness)
self._thickness = SubDimensionThickness(*thickness)
else:
self._thickness = self._symbolic_thickness(thickness=thickness)

Expand All @@ -648,7 +644,7 @@ def _symbolic_thickness(self, **kwargs):
kwargs = {'dtype': np.int32, 'is_const': True, 'nonnegative': True}

names = ["%s_%stkn" % (self.parent.name, s) for s in ('l', 'r')]
return Thickness(*[Symbol(name=n, **kwargs) for n in names])
return SubDimensionThickness(*[Symbol(name=n, **kwargs) for n in names])

@cached_property
def symbolic_min(self):
Expand Down Expand Up @@ -735,7 +731,7 @@ class SubDimension(AbstractSubDimension):

__rargs__ = AbstractSubDimension.__rargs__ + ('local',)

_thickness_type = SubDimensionThickness
_thickness_type = Thickness

def __init_finalize__(self, name, parent, thickness, local,
**kwargs):
Expand All @@ -756,12 +752,13 @@ def middle(cls, name, parent, thickness_left, thickness_right, local=False):

@memoized_meth
def _symbolic_thickness(self, thickness=None):
kwargs = {'dtype': np.int64, 'is_const': True, 'nonnegative': True,
kwargs = {'dtype': np.int32, 'is_const': True, 'nonnegative': True,
'root': self.root, 'local': self.local}

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

@cached_property
def _interval(self):
Expand Down

0 comments on commit 1d056ab

Please sign in to comment.