From cb818d5a55361b6aea2af3d6713ff98886c400bc Mon Sep 17 00:00:00 2001 From: Adrian Kummerlaender Date: Sat, 9 Nov 2019 00:08:36 +0100 Subject: 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. --- boltzgen/kernel/template/equilibrilize.cl.mako | 2 +- boltzgen/kernel/template/equilibrilize.cpp.mako | 2 +- boltzgen/kernel/template/momenta_boundary.cl.mako | 8 ++++---- boltzgen/kernel/template/momenta_boundary.cpp.mako | 8 ++++---- 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 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 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 <%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 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 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 <%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 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 -- cgit v1.2.3