SCM Repository
[diderot] Annotation of /benchmarks/programs/lic2d/hact2.diderot
Annotation of /benchmarks/programs/lic2d/hact2.diderot
Parent Directory
|
Revision Log
Revision 1615 -
(view)
(download)
1 : |
glk |
1615 |
// lic-turb.diderot
|
2 : |
|
|
//
|
3 : |
|
|
// demo of line integral convolution (LIC) on 2D turbulent flow
|
4 : |
|
|
//
|
5 : |
|
|
// process output with:
|
6 : |
|
|
// unu reshape -i lic-turb2d.txt -s 3 1020 561 | unu quantize -b 8 -o lic-turb2d.ppm
|
7 : |
|
|
|
8 : |
|
|
int imgSizeX = 500;
|
9 : |
|
|
int imgSizeY = 500;
|
10 : |
|
|
real h = 0.005; // step size of integration
|
11 : |
|
|
int stepNum = 10; // take this many steps both upstream and downstream
|
12 : |
|
|
|
13 : |
|
|
// field#2(2)[2] V = load("imp-u.nrrd") ⊛ bspln3;
|
14 : |
|
|
field#1(2)[2] V = load("imp-u.nrrd") ⊛ ctmr;
|
15 : |
|
|
field#0(2)[] R = load("../../data/R.nrrd") ⊛ tent;
|
16 : |
|
|
|
17 : |
|
|
strand LIC (int xi, int yi) {
|
18 : |
|
|
real xx = lerp(0.0, 8.0, 0.0, real(xi), real(imgSizeX)-1.0);
|
19 : |
|
|
real yy = lerp(0.0, 8.0, 0.0, real(yi), real(imgSizeY)-1.0);
|
20 : |
|
|
vec2 pos0 = [xx,yy];
|
21 : |
|
|
output vec3 RGB = [0.0, 0.0, 0.0];
|
22 : |
|
|
|
23 : |
|
|
update {
|
24 : |
|
|
tensor[2,2] J = ∇⊗V(pos0);
|
25 : |
|
|
RGB = [J[0,0], J[0,1], J[0,0]];
|
26 : |
|
|
stabilize;
|
27 : |
|
|
}
|
28 : |
|
|
}
|
29 : |
|
|
|
30 : |
|
|
initially [ LIC(xi, yi) | yi in 0..(imgSizeY-1), xi in 0..(imgSizeX-1) ];
|