File tree Expand file tree Collapse file tree 2 files changed +12
-27
lines changed Expand file tree Collapse file tree 2 files changed +12
-27
lines changed Original file line number Diff line number Diff line change 32
32
33
33
from pytools import memoize_method
34
34
35
- from sumpy .symbolic import (SympyToPymbolicMapper as SympyToPymbolicMapperBase )
35
+ from sumpy .symbolic import SympyToPymbolicMapper
36
+ import sumpy .symbolic as sym
36
37
37
38
import logging
38
39
logger = logging .getLogger (__name__ )
49
50
"""
50
51
51
52
52
- # {{{ sympy -> pymbolic mapper
53
-
54
- import sumpy .symbolic as sym
55
- _SPECIAL_FUNCTION_NAMES = frozenset (dir (sym .functions ))
56
-
57
-
58
- class SympyToPymbolicMapper (SympyToPymbolicMapperBase ):
59
-
60
- def not_supported (self , expr ):
61
- if isinstance (expr , int ):
62
- return expr
63
- elif getattr (expr , "is_Function" , False ):
64
- func_name = SympyToPymbolicMapperBase .function_name (self , expr )
65
- return prim .Variable (func_name )(
66
- * tuple (self .rec (arg ) for arg in expr .args ))
67
- else :
68
- return SympyToPymbolicMapperBase .not_supported (self , expr )
69
-
70
- # }}}
71
-
72
-
73
53
# {{{ bessel -> loopy codegen
74
54
75
55
BESSEL_PREAMBLE = """//CL//
Original file line number Diff line number Diff line change @@ -313,12 +313,17 @@ def map_Mul(self, expr): # noqa: N802
313
313
314
314
return math .prod (num_args ) / math .prod (den_args )
315
315
316
- def map_FunctionSymbol (self , expr ):
317
- if expr .get_name () == "ExpI" :
318
- arg = self .rec (expr .args [0 ])
319
- return prim .Variable ("cos" )(arg ) + 1j * prim .Variable ("sin" )(arg )
316
+ def not_supported (self , expr ):
317
+ print (expr )
318
+ if getattr (expr , "is_Function" , False ):
319
+ if self .function_name (expr ) == "ExpI" :
320
+ arg = self .rec (expr .args [0 ])
321
+ return prim .Variable ("cos" )(arg ) + 1j * prim .Variable ("sin" )(arg )
322
+ else :
323
+ return prim .Variable (self .function_name (expr ))(
324
+ * [self .rec (arg ) for arg in expr .args ])
320
325
else :
321
- return SympyToPymbolicMapperBase .map_FunctionSymbol (self , expr )
326
+ return SympyToPymbolicMapperBase .not_supported (self , expr )
322
327
323
328
324
329
class PymbolicToSympyMapperWithSymbols (PymbolicToSympyMapper ):
You can’t perform that action at this time.
0 commit comments