Multi-Threaded N-Body 2D Smoothed Particle Hydrodynamics Fluid Simulation based on paper "Particle-based Viscoelastic Fluid Simulation" by Simon Clavet, Philippe Beaudoin, and Pierre Poulin.
A experiment about creating a two-way particle simulation in 4 different programming styles to see the difference in performance and maintainability. The core math is same for all implementations, including rendering and threading.
- Object oriented style 1 (Naive)
- Object oriented style 2 (Public, reserved vectors, fixed grid, no unneccesary classes or pointers)
- Object oriented style 3 (Structs only, no virtual function calls, reserved vectors, fixed grid)
- Data oriented style with 8/16 byte aligned structures
Compile main.cpp with C++/11 compiler and link to kernel32.lib or ld.so and thats it.
There is a benchmark recording and rendering built-in.
To start a benchmark hit "B" key. To stop a benchmark hit "Escape" key.
MIT License Copyright (c) 2017 Torsten Spaete