From d48d072372ec305151d7b0a49e2f877f0b9dde98 Mon Sep 17 00:00:00 2001 From: YzzIzzY Date: Tue, 28 Mar 2023 16:41:30 +0200 Subject: [PATCH 1/2] process argument of DiffOperator in LogicalExpr --- sympde/topology/mapping.py | 29 +++++++++++++---------------- 1 file changed, 13 insertions(+), 16 deletions(-) diff --git a/sympde/topology/mapping.py b/sympde/topology/mapping.py index 5c8b6589..83a07c5f 100644 --- a/sympde/topology/mapping.py +++ b/sympde/topology/mapping.py @@ -895,10 +895,10 @@ def eval(cls, expr, domain, **options): """.""" from sympde.expr.evaluation import TerminalExpr, DomainExpression - from sympde.expr.expr import BilinearForm, LinearForm, BasicForm, Norm - from sympde.expr.expr import Integral + from sympde.expr.expr import BilinearForm, LinearForm, Norm, Integral - types = (ScalarFunction, VectorFunction, DifferentialOperator, Trace, Integral) + types = (ScalarFunction, VectorFunction, DifferentialOperator, + Trace, Integral, DiffOperator) mapping = domain.mapping dim = domain.dim @@ -909,20 +909,17 @@ def eval(cls, expr, domain, **options): ph_coords = ['x', 'y', 'z'] if not has(expr, types): - if has(expr, DiffOperator): - return cls( expr, domain, evaluate=False) - else: - syms = symbols(ph_coords[:dim]) - if isinstance(mapping, InterfaceMapping): - mapping = mapping.minus - # here we assume that the two mapped domains - # are identical in the interface so we choose one of them - Ms = [mapping[i] for i in range(dim)] - expr = expr.subs(list(zip(syms, Ms))) + syms = symbols(ph_coords[:dim]) + if isinstance(mapping, InterfaceMapping): + mapping = mapping.minus + # here we assume that the two mapped domains + # are identical in the interface so we choose one of them + Ms = [mapping[i] for i in range(dim)] + expr = expr.subs(list(zip(syms, Ms))) - if mapping.is_analytical: - expr = expr.subs(list(zip(Ms, mapping.expressions))) - return expr + if mapping.is_analytical: + expr = expr.subs(list(zip(Ms, mapping.expressions))) + return expr if isinstance(expr, Symbol) and expr.name in l_coords: return expr From 0190f9b1e3d3d8c004a4cf3c7d97a819d0a4e123 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yaman=20G=C3=BC=C3=A7l=C3=BC?= Date: Wed, 29 Mar 2023 11:43:54 +0200 Subject: [PATCH 2/2] Add missing import to mapping.py Function `is_sequence` should be imported from `sympy.core.compatibility`. --- sympde/topology/mapping.py | 1 + 1 file changed, 1 insertion(+) diff --git a/sympde/topology/mapping.py b/sympde/topology/mapping.py index 83a07c5f..55aeee8c 100644 --- a/sympde/topology/mapping.py +++ b/sympde/topology/mapping.py @@ -14,6 +14,7 @@ from sympy import sqrt, symbols from sympy.core.exprtools import factor_terms from sympy.polys.polytools import parallel_poly_from_expr +from sympy.core.compatibility import is_sequence from sympde.core import Constant from sympde.core.basic import BasicMapping