diff options
author | Adrian Kummerlaender | 2021-05-17 00:30:13 +0200 |
---|---|---|
committer | Adrian Kummerlaender | 2021-05-17 00:30:13 +0200 |
commit | a92271176a19e06611099c0eccc4e6a6887f4915 (patch) | |
tree | 54067b334bfae7d99c79cfb00da5891334f9514c /src/LLBM/collect_moments.h | |
download | SweepLB-a92271176a19e06611099c0eccc4e6a6887f4915.tar SweepLB-a92271176a19e06611099c0eccc4e6a6887f4915.tar.gz SweepLB-a92271176a19e06611099c0eccc4e6a6887f4915.tar.bz2 SweepLB-a92271176a19e06611099c0eccc4e6a6887f4915.tar.lz SweepLB-a92271176a19e06611099c0eccc4e6a6887f4915.tar.xz SweepLB-a92271176a19e06611099c0eccc4e6a6887f4915.tar.zst SweepLB-a92271176a19e06611099c0eccc4e6a6887f4915.zip |
Extract public version of SweepLB
Diffstat (limited to 'src/LLBM/collect_moments.h')
-rw-r--r-- | src/LLBM/collect_moments.h | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/LLBM/collect_moments.h b/src/LLBM/collect_moments.h new file mode 100644 index 0000000..afd5d59 --- /dev/null +++ b/src/LLBM/collect_moments.h @@ -0,0 +1,25 @@ +#pragma once + +#include "concepts.h" + +struct CollectMomentsF { + +static constexpr unsigned size = 4; + +template <concepts::Arithmetic V> +static void observe(V f_curr[19], V* momenta) { + V m0 = f_curr[10] + f_curr[13] + f_curr[17]; + V m1 = f_curr[14] + f_curr[5] + f_curr[6]; + V m2 = f_curr[1] + f_curr[2] + f_curr[4]; + V m3 = m0 + m1 + m2 + f_curr[0] + f_curr[11] + f_curr[12] + f_curr[15] + f_curr[16] + f_curr[18] + f_curr[3] + f_curr[7] + f_curr[8] + f_curr[9]; + V m4 = -f_curr[11] + f_curr[7]; + V m5 = -f_curr[15] + f_curr[3]; + V m6 = V{1}/m3; + V m7 = f_curr[0] - f_curr[18]; + momenta[0] = m3; + momenta[1] = m6*(m0 + m4 + m5 - f_curr[1] - f_curr[5] - f_curr[8]); + momenta[2] = m6*(m1 + m4 + m7 - f_curr[12] - f_curr[13] - f_curr[4]); + momenta[3] = m6*(m2 + m5 + m7 - f_curr[14] - f_curr[16] - f_curr[17]); +} + +}; |