diff options
Diffstat (limited to 'Smoke/fluids.c')
-rw-r--r-- | Smoke/fluids.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/Smoke/fluids.c b/Smoke/fluids.c index 6ea63d8..6071d36 100644 --- a/Smoke/fluids.c +++ b/Smoke/fluids.c @@ -17,6 +17,7 @@ #include "funcs.h" #include "fluids.h" +#include "smoke.h" #include "colormap.h" //--- SIMULATION PARAMETERS ------------------------------------------------------------------------ @@ -88,6 +89,15 @@ fftw_real *init_simulation(int n) return return_value; } +void fluids_init(int dim) +{ + size_t frame_size; + + frame_size = dim * 2*(dim/2+1)*sizeof(fftw_real); + + smoke_init(frame_size); +} + int rescale_to_winwidth(float value) { return round(value *winWidth); @@ -301,9 +311,9 @@ void calculate_height_plot(void) } } -void copy_frame(fftw_real *field, fftw_real *dataset) +void copy_frames(fftw_real *dataset) { - memcpy(field, dataset, DIM * 2 * (DIM / 2 + 1) * sizeof(fftw_real)); + memcpy(smoke_get_frame(), dataset, DIM * 2 * (DIM / 2 + 1) * sizeof(fftw_real)); } //do_one_simulation_step: Do one complete cycle of the simulation: @@ -321,7 +331,7 @@ void calculate_one_simulation_step(fftw_real *field) diffuse_matter(DIM, vx, vy, rho, rho0, dt); calculate_height_plot(); calculate_normal_vectors(); - copy_frame(field, rho); + copy_frames(rho); colormap_autoscale(); } } |