summaryrefslogtreecommitdiff
path: root/src/LLBM/collect_moments.h
blob: afd5d5916753e987d11d3b88458bdfe14bb5a29a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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]);
}

};