Skip to content

Commit 5fa19a4

Browse files
committed
compiler: Refactor VectorAccess
1 parent 2713dcc commit 5fa19a4

2 files changed

Lines changed: 4 additions & 19 deletions

File tree

devito/symbolics/extended_sympy.py

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -794,7 +794,7 @@ def __str__(self):
794794
__repr__ = __str__
795795

796796

797-
class VectorAccess(Expr, Pickable):
797+
class VectorAccess(Expr, Pickable, BasicWrapperMixin):
798798

799799
"""
800800
Represent a vector access operation at high-level.
@@ -804,40 +804,25 @@ def __new__(cls, *args, **kwargs):
804804
return Expr.__new__(cls, *args)
805805

806806
def __str__(self):
807-
return f"VL4<{self.base}>"
807+
return f"VL<{self.base}>"
808808

809809
__repr__ = __str__
810810

811811
func = Pickable._rebuild
812812

813-
def _sympystr(self, printer):
814-
return str(self)
815-
816813
@property
817814
def base(self):
818815
return self.args[0]
819816

820-
@property
821-
def function(self):
822-
return self.base.function
823-
824817
@property
825818
def indices(self):
826819
return self.base.indices
827820

828-
@property
829-
def dtype(self):
830-
return self.function.dtype
831-
832821
@cacheit
833822
def sort_key(self, order=None):
834823
# Ensure that the VectorAccess is sorted as the base
835824
return self.base.sort_key(order=order)
836825

837-
# Default assumptions correspond to those of the `base`
838-
for i in ('is_real', 'is_imaginary', 'is_commutative'):
839-
locals()[i] = property(lambda self, v=i: getattr(self.base, v))
840-
841826

842827
# Some other utility objects
843828
Null = Macro('NULL')

tests/test_symbolics.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -513,11 +513,11 @@ def test_vector_access():
513513
assert v.function is f
514514

515515
# Code generation
516-
assert ccode(v) == 'VL4<f[x, y, z]>'
516+
assert ccode(v) == 'VL<f[x, y, z]>'
517517

518518
# Reconstruction
519519
v1 = v.func(g.indexify())
520-
assert ccode(v1) == 'VL4<g[x, y, z]>'
520+
assert ccode(v1) == 'VL<g[x, y, z]>'
521521

522522

523523
def test_canonical_ordering_of_weights():

0 commit comments

Comments
 (0)