diff options
author | Dominic Steinitz <dominic@steinitz.org> | 2018-04-27 09:06:41 +0100 |
---|---|---|
committer | Dominic Steinitz <dominic@steinitz.org> | 2018-04-27 09:06:41 +0100 |
commit | 0e12d0aa99adbf83d5a80211a2f9fd13e4880901 (patch) | |
tree | 84aa9c44ebd527fd4bad7dfa73017163acd4b72f /packages/sundials | |
parent | e8e631c7dbc7ea34b51dcce5fef5e2ec620f9458 (diff) |
Start of better naming
Diffstat (limited to 'packages/sundials')
-rw-r--r-- | packages/sundials/hmatrix-sundials.cabal | 8 | ||||
-rw-r--r-- | packages/sundials/src/Numeric/Sundials/ARKode/ODE.hs | 14 | ||||
-rw-r--r-- | packages/sundials/src/Numeric/Sundials/Arkode.hsc (renamed from packages/sundials/src/Arkode.hsc) | 2 | ||||
-rw-r--r-- | packages/sundials/src/Numeric/Sundials/CLangToHaskellTypes.hs (renamed from packages/sundials/src/Types.hs) | 7 | ||||
-rw-r--r-- | packages/sundials/src/Numeric/Sundials/CVode/ODE.hs | 8 | ||||
-rw-r--r-- | packages/sundials/src/Numeric/Sundials/ODEOpts.hs | 4 |
6 files changed, 19 insertions, 24 deletions
diff --git a/packages/sundials/hmatrix-sundials.cabal b/packages/sundials/hmatrix-sundials.cabal index b7fa0fe..234bb9c 100644 --- a/packages/sundials/hmatrix-sundials.cabal +++ b/packages/sundials/hmatrix-sundials.cabal | |||
@@ -32,19 +32,19 @@ library | |||
32 | exposed-modules: Numeric.Sundials.ODEOpts, | 32 | exposed-modules: Numeric.Sundials.ODEOpts, |
33 | Numeric.Sundials.ARKode.ODE, | 33 | Numeric.Sundials.ARKode.ODE, |
34 | Numeric.Sundials.CVode.ODE | 34 | Numeric.Sundials.CVode.ODE |
35 | other-modules: Types, | 35 | other-modules: Numeric.Sundials.CLangToHaskellTypes, |
36 | Arkode | 36 | Numeric.Sundials.Arkode |
37 | c-sources: src/helpers.c src/helpers.h | 37 | c-sources: src/helpers.c src/helpers.h |
38 | default-language: Haskell2010 | 38 | default-language: Haskell2010 |
39 | 39 | ||
40 | test-suite hmatrix-sundials-testsuite | 40 | test-suite hmatrix-sundials-testsuite |
41 | type: exitcode-stdio-1.0 | 41 | type: exitcode-stdio-1.0 |
42 | main-is: Main.hs | 42 | main-is: Main.hs |
43 | other-modules: Types, | 43 | other-modules: Numeric.Sundials.CLangToHaskellTypes, |
44 | Numeric.Sundials.ODEOpts, | 44 | Numeric.Sundials.ODEOpts, |
45 | Numeric.Sundials.ARKode.ODE, | 45 | Numeric.Sundials.ARKode.ODE, |
46 | Numeric.Sundials.CVode.ODE, | 46 | Numeric.Sundials.CVode.ODE, |
47 | Arkode | 47 | Numeric.Sundials.Arkode |
48 | build-depends: base >=4.10 && <4.11, | 48 | build-depends: base >=4.10 && <4.11, |
49 | inline-c >=0.6 && <0.7, | 49 | inline-c >=0.6 && <0.7, |
50 | vector >=0.12 && <0.13, | 50 | vector >=0.12 && <0.13, |
diff --git a/packages/sundials/src/Numeric/Sundials/ARKode/ODE.hs b/packages/sundials/src/Numeric/Sundials/ARKode/ODE.hs index 8b713c6..a8d418b 100644 --- a/packages/sundials/src/Numeric/Sundials/ARKode/ODE.hs +++ b/packages/sundials/src/Numeric/Sundials/ARKode/ODE.hs | |||
@@ -1,5 +1,3 @@ | |||
1 | {-# OPTIONS_GHC -Wall #-} | ||
2 | |||
3 | {-# LANGUAGE QuasiQuotes #-} | 1 | {-# LANGUAGE QuasiQuotes #-} |
4 | {-# LANGUAGE TemplateHaskell #-} | 2 | {-# LANGUAGE TemplateHaskell #-} |
5 | {-# LANGUAGE MultiWayIf #-} | 3 | {-# LANGUAGE MultiWayIf #-} |
@@ -141,9 +139,9 @@ import Numeric.LinearAlgebra.HMatrix (Vector, Matrix, toList, (><), | |||
141 | subMatrix, rows, cols, toLists, | 139 | subMatrix, rows, cols, toLists, |
142 | size, subVector) | 140 | size, subVector) |
143 | 141 | ||
144 | import qualified Types as T | 142 | import qualified Numeric.Sundials.CLangToHaskellTypes as T |
145 | import Arkode | 143 | import Numeric.Sundials.Arkode |
146 | import qualified Arkode as B | 144 | import qualified Numeric.Sundials.Arkode as B |
147 | import qualified Numeric.Sundials.ODEOpts as SO | 145 | import qualified Numeric.Sundials.ODEOpts as SO |
148 | 146 | ||
149 | 147 | ||
@@ -160,7 +158,7 @@ C.include "<arkode/arkode_direct.h>" -- access to ARKDls interface | |||
160 | C.include "<sundials/sundials_types.h>" -- definition of type realtype | 158 | C.include "<sundials/sundials_types.h>" -- definition of type realtype |
161 | C.include "<sundials/sundials_math.h>" | 159 | C.include "<sundials/sundials_math.h>" |
162 | C.include "../../../helpers.h" | 160 | C.include "../../../helpers.h" |
163 | C.include "Arkode_hsc.h" | 161 | C.include "Numeric/Sundials/Arkode_hsc.h" |
164 | 162 | ||
165 | 163 | ||
166 | type Jacobian = Double -> Vector Double -> Matrix Double | 164 | type Jacobian = Double -> Vector Double -> Matrix Double |
@@ -448,7 +446,7 @@ solveOdeC method initStepSize jacH (absTols, relTol) fun f0 ts = unsafePerformIO | |||
448 | diagnostics :: V.Vector CLong <- createVector 10 -- FIXME | 446 | diagnostics :: V.Vector CLong <- createVector 10 -- FIXME |
449 | diagMut <- V.thaw diagnostics | 447 | diagMut <- V.thaw diagnostics |
450 | -- We need the types that sundials expects. These are tied together | 448 | -- We need the types that sundials expects. These are tied together |
451 | -- in 'Types'. FIXME: The Haskell type is currently empty! | 449 | -- in 'CLangToHaskellTypes'. FIXME: The Haskell type is currently empty! |
452 | let funIO :: CDouble -> Ptr T.SunVector -> Ptr T.SunVector -> Ptr () -> IO CInt | 450 | let funIO :: CDouble -> Ptr T.SunVector -> Ptr T.SunVector -> Ptr () -> IO CInt |
453 | funIO x y f _ptr = do | 451 | funIO x y f _ptr = do |
454 | -- Convert the pointer we get from C (y) to a vector, and then | 452 | -- Convert the pointer we get from C (y) to a vector, and then |
@@ -516,7 +514,7 @@ solveOdeC method initStepSize jacH (absTols, relTol) fun f0 ts = unsafePerformIO | |||
516 | /* problem as fully implicit and set f_E to NULL and f_I to f. */ | 514 | /* problem as fully implicit and set f_E to NULL and f_I to f. */ |
517 | 515 | ||
518 | /* Here we use the C types defined in helpers.h which tie up with */ | 516 | /* Here we use the C types defined in helpers.h which tie up with */ |
519 | /* the Haskell types defined in Types */ | 517 | /* the Haskell types defined in CLangToHaskellTypes */ |
520 | if ($(int method) < MIN_DIRK_NUM) { | 518 | if ($(int method) < MIN_DIRK_NUM) { |
521 | flag = ARKodeInit(arkode_mem, $fun:(int (* funIO) (double t, SunVector y[], SunVector dydt[], void * params)), NULL, T0, y); | 519 | flag = ARKodeInit(arkode_mem, $fun:(int (* funIO) (double t, SunVector y[], SunVector dydt[], void * params)), NULL, T0, y); |
522 | if (check_flag(&flag, "ARKodeInit", 1)) return 1; | 520 | if (check_flag(&flag, "ARKodeInit", 1)) return 1; |
diff --git a/packages/sundials/src/Arkode.hsc b/packages/sundials/src/Numeric/Sundials/Arkode.hsc index 558ce9e..f5e5dc1 100644 --- a/packages/sundials/src/Arkode.hsc +++ b/packages/sundials/src/Numeric/Sundials/Arkode.hsc | |||
@@ -1,4 +1,4 @@ | |||
1 | module Arkode where | 1 | |module Numeric.Sundials.Arkode where |
2 | 2 | ||
3 | import Foreign | 3 | import Foreign |
4 | import Foreign.C.Types | 4 | import Foreign.C.Types |
diff --git a/packages/sundials/src/Types.hs b/packages/sundials/src/Numeric/Sundials/CLangToHaskellTypes.hs index 04e4280..0908cbe 100644 --- a/packages/sundials/src/Types.hs +++ b/packages/sundials/src/Numeric/Sundials/CLangToHaskellTypes.hs | |||
@@ -1,12 +1,9 @@ | |||
1 | {-# OPTIONS_GHC -Wall #-} | ||
2 | |||
3 | {-# LANGUAGE QuasiQuotes #-} | 1 | {-# LANGUAGE QuasiQuotes #-} |
4 | {-# LANGUAGE TemplateHaskell #-} | 2 | {-# LANGUAGE TemplateHaskell #-} |
5 | {-# LANGUAGE MultiWayIf #-} | ||
6 | {-# LANGUAGE OverloadedStrings #-} | 3 | {-# LANGUAGE OverloadedStrings #-} |
7 | {-# LANGUAGE EmptyDataDecls #-} | 4 | {-# LANGUAGE EmptyDataDecls #-} |
8 | 5 | ||
9 | module Types where | 6 | module Numeric.Sundials.CLangToHaskellTypes where |
10 | 7 | ||
11 | import Foreign.C.Types | 8 | import Foreign.C.Types |
12 | 9 | ||
@@ -24,7 +21,7 @@ data SunMatrix = SunMatrix { rows :: CInt | |||
24 | , vals :: V.Vector CDouble | 21 | , vals :: V.Vector CDouble |
25 | } | 22 | } |
26 | 23 | ||
27 | -- FIXME: Is this true? | 24 | -- | This is true only if configured/ built as 64 bits |
28 | type SunIndexType = CLong | 25 | type SunIndexType = CLong |
29 | 26 | ||
30 | sunTypesTable :: Map.Map CT.TypeSpecifier TH.TypeQ | 27 | sunTypesTable :: Map.Map CT.TypeSpecifier TH.TypeQ |
diff --git a/packages/sundials/src/Numeric/Sundials/CVode/ODE.hs b/packages/sundials/src/Numeric/Sundials/CVode/ODE.hs index 0871f9b..1cd072f 100644 --- a/packages/sundials/src/Numeric/Sundials/CVode/ODE.hs +++ b/packages/sundials/src/Numeric/Sundials/CVode/ODE.hs | |||
@@ -90,8 +90,8 @@ import Numeric.LinearAlgebra.Devel (createVector) | |||
90 | import Numeric.LinearAlgebra.HMatrix (Vector, Matrix, toList, rows, | 90 | import Numeric.LinearAlgebra.HMatrix (Vector, Matrix, toList, rows, |
91 | cols, toLists, size, reshape) | 91 | cols, toLists, size, reshape) |
92 | 92 | ||
93 | import qualified Types as T | 93 | import qualified Numeric.Sundials.CLangToHaskellTypes as T |
94 | import Arkode (cV_ADAMS, cV_BDF) | 94 | import Numeric.Sundials.Arkode (cV_ADAMS, cV_BDF) |
95 | import Numeric.Sundials.ODEOpts (ODEOpts(..), Jacobian) | 95 | import Numeric.Sundials.ODEOpts (ODEOpts(..), Jacobian) |
96 | import qualified Numeric.Sundials.ODEOpts as SO | 96 | import qualified Numeric.Sundials.ODEOpts as SO |
97 | 97 | ||
@@ -109,7 +109,7 @@ C.include "<cvode/cvode_direct.h>" -- access to CVDls interface | |||
109 | C.include "<sundials/sundials_types.h>" -- definition of type realtype | 109 | C.include "<sundials/sundials_types.h>" -- definition of type realtype |
110 | C.include "<sundials/sundials_math.h>" | 110 | C.include "<sundials/sundials_math.h>" |
111 | C.include "../../../helpers.h" | 111 | C.include "../../../helpers.h" |
112 | C.include "Arkode_hsc.h" | 112 | C.include "Numeric/Sundials/Arkode_hsc.h" |
113 | 113 | ||
114 | 114 | ||
115 | -- | Stepping functions | 115 | -- | Stepping functions |
@@ -252,7 +252,7 @@ solveOdeC maxNumSteps_ minStep_ method initStepSize jacH (aTols, rTol) fun f0 ts | |||
252 | diagnostics :: V.Vector CLong <- createVector 10 -- FIXME | 252 | diagnostics :: V.Vector CLong <- createVector 10 -- FIXME |
253 | diagMut <- V.thaw diagnostics | 253 | diagMut <- V.thaw diagnostics |
254 | -- We need the types that sundials expects. These are tied together | 254 | -- We need the types that sundials expects. These are tied together |
255 | -- in 'Types'. FIXME: The Haskell type is currently empty! | 255 | -- in 'CLangToHaskellTypes'. FIXME: The Haskell type is currently empty! |
256 | let funIO :: CDouble -> Ptr T.SunVector -> Ptr T.SunVector -> Ptr () -> IO CInt | 256 | let funIO :: CDouble -> Ptr T.SunVector -> Ptr T.SunVector -> Ptr () -> IO CInt |
257 | funIO x y f _ptr = do | 257 | funIO x y f _ptr = do |
258 | -- Convert the pointer we get from C (y) to a vector, and then | 258 | -- Convert the pointer we get from C (y) to a vector, and then |
diff --git a/packages/sundials/src/Numeric/Sundials/ODEOpts.hs b/packages/sundials/src/Numeric/Sundials/ODEOpts.hs index 538b474..56dc12c 100644 --- a/packages/sundials/src/Numeric/Sundials/ODEOpts.hs +++ b/packages/sundials/src/Numeric/Sundials/ODEOpts.hs | |||
@@ -10,8 +10,8 @@ import qualified Data.Vector.Storable.Mutable as VM | |||
10 | 10 | ||
11 | import Numeric.LinearAlgebra.HMatrix (Vector, Matrix) | 11 | import Numeric.LinearAlgebra.HMatrix (Vector, Matrix) |
12 | 12 | ||
13 | import qualified Types as T | 13 | import qualified Numeric.Sundials.CLangToHaskellTypes as T |
14 | import qualified Arkode as B | 14 | import qualified Numeric.Sundials.Arkode as B |
15 | 15 | ||
16 | type Jacobian = Double -> Vector Double -> Matrix Double | 16 | type Jacobian = Double -> Vector Double -> Matrix Double |
17 | 17 | ||