aboutsummaryrefslogtreecommitdiff
path: root/symbolic
diff options
context:
space:
mode:
authorAdrian Kummerlaender2019-06-20 15:42:58 +0200
committerAdrian Kummerlaender2019-06-20 15:42:58 +0200
commitce971fa70059079ca2328f5fbf49a751c4833399 (patch)
tree6b2acb70091b54caf1f73ed56bfc505f58555144 /symbolic
parent804e15d65e32479a476ef212238c25ada4865e3f (diff)
downloadsymlbm_playground-ce971fa70059079ca2328f5fbf49a751c4833399.tar
symlbm_playground-ce971fa70059079ca2328f5fbf49a751c4833399.tar.gz
symlbm_playground-ce971fa70059079ca2328f5fbf49a751c4833399.tar.bz2
symlbm_playground-ce971fa70059079ca2328f5fbf49a751c4833399.tar.lz
symlbm_playground-ce971fa70059079ca2328f5fbf49a751c4833399.tar.xz
symlbm_playground-ce971fa70059079ca2328f5fbf49a751c4833399.tar.zst
symlbm_playground-ce971fa70059079ca2328f5fbf49a751c4833399.zip
Move back assignment
Diffstat (limited to 'symbolic')
-rw-r--r--symbolic/generator.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/symbolic/generator.py b/symbolic/generator.py
index 7315ae0..853bbf9 100644
--- a/symbolic/generator.py
+++ b/symbolic/generator.py
@@ -3,6 +3,10 @@ from sympy.codegen.ast import Assignment
import symbolic.optimizations as optimizations
+
+def assign(names, definitions):
+ return list(map(lambda x: Assignment(*x), zip(names, definitions)))
+
class LBM:
def __init__(self, descriptor):
self.descriptor = descriptor
@@ -40,9 +44,10 @@ class LBM:
return f_eq
def bgk(self, tau, f_eq, optimize = True):
- exprs = [ Assignment(self.f_next[i], self.f_curr[i] + 1/tau * (f_eq_i - self.f_curr[i])) for i, f_eq_i in enumerate(f_eq) ]
+ exprs = [ self.f_curr[i] + 1/tau * (f_eq_i - self.f_curr[i]) for i, f_eq_i in enumerate(f_eq) ]
if optimize:
- return cse(exprs, optimizations=optimizations.custom)
+ helper, f = cse(exprs, optimizations=optimizations.custom)
+ return (helper, assign(self.f_next, f))
else:
- return ([], exprs)
+ return ([], assign(self.f_next, f))