diff options
Diffstat (limited to 'packages/sundials/src/Arkode.hsc')
-rw-r--r-- | packages/sundials/src/Arkode.hsc | 46 |
1 files changed, 46 insertions, 0 deletions
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 @@ | |||
1 | {-# LANGUAGE RecordWildCards #-} | ||
2 | |||
3 | module Arkode where | ||
4 | |||
5 | import Foreign | ||
6 | import Foreign.C.Types | ||
7 | import Foreign.C.String | ||
8 | |||
9 | |||
10 | #include <stdio.h> | ||
11 | #include <sundials/sundials_nvector.h> | ||
12 | #include <nvector/nvector_serial.h> | ||
13 | #include <arkode/arkode.h> | ||
14 | |||
15 | #def typedef struct _generic_N_Vector SunVector; | ||
16 | #def typedef struct _N_VectorContent_Serial SunContent; | ||
17 | |||
18 | getContentPtr :: Storable a => Ptr b -> IO a | ||
19 | getContentPtr ptr = (#peek SunVector, content) ptr | ||
20 | |||
21 | getData :: Storable a => Ptr b -> IO a | ||
22 | getData ptr = (#peek SunContent, data) ptr | ||
23 | |||
24 | arkSMax :: Int | ||
25 | arkSMax = #const ARK_S_MAX | ||
26 | |||
27 | -- FIXME: We could just use inline-c instead | ||
28 | sDIRK_2_1_2 :: Int | ||
29 | sDIRK_2_1_2 = #const SDIRK_2_1_2 | ||
30 | -- #define BILLINGTON_3_3_2 13 | ||
31 | -- #define TRBDF2_3_3_2 14 | ||
32 | kVAERNO_4_2_3 :: Int | ||
33 | kVAERNO_4_2_3 = #const KVAERNO_4_2_3 | ||
34 | -- #define ARK324L2SA_DIRK_4_2_3 16 | ||
35 | -- #define CASH_5_2_4 17 | ||
36 | -- #define CASH_5_3_4 18 | ||
37 | -- #define SDIRK_5_3_4 19 | ||
38 | -- #define KVAERNO_5_3_4 20 | ||
39 | -- #define ARK436L2SA_DIRK_6_3_4 21 | ||
40 | -- #define KVAERNO_7_4_5 22 | ||
41 | -- #define ARK548L2SA_DIRK_8_4_5 23 | ||
42 | |||
43 | -- #define DEFAULT_DIRK_2 SDIRK_2_1_2 | ||
44 | -- #define DEFAULT_DIRK_3 ARK324L2SA_DIRK_4_2_3 | ||
45 | -- #define DEFAULT_DIRK_4 SDIRK_5_3_4 | ||
46 | -- #define DEFAULT_DIRK_5 ARK548L2SA_DIRK_8_4_5 | ||