aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrian Kummerlaender2019-10-29 19:38:32 +0100
committerAdrian Kummerlaender2019-10-29 19:38:32 +0100
commit61d77cf8aa815b456d873ff3c01e54ad21a8fce9 (patch)
tree49b9f025ce6baef3c228447b50963ca9870290ae
parenta0438d434a8dde45e6fdab38d44181f0cd0cb2c6 (diff)
downloadboltzgen-61d77cf8aa815b456d873ff3c01e54ad21a8fce9.tar
boltzgen-61d77cf8aa815b456d873ff3c01e54ad21a8fce9.tar.gz
boltzgen-61d77cf8aa815b456d873ff3c01e54ad21a8fce9.tar.bz2
boltzgen-61d77cf8aa815b456d873ff3c01e54ad21a8fce9.tar.lz
boltzgen-61d77cf8aa815b456d873ff3c01e54ad21a8fce9.tar.xz
boltzgen-61d77cf8aa815b456d873ff3c01e54ad21a8fce9.tar.zst
boltzgen-61d77cf8aa815b456d873ff3c01e54ad21a8fce9.zip
Add support for generating custom templates in boltzgen's context
-rw-r--r--boltzgen/kernel/generator.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/boltzgen/kernel/generator.py b/boltzgen/kernel/generator.py
index 30e2c04..92ceb72 100644
--- a/boltzgen/kernel/generator.py
+++ b/boltzgen/kernel/generator.py
@@ -50,3 +50,19 @@ class Generator:
raise Exception('Geometry dimension must match descriptor dimension')
return "\n".join(map(lambda f: self.instantiate(f, geometry, extras), functions))
+
+ def custom(self, geometry, source):
+ return Template(text = source).render(
+ descriptor = self.descriptor,
+ geometry = geometry,
+ index = self.index_impl(geometry),
+ layout = self.layout_impl(self.descriptor, self.index_impl, geometry),
+
+ moments_subexpr = self.moments[0],
+ moments_assignment = self.moments[1],
+ collision_subexpr = self.collision[0],
+ collision_assignment = self.collision[1],
+ ccode = sympy.ccode,
+
+ float_type = self.float_type,
+ )