diff options
Diffstat (limited to 'Smoke/fluids.c')
-rw-r--r-- | Smoke/fluids.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/Smoke/fluids.c b/Smoke/fluids.c index 4a23c85..b339d1e 100644 --- a/Smoke/fluids.c +++ b/Smoke/fluids.c @@ -71,10 +71,10 @@ void fluids_init_simulation(int n, struct vis_data_arrays *vis_data) for (i = 0; i < HISTORY_SIZE; i++) { vis_data->history_frame[i] = (fftw_real *)malloc(dim1); - vis_data->history_scalars[i].x = (fftw_real *)malloc(dim1); - vis_data->history_scalars[i].y = (fftw_real *)malloc(dim1); + vis_data->history_scalars[i] = (struct fftw_real_xy *)malloc(sizeof(struct fftw_real_xy)); + vis_data->history_scalars[i]->x = (fftw_real *)malloc(dim1); + vis_data->history_scalars[i]->y = (fftw_real *)malloc(dim1); } - fluids_reset_simulation(); vis_data->rho = (fftw_real *)malloc(dim2); @@ -382,6 +382,7 @@ void setup_arrays(struct vis_data_arrays *vis_data) fftw_real *frame_smoke, *frame_streamlines; struct fftw_real_xy scalar_frames_glyphs, scalar_frames_streamlines; int dataset; + struct fftw_real_xy *test; fftw_real wn = (fftw_real)winWidth / (fftw_real)(DIM + 1); // Grid cell width @@ -396,6 +397,8 @@ void setup_arrays(struct vis_data_arrays *vis_data) dataset = streamlines_get_dataset(); scalar_frames_streamlines = get_scalar_frames(vis_data, dataset); + test = streamlines_get_history_scalars(0); + for (j = 0; j < DIM; j++) { for (i = 0; i < DIM; i++) @@ -410,8 +413,10 @@ void setup_arrays(struct vis_data_arrays *vis_data) vis_data->div_vel[idx] = par_der(vx[idx + 1], vx[idx], wn) + par_der(vy[idx + 1], vy[idx], wn); vis_data->div_force[idx] = par_der(fx[idx + 1], fx[idx], hn) + par_der(fy[idx + 1], fy[idx], hn); vis_data->history_frame[fluids_hisdex][idx] = frame_streamlines[idx]; - vis_data->history_scalars[fluids_hisdex].x[idx] = scalar_frames_streamlines.x[idx]; - vis_data->history_scalars[fluids_hisdex].y[idx] = scalar_frames_streamlines.y[idx]; + vis_data->history_scalars[fluids_hisdex]->x[idx] = scalar_frames_streamlines.x[idx]; + vis_data->history_scalars[fluids_hisdex]->y[idx] = scalar_frames_streamlines.y[idx]; + + // printf("val copy: %p; val orig: %f; test: %p\n", vis_data->history_scalars[fluids_hisdex]->x, scalar_frames_streamlines.x[idx], test->x); vis_data->height[idx] = calculate_height_plot(heightplots_get_dataset(), idx); vis_data->normals[idx] = calculate_normal_vector(vis_data->height, idx, i, j); @@ -422,6 +427,7 @@ void setup_arrays(struct vis_data_arrays *vis_data) } } + if (colormap_get_autoscaling()) { colormap_set_scale_min(scale_min); |