aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--boltzgen.py16
-rw-r--r--boltzgen/__init__.py7
2 files changed, 15 insertions, 8 deletions
diff --git a/boltzgen.py b/boltzgen.py
index b487b07..6f8f20c 100644
--- a/boltzgen.py
+++ b/boltzgen.py
@@ -3,16 +3,22 @@ import string
from boltzgen import *
-argparser = argparse.ArgumentParser(description='Generate LBM kernels in various languages using a symbolic description.')
+argparser = argparse.ArgumentParser(
+ description = 'Generate LBM kernels in various languages using a symbolic description.')
+
argparser.add_argument('language', help = 'Target language (currently either "cl" or "cpp")')
-argparser.add_argument('--layout', dest = 'layout', help = 'Memory layout ("AOS" or "SOA")', required = True)
-argparser.add_argument('--precision', dest = 'precision', help = 'Floating precision ("single" or "double")', required = True)
+
+argparser.add_argument('--lattice', dest = 'lattice', required = True, help = 'Lattice type (D2Q9, D3Q7, D3Q19, D3Q27)')
+argparser.add_argument('--layout', dest = 'layout', required = True, help = 'Memory layout ("AOS" or "SOA")')
+argparser.add_argument('--precision', dest = 'precision', required = True, help = 'Floating precision ("single" or "double")')
args = argparser.parse_args()
-lbm = LBM(D2Q9)
+lattice = eval("lbm.model.%s" % args.lattice)
+
+lbm = LBM(lattice)
generator = Generator(
- descriptor = D2Q9,
+ descriptor = lattice,
moments = lbm.moments(),
collision = lbm.bgk(f_eq = lbm.equilibrium(), tau = 0.6))
diff --git a/boltzgen/__init__.py b/boltzgen/__init__.py
index 0cf365b..d12f06d 100644
--- a/boltzgen/__init__.py
+++ b/boltzgen/__init__.py
@@ -1,8 +1,9 @@
from lbm import LBM
-import lbm.model.D2Q9 as D2Q9
-import lbm.model.D3Q19 as D3Q19
-import lbm.model.D3Q27 as D3Q27
+import lbm.model.D2Q9
+import lbm.model.D3Q7
+import lbm.model.D3Q19
+import lbm.model.D3Q27
from geometry import Geometry