fluid-cube-set-row   xtlang


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

Implementation

;; where type is the ref into cube
;; 5 for density
;; 6 for x velocity
;; 7 for y velocity
(bind-func fluid-cube-set-row
  (lambda (cube:fluidcube* type:i32 offset:i64 vals:double*)
    (let ((xN (tref cube 0))
    (yN (tref cube 10))
    (ds (tref cube 5))
    (xs (tref cube 6))
    (ys (tref cube 7))
    (dat (cond ((= type 5) ds)
         ((= type 6) xs)
         ((= type 7) ys)
         (else ds)))
    (i 0))
      (dotimes (i xN)
  (pset! dat (+ i offset)
;        (* 1.0 (pref vals i))))
         (* 0.5 (+ (* 1.0 (pref dat (+ i offset)))
       (* 1.0 (pref vals i))))))
      void)))


Back to Index