From ff4b4d0cb6b0befad646eb2bb0e3b06748a73f79 Mon Sep 17 00:00:00 2001 From: Edward Caunt Date: Wed, 13 Nov 2024 12:06:02 +0000 Subject: [PATCH 1/2] dsl: Add ArgProvider inheritance to AbstractSymbol --- devito/types/basic.py | 4 ++-- devito/types/dimension.py | 9 --------- 2 files changed, 2 insertions(+), 11 deletions(-) diff --git a/devito/types/basic.py b/devito/types/basic.py index 3d3241f27d..b63115f1d7 100644 --- a/devito/types/basic.py +++ b/devito/types/basic.py @@ -297,7 +297,7 @@ def bound_symbols(self): return set() -class AbstractSymbol(sympy.Symbol, Basic, Pickable, Evaluable): +class AbstractSymbol(sympy.Symbol, Basic, Pickable, Evaluable, ArgProvider): """ Base class for scalar symbols. @@ -549,7 +549,7 @@ def __new__(cls, *args, **kwargs): __hash__ = Uncached.__hash__ -class Scalar(Symbol, ArgProvider): +class Scalar(Symbol): """ Like a Symbol, but in addition it can pass runtime values to an Operator. diff --git a/devito/types/dimension.py b/devito/types/dimension.py index 7e1f7fc811..784dde499e 100644 --- a/devito/types/dimension.py +++ b/devito/types/dimension.py @@ -570,9 +570,6 @@ def local(self): def value(self): return self._value - def _arg_check(self, *args, **kwargs): - pass - def _arg_values(self, grid=None, **kwargs): # Allow override of thickness values to disable BCs # However, arguments from the user are considered global @@ -597,12 +594,6 @@ def _arg_values(self, grid=None, **kwargs): return {self.name: tkn} - def _arg_finalize(self, *args, **kwargs): - return {} - - def _arg_apply(self, *args, **kwargs): - pass - class AbstractSubDimension(DerivedDimension): From acdcb1e5656b7993ffbdf55bb8274df3c82eed7e Mon Sep 17 00:00:00 2001 From: Edward Caunt Date: Wed, 13 Nov 2024 14:01:21 +0000 Subject: [PATCH 2/2] dsl: Reworked inheritance --- devito/types/basic.py | 6 +++--- devito/types/constant.py | 3 +-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/devito/types/basic.py b/devito/types/basic.py index b63115f1d7..7a6a349100 100644 --- a/devito/types/basic.py +++ b/devito/types/basic.py @@ -297,7 +297,7 @@ def bound_symbols(self): return set() -class AbstractSymbol(sympy.Symbol, Basic, Pickable, Evaluable, ArgProvider): +class AbstractSymbol(sympy.Symbol, Basic, Pickable, Evaluable): """ Base class for scalar symbols. @@ -526,7 +526,7 @@ def __new__(cls, *args, **kwargs): __hash__ = Cached.__hash__ -class DataSymbol(AbstractSymbol, Uncached): +class DataSymbol(AbstractSymbol, Uncached, ArgProvider): """ A unique scalar symbol that carries data. @@ -549,7 +549,7 @@ def __new__(cls, *args, **kwargs): __hash__ = Uncached.__hash__ -class Scalar(Symbol): +class Scalar(Symbol, ArgProvider): """ Like a Symbol, but in addition it can pass runtime values to an Operator. diff --git a/devito/types/constant.py b/devito/types/constant.py index 2874861c10..bea67674a2 100644 --- a/devito/types/constant.py +++ b/devito/types/constant.py @@ -2,13 +2,12 @@ from devito.exceptions import InvalidArgument from devito.logger import warning -from devito.types.args import ArgProvider from devito.types.basic import DataSymbol __all__ = ['Constant'] -class Constant(DataSymbol, ArgProvider): +class Constant(DataSymbol): """ Symbol representing a constant, scalar value in symbolic equations.