blob: 493c53d986d5053ebc62cd557a96e86fc773f1a3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
<%
import sympy
%>
void collect_moments(const ${float_type}* f,
std::size_t gid,
${float_type}& rho,
${float_type} u[${descriptor.d}])
{
const ${float_type}* preshifted_f = f + ${layout.cell_preshift('gid')};
% for i in range(0,descriptor.q):
const ${float_type} f_curr_${i} = preshifted_f[${layout.pop_offset(i)}];
% endfor
<%
moments_subexpr, moments_assignment = model.moments()
%>
% for i, expr in enumerate(moments_subexpr):
const ${float_type} ${expr[0]} = ${sympy.ccode(expr[1])};
% endfor
% for i, expr in enumerate(moments_assignment):
% if i == 0:
rho = ${sympy.ccode(expr.rhs)};
% else:
u[${i-1}] = ${sympy.ccode(expr.rhs)};
% endif
% endfor
}
|