]> gitweb.michael.orlitzky.com - spline3.git/blobdiff - src/Grid.hs
Fix more hlint issues in Grid tests.
[spline3.git] / src / Grid.hs
index eb0de04a08110a973e3a89cbc03dfeb813110f65..66275491fd5c58d64fd0db110c15702211862b1a 100644 (file)
@@ -5,7 +5,6 @@
 module Grid (
   cube_at,
   grid_tests,
-  make_grid,
   slow_tests,
   zoom
   )
@@ -53,14 +52,7 @@ instance Arbitrary Grid where
     arbitrary = do
       (Positive h') <- arbitrary :: Gen (Positive Double)
       fvs <- arbitrary :: Gen Values3D
-      return (make_grid h' fvs)
-
-
--- | The constructor that we want people to use.
---   Ignore non-positive grid sizes for performance.
-make_grid :: Double -> Values3D -> Grid
-make_grid grid_size values =
-  Grid grid_size values
+      return $ Grid h' fvs
 
 
 
@@ -119,7 +111,7 @@ zoom_result :: Values3D -> ScaleFactor -> R.DIM3 -> Double
 zoom_result v3d (sfx, sfy, sfz) (R.Z R.:. m R.:. n R.:. o) =
   f p
   where
-    g = make_grid 1 v3d
+    g = Grid 1 v3d
     offset = (h g)/2
     m' = (fromIntegral m) / (fromIntegral sfx) - offset
     n' = (fromIntegral n) / (fromIntegral sfy) - offset
@@ -180,7 +172,7 @@ trilinear_c0_t0_tests =
        testCase "v3 is correct" test_trilinear_f0_t0_v3]
     ]
   where
-    g = make_grid 1 trilinear
+    g = Grid 1 trilinear
     cube = cube_at g 1 1 1
     t = tetrahedron cube 0
 
@@ -295,7 +287,7 @@ test_trilinear_reproduced =
                       let j' = fromIntegral j,
                       let k' = fromIntegral k]
     where
-      g = make_grid 1 trilinear
+      g = Grid 1 trilinear
       cs = [ cube_at g ci cj ck | ci <- [0..2], cj <- [0..2], ck <- [0..2] ]
 
 
@@ -313,7 +305,7 @@ test_zeros_reproduced =
                       t0 <- tetrahedra c0,
                       let p = polynomial t0 ]
     where
-      g = make_grid 1 zeros
+      g = Grid 1 zeros
       cs = [ cube_at g ci cj ck | ci <- [0..2], cj <- [0..2], ck <- [0..2] ]
 
 
@@ -331,7 +323,7 @@ test_trilinear9x9x9_reproduced =
               let j' = (fromIntegral j) * 0.5,
               let k' = (fromIntegral k) * 0.5]
     where
-      g = make_grid 1 trilinear
+      g = Grid 1 trilinear
       c0 = cube_at g 1 1 1
 
 
@@ -371,7 +363,7 @@ prop_cube_indices_never_go_out_of_bounds g =
 --   in opposite directions, one of them has to have negative volume!
 prop_c0120_identity :: Grid -> Property
 prop_c0120_identity g =
-  and [xsize >= 3, ysize >= 3, zsize >= 3] ==>
+  xsize >= 3 && ysize >= 3 && zsize >= 3 ==>
     c t0 0 1 2 0 ~= (c t0 1 0 2 0 + c t10 1 0 0 2) / 2
   where
     fvs = function_values g
@@ -386,7 +378,7 @@ prop_c0120_identity g =
 --   'prop_c0120_identity'.
 prop_c0111_identity :: Grid -> Property
 prop_c0111_identity g =
-  and [xsize >= 3, ysize >= 3, zsize >= 3] ==>
+  xsize >= 3 && ysize >= 3 && zsize >= 3 ==>
     c t0 0 1 1 1 ~= (c t0 1 0 1 1 + c t10 1 0 1 1) / 2
   where
     fvs = function_values g
@@ -401,7 +393,7 @@ prop_c0111_identity g =
 --   'prop_c0120_identity'.
 prop_c0201_identity :: Grid -> Property
 prop_c0201_identity g =
-  and [xsize >= 3, ysize >= 3, zsize >= 3] ==>
+  xsize >= 3 && ysize >= 3 && zsize >= 3 ==>
     c t0 0 2 0 1 ~= (c t0 1 1 0 1 + c t10 1 1 1 0) / 2
   where
     fvs = function_values g
@@ -416,7 +408,7 @@ prop_c0201_identity g =
 --   'prop_c0120_identity'.
 prop_c0102_identity :: Grid -> Property
 prop_c0102_identity g =
-  and [xsize >= 3, ysize >= 3, zsize >= 3] ==>
+  xsize >= 3 && ysize >= 3 && zsize >= 3 ==>
     c t0 0 1 0 2 ~= (c t0 1 0 0 2 + c t10 1 0 2 0) / 2
   where
     fvs = function_values g
@@ -431,7 +423,7 @@ prop_c0102_identity g =
 --   'prop_c0120_identity'.
 prop_c0210_identity :: Grid -> Property
 prop_c0210_identity g =
-  and [xsize >= 3, ysize >= 3, zsize >= 3] ==>
+  xsize >= 3 && ysize >= 3 && zsize >= 3 ==>
     c t0 0 2 1 0 ~= (c t0 1 1 1 0 + c t10 1 1 0 1) / 2
   where
     fvs = function_values g
@@ -446,7 +438,7 @@ prop_c0210_identity g =
 --   'prop_c0120_identity'.
 prop_c0300_identity :: Grid -> Property
 prop_c0300_identity g =
-  and [xsize >= 3, ysize >= 3, zsize >= 3] ==>
+  xsize >= 3 && ysize >= 3 && zsize >= 3 ==>
     c t0 0 3 0 0 ~= (c t0 1 2 0 0 + c t10 1 2 0 0) / 2
   where
     fvs = function_values g