VirtualFluids 0.2.0
Parallel CFD LBM Solver
Loading...
Searching...
No Matches
D3Q27.h
Go to the documentation of this file.
1//=======================================================================================
2// ____ ____ __ ______ __________ __ __ __ __
3// \ \ | | | | | _ \ |___ ___| | | | | / \ | |
4// \ \ | | | | | |_) | | | | | | | / \ | |
5// \ \ | | | | | _ / | | | | | | / /\ \ | |
6// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____
7// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______|
8// \ \ | | ________________________________________________________________
9// \ \ | | | ______________________________________________________________|
10// \ \| | | | __ __ __ __ ______ _______
11// \ | | |_____ | | | | | | | | | _ \ / _____)
12// \ | | _____| | | | | | | | | | | \ \ \_______
13// \ | | | | |_____ | \_/ | | | | |_/ / _____ |
14// \ _____| |__| |________| \_______/ |__| |______/ (_______/
15//
16// This file is part of VirtualFluids. VirtualFluids is free software: you can
17// redistribute it and/or modify it under the terms of the GNU General Public
18// License as published by the Free Software Foundation, either version 3 of
19// the License, or (at your option) any later version.
20//
21// VirtualFluids is distributed in the hope that it will be useful, but WITHOUT
22// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
23// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
24// for more details.
25//
26// SPDX-License-Identifier: GPL-3.0-or-later
27// SPDX-FileCopyrightText: Copyright © VirtualFluids Project contributors, see AUTHORS.md in root folder
28//
32//=======================================================================================
33#ifndef LBM_D3Q27_H
34#define LBM_D3Q27_H
35
36#include <map>
37
38#include <basics/DataTypes.h>
40
41namespace vf::lbm::dir
42{
43static constexpr size_t STARTDIR = 0;
44static constexpr size_t ENDDIR = 26;
45static constexpr size_t NUMBER_Of_DIRECTIONS = ENDDIR + 1;
46
47static constexpr size_t d000 = 0;
48static constexpr size_t dP00 = 1;
49static constexpr size_t dM00 = 2;
50static constexpr size_t d0P0 = 3;
51static constexpr size_t d0M0 = 4;
52static constexpr size_t d00P = 5;
53static constexpr size_t d00M = 6;
54static constexpr size_t dPP0 = 7;
55static constexpr size_t dMM0 = 8;
56static constexpr size_t dPM0 = 9;
57static constexpr size_t dMP0 = 10;
58static constexpr size_t dP0P = 11;
59static constexpr size_t dM0M = 12;
60static constexpr size_t dP0M = 13;
61static constexpr size_t dM0P = 14;
62static constexpr size_t d0PP = 15;
63static constexpr size_t d0MM = 16;
64static constexpr size_t d0PM = 17;
65static constexpr size_t d0MP = 18;
66static constexpr size_t dPPP = 19;
67static constexpr size_t dMPP = 20;
68static constexpr size_t dPMP = 21;
69static constexpr size_t dMMP = 22;
70static constexpr size_t dPPM = 23;
71static constexpr size_t dMPM = 24;
72static constexpr size_t dPMM = 25;
73static constexpr size_t dMMM = 26;
74
75#define NAME_OF(direction) #direction
76static const std::map<size_t, std::string> directionNames {
77 { d000, NAME_OF(d000) }, { dP00, NAME_OF(dP00) }, { dM00, NAME_OF(dM00) }, { d0P0, NAME_OF(d0P0) },
78 { d0M0, NAME_OF(d0M0) }, { d00P, NAME_OF(d00P) }, { d00M, NAME_OF(d00M) }, { dPP0, NAME_OF(dPP0) },
79 { dMM0, NAME_OF(dMM0) }, { dPM0, NAME_OF(dPM0) }, { dMP0, NAME_OF(dMP0) }, { dP0P, NAME_OF(dP0P) },
80 { dM0M, NAME_OF(dM0M) }, { dP0M, NAME_OF(dP0M) }, { dM0P, NAME_OF(dM0P) }, { d0PP, NAME_OF(d0PP) },
81 { d0MM, NAME_OF(d0MM) }, { d0PM, NAME_OF(d0PM) }, { d0MP, NAME_OF(d0MP) }, { dPPP, NAME_OF(dPPP) },
82 { dMPP, NAME_OF(dMPP) }, { dPMP, NAME_OF(dPMP) }, { dMMP, NAME_OF(dMMP) }, { dPPM, NAME_OF(dPPM) },
83 { dMPM, NAME_OF(dMPM) }, { dPMM, NAME_OF(dPMM) }, { dMMM, NAME_OF(dMMM) },
84};
85
86static constexpr size_t i000 = d000;
87static constexpr size_t iP00 = dM00;
88static constexpr size_t iM00 = dP00;
89static constexpr size_t i0P0 = d0M0;
90static constexpr size_t i0M0 = d0P0;
91static constexpr size_t i00P = d00M;
92static constexpr size_t i00M = d00P;
93static constexpr size_t iPP0 = dMM0;
94static constexpr size_t iMM0 = dPP0;
95static constexpr size_t iPM0 = dMP0;
96static constexpr size_t iMP0 = dPM0;
97static constexpr size_t iP0P = dM0M;
98static constexpr size_t iM0M = dP0P;
99static constexpr size_t iP0M = dM0P;
100static constexpr size_t iM0P = dP0M;
101static constexpr size_t i0PP = d0MM;
102static constexpr size_t i0MM = d0PP;
103static constexpr size_t i0PM = d0MP;
104static constexpr size_t i0MP = d0PM;
105static constexpr size_t iPPP = dMMM;
106static constexpr size_t iMPP = dPMM;
107static constexpr size_t iPMP = dMPM;
108static constexpr size_t iMMP = dPPM;
109static constexpr size_t iPPM = dMMP;
110static constexpr size_t iMPM = dPMP;
111static constexpr size_t iPMM = dMPP;
112static constexpr size_t iMMM = dPPP;
113
114static constexpr size_t eP00 = 0;
115static constexpr size_t eM00 = 0;
116static constexpr size_t e0P0 = 1;
117static constexpr size_t e0M0 = 1;
118static constexpr size_t e00P = 2;
119static constexpr size_t e00M = 2;
120static constexpr size_t ePP0 = 3;
121static constexpr size_t eMM0 = 3;
122static constexpr size_t ePM0 = 4;
123static constexpr size_t eMP0 = 4;
124static constexpr size_t eP0P = 5;
125static constexpr size_t eM0M = 5;
126static constexpr size_t eP0M = 6;
127static constexpr size_t eM0P = 6;
128static constexpr size_t e0PP = 7;
129static constexpr size_t e0MM = 7;
130static constexpr size_t e0PM = 8;
131static constexpr size_t e0MP = 8;
132static constexpr size_t ePPP = 9;
133static constexpr size_t eMMM = 9;
134static constexpr size_t eMPP = 10;
135static constexpr size_t ePMM = 10;
136static constexpr size_t ePMP = 11;
137static constexpr size_t eMPM = 11;
138static constexpr size_t eMMP = 12;
139static constexpr size_t ePPM = 12;
140
141static constexpr unsigned long int et000 = 1;
142static constexpr unsigned long int etP00 = 2;
143static constexpr unsigned long int etM00 = 4;
144static constexpr unsigned long int et0P0 = 8;
145static constexpr unsigned long int et0M0 = 16;
146static constexpr unsigned long int et00P = 32;
147static constexpr unsigned long int et00M = 64;
148static constexpr unsigned long int etPP0 = 128;
149static constexpr unsigned long int etMM0 = 256;
150static constexpr unsigned long int etPM0 = 512;
151static constexpr unsigned long int etMP0 = 1024;
152static constexpr unsigned long int etP0P = 2048;
153static constexpr unsigned long int etM0M = 4096;
154static constexpr unsigned long int etP0M = 8192;
155static constexpr unsigned long int etM0P = 16384;
156static constexpr unsigned long int et0PP = 32768;
157static constexpr unsigned long int et0MM = 65536;
158static constexpr unsigned long int et0PM = 131072;
159static constexpr unsigned long int et0MP = 262144;
160static constexpr unsigned long int etPPP = 524288;
161static constexpr unsigned long int etMPP = 1048576;
162static constexpr unsigned long int etPMP = 2097152;
163static constexpr unsigned long int etMMP = 4194304;
164static constexpr unsigned long int etPPM = 8388608;
165static constexpr unsigned long int etMPM = 16777216;
166static constexpr unsigned long int etPMM = 33554432;
167static constexpr unsigned long int etMMM = 67108864;
168
169template<size_t direction> constexpr size_t inverseDir();
170template<> constexpr size_t inverseDir<d000>(){ return i000; };
171template<> constexpr size_t inverseDir<dP00>(){ return iP00; };
172template<> constexpr size_t inverseDir<dM00>(){ return iM00; };
173template<> constexpr size_t inverseDir<d0P0>(){ return i0P0; };
174template<> constexpr size_t inverseDir<d0M0>(){ return i0M0; };
175template<> constexpr size_t inverseDir<d00P>(){ return i00P; };
176template<> constexpr size_t inverseDir<d00M>(){ return i00M; };
177template<> constexpr size_t inverseDir<dPP0>(){ return iPP0; };
178template<> constexpr size_t inverseDir<dMM0>(){ return iMM0; };
179template<> constexpr size_t inverseDir<dPM0>(){ return iPM0; };
180template<> constexpr size_t inverseDir<dMP0>(){ return iMP0; };
181template<> constexpr size_t inverseDir<dP0P>(){ return iP0P; };
182template<> constexpr size_t inverseDir<dM0M>(){ return iM0M; };
183template<> constexpr size_t inverseDir<dP0M>(){ return iP0M; };
184template<> constexpr size_t inverseDir<dM0P>(){ return iM0P; };
185template<> constexpr size_t inverseDir<d0PP>(){ return i0PP; };
186template<> constexpr size_t inverseDir<d0MM>(){ return i0MM; };
187template<> constexpr size_t inverseDir<d0PM>(){ return i0PM; };
188template<> constexpr size_t inverseDir<d0MP>(){ return i0MP; };
189template<> constexpr size_t inverseDir<dPPP>(){ return iPPP; };
190template<> constexpr size_t inverseDir<dMMM>(){ return iMMM; };
191template<> constexpr size_t inverseDir<dPPM>(){ return iPPM; };
192template<> constexpr size_t inverseDir<dMMP>(){ return iMMP; };
193template<> constexpr size_t inverseDir<dPMP>(){ return iPMP; };
194template<> constexpr size_t inverseDir<dMPM>(){ return iMPM; };
195template<> constexpr size_t inverseDir<dPMM>(){ return iPMM; };
196template<> constexpr size_t inverseDir<dMPP>(){ return iMPP; };
197
198
199template<size_t direction> constexpr real getVelocity(real velocityX, real velocityY, real velocityZ);
200template<> constexpr real getVelocity<d000>(real /*velocityX*/, real /*velocityY*/, real /*velocityZ*/){ return basics::constant::c0o1; }
201template<> constexpr real getVelocity<dP00>(real velocityX, real /*velocityY*/, real /*velocityZ*/){ return velocityX; }
202template<> constexpr real getVelocity<dM00>(real velocityX, real /*velocityY*/, real /*velocityZ*/){ return -velocityX; }
203template<> constexpr real getVelocity<d0P0>(real /*velocityX*/, real velocityY, real /*velocityZ*/){ return velocityY; }
204template<> constexpr real getVelocity<d0M0>(real /*velocityX*/, real velocityY, real /*velocityZ*/){ return -velocityY; }
205template<> constexpr real getVelocity<d00P>(real /*velocityX*/, real /*velocityY*/, real velocityZ){ return velocityZ; }
206template<> constexpr real getVelocity<d00M>(real /*velocityX*/, real /*velocityY*/, real velocityZ){ return -velocityZ; }
207template<> constexpr real getVelocity<dPP0>(real velocityX, real velocityY, real /*velocityZ*/){ return velocityX + velocityY; }
208template<> constexpr real getVelocity<dMM0>(real velocityX, real velocityY, real /*velocityZ*/){ return -velocityX - velocityY; }
209template<> constexpr real getVelocity<dPM0>(real velocityX, real velocityY, real /*velocityZ*/){ return velocityX - velocityY; }
210template<> constexpr real getVelocity<dMP0>(real velocityX, real velocityY, real /*velocityZ*/){ return -velocityX + velocityY; }
211template<> constexpr real getVelocity<dP0P>(real velocityX, real /*velocityY*/, real velocityZ){ return velocityX + velocityZ; }
212template<> constexpr real getVelocity<dM0M>(real velocityX, real /*velocityY*/, real velocityZ){ return -velocityX - velocityZ; }
213template<> constexpr real getVelocity<dP0M>(real velocityX, real /*velocityY*/, real velocityZ){ return velocityX - velocityZ; }
214template<> constexpr real getVelocity<dM0P>(real velocityX, real /*velocityY*/, real velocityZ){ return -velocityX + velocityZ; }
215template<> constexpr real getVelocity<d0PP>(real /*velocityX*/, real velocityY, real velocityZ){ return velocityY + velocityZ; }
216template<> constexpr real getVelocity<d0MM>(real /*velocityX*/, real velocityY, real velocityZ){ return -velocityY - velocityZ; }
217template<> constexpr real getVelocity<d0PM>(real /*velocityX*/, real velocityY, real velocityZ){ return velocityY - velocityZ; }
218template<> constexpr real getVelocity<d0MP>(real /*velocityX*/, real velocityY, real velocityZ){ return -velocityY + velocityZ; }
219template<> constexpr real getVelocity<dPPP>(real velocityX, real velocityY, real velocityZ){ return velocityX + velocityY + velocityZ; }
220template<> constexpr real getVelocity<dMMM>(real velocityX, real velocityY, real velocityZ){ return -velocityX - velocityY - velocityZ; }
221template<> constexpr real getVelocity<dPPM>(real velocityX, real velocityY, real velocityZ){ return velocityX + velocityY - velocityZ; }
222template<> constexpr real getVelocity<dMMP>(real velocityX, real velocityY, real velocityZ){ return -velocityX - velocityY + velocityZ; }
223template<> constexpr real getVelocity<dPMP>(real velocityX, real velocityY, real velocityZ){ return velocityX - velocityY + velocityZ; }
224template<> constexpr real getVelocity<dMPM>(real velocityX, real velocityY, real velocityZ){ return -velocityX + velocityY - velocityZ; }
225template<> constexpr real getVelocity<dPMM>(real velocityX, real velocityY, real velocityZ){ return velocityX - velocityY - velocityZ; }
226template<> constexpr real getVelocity<dMPP>(real velocityX, real velocityY, real velocityZ){ return -velocityX + velocityY + velocityZ; }
227
228
229template<size_t direction> constexpr real getWeight();
230template<> constexpr real getWeight<d000>(){ return basics::constant::c8o27; }
231template<> constexpr real getWeight<dP00>(){ return basics::constant::c2o27; }
232template<> constexpr real getWeight<dM00>(){ return basics::constant::c2o27; }
233template<> constexpr real getWeight<d0P0>(){ return basics::constant::c2o27; }
234template<> constexpr real getWeight<d0M0>(){ return basics::constant::c2o27; }
235template<> constexpr real getWeight<d00P>(){ return basics::constant::c2o27; }
236template<> constexpr real getWeight<d00M>(){ return basics::constant::c2o27; }
237template<> constexpr real getWeight<dPP0>(){ return basics::constant::c1o54; }
238template<> constexpr real getWeight<dMM0>(){ return basics::constant::c1o54; }
239template<> constexpr real getWeight<dPM0>(){ return basics::constant::c1o54; }
240template<> constexpr real getWeight<dMP0>(){ return basics::constant::c1o54; }
241template<> constexpr real getWeight<dP0P>(){ return basics::constant::c1o54; }
242template<> constexpr real getWeight<dM0M>(){ return basics::constant::c1o54; }
243template<> constexpr real getWeight<dP0M>(){ return basics::constant::c1o54; }
244template<> constexpr real getWeight<dM0P>(){ return basics::constant::c1o54; }
245template<> constexpr real getWeight<d0PP>(){ return basics::constant::c1o54; }
246template<> constexpr real getWeight<d0MM>(){ return basics::constant::c1o54; }
247template<> constexpr real getWeight<d0PM>(){ return basics::constant::c1o54; }
248template<> constexpr real getWeight<d0MP>(){ return basics::constant::c1o54; }
249template<> constexpr real getWeight<dPPP>(){ return basics::constant::c1o216; }
250template<> constexpr real getWeight<dMMM>(){ return basics::constant::c1o216; }
251template<> constexpr real getWeight<dPPM>(){ return basics::constant::c1o216; }
252template<> constexpr real getWeight<dMMP>(){ return basics::constant::c1o216; }
253template<> constexpr real getWeight<dPMP>(){ return basics::constant::c1o216; }
254template<> constexpr real getWeight<dMPM>(){ return basics::constant::c1o216; }
255template<> constexpr real getWeight<dPMM>(){ return basics::constant::c1o216; }
256template<> constexpr real getWeight<dMPP>(){ return basics::constant::c1o216; }
257
258template<size_t direction> constexpr real getComponentX();
259template<> constexpr real getComponentX<d000>(){ return basics::constant::c0o1; }
260template<> constexpr real getComponentX<dP00>(){ return basics::constant::c1o1; }
261template<> constexpr real getComponentX<dM00>(){ return -basics::constant::c1o1; }
262template<> constexpr real getComponentX<d0P0>(){ return basics::constant::c0o1; }
263template<> constexpr real getComponentX<d0M0>(){ return basics::constant::c0o1; }
264template<> constexpr real getComponentX<d00P>(){ return basics::constant::c0o1; }
265template<> constexpr real getComponentX<d00M>(){ return basics::constant::c0o1; }
266template<> constexpr real getComponentX<dPP0>(){ return basics::constant::c1o1; }
267template<> constexpr real getComponentX<dMM0>(){ return -basics::constant::c1o1; }
268template<> constexpr real getComponentX<dPM0>(){ return basics::constant::c1o1; }
269template<> constexpr real getComponentX<dMP0>(){ return -basics::constant::c1o1; }
270template<> constexpr real getComponentX<dP0P>(){ return basics::constant::c1o1; }
271template<> constexpr real getComponentX<dM0M>(){ return -basics::constant::c1o1; }
272template<> constexpr real getComponentX<dP0M>(){ return basics::constant::c1o1; }
273template<> constexpr real getComponentX<dM0P>(){ return -basics::constant::c1o1; }
274template<> constexpr real getComponentX<d0PP>(){ return basics::constant::c0o1; }
275template<> constexpr real getComponentX<d0MM>(){ return basics::constant::c0o1; }
276template<> constexpr real getComponentX<d0PM>(){ return basics::constant::c0o1; }
277template<> constexpr real getComponentX<d0MP>(){ return basics::constant::c0o1; }
278template<> constexpr real getComponentX<dPPP>(){ return basics::constant::c1o1; }
279template<> constexpr real getComponentX<dMMM>(){ return -basics::constant::c1o1; }
280template<> constexpr real getComponentX<dPPM>(){ return basics::constant::c1o1; }
281template<> constexpr real getComponentX<dMMP>(){ return -basics::constant::c1o1; }
282template<> constexpr real getComponentX<dPMP>(){ return basics::constant::c1o1; }
283template<> constexpr real getComponentX<dMPM>(){ return -basics::constant::c1o1; }
284template<> constexpr real getComponentX<dPMM>(){ return basics::constant::c1o1; }
285template<> constexpr real getComponentX<dMPP>(){ return -basics::constant::c1o1; }
286
287template<size_t direction> constexpr real getComponentY();
288template<> constexpr real getComponentY<d000>(){ return basics::constant::c0o1; }
289template<> constexpr real getComponentY<dP00>(){ return basics::constant::c0o1; }
290template<> constexpr real getComponentY<dM00>(){ return basics::constant::c0o1; }
291template<> constexpr real getComponentY<d0P0>(){ return basics::constant::c1o1; }
292template<> constexpr real getComponentY<d0M0>(){ return -basics::constant::c1o1; }
293template<> constexpr real getComponentY<d00P>(){ return basics::constant::c0o1; }
294template<> constexpr real getComponentY<d00M>(){ return basics::constant::c0o1; }
295template<> constexpr real getComponentY<dPP0>(){ return basics::constant::c1o1; }
296template<> constexpr real getComponentY<dMM0>(){ return -basics::constant::c1o1; }
297template<> constexpr real getComponentY<dPM0>(){ return -basics::constant::c1o1; }
298template<> constexpr real getComponentY<dMP0>(){ return basics::constant::c1o1; }
299template<> constexpr real getComponentY<dP0P>(){ return basics::constant::c0o1; }
300template<> constexpr real getComponentY<dM0M>(){ return basics::constant::c0o1; }
301template<> constexpr real getComponentY<dP0M>(){ return basics::constant::c0o1; }
302template<> constexpr real getComponentY<dM0P>(){ return basics::constant::c0o1; }
303template<> constexpr real getComponentY<d0PP>(){ return basics::constant::c1o1; }
304template<> constexpr real getComponentY<d0MM>(){ return -basics::constant::c1o1; }
305template<> constexpr real getComponentY<d0PM>(){ return basics::constant::c1o1; }
306template<> constexpr real getComponentY<d0MP>(){ return -basics::constant::c1o1; }
307template<> constexpr real getComponentY<dPPP>(){ return basics::constant::c1o1; }
308template<> constexpr real getComponentY<dMMM>(){ return -basics::constant::c1o1; }
309template<> constexpr real getComponentY<dPPM>(){ return basics::constant::c1o1; }
310template<> constexpr real getComponentY<dMMP>(){ return -basics::constant::c1o1; }
311template<> constexpr real getComponentY<dPMP>(){ return -basics::constant::c1o1; }
312template<> constexpr real getComponentY<dMPM>(){ return basics::constant::c1o1; }
313template<> constexpr real getComponentY<dPMM>(){ return -basics::constant::c1o1; }
314template<> constexpr real getComponentY<dMPP>(){ return basics::constant::c1o1; }
315
316template<size_t direction> constexpr real getComponentZ();
317template<> constexpr real getComponentZ<d000>(){ return basics::constant::c0o1; }
318template<> constexpr real getComponentZ<dP00>(){ return basics::constant::c0o1; }
319template<> constexpr real getComponentZ<dM00>(){ return basics::constant::c0o1; }
320template<> constexpr real getComponentZ<d0P0>(){ return basics::constant::c0o1; }
321template<> constexpr real getComponentZ<d0M0>(){ return basics::constant::c0o1; }
322template<> constexpr real getComponentZ<d00P>(){ return basics::constant::c1o1; }
323template<> constexpr real getComponentZ<d00M>(){ return -basics::constant::c1o1; }
324template<> constexpr real getComponentZ<dPP0>(){ return basics::constant::c0o1; }
325template<> constexpr real getComponentZ<dMM0>(){ return basics::constant::c0o1; }
326template<> constexpr real getComponentZ<dPM0>(){ return basics::constant::c0o1; }
327template<> constexpr real getComponentZ<dMP0>(){ return basics::constant::c0o1; }
328template<> constexpr real getComponentZ<dP0P>(){ return basics::constant::c1o1; }
329template<> constexpr real getComponentZ<dM0M>(){ return -basics::constant::c1o1; }
330template<> constexpr real getComponentZ<dP0M>(){ return -basics::constant::c1o1; }
331template<> constexpr real getComponentZ<dM0P>(){ return basics::constant::c1o1; }
332template<> constexpr real getComponentZ<d0PP>(){ return basics::constant::c1o1; }
333template<> constexpr real getComponentZ<d0MM>(){ return -basics::constant::c1o1; }
334template<> constexpr real getComponentZ<d0PM>(){ return -basics::constant::c1o1; }
335template<> constexpr real getComponentZ<d0MP>(){ return basics::constant::c1o1; }
336template<> constexpr real getComponentZ<dPPP>(){ return basics::constant::c1o1; }
337template<> constexpr real getComponentZ<dMMM>(){ return -basics::constant::c1o1; }
338template<> constexpr real getComponentZ<dPPM>(){ return -basics::constant::c1o1; }
339template<> constexpr real getComponentZ<dMMP>(){ return basics::constant::c1o1; }
340template<> constexpr real getComponentZ<dPMP>(){ return basics::constant::c1o1; }
341template<> constexpr real getComponentZ<dMPM>(){ return -basics::constant::c1o1; }
342template<> constexpr real getComponentZ<dPMM>(){ return -basics::constant::c1o1; }
343template<> constexpr real getComponentZ<dMPP>(){ return basics::constant::c1o1; }
344
345
346template <std::size_t offset, std::size_t... S, typename F>
347constexpr void forSequence(std::index_sequence<S...> , F func)
348{
349 (func(std::integral_constant<std::size_t, S + offset> {}), ...);
350}
351
353// this template can be used to generate a loop over all directions (except d000) at compile time.
354// it takes a lambda of the form [](auto direction){...}.
355// See src/gpu/core/BoundaryConditions/AdvectionDiffusion/AdvectionDiffusionBounceBack.cuh for an example
356template <typename F>
358{
359 forSequence<1>(std::make_index_sequence<vf::lbm::dir::ENDDIR> {}, func);
360}
361
362template <typename F>
363constexpr void forEachDirection(F func)
364{
365 forSequence<0>(std::make_index_sequence<vf::lbm::dir::NUMBER_Of_DIRECTIONS> {}, func);
366}
367} // namespace vf::lbm::dir
368#endif
369
std::shared_ptr< T > SPtr
float real
Definition DataTypes.h:42
#define NAME_OF(direction)
Definition D3Q27.h:75
constexpr real getComponentY< dP0P >()
Definition D3Q27.h:299
constexpr real getVelocity< dPP0 >(real velocityX, real velocityY, real)
Definition D3Q27.h:207
constexpr real getVelocity< d0MP >(real, real velocityY, real velocityZ)
Definition D3Q27.h:218
constexpr real getComponentX< d0MP >()
Definition D3Q27.h:277
constexpr real getWeight< dPMP >()
Definition D3Q27.h:253
constexpr real getWeight< dM0P >()
Definition D3Q27.h:244
constexpr real getComponentZ< dPP0 >()
Definition D3Q27.h:324
constexpr real getComponentZ< d0MP >()
Definition D3Q27.h:335
constexpr real getWeight< dMPM >()
Definition D3Q27.h:254
constexpr real getComponentX< dMPM >()
Definition D3Q27.h:283
constexpr size_t inverseDir< d0PP >()
Definition D3Q27.h:185
constexpr real getComponentZ< dMMP >()
Definition D3Q27.h:339
constexpr real getVelocity< d00M >(real, real, real velocityZ)
Definition D3Q27.h:206
constexpr real getVelocity< dPMP >(real velocityX, real velocityY, real velocityZ)
Definition D3Q27.h:223
constexpr real getComponentX< dPPP >()
Definition D3Q27.h:278
constexpr real getComponentX()
constexpr real getComponentY< d0MP >()
Definition D3Q27.h:306
constexpr real getComponentX< dM0P >()
Definition D3Q27.h:273
constexpr real getVelocity< d00P >(real, real, real velocityZ)
Definition D3Q27.h:205
constexpr real getComponentZ< dM00 >()
Definition D3Q27.h:319
constexpr real getComponentX< d00P >()
Definition D3Q27.h:264
constexpr real getWeight< d0M0 >()
Definition D3Q27.h:234
constexpr real getComponentX< dMMP >()
Definition D3Q27.h:281
constexpr real getComponentZ< d00P >()
Definition D3Q27.h:322
constexpr real getVelocity< dPMM >(real velocityX, real velocityY, real velocityZ)
Definition D3Q27.h:225
constexpr real getWeight< dMMM >()
Definition D3Q27.h:250
constexpr real getComponentZ< d000 >()
Definition D3Q27.h:317
constexpr size_t inverseDir< d0MM >()
Definition D3Q27.h:186
constexpr real getComponentZ< dMPP >()
Definition D3Q27.h:343
constexpr void forEachNonRestDirection(F func)
How to use this function:
Definition D3Q27.h:357
constexpr size_t inverseDir< d0M0 >()
Definition D3Q27.h:174
constexpr real getComponentY< dMM0 >()
Definition D3Q27.h:296
constexpr real getComponentZ()
constexpr real getComponentY< dMP0 >()
Definition D3Q27.h:298
constexpr real getWeight< d00P >()
Definition D3Q27.h:235
constexpr real getComponentZ< dMM0 >()
Definition D3Q27.h:325
constexpr real getComponentX< dPP0 >()
Definition D3Q27.h:266
constexpr real getWeight< dP0P >()
Definition D3Q27.h:241
constexpr real getComponentZ< dPM0 >()
Definition D3Q27.h:326
constexpr size_t inverseDir< dPM0 >()
Definition D3Q27.h:179
constexpr real getComponentZ< dPPM >()
Definition D3Q27.h:338
constexpr real getWeight< dPP0 >()
Definition D3Q27.h:237
constexpr size_t inverseDir< dP0M >()
Definition D3Q27.h:183
constexpr real getVelocity< dMMM >(real velocityX, real velocityY, real velocityZ)
Definition D3Q27.h:220
constexpr real getWeight< d0PM >()
Definition D3Q27.h:247
constexpr real getVelocity< d0P0 >(real, real velocityY, real)
Definition D3Q27.h:203
constexpr size_t inverseDir< dPMP >()
Definition D3Q27.h:193
constexpr real getComponentY< dMPP >()
Definition D3Q27.h:314
constexpr real getComponentX< dM00 >()
Definition D3Q27.h:261
constexpr real getComponentX< d0PP >()
Definition D3Q27.h:274
constexpr real getVelocity(real velocityX, real velocityY, real velocityZ)
constexpr size_t inverseDir< dPPM >()
Definition D3Q27.h:191
constexpr size_t inverseDir< d0MP >()
Definition D3Q27.h:188
constexpr real getWeight()
constexpr real getComponentY< dPPM >()
Definition D3Q27.h:309
constexpr real getWeight< dP0M >()
Definition D3Q27.h:243
constexpr real getComponentZ< d0P0 >()
Definition D3Q27.h:320
constexpr size_t inverseDir< d00P >()
Definition D3Q27.h:175
constexpr size_t inverseDir< d00M >()
Definition D3Q27.h:176
constexpr real getComponentX< dP0P >()
Definition D3Q27.h:270
constexpr real getVelocity< dP0P >(real velocityX, real, real velocityZ)
Definition D3Q27.h:211
constexpr real getComponentX< dPMP >()
Definition D3Q27.h:282
constexpr size_t inverseDir()
constexpr size_t inverseDir< dMM0 >()
Definition D3Q27.h:178
constexpr real getComponentY< dMMM >()
Definition D3Q27.h:308
constexpr real getComponentZ< dM0P >()
Definition D3Q27.h:331
constexpr real getWeight< d0MP >()
Definition D3Q27.h:248
constexpr real getWeight< dPPP >()
Definition D3Q27.h:249
constexpr size_t inverseDir< dMP0 >()
Definition D3Q27.h:180
constexpr size_t inverseDir< d0P0 >()
Definition D3Q27.h:173
constexpr size_t inverseDir< dMPP >()
Definition D3Q27.h:196
constexpr real getVelocity< dMPP >(real velocityX, real velocityY, real velocityZ)
Definition D3Q27.h:226
constexpr real getComponentZ< d0MM >()
Definition D3Q27.h:333
constexpr real getComponentY< d0P0 >()
Definition D3Q27.h:291
constexpr real getComponentX< dPMM >()
Definition D3Q27.h:284
constexpr real getComponentX< dM0M >()
Definition D3Q27.h:271
constexpr real getVelocity< d0M0 >(real, real velocityY, real)
Definition D3Q27.h:204
constexpr real getWeight< dMPP >()
Definition D3Q27.h:256
constexpr real getComponentZ< dPMM >()
Definition D3Q27.h:342
constexpr real getVelocity< dPPP >(real velocityX, real velocityY, real velocityZ)
Definition D3Q27.h:219
constexpr real getComponentZ< dMMM >()
Definition D3Q27.h:337
constexpr real getComponentX< dMM0 >()
Definition D3Q27.h:267
constexpr void forSequence(std::index_sequence< S... >, F func)
Definition D3Q27.h:347
constexpr real getComponentY< d0PM >()
Definition D3Q27.h:305
constexpr real getComponentZ< d00M >()
Definition D3Q27.h:323
constexpr size_t inverseDir< dM0P >()
Definition D3Q27.h:184
constexpr size_t inverseDir< dPMM >()
Definition D3Q27.h:195
constexpr real getWeight< d0MM >()
Definition D3Q27.h:246
constexpr real getComponentX< dPM0 >()
Definition D3Q27.h:268
constexpr real getVelocity< d000 >(real, real, real)
Definition D3Q27.h:200
constexpr real getComponentX< d0PM >()
Definition D3Q27.h:276
constexpr real getComponentX< dP0M >()
Definition D3Q27.h:272
constexpr size_t inverseDir< dPP0 >()
Definition D3Q27.h:177
constexpr size_t inverseDir< d000 >()
Definition D3Q27.h:170
constexpr real getComponentX< dMMM >()
Definition D3Q27.h:279
constexpr real getWeight< dPMM >()
Definition D3Q27.h:255
constexpr real getComponentX< d00M >()
Definition D3Q27.h:265
constexpr real getWeight< dMMP >()
Definition D3Q27.h:252
constexpr real getVelocity< dMM0 >(real velocityX, real velocityY, real)
Definition D3Q27.h:208
constexpr real getComponentY< dMMP >()
Definition D3Q27.h:310
constexpr real getComponentZ< d0PM >()
Definition D3Q27.h:334
constexpr real getComponentX< d0M0 >()
Definition D3Q27.h:263
constexpr real getComponentY< dM0P >()
Definition D3Q27.h:302
constexpr real getComponentY< d0MM >()
Definition D3Q27.h:304
constexpr real getComponentY< dPMM >()
Definition D3Q27.h:313
constexpr real getComponentX< dPPM >()
Definition D3Q27.h:280
constexpr size_t inverseDir< dP00 >()
Definition D3Q27.h:171
constexpr real getComponentX< dP00 >()
Definition D3Q27.h:260
constexpr real getComponentY< dPMP >()
Definition D3Q27.h:311
constexpr real getVelocity< d0MM >(real, real velocityY, real velocityZ)
Definition D3Q27.h:216
constexpr real getWeight< d000 >()
Definition D3Q27.h:230
constexpr real getWeight< dMP0 >()
Definition D3Q27.h:240
constexpr size_t inverseDir< dPPP >()
Definition D3Q27.h:189
constexpr real getVelocity< d0PP >(real, real velocityY, real velocityZ)
Definition D3Q27.h:215
constexpr real getComponentY< dM00 >()
Definition D3Q27.h:290
constexpr real getVelocity< dMP0 >(real velocityX, real velocityY, real)
Definition D3Q27.h:210
constexpr real getWeight< dPPM >()
Definition D3Q27.h:251
constexpr real getWeight< d0P0 >()
Definition D3Q27.h:233
constexpr real getComponentX< d0MM >()
Definition D3Q27.h:275
constexpr real getComponentY< dPP0 >()
Definition D3Q27.h:295
constexpr real getVelocity< dMPM >(real velocityX, real velocityY, real velocityZ)
Definition D3Q27.h:224
constexpr real getComponentZ< d0PP >()
Definition D3Q27.h:332
constexpr real getWeight< dP00 >()
Definition D3Q27.h:231
constexpr real getComponentZ< dP00 >()
Definition D3Q27.h:318
constexpr real getVelocity< dPM0 >(real velocityX, real velocityY, real)
Definition D3Q27.h:209
constexpr real getComponentY< d00M >()
Definition D3Q27.h:294
constexpr real getComponentY< d0PP >()
Definition D3Q27.h:303
constexpr real getComponentY< d000 >()
Definition D3Q27.h:288
constexpr void forEachDirection(F func)
Definition D3Q27.h:363
constexpr real getWeight< dMM0 >()
Definition D3Q27.h:238
constexpr real getComponentZ< dP0M >()
Definition D3Q27.h:330
constexpr size_t inverseDir< dMMP >()
Definition D3Q27.h:192
constexpr real getComponentZ< dMPM >()
Definition D3Q27.h:341
constexpr real getComponentY< dP00 >()
Definition D3Q27.h:289
constexpr size_t inverseDir< dP0P >()
Definition D3Q27.h:181
constexpr real getComponentY< d0M0 >()
Definition D3Q27.h:292
constexpr real getComponentY< dPPP >()
Definition D3Q27.h:307
constexpr real getVelocity< dP0M >(real velocityX, real, real velocityZ)
Definition D3Q27.h:213
constexpr real getVelocity< d0PM >(real, real velocityY, real velocityZ)
Definition D3Q27.h:217
constexpr real getVelocity< dP00 >(real velocityX, real, real)
Definition D3Q27.h:201
constexpr real getVelocity< dM0P >(real velocityX, real, real velocityZ)
Definition D3Q27.h:214
constexpr real getWeight< d0PP >()
Definition D3Q27.h:245
constexpr real getWeight< dM00 >()
Definition D3Q27.h:232
constexpr real getComponentY< dP0M >()
Definition D3Q27.h:301
constexpr real getComponentY< dPM0 >()
Definition D3Q27.h:297
constexpr size_t inverseDir< dMPM >()
Definition D3Q27.h:194
constexpr real getComponentZ< dP0P >()
Definition D3Q27.h:328
constexpr real getVelocity< dMMP >(real velocityX, real velocityY, real velocityZ)
Definition D3Q27.h:222
constexpr real getComponentZ< dM0M >()
Definition D3Q27.h:329
constexpr real getWeight< d00M >()
Definition D3Q27.h:236
constexpr size_t inverseDir< d0PM >()
Definition D3Q27.h:187
constexpr size_t inverseDir< dMMM >()
Definition D3Q27.h:190
constexpr size_t inverseDir< dM0M >()
Definition D3Q27.h:182
constexpr real getComponentZ< d0M0 >()
Definition D3Q27.h:321
constexpr real getComponentY< dM0M >()
Definition D3Q27.h:300
constexpr real getComponentX< dMP0 >()
Definition D3Q27.h:269
constexpr real getComponentX< d000 >()
Definition D3Q27.h:259
constexpr real getComponentX< dMPP >()
Definition D3Q27.h:285
constexpr size_t inverseDir< dM00 >()
Definition D3Q27.h:172
constexpr real getComponentY< dMPM >()
Definition D3Q27.h:312
constexpr real getComponentY< d00P >()
Definition D3Q27.h:293
constexpr real getWeight< dPM0 >()
Definition D3Q27.h:239
constexpr real getComponentZ< dPMP >()
Definition D3Q27.h:340
constexpr real getVelocity< dM00 >(real velocityX, real, real)
Definition D3Q27.h:202
constexpr real getVelocity< dPPM >(real velocityX, real velocityY, real velocityZ)
Definition D3Q27.h:221
constexpr real getComponentZ< dMP0 >()
Definition D3Q27.h:327
constexpr real getComponentY()
constexpr real getComponentX< d0P0 >()
Definition D3Q27.h:262
constexpr real getComponentZ< dPPP >()
Definition D3Q27.h:336
constexpr real getWeight< dM0M >()
Definition D3Q27.h:242
constexpr real getVelocity< dM0M >(real velocityX, real, real velocityZ)
Definition D3Q27.h:212