fluid-lin-solve   xtlang


Defined in:  https://github.com/digego/extempore/tree/v0.8.9/libs/external/fluid2d.xtm

Implementation

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


Back to Index

Similar Entries