From 5bcc77b1e115a8c8eb94a1aa1a441618bfeb0b54 Mon Sep 17 00:00:00 2001 From: Dominic Steinitz Date: Fri, 30 Mar 2018 14:15:26 +0100 Subject: Improve naming --- packages/sundials/hmatrix-sundials.cabal | 7 +--- packages/sundials/src/Arkode.hsc | 46 ++++++++++++++++++++++ packages/sundials/src/Bar.hsc | 46 ---------------------- .../sundials/src/Numeric/Sundials/ARKode/ODE.hs | 6 +-- 4 files changed, 51 insertions(+), 54 deletions(-) create mode 100644 packages/sundials/src/Arkode.hsc delete mode 100644 packages/sundials/src/Bar.hsc (limited to 'packages') diff --git a/packages/sundials/hmatrix-sundials.cabal b/packages/sundials/hmatrix-sundials.cabal index 83a30c7..7b44cea 100644 --- a/packages/sundials/hmatrix-sundials.cabal +++ b/packages/sundials/hmatrix-sundials.cabal @@ -1,6 +1,3 @@ --- Initial sundials.cabal generated by cabal init. For further --- documentation, see http://haskell.org/cabal/users-guide/ - name: hmatrix-sundials version: 0.1.0.0 -- synopsis: @@ -29,14 +26,14 @@ library hs-source-dirs: src exposed-modules: Numeric.Sundials.Arkode.ODE other-modules: Types, - Bar + Arkode c-sources: src/helpers.c src/helpers.h executable sundials main-is: Main.hs other-modules: Types, Numeric.Sundials.Arkode.ODE, - Bar + Arkode other-extensions: QuasiQuotes build-depends: base >=4.10 && <4.11, inline-c >=0.6 && <0.7, diff --git a/packages/sundials/src/Arkode.hsc b/packages/sundials/src/Arkode.hsc new file mode 100644 index 0000000..59e701e --- /dev/null +++ b/packages/sundials/src/Arkode.hsc @@ -0,0 +1,46 @@ +{-# LANGUAGE RecordWildCards #-} + +module Arkode where + +import Foreign +import Foreign.C.Types +import Foreign.C.String + + +#include +#include +#include +#include + +#def typedef struct _generic_N_Vector SunVector; +#def typedef struct _N_VectorContent_Serial SunContent; + +getContentPtr :: Storable a => Ptr b -> IO a +getContentPtr ptr = (#peek SunVector, content) ptr + +getData :: Storable a => Ptr b -> IO a +getData ptr = (#peek SunContent, data) ptr + +arkSMax :: Int +arkSMax = #const ARK_S_MAX + +-- FIXME: We could just use inline-c instead +sDIRK_2_1_2 :: Int +sDIRK_2_1_2 = #const SDIRK_2_1_2 +-- #define BILLINGTON_3_3_2 13 +-- #define TRBDF2_3_3_2 14 +kVAERNO_4_2_3 :: Int +kVAERNO_4_2_3 = #const KVAERNO_4_2_3 +-- #define ARK324L2SA_DIRK_4_2_3 16 +-- #define CASH_5_2_4 17 +-- #define CASH_5_3_4 18 +-- #define SDIRK_5_3_4 19 +-- #define KVAERNO_5_3_4 20 +-- #define ARK436L2SA_DIRK_6_3_4 21 +-- #define KVAERNO_7_4_5 22 +-- #define ARK548L2SA_DIRK_8_4_5 23 + +-- #define DEFAULT_DIRK_2 SDIRK_2_1_2 +-- #define DEFAULT_DIRK_3 ARK324L2SA_DIRK_4_2_3 +-- #define DEFAULT_DIRK_4 SDIRK_5_3_4 +-- #define DEFAULT_DIRK_5 ARK548L2SA_DIRK_8_4_5 diff --git a/packages/sundials/src/Bar.hsc b/packages/sundials/src/Bar.hsc deleted file mode 100644 index 26f0bf0..0000000 --- a/packages/sundials/src/Bar.hsc +++ /dev/null @@ -1,46 +0,0 @@ -{-# LANGUAGE RecordWildCards #-} - -module Bar where - -import Foreign -import Foreign.C.Types -import Foreign.C.String - - -#include -#include -#include -#include - -#def typedef struct _generic_N_Vector SunVector; -#def typedef struct _N_VectorContent_Serial SunContent; - -getContentPtr :: Storable a => Ptr b -> IO a -getContentPtr ptr = (#peek SunVector, content) ptr - -getData :: Storable a => Ptr b -> IO a -getData ptr = (#peek SunContent, data) ptr - -arkSMax :: Int -arkSMax = #const ARK_S_MAX - --- FIXME: We could just use inline-c instead -sDIRK_2_1_2 :: Int -sDIRK_2_1_2 = #const SDIRK_2_1_2 --- #define BILLINGTON_3_3_2 13 --- #define TRBDF2_3_3_2 14 -kVAERNO_4_2_3 :: Int -kVAERNO_4_2_3 = #const KVAERNO_4_2_3 --- #define ARK324L2SA_DIRK_4_2_3 16 --- #define CASH_5_2_4 17 --- #define CASH_5_3_4 18 --- #define SDIRK_5_3_4 19 --- #define KVAERNO_5_3_4 20 --- #define ARK436L2SA_DIRK_6_3_4 21 --- #define KVAERNO_7_4_5 22 --- #define ARK548L2SA_DIRK_8_4_5 23 - --- #define DEFAULT_DIRK_2 SDIRK_2_1_2 --- #define DEFAULT_DIRK_3 ARK324L2SA_DIRK_4_2_3 --- #define DEFAULT_DIRK_4 SDIRK_5_3_4 --- #define DEFAULT_DIRK_5 ARK548L2SA_DIRK_8_4_5 diff --git a/packages/sundials/src/Numeric/Sundials/ARKode/ODE.hs b/packages/sundials/src/Numeric/Sundials/ARKode/ODE.hs index a5083e3..30ff4c8 100644 --- a/packages/sundials/src/Numeric/Sundials/ARKode/ODE.hs +++ b/packages/sundials/src/Numeric/Sundials/ARKode/ODE.hs @@ -58,8 +58,8 @@ import Numeric.LinearAlgebra.Devel (createVector) import Numeric.LinearAlgebra.HMatrix (Vector, Matrix, toList, (><), subMatrix) import qualified Types as T -import Bar (sDIRK_2_1_2, kVAERNO_4_2_3) -import qualified Bar as B +import Arkode (sDIRK_2_1_2, kVAERNO_4_2_3) +import qualified Arkode as B C.context (C.baseCtx <> C.vecCtx <> C.funCtx <> T.sunCtx) @@ -75,7 +75,7 @@ C.include "" -- access to ARKDls interface C.include "" -- definition of type realtype C.include "" C.include "../../../helpers.h" -C.include "Bar_hsc.h" +C.include "Arkode_hsc.h" getDataFromContents :: Storable b => Int -> Ptr a -> IO (V.Vector b) -- cgit v1.2.3