-
Notifications
You must be signed in to change notification settings - Fork 0
/
fluid.cuh
46 lines (37 loc) · 1.11 KB
/
fluid.cuh
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
//
// Created by condo on 2024/1/5.
//
#ifndef FLUID_CUH
#define FLUID_CUH
class FluidCUDA {
private:
float * U0_z, *U0_y, *U0_x, *U1_z, *U1_y, *U1_x; // velocity grids
float * render_buffer;
float **S0, **S1; // scalar grids
// Position and rotation of the camera
float * pos;
float (*rot)[3];
float focal_length = 400.0F;
float theta, phi, radius;
void swap_grids(void);
public:
void init(void);
void step(void);
void render(float *dest = nullptr);
void cleanup(void);
// setters, essentially
void add_U_z_force_at(int z, int y, int x, float force);
void add_U_y_force_at(int z, int y, int x, float force);
void add_U_x_force_at(int z, int y, int x, float force);
void add_source_at(int z, int y, int x, int i, float source);
void rot_left(float angle);
void rot_up(float angle);
void zoom_in(float dist);
// getters
float Uz_at(int z, int y, int x);
float Uy_at(int z, int y, int x);
float Ux_at(int z, int y, int x);
float S_at(int z, int y, int x, int i);
float *get_render_buffer(void);
};
#endif // FLUID_CUH