1= r"""
2 const auto irho = 1.0 / Q[Shortcuts::rho];
3 const auto u0 = Q[Shortcuts::rhoU + 0] * irho;
4 const auto u1 = Q[Shortcuts::rhoU + 1] * irho;
5#if DIMENSIONS == 3
6 const auto u2 = Q[Shortcuts::rhoU + 2] * irho;
7#endif
8
9#if DIMENSIONS == 3
10 const auto uSq = u0 * u0 + u1 * u1 + u2 * u2;
11 const auto u_n = (normal == 0) ? u0 : (normal == 1) ? u1 : u2;
12#else
13 const auto uSq = u0 * u0 + u1 * u1;
14 const auto u_n = (normal == 0) ? u0 : u1;
15#endif
16
17 const auto internalE = Q[Shortcuts::rhoE] - 0.5 * Q[Shortcuts::rho] * uSq;
18 const auto p = (GAMMA - 1.0) * internalE;
19"""