summaryrefslogtreecommitdiff
path: root/packages/sundials/src/Numeric/Sundials/Arkode.hsc
diff options
context:
space:
mode:
Diffstat (limited to 'packages/sundials/src/Numeric/Sundials/Arkode.hsc')
-rw-r--r--packages/sundials/src/Numeric/Sundials/Arkode.hsc120
1 files changed, 120 insertions, 0 deletions
diff --git a/packages/sundials/src/Numeric/Sundials/Arkode.hsc b/packages/sundials/src/Numeric/Sundials/Arkode.hsc
new file mode 100644
index 0000000..f5e5dc1
--- /dev/null
+++ b/packages/sundials/src/Numeric/Sundials/Arkode.hsc
@@ -0,0 +1,120 @@
1|module Numeric.Sundials.Arkode where
2
3import Foreign
4import Foreign.C.Types
5
6
7#include <stdio.h>
8#include <sundials/sundials_nvector.h>
9#include <sundials/sundials_matrix.h>
10#include <nvector/nvector_serial.h>
11#include <sunmatrix/sunmatrix_dense.h>
12#include <arkode/arkode.h>
13#include <cvode/cvode.h>
14
15
16#def typedef struct _generic_N_Vector SunVector;
17#def typedef struct _N_VectorContent_Serial SunContent;
18
19#def typedef struct _generic_SUNMatrix SunMatrix;
20#def typedef struct _SUNMatrixContent_Dense SunMatrixContent;
21
22getContentMatrixPtr :: Storable a => Ptr b -> IO a
23getContentMatrixPtr ptr = (#peek SunMatrix, content) ptr
24
25getNRows :: Ptr b -> IO CInt
26getNRows ptr = (#peek SunMatrixContent, M) ptr
27putNRows :: CInt -> Ptr b -> IO ()
28putNRows nr ptr = (#poke SunMatrixContent, M) ptr nr
29
30getNCols :: Ptr b -> IO CInt
31getNCols ptr = (#peek SunMatrixContent, N) ptr
32putNCols :: CInt -> Ptr b -> IO ()
33putNCols nc ptr = (#poke SunMatrixContent, N) ptr nc
34
35getMatrixData :: Storable a => Ptr b -> IO a
36getMatrixData ptr = (#peek SunMatrixContent, data) ptr
37
38getContentPtr :: Storable a => Ptr b -> IO a
39getContentPtr ptr = (#peek SunVector, content) ptr
40
41getData :: Storable a => Ptr b -> IO a
42getData ptr = (#peek SunContent, data) ptr
43
44cV_ADAMS :: Int
45cV_ADAMS = #const CV_ADAMS
46cV_BDF :: Int
47cV_BDF = #const CV_BDF
48
49arkSMax :: Int
50arkSMax = #const ARK_S_MAX
51
52mIN_DIRK_NUM, mAX_DIRK_NUM :: Int
53mIN_DIRK_NUM = #const MIN_DIRK_NUM
54mAX_DIRK_NUM = #const MAX_DIRK_NUM
55
56-- FIXME: We could just use inline-c instead
57
58-- Butcher table accessors -- implicit
59sDIRK_2_1_2 :: Int
60sDIRK_2_1_2 = #const SDIRK_2_1_2
61bILLINGTON_3_3_2 :: Int
62bILLINGTON_3_3_2 = #const BILLINGTON_3_3_2
63tRBDF2_3_3_2 :: Int
64tRBDF2_3_3_2 = #const TRBDF2_3_3_2
65kVAERNO_4_2_3 :: Int
66kVAERNO_4_2_3 = #const KVAERNO_4_2_3
67aRK324L2SA_DIRK_4_2_3 :: Int
68aRK324L2SA_DIRK_4_2_3 = #const ARK324L2SA_DIRK_4_2_3
69cASH_5_2_4 :: Int
70cASH_5_2_4 = #const CASH_5_2_4
71cASH_5_3_4 :: Int
72cASH_5_3_4 = #const CASH_5_3_4
73sDIRK_5_3_4 :: Int
74sDIRK_5_3_4 = #const SDIRK_5_3_4
75kVAERNO_5_3_4 :: Int
76kVAERNO_5_3_4 = #const KVAERNO_5_3_4
77aRK436L2SA_DIRK_6_3_4 :: Int
78aRK436L2SA_DIRK_6_3_4 = #const ARK436L2SA_DIRK_6_3_4
79kVAERNO_7_4_5 :: Int
80kVAERNO_7_4_5 = #const KVAERNO_7_4_5
81aRK548L2SA_DIRK_8_4_5 :: Int
82aRK548L2SA_DIRK_8_4_5 = #const ARK548L2SA_DIRK_8_4_5
83
84-- #define DEFAULT_DIRK_2 SDIRK_2_1_2
85-- #define DEFAULT_DIRK_3 ARK324L2SA_DIRK_4_2_3
86-- #define DEFAULT_DIRK_4 SDIRK_5_3_4
87-- #define DEFAULT_DIRK_5 ARK548L2SA_DIRK_8_4_5
88
89-- Butcher table accessors -- explicit
90hEUN_EULER_2_1_2 :: Int
91hEUN_EULER_2_1_2 = #const HEUN_EULER_2_1_2
92bOGACKI_SHAMPINE_4_2_3 :: Int
93bOGACKI_SHAMPINE_4_2_3 = #const BOGACKI_SHAMPINE_4_2_3
94aRK324L2SA_ERK_4_2_3 :: Int
95aRK324L2SA_ERK_4_2_3 = #const ARK324L2SA_ERK_4_2_3
96zONNEVELD_5_3_4 :: Int
97zONNEVELD_5_3_4 = #const ZONNEVELD_5_3_4
98aRK436L2SA_ERK_6_3_4 :: Int
99aRK436L2SA_ERK_6_3_4 = #const ARK436L2SA_ERK_6_3_4
100sAYFY_ABURUB_6_3_4 :: Int
101sAYFY_ABURUB_6_3_4 = #const SAYFY_ABURUB_6_3_4
102cASH_KARP_6_4_5 :: Int
103cASH_KARP_6_4_5 = #const CASH_KARP_6_4_5
104fEHLBERG_6_4_5 :: Int
105fEHLBERG_6_4_5 = #const FEHLBERG_6_4_5
106dORMAND_PRINCE_7_4_5 :: Int
107dORMAND_PRINCE_7_4_5 = #const DORMAND_PRINCE_7_4_5
108aRK548L2SA_ERK_8_4_5 :: Int
109aRK548L2SA_ERK_8_4_5 = #const ARK548L2SA_ERK_8_4_5
110vERNER_8_5_6 :: Int
111vERNER_8_5_6 = #const VERNER_8_5_6
112fEHLBERG_13_7_8 :: Int
113fEHLBERG_13_7_8 = #const FEHLBERG_13_7_8
114
115-- #define DEFAULT_ERK_2 HEUN_EULER_2_1_2
116-- #define DEFAULT_ERK_3 BOGACKI_SHAMPINE_4_2_3
117-- #define DEFAULT_ERK_4 ZONNEVELD_5_3_4
118-- #define DEFAULT_ERK_5 CASH_KARP_6_4_5
119-- #define DEFAULT_ERK_6 VERNER_8_5_6
120-- #define DEFAULT_ERK_8 FEHLBERG_13_7_8