aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrian Kummerlaender2019-10-26 22:44:09 +0200
committerAdrian Kummerlaender2019-10-26 22:44:09 +0200
commit820ed4b674a199c252e1b77ee7013f330ef284bb (patch)
tree42edb72e211789dada5cbe55ace0b88bf96f5c03
parent1bf577b1c5e606ac2c0553857297ce8c0c04ccb7 (diff)
downloadboltzgen-820ed4b674a199c252e1b77ee7013f330ef284bb.tar
boltzgen-820ed4b674a199c252e1b77ee7013f330ef284bb.tar.gz
boltzgen-820ed4b674a199c252e1b77ee7013f330ef284bb.tar.bz2
boltzgen-820ed4b674a199c252e1b77ee7013f330ef284bb.tar.xz
boltzgen-820ed4b674a199c252e1b77ee7013f330ef284bb.zip
Generate primitive velocity momenta BC for C++ target
-rw-r--r--boltzgen/kernel/template/basic.cpp.mako36
1 files changed, 36 insertions, 0 deletions
diff --git a/boltzgen/kernel/template/basic.cpp.mako b/boltzgen/kernel/template/basic.cpp.mako
index 3e16d2e..468a292 100644
--- a/boltzgen/kernel/template/basic.cpp.mako
+++ b/boltzgen/kernel/template/basic.cpp.mako
@@ -43,6 +43,42 @@ void collide_and_stream( ${float_type}* f_next,
% endfor
}
+void velocity_momenta_boundary( ${float_type}* f_next,
+ const ${float_type}* f_prev,
+ std::size_t gid,
+ ${float_type} velocity[${descriptor.d}])
+{
+ ${float_type}* preshifted_f_next = f_next + gid*${layout.gid_offset()};
+ const ${float_type}* preshifted_f_prev = f_prev + gid*${layout.gid_offset()};
+
+% for i, c_i in enumerate(descriptor.c):
+ const ${float_type} f_curr_${i} = preshifted_f_prev[${layout.pop_offset(i) + layout.neighbor_offset(-c_i)}];
+% endfor
+
+% for i, expr in enumerate(moments_subexpr):
+ const ${float_type} ${expr[0]} = ${ccode(expr[1])};
+% endfor
+
+% for i, expr in enumerate(moments_assignment):
+ ${float_type} ${ccode(expr)}
+% endfor
+% for i, expr in enumerate(moments_assignment[1:]):
+ ${expr.lhs} = velocity[${i}];
+% endfor
+
+% for i, expr in enumerate(collision_subexpr):
+ const ${float_type} ${expr[0]} = ${ccode(expr[1])};
+% endfor
+
+% for i, expr in enumerate(collision_assignment):
+ const ${float_type} ${ccode(expr)}
+% endfor
+
+% for i, expr in enumerate(collision_assignment):
+ preshifted_f_next[${layout.pop_offset(i)}] = f_next_${i};
+% endfor
+}
+
void collect_moments(const ${float_type}* f,
std::size_t gid,
${float_type}& rho,