summaryrefslogtreecommitdiffstats
path: root/Smoke/fluids.c
diff options
context:
space:
mode:
authorOliver Schinagl <oliver@schinagl.nl>2008-01-03 18:05:51 (GMT)
committerOliver Schinagl <oliver@schinagl.nl>2008-01-03 18:05:51 (GMT)
commitb12d6854cbb458c3de11266efefa8fb2ea11a1cf (patch)
tree32fc00f87d0bdb7f9d024c6b174e5896fd66a0f2 /Smoke/fluids.c
parent909340f9a5299194c582f9224f21f4f4daf56e51 (diff)
download2iv35-b12d6854cbb458c3de11266efefa8fb2ea11a1cf.zip
2iv35-b12d6854cbb458c3de11266efefa8fb2ea11a1cf.tar.gz
2iv35-b12d6854cbb458c3de11266efefa8fb2ea11a1cf.tar.bz2
frame passing changes
Diffstat (limited to 'Smoke/fluids.c')
-rw-r--r--Smoke/fluids.c16
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();
}
}