summaryrefslogtreecommitdiffstats
path: root/Smoke/fluids.c
diff options
context:
space:
mode:
Diffstat (limited to 'Smoke/fluids.c')
-rw-r--r--Smoke/fluids.c33
1 files changed, 8 insertions, 25 deletions
diff --git a/Smoke/fluids.c b/Smoke/fluids.c
index f80a2f0..c020b2f 100644
--- a/Smoke/fluids.c
+++ b/Smoke/fluids.c
@@ -21,6 +21,7 @@
#include "colormap.h"
#include "glyphs.h"
#include "heightplots.h"
+#include "normals.h"
//--- SIMULATION PARAMETERS ------------------------------------------------------------------------
int var_dims = 25;
@@ -96,7 +97,7 @@ fftw_real *init_simulation(int n, struct vis_data_arrays *vis_data)
vis_data->div_force = (fftw_real *)malloc(dim2);
vis_data->div_vel = (fftw_real *)malloc(dim1);
vis_data->height = (fftw_real *)malloc(dim2);
- vis_data->normals = (struct point *)malloc(dim2);
+ vis_data->normals = (struct point *)malloc(dim2 *sizeof(struct point *));
return return_value;
}
@@ -398,9 +399,11 @@ void populate_arrays(struct vis_data_arrays *vis_data)
vis_data->height[idx] = calculate_height_plot(heightplots_get_dataset(), idx);
- //vis_data->normals[idx] = calculate_normal_vector(vis_data->height, idx, i, j);
- // printf("vis: h: %lf n: %lf; old: h: %lf n: %lf\n",
- // vis_data->height[idx], vis_data->normals[idx].x, height_array[idx], normal_array[idx].x);
+ vis_data->normals[idx] = calculate_normal_vector(vis_data->height, idx, i, j);
+// if (normal_array[idx].x != vis_data->normals[idx].x) {
+ // printf("n: %lf; old: %lf\n",
+ // vis_data->normals[idx].x, normal_array[idx].x);
+ //}
}
}
}
@@ -465,6 +468,7 @@ void calculate_one_simulation_step(struct vis_data_arrays *vis_data)
glyphs_set_frame(frame);
heightplots_set_frame(vis_data->height);
+ normals_set_frame(vis_data->normals);
}
//------ VISUALIZATION CODE STARTS HERE -----------------------------------------------------------------
@@ -537,27 +541,6 @@ float get_dataset(int index)
return return_value;
}
-#if 0
-void set_autoscaling(void)
-{
- int k;
- float value, scale_min, scale_max;
-
- scale_min = scale_max = get_dataset(0);
- colormap_set_scale_min(scale_min);
- colormap_set_scale_max(scale_max);
-
- for (k = 1; k < DIM * DIM; k++)
- {
- value = get_dataset(k);
-
- if (scale_min > value) { colormap_set_scale_min(value); }
- if (scale_max < value) { colormap_set_scale_max(value); }
- }
-
- //threshold = (scale_min + scale_max) / 2;
-}
-#endif
void fluids_insert_smoke(int x, int y)
{