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
|
import sympy
from mako.template import Template
from pathlib import Path
def source(target, descriptor, moments, collide, boundary_src, float_type, geometry):
return Template(filename = str(Path(__file__).parent/('template/basic.' + target + '.mako'))).render(
descriptor = descriptor,
geometry = geometry,
moments_subexpr = moments[0],
moments_assignment = moments[1],
collide_subexpr = collide[0],
collide_assignment = collide[1],
float_type = float_type,
boundary_src = Template(boundary_src).render(
descriptor = descriptor,
geometry = geometry,
float_type = float_type
),
ccode = sympy.ccode
)
|