```
(bind-func fluid-lin-solve
(lambda (b:i64 x:double* x0:double* a c iter:i64 N:i64)
(let ((cRecip (/ 1.0 c))
(k 0)
(m 0)
(j 0)
(i 0))
(dotimes (k iter)
(dotimes (m (- N 2))
(dotimes (j (- N 2))
(dotimes (i (- N 2))
(pset! x (fluid-ix (+ i 1) (+ j 1) (+ m 1) N)
(* cRecip
(+ (pref x0 (fluid-ix (+ i 1) (+ j 1) (+ m 1) N))
(* a (+ (pref x (fluid-ix (+ i 2) (+ j 1) (+ m 1) N))
(pref x (fluid-ix i (+ j 1) (+ m 1) N))
(pref x (fluid-ix (+ i 1) (+ j 2) (+ m 1) N))
(pref x (fluid-ix (+ i 1) j (+ m 1) N))
(pref x (fluid-ix (+ i 1) (+ j 1) (+ m 2) N))
(pref x (fluid-ix (+ i 1) (+ j 1) m N))))))))))
(fluid-set-boundary b x N)))
1))
```

Back to Index