Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- advectOnGPU = gpu.createKernel(function (q: number[], u_x: number[], u_y: number[], u_z: number[], dt: number) {
- let z = this.thread.x % 15;
- let y = Math.floor(this.thread.x / 15) % 15;
- let x = Math.floor(this.thread.x / (15 * 15));
- // Look at the vector (a,b,c) in self.u in position (x,y,z)
- let a = getWithClipping(u_x, x, y, z);
- let b = getWithClipping(u_y, x, y, z);
- let c = getWithClipping(u_z, x, y, z);
- let norm = Math.sqrt(Math.pow(a,2) + Math.pow(b,2) + Math.pow(c,2));
- // origin_coords = (x,y,z) - dt*(u,v,w)
- return norm * trilinearlyInterpolate(q, x - dt * a, y - dt * b, z - dt * c);
- }).setOutput([15 * 15 * 15]);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement