fluid-cube-get-column   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 velcority
(bind-func fluid-cube-get-column 10000
  (let ((_ds:double* (salloc 2000))
  (_xs:double* (salloc 2000))
  (_ys:double* (salloc 2000)))
    (lambda (cube:fluidcube* type:i32 offset:i64)
      (let ((xN (tref cube 0))
      (yN (tref cube 10))
      (ds (tref cube 5))
      (xs (tref cube 6))
      (ys (tref cube 7))
      (s (cond ((= type 5) ds)
         ((= type 6) xs)
         ((= type 7) ys)
         (else ds)))
      ;; (dat (cond ((= type 5) _ds)
      ;;         ((= type 6) _xs)
      ;;         ((= type 7) _ys)
      ;;         (else _ds)))
      (dat:double* (halloc yN))
      (i 0))
  (dotimes (i yN)
    (pset! dat i (pref s (+ (* i xN) offset))))
  dat))))


Back to Index