Skip to content

Commit bde25ea

Browse files
committed
Added interactive graphics mode on Linux with X11, re-wrote C++ graphics library to minimize API dependencies, colors are now signed int consistently, fixed streamline visualization in 2D
1 parent 8c05d54 commit bde25ea

File tree

17 files changed

+6045
-883
lines changed

17 files changed

+6045
-883
lines changed

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
src/OpenCL/** linguist-vendored
2+
src/X11/** linguist-vendored
23
src/lodepng.* linguist-vendored
34
src/kernel.cpp linguist-language=OpenCL
45
src/setup.cpp linguist-documentation

README.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ Q = &Sigma;<sub><i>&alpha;&beta;</i></sub> <i>&Pi;<sub>&alpha;&beta;</sub></i><s
9494

9595
## Graphics Features
9696

97-
- on Windows: real time [interactive rasterization and raytracing graphics](https://www.researchgate.net/publication/360501260_Combined_scientific_CFD_simulation_and_interactive_raytracing_with_OpenCL)
97+
- on Windows and Linux: real time [interactive rasterization and raytracing graphics](https://www.researchgate.net/publication/360501260_Combined_scientific_CFD_simulation_and_interactive_raytracing_with_OpenCL)
9898
- on Windows and Linux (even in WSL and/or in a remote console through SSH): real time interactive ASCII console graphics
9999
- with interactive graphics mode disabled, image resolution can be as large as VRAM allows for (132 Megapixel (16K) and above)
100100
- (interacitive) visualization modes:
@@ -116,8 +116,8 @@ Q = &Sigma;<sub><i>&alpha;&beta;</i></sub> <i>&Pi;<sub>&alpha;&beta;</sub></i><s
116116
- Set the initial condition in a loop that iterates over the entire lattice by writing to `lbm.rho[n]`/`lbm.u.x[n]`/`lbm.u.y[n]`/`lbm.u.z[n]`/`lbm.flags[n]`.
117117
- Call `lbm.run()` to initialize and execute the setup (infinite time steps) or `lbm.run(time_steps)` to execute only a specific number of time steps.
118118
- As long as the `lbm` object is in scope, you can access the memory. As soon as it goes out of scope, all memory associated to the current simulation is freed again.
119-
3. When done with the setup, hit compile+run on Windows in Visual Studio Community or execute `./make.sh` on Linux; this will automatically select the fastest installed GPU. Alternatively, you can add the device ID as the first command-line argument, for example `./make.sh 2` to compile+run on device 2, or `bin/FluidX3D.exe 2` to run the executable on device 2. Compile time for the entire code is about 10 seconds.
120-
4. On Windows with `WINDOWS_GRAPHICS`/`CONSOLE_GRAPHICS` or on Linux with `CONSOLE_GRAPHICS`, press the <kbd>P</kbd> key to start/pause the simulation.
119+
3. When done with the setup, hit compile+run on Windows in Visual Studio Community or execute `./make.sh` on Linux; this will automatically select the fastest installed GPU. Alternatively, you can add the device ID as the first command-line argument, for example `./make.sh 2` to compile+run on device 2, or `bin/FluidX3D.exe 2` to run the executable on device 2. Compile time for the entire code is about 10 seconds. If you use `INTERACTIVE_GRAPHICS` on Linux, change to the "compile on Linux with X11" command in `make.sh`.
120+
4. With `INTERACTIVE_GRAPHICS`/`INTERACTIVE_GRAPHICS_ASCII` enabled, press the <kbd>P</kbd> key to start/pause the simulation.
121121

122122
Toggle rendering modes with the keyboard:
123123
- <kbd>1</kbd>: flags (and force vectors on solid boundary nodes if the extension is used)
@@ -337,6 +337,8 @@ In consequence, the arithmetic intensity of this implementation is 2.13 (FP32/FP
337337
## External Code/Libraries/Images used in FluidX3D
338338

339339
- [OpenCL-Headers](https://github.com/KhronosGroup/OpenCL-Headers) for GPU parallelization ([Khronos Group](https://www.khronos.org/opencl/))
340+
- [Win32 API](https://learn.microsoft.com/en-us/windows/win32/api/winbase/) for interactive graphics in Windows ([Microsoft](https://www.microsoft.com/))
341+
- [X11/Xlib](https://www.x.org/releases/current/doc/libX11/libX11/libX11.html) for interactive graphics in Linux ([The Open Group](https://www.x.org/releases/current/doc/libX11/libX11/libX11.html))
340342
- [marching-cubes tables](http://paulbourke.net/geometry/polygonise/) for isosurface generation on GPU ([Paul Bourke](http://paulbourke.net/geometry/))
341343
- [`src/lodepng.cpp`](https://github.com/lvandeve/lodepng/blob/master/lodepng.cpp) and [`src/lodepng.hpp`](https://github.com/lvandeve/lodepng/blob/master/lodepng.h) for `.png` encoding and decoding ([Lode Vandevenne](https://lodev.org/))
342344
- [SimplexNoise](https://weber.itn.liu.se/~stegu/simplexnoise/SimplexNoise.java) class in [`src/utilities.hpp`](https://github.com/ProjectPhysX/FluidX3D/blob/master/src/utilities.hpp) for generating continuous noise in 2D/3D/4D space ([Stefan Gustavson](https://github.com/stegu))

make.sh

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
# command line argument $1: device ID; if empty, FluidX3D will automatically choose the fastest available device
2+
23
mkdir -p bin # create directory for executable
34
rm -f ./bin/FluidX3D.exe # prevent execution of old version if compiling fails
4-
g++ ./src/*.cpp -o ./bin/FluidX3D.exe -std=c++17 -pthread -I./src/OpenCL/include -L./src/OpenCL/lib -lOpenCL # compile on Linux
5-
#g++ ./src/*.cpp -o ./bin/FluidX3D.exe -std=c++17 -pthread -I./src/OpenCL/include -framework OpenCL # compile on macOS
6-
#g++ ./src/*.cpp -o ./bin/FluidX3D.exe -std=c++17 -pthread -I./src/OpenCL/include -L/system/vendor/lib64 -lOpenCL # compile on Android
5+
6+
#g++ ./src/*.cpp -o ./bin/FluidX3D.exe -std=c++17 -pthread -I./src/OpenCL/include -L./src/OpenCL/lib -lOpenCL -I./src/X11/include -L./src/X11/lib -lX11 # compile on Linux with X11
7+
8+
g++ ./src/*.cpp -o ./bin/FluidX3D.exe -std=c++17 -pthread -I./src/OpenCL/include -L./src/OpenCL/lib -lOpenCL # compile on Linux (without X11)
9+
#g++ ./src/*.cpp -o ./bin/FluidX3D.exe -std=c++17 -pthread -I./src/OpenCL/include -framework OpenCL # compile on macOS (without X11)
10+
#g++ ./src/*.cpp -o ./bin/FluidX3D.exe -std=c++17 -pthread -I./src/OpenCL/include -L/system/vendor/lib64 -lOpenCL # compile on Android (without X11)
11+
712
./bin/FluidX3D.exe $1 # run FluidX3D

0 commit comments

Comments
 (0)