diff options
author | Adrian Kummerlaender | 2019-11-09 00:08:36 +0100 |
---|---|---|
committer | Adrian Kummerlaender | 2019-11-09 00:08:36 +0100 |
commit | cb818d5a55361b6aea2af3d6713ff98886c400bc (patch) | |
tree | c75a9a021fbd6f1bf659c8dbe393da42bc4604cf | |
parent | d3c24f497f29ba9f26a87c3099f1e46688d0414b (diff) | |
download | boltzgen-cb818d5a55361b6aea2af3d6713ff98886c400bc.tar boltzgen-cb818d5a55361b6aea2af3d6713ff98886c400bc.tar.gz boltzgen-cb818d5a55361b6aea2af3d6713ff98886c400bc.tar.bz2 boltzgen-cb818d5a55361b6aea2af3d6713ff98886c400bc.tar.lz boltzgen-cb818d5a55361b6aea2af3d6713ff98886c400bc.tar.xz boltzgen-cb818d5a55361b6aea2af3d6713ff98886c400bc.tar.zst boltzgen-cb818d5a55361b6aea2af3d6713ff98886c400bc.zip |
Mark equilibrilize, momenta result values as const
Doesn't change the outcome but is more in line how the rest of the
generated code looks like.
4 files changed, 10 insertions, 10 deletions
diff --git a/boltzgen/kernel/template/equilibrilize.cl.mako b/boltzgen/kernel/template/equilibrilize.cl.mako index 3ffa39e..8a423ae 100644 --- a/boltzgen/kernel/template/equilibrilize.cl.mako +++ b/boltzgen/kernel/template/equilibrilize.cl.mako @@ -2,6 +2,6 @@ <%call expr="pattern.operator('equilibrilize')"> % for i, w_i in enumerate(descriptor.w): - ${float_type} f_next_${i} = ${w_i.evalf()}; + const ${float_type} f_next_${i} = ${w_i.evalf()}; % endfor </%call> diff --git a/boltzgen/kernel/template/equilibrilize.cpp.mako b/boltzgen/kernel/template/equilibrilize.cpp.mako index 74a6aa1..e10eb6c 100644 --- a/boltzgen/kernel/template/equilibrilize.cpp.mako +++ b/boltzgen/kernel/template/equilibrilize.cpp.mako @@ -2,6 +2,6 @@ <%call expr="pattern.operator('equilibrilize')"> % for i, w_i in enumerate(descriptor.w): - ${float_type} f_next_${i} = ${w_i.evalf()}; + const ${float_type} f_next_${i} = ${w_i.evalf()}; % endfor </%call> diff --git a/boltzgen/kernel/template/momenta_boundary.cl.mako b/boltzgen/kernel/template/momenta_boundary.cl.mako index 9581a14..2cdc202 100644 --- a/boltzgen/kernel/template/momenta_boundary.cl.mako +++ b/boltzgen/kernel/template/momenta_boundary.cl.mako @@ -24,15 +24,15 @@ collision_subexpr, collision_assignment = model.collision(f_eq = model.equilibri </%def> <%call expr="momenta_boundary('velocity', [('%s%d' % (float_type, descriptor.d), 'velocity')])"> - ${float_type} ${sympy.ccode(moments_assignment[0])} + const ${float_type} ${sympy.ccode(moments_assignment[0])} % for i, expr in enumerate(moments_assignment[1:]): - ${float_type} ${expr.lhs} = velocity.${['x','y','z'][i]}; + const ${float_type} ${expr.lhs} = velocity.${['x','y','z'][i]}; % endfor </%call> <%call expr="momenta_boundary('density', [(float_type, 'density')])"> - ${float_type} ${moments_assignment[0].lhs} = density; + const ${float_type} ${moments_assignment[0].lhs} = density; % for i, expr in enumerate(moments_assignment[1:]): - ${float_type} ${sympy.ccode(expr)} + const ${float_type} ${sympy.ccode(expr)} % endfor </%call> diff --git a/boltzgen/kernel/template/momenta_boundary.cpp.mako b/boltzgen/kernel/template/momenta_boundary.cpp.mako index 48b0fa5..ef7f7ad 100644 --- a/boltzgen/kernel/template/momenta_boundary.cpp.mako +++ b/boltzgen/kernel/template/momenta_boundary.cpp.mako @@ -24,15 +24,15 @@ collision_subexpr, collision_assignment = model.collision(f_eq = model.equilibri </%def> <%call expr="momenta_boundary('velocity', [(float_type, 'velocity[%d]' % descriptor.d)])"> - ${float_type} ${sympy.ccode(moments_assignment[0])} + const ${float_type} ${sympy.ccode(moments_assignment[0])} % for i, expr in enumerate(moments_assignment[1:]): - ${float_type} ${expr.lhs} = velocity[${i}]; + const ${float_type} ${expr.lhs} = velocity[${i}]; % endfor </%call> <%call expr="momenta_boundary('density', [(float_type, 'density')])"> - ${float_type} ${moments_assignment[0].lhs} = density; + const ${float_type} ${moments_assignment[0].lhs} = density; % for i, expr in enumerate(moments_assignment[1:]): - ${float_type} ${sympy.ccode(expr)} + const ${float_type} ${sympy.ccode(expr)} % endfor </%call> |