Skip to content

Commit 7b9d763

Browse files
committed
compiler: Started ghosted subdomain implementation
1 parent 169a8cf commit 7b9d763

2 files changed

Lines changed: 38 additions & 1 deletion

File tree

devito/operator/operator.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
from devito.types.dimension import Thickness
4343
from devito.petsc.iet.passes import lower_petsc
4444
from devito.petsc.clusters import petsc_preprocess
45+
from devito.petsc.equations import lower_exprs_petsc
4546

4647
__all__ = ['Operator']
4748

@@ -368,6 +369,9 @@ def _lower_exprs(cls, expressions, **kwargs):
368369
# in particular uniqueness across expressions is ensured
369370
expressions = concretize_subdims(expressions, **kwargs)
370371

372+
# rename etc
373+
expressions = lower_exprs_petsc(expressions, **kwargs)
374+
371375
processed = [LoweredEq(i) for i in expressions]
372376

373377
return processed

devito/types/dimension.py

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
'CustomDimension', 'SteppingDimension', 'SubDimension',
2222
'MultiSubDimension', 'ConditionalDimension', 'ModuloDimension',
2323
'IncrDimension', 'BlockDimension', 'StencilDimension',
24-
'VirtualDimension', 'Spacing', 'dimensions']
24+
'VirtualDimension', 'Spacing', 'dimensions', 'CustomBoundSubDimension']
2525

2626

2727
SubDimensionThickness = namedtuple('SubDimensionThickness', 'left right')
@@ -822,6 +822,39 @@ def __init_finalize__(self, name, parent, thickness, functions=None,
822822
@cached_property
823823
def bound_symbols(self):
824824
return self.parent.bound_symbols
825+
826+
827+
class CustomBoundSubDimension(SubDimension):
828+
829+
# have is_CustomSub = True ... here?
830+
831+
__rargs__ = SubDimension.__rargs__ + ('custom_left', 'custom_right')
832+
833+
def __init_finalize__(self, name, parent, thickness, local,
834+
custom_left=0, custom_right=0, **kwargs):
835+
self._custom_left = custom_left
836+
self._custom_right = custom_right
837+
super().__init_finalize__(name, parent, thickness, local)
838+
839+
@property
840+
def custom_left(self):
841+
return self._custom_left
842+
843+
@property
844+
def custom_right(self):
845+
return self._custom_right
846+
847+
# @cached_property
848+
# def _interval(self):
849+
# left = self.parent.symbolic_min + self._offset_left
850+
# right = self.parent.symbolic_max - self._offset_right
851+
# return sympy.Interval(left, right)
852+
853+
@cached_property
854+
def _interval(self):
855+
left = self.custom_left
856+
right = self.custom_right
857+
return sympy.Interval(left, right)
825858

826859

827860
class SubsamplingFactor(Scalar):

0 commit comments

Comments
 (0)