From 7f0f58b951975bc99f8e2555710893520f56d5bc Mon Sep 17 00:00:00 2001 From: Oliver Schinagl Date: Thu, 10 Jan 2008 13:14:59 +0000 Subject: added getter for hisdex --- Smoke/fluids.c | 15 ++++++++------- Smoke/fluids.h | 2 ++ 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/Smoke/fluids.c b/Smoke/fluids.c index 83764ac..a0bcb89 100644 --- a/Smoke/fluids.c +++ b/Smoke/fluids.c @@ -36,8 +36,6 @@ fftw_real *fx, *fy; //(fx,fy) = user-controlled simulation forces, fftw_real *rho, *rho0; //smoke density at the current (rho) and previous (rho0) moment fftw_real *height_array; //used for height plot struct point *normal_array; //used for normal vectors -int *frame_hist; -int frame_index = 0; rfftwnd_plan plan_rc, plan_cr; //simulation domain discretization int winWidth, winHeight; //size of the graphics window, in pixels @@ -47,10 +45,10 @@ int vis_dataset = DATASET_RHO; int active_slider = 0; int glyph_scalar = SCALAR_RHO; int glyph_vector = VECTOR_VEL; -GLuint startList; static int fluids_calculate = TRUE; static int DIM; //size of simulation grid +static int fluids_hisdex = 0; //------ SIMULATION CODE STARTS HERE ----------------------------------------------------------------- @@ -83,7 +81,6 @@ void fluids_init_simulation(int n, struct vis_data_arrays *vis_data) { vis_data->history[i] = (fftw_real *)malloc(dim1); } - printf("frame 0: %p\n", vis_data->history[0]); fluids_reset_simulation(); @@ -409,15 +406,14 @@ fftw_real *get_frame(struct vis_data_arrays *vis_data, int dataset) void add_history_frame(int dataset, struct vis_data_arrays *vis_data) { - static int hisdex = 0; fftw_real *frame; if (dataset != DATASET_HIST) { frame = get_frame(vis_data, dataset); - memcpy(vis_data->history[hisdex], frame, DIM * 2 * (DIM / 2 + 1) * sizeof(fftw_real)); - hisdex = (hisdex >= HISTORY_SIZE -1) ? 0 : hisdex +1; + memcpy(vis_data->history[fluids_hisdex], frame, DIM * 2 * (DIM / 2 + 1) * sizeof(fftw_real)); + fluids_hisdex = (fluids_hisdex >= HISTORY_SIZE -1) ? 0 : fluids_hisdex +1; } } @@ -597,3 +593,8 @@ int fluids_get_dim(void) { return DIM; } + +int fluids_get_hisdex(void) +{ + return fluids_hisdex; +} diff --git a/Smoke/fluids.h b/Smoke/fluids.h index e495222..2e79fd5 100644 --- a/Smoke/fluids.h +++ b/Smoke/fluids.h @@ -84,6 +84,8 @@ void fluids_reset_simulation(void); void fluids_calculate_one_simulation_step(struct vis_data_arrays *vis_data); +int fluids_get_hisdex(void); + float get_dataset(int index); void set_autoscaling(void); #endif -- cgit v0.12