summaryrefslogtreecommitdiff
path: root/tangle/LLBM/kernel/propagate.h
diff options
context:
space:
mode:
Diffstat (limited to 'tangle/LLBM/kernel/propagate.h')
-rw-r--r--tangle/LLBM/kernel/propagate.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/tangle/LLBM/kernel/propagate.h b/tangle/LLBM/kernel/propagate.h
new file mode 100644
index 0000000..08f78ea
--- /dev/null
+++ b/tangle/LLBM/kernel/propagate.h
@@ -0,0 +1,20 @@
+#pragma once
+
+template <typename DESCRIPTOR, typename S>
+class LatticeView;
+
+template <typename DESCRIPTOR, typename S>
+__global__ void propagate(LatticeView<DESCRIPTOR,S> lattice, S** base, std::size_t size) {
+
+ for (unsigned iPop=0; iPop < DESCRIPTOR::q; ++iPop) {
+ std::ptrdiff_t shift = -descriptor::offset<DESCRIPTOR>(lattice.cuboid, iPop);
+
+ lattice.population[iPop] += shift;
+
+ if (lattice.population[iPop] < base[iPop]) {
+ lattice.population[iPop] += size;
+ } else if (lattice.population[iPop] + size > base[iPop] + 2*size) {
+ lattice.population[iPop] -= size;
+ }
+ }
+}