Commit 5c7a50d8 authored by Martin Bauer's avatar Martin Bauer
Browse files

Pyphasefield updates

parent fd68e34d
from collections import defaultdict, OrderedDict
from operator import attrgetter
from copy import deepcopy
import functools
import sympy as sp
from sympy.logic.boolalg import Boolean
......@@ -22,6 +23,9 @@ def filteredTreeIteration(node, nodeType):
def fastSubs(term, subsDict):
"""Similar to sympy subs function.
This version is much faster for big substitution dictionaries than sympy version"""
if type(term) is sp.Matrix:
return term.copy().applyfunc(functools.partial(fastSubs, subsDict=subsDict))
def visit(expr):
if expr in subsDict:
return subsDict[expr]
......@@ -293,6 +297,7 @@ def substituteArrayAccessesWithConstants(astNode):
for a in astNode.args:
substituteArrayAccessesWithConstants(a)
def resolveBufferAccesses(astNode, baseBufferIndex, readOnlyFieldNames=set()):
def visitSympyExpr(expr, enclosingBlock, sympyAssignment):
if isinstance(expr, Field.Access):
......
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