summaryrefslogtreecommitdiffstats
path: root/Smoke/fluids.c
diff options
context:
space:
mode:
Diffstat (limited to 'Smoke/fluids.c')
-rw-r--r--Smoke/fluids.c16
1 files changed, 5 insertions, 11 deletions
diff --git a/Smoke/fluids.c b/Smoke/fluids.c
index 2a59ef1..cce2c38 100644
--- a/Smoke/fluids.c
+++ b/Smoke/fluids.c
@@ -9,6 +9,7 @@
#include <math.h>
#include <stdio.h>
+#include <stdlib.h>
#include <string.h>
#include <rfftw.h>
@@ -76,11 +77,11 @@ void fluids_init_simulation(int n, struct vis_data_arrays *vis_data)
plan_cr = rfftw2d_create_plan(n, n, FFTW_COMPLEX_TO_REAL, FFTW_IN_PLACE);
height_array = (fftw_real*) malloc(dim2);
- normal_array = (struct point*) malloc(dim2);
+ normal_array = (struct point*) malloc(dim2 *sizeof(struct point *));
for (i = 0; i < HISTORY_SIZE; i++)
{
- vis_data->history[i] = (fftw_real*)malloc(dim1);
+ vis_data->history[i] = (fftw_real *)malloc(dim1);
}
fluids_reset_simulation();
@@ -413,14 +414,8 @@ void add_history_frame(int dataset, struct vis_data_arrays *vis_data)
if (dataset != DATASET_HIST) {
frame = get_frame(vis_data, dataset);
-// printf("hisdex: %d\n", hisdex);
-
- // if (hisdex) {
- memcpy(vis_data->history[hisdex], frame, DIM * 2 * (DIM / 2) * sizeof(fftw_real));
- // } else {
- // memcpy(vis_data->history[0], frame, DIM * 2 * (DIM / 2) * sizeof(fftw_real));
- // memcpy(vis_data->history[hisdex], vis_data->history[0], DIM * 2 * (DIM / 2) * sizeof(fftw_real));
- // }
+
+ memcpy(vis_data->history[hisdex], frame, DIM * 2 * (DIM / 2 + 1) * sizeof(fftw_real));
hisdex = (hisdex >= HISTORY_SIZE -1) ? 0 : hisdex +1;
}
}
@@ -503,7 +498,6 @@ void fluids_calculate_one_simulation_step(struct vis_data_arrays *vis_data)
heightplots_set_frame(vis_data->height);
normals_set_frame(vis_data->normals);
- streamlines_set_history(vis_data->history);
}
//------ VISUALIZATION CODE STARTS HERE -----------------------------------------------------------------