summaryrefslogtreecommitdiffstats
path: root/Smoke/fluids.h
blob: 43ca4bcb3f4496c28a5fba4171f8f0f7aecc0f74 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
#ifndef _FLUIDS_H
#define _FLUIDS_H

//--- SIMULATION PARAMETERS ------------------------------------------------------------------------

extern double dt;		                		//simulation time step
extern float visc;              				//fluid viscosity
extern fftw_real *vx, *vy;              //(vx,vy)   = velocity field at the current moment
extern fftw_real *fx, *fy;	            //(fx,fy)   = user-controlled simulation forces, steered with the mouse 
extern fftw_real *rho;			      //smoke density at the current (rho) and previous (rho0) moment 
extern rfftwnd_plan plan_rc, plan_cr;   //simulation domain discretization
extern fftw_real *height_array;         //used for hight plot
struct point *normal_array;             //used for normal vectors
extern int *frame_hist;
extern int frame_index;

//--- VISUALIZATION PARAMETERS ---------------------------------------------------------------------
#define DATASET_RHO   0
#define DATASET_VEL   1
#define DATASET_FORCE 2
#define DATASET_DIVV  3
#define DATASET_DIVF  4
#define DATASET_HIST  5

#define SCALAR_RHO   0
#define SCALAR_VEL   1
#define SCALAR_FORCE 2

#define VECTOR_VEL   0
#define VECTOR_FORCE 1

#define HISTORY_SIZE        80

extern int   winWidth, winHeight;      //size of the graphics window, in pixels
extern int   color_dir;            //use direction color-coding or not
extern float vec_scale;			    //scaling of hedgehogs
extern int vis_dataset;
extern int glyph_scalar;
extern int glyph_vector;

//////////////////

void select_dataset(int arg);
void set_glyph_scalar(int arg);
void set_glyph_vector(int arg);

int  fluids_get_var_dim(void);
void fluids_set_var_dim(int);

struct point {
  float x;
  float y;
  float z;
};

struct scalar_frame {
  fftw_real *x;
  fftw_real *y;
};

struct scalar_history {
  fftw_real *x[HISTORY_SIZE];
  fftw_real *y[HISTORY_SIZE];
};

struct vis_data_arrays {
  fftw_real *rho;
  fftw_real *vel;
  fftw_real *force;
  struct scalar_frame frame;
  fftw_real *div_vel;
  fftw_real *div_force;
  fftw_real *height;
  struct point *normals;
  fftw_real *frame_history[HISTORY_SIZE];
  struct scalar_history history;
};


extern int active_slider;



void fluids_set_calculate(int calculate);
int fluids_get_calculate(void);

void fluids_insert_smoke(int x, int y);

int fluids_get_dim(void);

void fluids_init_simulation(int n, struct vis_data_arrays *vis_data);
void fluids_reset_simulation(void);

void fluids_calculate_one_simulation_step(struct vis_data_arrays *vis_data);

int fluids_get_hisdex(void);
#endif