From: Michael Orlitzky Date: Tue, 4 Oct 2011 19:50:30 +0000 (-0400) Subject: Clean up imports/exports. X-Git-Tag: 0.0.1~102 X-Git-Url: https://gitweb.michael.orlitzky.com/?a=commitdiff_plain;h=3f7331f579118687cd73b977ce6aa7d401f88a09;p=spline3.git Clean up imports/exports. Remove some unused functions. --- diff --git a/src/Cardinal.hs b/src/Cardinal.hs index ff410a8..031dfc2 100644 --- a/src/Cardinal.hs +++ b/src/Cardinal.hs @@ -15,7 +15,7 @@ where import Control.Monad (liftM, liftM2) import Prelude hiding (LT) -import Test.HUnit +import Test.HUnit (Assertion, assertEqual) import Test.Framework (Test, testGroup) import Test.Framework.Providers.HUnit (testCase) import Test.Framework.Providers.QuickCheck2 (testProperty) diff --git a/src/Comparisons.hs b/src/Comparisons.hs index d033159..3bf4e24 100644 --- a/src/Comparisons.hs +++ b/src/Comparisons.hs @@ -1,5 +1,14 @@ -- | Functions for comparing 'Double' values. -module Comparisons +module Comparisons ( + (~=), + (~~=), + almost_equals, + kinda_equals, + nearly_equals, + nearly_ge, + non_very_positive_entries, + very_positive, + ) where -- | epsilon is the value that will be used in all tests that require diff --git a/src/Examples.hs b/src/Examples.hs index 0fc31c9..6300ce8 100644 --- a/src/Examples.hs +++ b/src/Examples.hs @@ -10,8 +10,8 @@ where import qualified Data.Array.Repa as Repa -import Misc -import Values +import Misc (flatten, transpose_xz) +import Values (Values3D) -- | Values of the function f(x,y,z) = 1 + x + xy + xyz taken at nine diff --git a/src/Face.hs b/src/Face.hs index 96848cd..9609260 100644 --- a/src/Face.hs +++ b/src/Face.hs @@ -1,6 +1,7 @@ -- | The Face module just contains the definition of the 'Face' data -- type and its two typeclass instances. module Face + ( Face(..) ) where import Point diff --git a/src/FunctionValues.hs b/src/FunctionValues.hs index ec8f35e..b1fede7 100644 --- a/src/FunctionValues.hs +++ b/src/FunctionValues.hs @@ -13,7 +13,7 @@ module FunctionValues ( where import Prelude hiding (LT) -import Test.HUnit +import Test.HUnit (Assertion) import Test.Framework (Test, testGroup) import Test.Framework.Providers.HUnit (testCase) import Test.Framework.Providers.QuickCheck2 (testProperty) diff --git a/src/Grid.hs b/src/Grid.hs index 0131a64..ca66437 100644 --- a/src/Grid.hs +++ b/src/Grid.hs @@ -11,7 +11,7 @@ module Grid ( where import qualified Data.Array.Repa as R -import Test.HUnit +import Test.HUnit (Assertion, assertEqual) import Test.Framework (Test, testGroup) import Test.Framework.Providers.HUnit (testCase) import Test.Framework.Providers.QuickCheck2 (testProperty) @@ -21,18 +21,18 @@ import Test.QuickCheck ((==>), Positive(..), Property, choose) -import Assertions -import Comparisons +import Assertions (assertAlmostEqual, assertClose, assertTrue) +import Comparisons ((~=)) import Cube (Cube(Cube), find_containing_tetrahedron, tetrahedra, tetrahedron) -import Examples -import FunctionValues +import Examples (trilinear, trilinear9x9x9, zeros, naturals_1d) +import FunctionValues (make_values, value_at) import Point (Point) -import ScaleFactor +import ScaleFactor (ScaleFactor) import Tetrahedron (Tetrahedron, c, polynomial, v0, v1, v2, v3) -import ThreeDimensional +import ThreeDimensional (ThreeDimensional(..)) import Values (Values3D, dims, empty3d, zoom_shape) diff --git a/src/Misc.hs b/src/Misc.hs index 57dfd43..b1cb1af 100644 --- a/src/Misc.hs +++ b/src/Misc.hs @@ -7,7 +7,7 @@ import qualified Data.Vector as V (Vector, elem, empty, filter) import Test.Framework (Test, testGroup) import Test.Framework.Providers.HUnit (testCase) import Test.Framework.Providers.QuickCheck2 (testProperty) -import Test.HUnit +import Test.HUnit (Assertion, assertEqual) import Test.QuickCheck diff --git a/src/Point.hs b/src/Point.hs index 95b3364..4b9eaec 100644 --- a/src/Point.hs +++ b/src/Point.hs @@ -1,9 +1,15 @@ {-# LANGUAGE FlexibleInstances #-} -module Point +module Point ( + Point, + distance, + dot, + is_close, + scale + ) where -import Comparisons +import Comparisons ((~=)) type Point = (Double, Double, Double) diff --git a/src/RealFunction.hs b/src/RealFunction.hs index cf98029..d461ae2 100644 --- a/src/RealFunction.hs +++ b/src/RealFunction.hs @@ -1,6 +1,10 @@ {-# LANGUAGE FlexibleInstances #-} -module RealFunction +module RealFunction ( + RealFunction, + cmult, + fexp + ) where diff --git a/src/ScaleFactor.hs b/src/ScaleFactor.hs index 4af2056..9c5530f 100644 --- a/src/ScaleFactor.hs +++ b/src/ScaleFactor.hs @@ -1,6 +1,5 @@ module ScaleFactor + (ScaleFactor) where type ScaleFactor = (Int, Int, Int) - ---instance Integral ScaleFactor where diff --git a/src/Tetrahedron.hs b/src/Tetrahedron.hs index f3b5319..359ade5 100644 --- a/src/Tetrahedron.hs +++ b/src/Tetrahedron.hs @@ -18,19 +18,18 @@ import qualified Data.Vector as V ( sum ) -import Prelude hiding (LT) import Test.Framework (Test, testGroup) import Test.Framework.Providers.HUnit (testCase) import Test.Framework.Providers.QuickCheck2 (testProperty) -import Test.HUnit +import Test.HUnit (Assertion, assertEqual) import Test.QuickCheck (Arbitrary(..), Gen, Property, (==>)) import Comparisons ((~=), nearly_ge) import FunctionValues (FunctionValues(..), empty_values) import Misc (factorial) -import Point -import RealFunction -import ThreeDimensional +import Point (Point, scale) +import RealFunction (RealFunction, cmult, fexp) +import ThreeDimensional (ThreeDimensional(..)) data Tetrahedron = Tetrahedron { function_values :: FunctionValues, diff --git a/src/ThreeDimensional.hs b/src/ThreeDimensional.hs index 2775ee9..4b74f18 100644 --- a/src/ThreeDimensional.hs +++ b/src/ThreeDimensional.hs @@ -1,4 +1,5 @@ module ThreeDimensional + ( ThreeDimensional(..) ) where import Point(Point) diff --git a/src/Values.hs b/src/Values.hs index d7ede83..a472025 100644 --- a/src/Values.hs +++ b/src/Values.hs @@ -1,6 +1,15 @@ {-# LANGUAGE FlexibleInstances #-} -module Values +module Values ( + Values, + Values2D, + Values3D, + dims, + empty3d, + idx, + read_values_3d, + zoom_shape + ) where import Data.Array.Repa ( @@ -13,17 +22,15 @@ import Data.Array.Repa ( extent, fromList, unsafeIndex, - reshape, - size + reshape ) -import Data.Array.Repa.IO.Vector (readVectorFromTextFile, - writeVectorToTextFile) +import Data.Array.Repa.IO.Vector (readVectorFromTextFile) import System.FilePath () import Test.QuickCheck (Arbitrary(..), Gen, choose, vectorOf) -import ScaleFactor +import ScaleFactor (ScaleFactor) type Values sh = Array sh Double @@ -53,13 +60,6 @@ read_values_3d sh path = do one_d <- read_values_1d path return $ reshape sh one_d -write_values_1d :: Values3D -> FilePath -> IO () -write_values_1d v3d path = do - let size3d = size $ extent v3d - let shape1d = (Z :. size3d) - let v1d = reshape shape1d v3d - writeVectorToTextFile v1d path - empty3d :: Values3D empty3d = Data.Array.Repa.fromList (Z :. 0 :. 0 :. 0) [] @@ -87,8 +87,3 @@ zoom_shape (sfx, sfy, sfz) sh = z' = z * sfz in (Z :. x' :. y' :. z') - - -drop_z :: DIM3 -> DIM2 -drop_z (Z :. 1 :. y :. x) = (Z :. y :. x) -drop_z _ = error "can't drop the z-dimension unless its size is 1"