From 4ec94c97879aafef15f7663135745e4ba61e62cf Mon Sep 17 00:00:00 2001 From: Adrian Kummerlaender Date: Mon, 17 May 2021 00:15:33 +0200 Subject: Extract first public LiterateLB version --- tangle/LLBM/kernel/propagate.h | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 tangle/LLBM/kernel/propagate.h (limited to 'tangle/LLBM/kernel/propagate.h') 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 +class LatticeView; + +template +__global__ void propagate(LatticeView lattice, S** base, std::size_t size) { + + for (unsigned iPop=0; iPop < DESCRIPTOR::q; ++iPop) { + std::ptrdiff_t shift = -descriptor::offset(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; + } + } +} -- cgit v1.2.3