Skip to content
Snippets Groups Projects
Commit cb78f5f8 authored by Stephan Seitz's avatar Stephan Seitz
Browse files

Export pystencils_autodiff.show_code{,_debug}

parent 47f72700
No related merge requests found
......@@ -8,6 +8,7 @@ from pystencils_autodiff._autodiff import (
AutoDiffAstPair, AutoDiffBoundaryHandling, AutoDiffOp, DiffModes, create_backward_assignments,
get_jacobian_of_assignments)
from pystencils_autodiff.field_tensor_conversion import ArrayWrapper, coerce_to_field
from pystencils_autodiff.framework_integration.printer import show_code, show_code_debug
__all__ = ['backends',
'AdjointField',
......@@ -19,7 +20,9 @@ __all__ = ['backends',
'DiffModes',
'AutoDiffBoundaryHandling',
'ArrayWrapper',
'coerce_to_field']
'coerce_to_field',
'show_code',
'show_code_debug']
sys.modules['pystencils.autodiff'] = pystencils_autodiff
sys.modules['pystencils.autodiff.backends'] = pystencils_autodiff.backends
import functools
import sympy as sp
import pystencils.backends.cbackend
......@@ -165,3 +167,7 @@ class DebugFrameworkPrinter(FrameworkIntegrationPrinter):
return super()._print(node) + f'/* {node.__class__.__name__} symbols_undefined: {node.undefined_symbols}, symbols_defined: {node.symbols_defined}, args {[a if isinstance(a,str) else a.__class__.__name__ for a in node.args]} */' # noqa
else:
return super()._print(node)
show_code = functools.partial(pystencils.show_code, custom_backend=FrameworkIntegrationPrinter())
show_code_debug = functools.partial(pystencils.show_code, custom_backend=DebugFrameworkPrinter())
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