summaryrefslogtreecommitdiffstats
path: root/Smoke/fluids.h
blob: d28f1761d1a71478326d8d314a90371f476ec42a (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
#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

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

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

struct point2f {
  float x;
  float y;
};

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

struct vis_data_arrays {
  fftw_real *rho;
  fftw_real *vel;
  fftw_real *force;
  struct fftw_real_xy scalars;
  fftw_real *div_vel;
  fftw_real *div_force;
  fftw_real *height;
  struct point *normals;
  fftw_real *history_frame[HISTORY_SIZE];
  struct fftw_real_xy history_scalars[HISTORY_SIZE];
};



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