|
10
|
1 |
/*
|
|
8
|
2 |
* This file is part of the TraKERS\Front Processing package.
|
|
|
3 |
*
|
|
|
4 |
* (c) IRI <http://www.iri.centrepompidou.fr/>
|
|
|
5 |
*
|
|
27
|
6 |
* For the full copyright and license information, please view the LICENSE
|
|
8
|
7 |
* file that was distributed with this source code.
|
|
|
8 |
*/
|
|
|
9 |
|
|
|
10 |
class vbuffer
|
|
|
11 |
{
|
|
|
12 |
int x;
|
|
|
13 |
int y;
|
|
|
14 |
float xvel;
|
|
|
15 |
float yvel;
|
|
|
16 |
float pressurex = 0;
|
|
|
17 |
float pressurey = 0;
|
|
|
18 |
float pressure = 0;
|
|
|
19 |
|
|
|
20 |
vbuffer(int xIn,int yIn) {
|
|
|
21 |
x = xIn;
|
|
|
22 |
y = yIn;
|
|
|
23 |
pressurex = 0;
|
|
|
24 |
pressurey = 0;
|
|
|
25 |
}
|
|
|
26 |
|
|
|
27 |
void updatebuf(int i, int u) {
|
|
|
28 |
if(i>0 && i<lwidth && u>0 && u<lheight) {
|
|
|
29 |
pressurex = (v[i-1][u-1].xvel*0.5 + v[i-1][u].xvel + v[i-1][u+1].xvel*0.5 - v[i+1][u-1].xvel*0.5 - v[i+1][u].xvel - v[i+1][u+1].xvel*0.5);
|
|
|
30 |
pressurey = (v[i-1][u-1].yvel*0.5 + v[i][u-1].yvel + v[i+1][u-1].yvel*0.5 - v[i-1][u+1].yvel*0.5 - v[i][u+1].yvel - v[i+1][u+1].yvel*0.5);
|
|
|
31 |
pressure = (pressurex + pressurey)*0.25;
|
|
|
32 |
}
|
|
|
33 |
}
|
|
9
|
34 |
}
|