k = calculate_containing_cube_coordinate g z
+{-# INLINE zoom_lookup #-}
+zoom_lookup :: Grid -> a -> (R.DIM3 -> Double)
+zoom_lookup g _ = zoom_result g
+
+
+{-# INLINE zoom_result #-}
+zoom_result :: Grid -> R.DIM3 -> Double
+zoom_result g (R.Z R.:. i R.:. j R.:. k) =
+ f p
+ where
+ i' = fromIntegral i
+ j' = fromIntegral j
+ k' = fromIntegral k
+ p = (i', j', k') :: Point
+ c = find_containing_cube g p
+ t = head (find_containing_tetrahedra c p)
+ f = polynomial t
+
+
zoom :: Grid -> Int -> Values3D
zoom g scale_factor
| xsize == 0 || ysize == 0 || zsize == 0 = empty3d
| otherwise =
- R.traverse arr transExtent (\_ -> newlookup)
+ R.force $ R.traverse arr transExtent (zoom_lookup g)
where
- fvs = function_values g
- (xsize, ysize, zsize) = dims fvs
- arr = fvs
+ arr = function_values g
+ (xsize, ysize, zsize) = dims arr
transExtent = zoom_shape scale_factor
- newlookup :: R.DIM3 -> Double
- newlookup (R.Z R.:. i R.:. j R.:. k) =
- f p
- where
- i' = fromIntegral i
- j' = fromIntegral j
- k' = fromIntegral k
- p = (i', j', k') :: Point
- c = find_containing_cube g p
- t = head (find_containing_tetrahedra c p)
- f = polynomial t