summaryrefslogtreecommitdiff
path: root/tangle/LLBM/kernel/propagate.h
diff options
context:
space:
mode:
authorAdrian Kummerlaender2021-05-17 00:15:33 +0200
committerAdrian Kummerlaender2021-05-17 00:15:33 +0200
commit4ec94c97879aafef15f7663135745e4ba61e62cf (patch)
tree322ae3f003892513f529842ff0b3fd100573b680 /tangle/LLBM/kernel/propagate.h
downloadLiterateLB-4ec94c97879aafef15f7663135745e4ba61e62cf.tar
LiterateLB-4ec94c97879aafef15f7663135745e4ba61e62cf.tar.gz
LiterateLB-4ec94c97879aafef15f7663135745e4ba61e62cf.tar.bz2
LiterateLB-4ec94c97879aafef15f7663135745e4ba61e62cf.tar.lz
LiterateLB-4ec94c97879aafef15f7663135745e4ba61e62cf.tar.xz
LiterateLB-4ec94c97879aafef15f7663135745e4ba61e62cf.tar.zst
LiterateLB-4ec94c97879aafef15f7663135745e4ba61e62cf.zip
Extract first public LiterateLB version
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;
+ }
+ }
+}