This is a slightly dodgy gravity simulator written using CUDA.
This project contains three different applications:
This is the main simulator, it expects an initial.ibin
file in it's current directory and generates <epoch number>.bin
files
in the output
directory it creates, it is the only application that requires CUDA.
This is the viewer application, it takes the <epoch number>
.bin files that cudagravity_sim
creates and shows them on the screen via SDL.
Currently these are the available keys:
Key | Function |
---|---|
space | Pauses/unpauses the viewer (starts paused) |
a | Turns auto-size on/off (auto size keeps every particle in the viewport |
→/← | Moves the viewer's time forwards/backwards by dt |
+/- | On the numpad, Increases or decreases dt by a factor of 2 |
0 | On the numpad, Goes back to the start |
↑/↓ | Zooms in/out, if you try zoom in past a particle with autosize on it won't do anything (use SHIFT for a bigger zoom interval and CTRL for a massive zoom interval |
This generates the initial.ibin
file required by cudagravity_sim
, it has three modes:
In this mode you pass in the number of particles you want and it generates N
random particles and writes those to a file
This reads the yaml file that you specify to generate the initial file (see generate_initial/sample.yaml) for an example
This opens a pygame based editor application, it's very simple but it works, you just click to create a particle and add velocity to it by dragging your mouse cursor