From: Michael Orlitzky Date: Wed, 24 Aug 2011 17:05:46 +0000 (-0400) Subject: Inline the two inner functions of the zoom traversal. X-Git-Tag: 0.0.1~221 X-Git-Url: https://gitweb.michael.orlitzky.com/?a=commitdiff_plain;h=394aeb5715f666d2fbdc17223d8eb803e4e1171c;p=spline3.git Inline the two inner functions of the zoom traversal. --- diff --git a/src/Grid.hs b/src/Grid.hs index 517e3b1..b8f1d75 100644 --- a/src/Grid.hs +++ b/src/Grid.hs @@ -105,24 +105,31 @@ find_containing_cube g p = 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