From c2455e5042ea0e740278be5520dd4663b892d1dd Mon Sep 17 00:00:00 2001 From: Andreas Kloeckner Date: Wed, 7 Dec 2016 16:06:12 -0600 Subject: [PATCH] Use CSE caching for the _VectorIndexAdder --- sumpy/kernel.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sumpy/kernel.py b/sumpy/kernel.py index 7324a082..cf0835de 100644 --- a/sumpy/kernel.py +++ b/sumpy/kernel.py @@ -26,7 +26,7 @@ from six.moves import range, zip import loopy as lp import numpy as np -from pymbolic.mapper import IdentityMapper +from pymbolic.mapper import IdentityMapper, CSECachingMapperMixin from sumpy.symbolic import pymbolic_real_norm_2 from pymbolic.primitives import make_sym_vector from pymbolic import var @@ -652,7 +652,7 @@ class AxisTargetDerivative(DerivativeBase): mapper_method = "map_axis_target_derivative" -class _VectorIndexAdder(IdentityMapper): +class _VectorIndexAdder(CSECachingMapperMixin, IdentityMapper): def __init__(self, vec_name, additional_indices): self.vec_name = vec_name self.additional_indices = additional_indices @@ -666,6 +666,8 @@ class _VectorIndexAdder(IdentityMapper): else: return IdentityMapper.map_subscript(self, expr) + map_common_subexpression_uncached = IdentityMapper.map_common_subexpression + class DirectionalDerivative(DerivativeBase): init_arg_names = ("inner_kernel", "dir_vec_name") -- GitLab