You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- Compiling requires `C++17`, which is supported since `g++`version `8` (check with `g++ --version`). If you have `make` installed (check with `make --version`), compiling will will be faster using multiple CPU cores; otherwise compiling falls back to using a single CPU core.
34
-
- If you use [`INTERACTIVE_GRAPHICS`](src/defines.hpp), change to the "[compile on Linux with X11 graphics](make.sh#L3)" command in [`make.sh`](make.sh#L3).
33
+
- Compiling requires [`g++`](https://gcc.gnu.org/) with `C++17`, which is supported since version `8` (check with `g++ --version`). If you have [`make`](https://www.gnu.org/software/make/) installed (check with `make --version`), compiling will will be faster using multiple CPU cores; otherwise compiling falls back to using a single CPU core.
34
+
- If you use [`INTERACTIVE_GRAPHICS`](src/defines.hpp), select [`TARGET=Linux-X11`](make.sh#L3) in [`make.sh`](make.sh#L3).
35
35
- To select a specific GPU, enter `./make.sh 0` to compile+run, or `bin/FluidX3D 0` to run on device `0`. You can also select multiple GPUs with `bin/FluidX3D 0 1 3 6` if the setup is [configured as multi-GPU](#the-lbm-class).
36
36
37
37
### macOS
38
-
- Select the "[compile on macOS](make.sh#L5)" command in [`make.sh`](make.sh#L5).
38
+
- Select [`TARGET=macOS`](make.sh#L5) in [`make.sh`](make.sh#L5).
39
39
- Compile and run with:
40
40
```bash
41
41
chmod +x make.sh
42
42
./make.sh
43
43
```
44
44
45
45
### Android
46
-
- Select the "[compile on Android](make.sh#L6)" command in [`make.sh`](make.sh#L6).
46
+
- Select [`TARGET=Android`](make.sh#L6) in [`make.sh`](make.sh#L6).
uint Nx=1u, Ny=1u, Nz=1u, Dx=1u, Dy=1u, Dz=1u, D=1u; // auxiliary variables: (local) lattice dimensions, lattice domains, number of domains
232
+
uint NxDx=1u, NyDy=1u, NzDz=1u, Hx=0u, Hy=0u, Hz=0u; // auxiliary variables: number of domains, shortcuts for N_/D_, halo offsets
233
+
ulong NxNy=1ull, local_Nx=1ull, local_Ny=1ull, local_Nz=1ull, local_N=1ull; // auxiliary variables: shortcut for Nx*Ny, size of each domain, number of cells in each domain
234
+
inlinevoidinitialize_auxiliary_variables() { // these variables are frequently used in reference() functions, so pre-compute them only once here
235
+
Nx = lbm->get_Nx(); Ny = lbm->get_Ny(); Nz = lbm->get_Nz();
236
+
Dx = lbm->get_Dx(); Dy = lbm->get_Dy(); Dz = lbm->get_Dz();
237
+
D = Dx*Dy*Dz; // number of domains
238
+
NxNy = (ulong)Nx*(ulong)Ny; // shortcut for Nx*Ny
239
+
NxDx=Nx/Dx; NyDy=Ny/Dy; NzDz=Nz/Dz; // shortcuts for N_/D_
240
+
Hx=Dx>1u; Hy=Dy>1u; Hz=Dz>1u; // halo offsets
241
+
local_Nx=(ulong)(NxDx+2u*Hx); local_Ny=(ulong)(NyDy+2u*Hy); local_Nz=(ulong)(NzDz+2u*Hz); // size of each domain
242
+
local_N = local_Nx*local_Ny*local_Nz; // number of cells in each domain
243
+
}
232
244
inlinevoidinitialize_auxiliary_pointers() {
233
245
/********/ x = Pointer(this, 0x0u);
234
246
if(d>0x1u) y = Pointer(this, 0x1u);
235
247
if(d>0x2u) z = Pointer(this, 0x2u);
236
248
}
249
+
inline T& reference(const ulong i) { // stitch together domain buffers and make them appear as one single large buffer
250
+
if(D==1u) { // take shortcut for single domain
251
+
return buffers[0]->data()[i]; // array of structures
252
+
} else { // decompose index for multiple domains
253
+
const ulong global_i=i%N, t=global_i%NxNy;
254
+
const uint x=(uint)(t%(ulong)Nx), y=(uint)(t/(ulong)Nx), z=(uint)(global_i/NxNy); // n = x+(y+z*Ny)*Nx
255
+
const uint px=x%NxDx, py=y%NyDy, pz=z%NzDz, dx=x/NxDx, dy=y/NyDy, dz=z/NzDz, domain=dx+(dy+dz*Dy)*Dx; // 3D position within domain and which domain
0 commit comments