Commit 0726201b authored by Markus Holzer's avatar Markus Holzer
Browse files

[skip ci]copy over pystencils function

parent de6b0007
Pipeline #35937 skipped
......@@ -12,7 +12,7 @@ from lbmpy.updatekernels import create_lbm_kernel, create_stream_only_kernel
from pystencils import AssignmentCollection, create_kernel, Target
from pystencils.astnodes import SympyAssignment
from pystencils.backends.cbackend import CBackend, CustomSympyPrinter, get_headers
from pystencils.data_types import TypedSymbol, type_all_numbers, cast_func
from pystencils.typing import TypedSymbol, cast_func
from pystencils.field import Field
from pystencils.stencil import offset_to_direction_string
from pystencils.sympyextensions import get_symmetric_part
......@@ -318,3 +318,8 @@ def equations_to_code(equations, variable_prefix="lm.", variables_without_prefix
return "\n".join(result)
def type_all_numbers(expr, dtype):
substitutions = {a: cast_func(a, dtype) for a in expr.atoms(sp.Number)}
return expr.subs(substitutions)
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment