Skip to content

Commit d1db7f6

Browse files
committed
feat: update to new pymbolic
1 parent 4df76e4 commit d1db7f6

File tree

7 files changed

+259
-189
lines changed

7 files changed

+259
-189
lines changed

pytential/symbolic/elasticity.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
from functools import cached_property
3030

3131
import numpy as np
32-
from pymbolic.typing import ArithmeticExpressionT
32+
from pymbolic.typing import ArithmeticExpression
3333
from sumpy.kernel import (AxisSourceDerivative, AxisTargetDerivative,
3434
BiharmonicKernel, ElasticityKernel, Kernel,
3535
LaplaceKernel, StokesletKernel, StressletKernel,
@@ -95,9 +95,9 @@ class ElasticityWrapperBase(ABC):
9595

9696
dim: int
9797
"""Ambient dimension of the representation."""
98-
mu: ArithmeticExpressionT
98+
mu: ArithmeticExpression
9999
r"""Expression or value for the shear modulus :math:`\mu`."""
100-
nu: ArithmeticExpressionT
100+
nu: ArithmeticExpression
101101
r"""Expression or value for Poisson's ratio :math:`\nu`."""
102102

103103
@abstractmethod
@@ -159,9 +159,9 @@ class ElasticityDoubleLayerWrapperBase(ABC):
159159

160160
dim: int
161161
"""Ambient dimension of the representation."""
162-
mu: ArithmeticExpressionT
162+
mu: ArithmeticExpression
163163
r"""Expression or value for the shear modulus :math:`\mu`."""
164-
nu: ArithmeticExpressionT
164+
nu: ArithmeticExpression
165165
r"""Expression or value for Poisson's ration :math:`\nu`."""
166166

167167
@abstractmethod
@@ -227,8 +227,8 @@ def _create_int_g(knl, deriv_dirs, density, **kwargs):
227227
@dataclass
228228
class _ElasticityWrapperNaiveOrBiharmonic:
229229
dim: int
230-
mu: ArithmeticExpressionT
231-
nu: ArithmeticExpressionT
230+
mu: ArithmeticExpression
231+
nu: ArithmeticExpression
232232
base_kernel: Kernel
233233

234234
def __post_init__(self):
@@ -315,8 +315,8 @@ def __init__(self, dim, mu, nu):
315315
@dataclass
316316
class _ElasticityDoubleLayerWrapperNaiveOrBiharmonic:
317317
dim: int
318-
mu: ArithmeticExpressionT
319-
nu: ArithmeticExpressionT
318+
mu: ArithmeticExpression
319+
nu: ArithmeticExpression
320320
base_kernel: Kernel
321321

322322
def __post_init__(self):
@@ -474,8 +474,8 @@ class Method(Enum):
474474

475475
def make_elasticity_wrapper(
476476
dim: int,
477-
mu: ArithmeticExpressionT = _MU_SYM_DEFAULT,
478-
nu: ArithmeticExpressionT = _NU_SYM_DEFAULT,
477+
mu: ArithmeticExpression = _MU_SYM_DEFAULT,
478+
nu: ArithmeticExpression = _NU_SYM_DEFAULT,
479479
method: Method = Method.Naive) -> ElasticityWrapperBase:
480480
"""Creates an appropriate :class:`ElasticityWrapperBase` object.
481481
@@ -502,8 +502,8 @@ def make_elasticity_wrapper(
502502

503503
def make_elasticity_double_layer_wrapper(
504504
dim: int,
505-
mu: ArithmeticExpressionT = _MU_SYM_DEFAULT,
506-
nu: ArithmeticExpressionT = _NU_SYM_DEFAULT,
505+
mu: ArithmeticExpression = _MU_SYM_DEFAULT,
506+
nu: ArithmeticExpression = _NU_SYM_DEFAULT,
507507
method: Method = Method.Naive) -> ElasticityDoubleLayerWrapperBase:
508508
"""Creates an appropriate :class:`ElasticityDoubleLayerWrapperBase` object.
509509

pytential/symbolic/mappers.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,12 @@ def map_common_subexpression(self, expr):
280280
# {{{ FlattenMapper
281281

282282
class FlattenMapper(FlattenMapperBase, IdentityMapper):
283-
pass
283+
def map_int_g(self, expr):
284+
densities, kernel_arguments, changed = rec_int_g_arguments(self, expr)
285+
if not changed:
286+
return expr
287+
288+
return replace(expr, densities=densities, kernel_arguments=kernel_arguments)
284289

285290

286291
def flatten(expr):

0 commit comments

Comments
 (0)