]> gitweb.michael.orlitzky.com - spline3.git/blobdiff - src/Values.hs
Add the Values module, wrapping the Repa stuff.
[spline3.git] / src / Values.hs
diff --git a/src/Values.hs b/src/Values.hs
new file mode 100644 (file)
index 0000000..10d7fb9
--- /dev/null
@@ -0,0 +1,24 @@
+module Values
+where
+
+import Data.Array.Repa (
+  Array,
+  DIM1,
+  DIM3,
+  reshape,
+  )
+
+import Data.Array.Repa.IO.Vector (readVectorFromTextFile)
+import System.FilePath ()
+
+
+type Values1D = Array DIM1 Double
+type Values3D = Array DIM3 Double
+
+read_values_1d :: FilePath -> IO Values1D
+read_values_1d path = readVectorFromTextFile path
+
+read_values_3d :: DIM3 -> FilePath -> IO Values3D
+read_values_3d sh path = do
+  one_d <- read_values_1d path
+  return $ reshape sh one_d