Commit 3135fec2 authored by MischaD's avatar MischaD
Browse files

SP Returns

parent 0698e79c
import click
import re
from lbmweights.lattice import Lattice
from lbmweights.utils.utils import timer
from lbmweights.utils.mylog import logger
......@@ -8,6 +9,12 @@ from lbmweights.utils.mylog import logger
def main():
def benchmark(x=10):
for i in range(x):
for name, kwargs in Lattice.BY_NAME.items():
weights = Lattice(**kwargs).weights
@click.option('--dimension', type=int, default=2, help='Dimension of the lattice, default 2')
......@@ -15,11 +22,12 @@ def main():
@click.option('--shells', type=str, default="1,2,4", help='String of velocity shell size. Squared length of the shell')
@click.option('--seed', type=int, help='Random number to be used as seed')
def lbmweights(dimension, order, shells, seed):
#shell_list = [int(x) for x in re.findall(u"\d+", shells)]
#Lattice(dimension=dimension, order=order, shell_list=shell_list, seed=seed)
lattice = Lattice.from_name()
shell_list = [int(x) for x in re.findall(u"\d+", shells)]
lattice = Lattice(dimension=dimension, order=order, shell_list=shell_list, seed=seed)
if __name__ == "__main__":
......@@ -358,7 +358,7 @@ class Lattice:
if self._interval.contains(c_s_sq) is sp.EmptySet: # Invalid c_s_sq input
return []
weights = [sp.N(x.eval(c_s_sq)) for x in self._weight_polynomials]
weights = [x.eval(c_s_sq) for x in self._weight_polynomials]
weights = [x if abs(x) >= 1e-10 else 0 for x in weights]
for i, shell in enumerate(self.shells):
shell.set_weight(c_s_sq, weights[i])
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