summaryrefslogtreecommitdiff
path: root/packages
diff options
context:
space:
mode:
authorDominic Steinitz <dominic@steinitz.org>2018-03-19 16:41:18 +0000
committerDominic Steinitz <dominic@steinitz.org>2018-03-19 16:41:18 +0000
commit71903cf575c31a15f9385659445c65fd85d22246 (patch)
treea2c5795b34a9ed17fd25688d147f6b6326ee24cf /packages
parent15a2c146d677dea7c4e0d7a39cbd6c8e9edb658f (diff)
Even more simplification
Diffstat (limited to 'packages')
-rw-r--r--packages/sundials/src/helpers.c21
-rw-r--r--packages/sundials/sundials.cabal27
2 files changed, 1 insertions, 47 deletions
diff --git a/packages/sundials/src/helpers.c b/packages/sundials/src/helpers.c
index f3fe40b..420d3be 100644
--- a/packages/sundials/src/helpers.c
+++ b/packages/sundials/src/helpers.c
@@ -8,12 +8,6 @@
8#include <sundials/sundials_types.h> /* definition of type realtype */ 8#include <sundials/sundials_types.h> /* definition of type realtype */
9#include <sundials/sundials_math.h> 9#include <sundials/sundials_math.h>
10 10
11#include "farkode.h"
12
13#include <HsFFI.h>
14#include "Main_stub.h"
15
16
17/* Check function return value... 11/* Check function return value...
18 opt == 0 means SUNDIALS function allocates memory so check if 12 opt == 0 means SUNDIALS function allocates memory so check if
19 returned NULL pointer 13 returned NULL pointer
@@ -49,21 +43,6 @@ int check_flag(void *flagvalue, const char *funcname, int opt)
49 return 0; 43 return 0;
50} 44}
51 45
52/* Jacobian routine to compute J(t,y) = df/dy. */
53int Jac(realtype t, N_Vector y, N_Vector fy, SUNMatrix J,
54 void *user_data, N_Vector tmp1, N_Vector tmp2, N_Vector tmp3)
55{
56 realtype *rdata = (realtype *) user_data; /* cast user_data to realtype */
57 realtype lamda = rdata[0]; /* set shortcut for stiffness parameter */
58 realtype *Jdata = SUNDenseMatrix_Data(J);
59
60 /* Fill in Jacobian of f: set the first entry of the data array to set the (0,0) entry */
61 Jdata[0] = lamda;
62
63 return 0; /* return with success */
64}
65
66
67/* check the computed solution */ 46/* check the computed solution */
68int check_ans(N_Vector y, realtype t, realtype rtol, realtype atol) 47int check_ans(N_Vector y, realtype t, realtype rtol, realtype atol)
69{ 48{
diff --git a/packages/sundials/sundials.cabal b/packages/sundials/sundials.cabal
index 9b2db12..43a83d0 100644
--- a/packages/sundials/sundials.cabal
+++ b/packages/sundials/sundials.cabal
@@ -18,19 +18,9 @@ cabal-version: >=1.10
18 18
19extra-source-files: src/helpers.c, src/helpers.h 19extra-source-files: src/helpers.c, src/helpers.h
20 20
21executable ExportAndImport.dylib
22 main-is: ExportAndImport.hs
23 other-extensions: ForeignFunctionInterface
24 build-depends: base >=4.10
25 hs-source-dirs: src
26 default-language: Haskell2010
27 include-dirs: src
28 ghc-options: -O2 -shared -fPIC -dynamic
29 extra-libraries: HSrts-ghc8.2.2
30
31executable sundials 21executable sundials
32 main-is: Main.hs 22 main-is: Main.hs
33 -- other-modules: 23 other-modules: Types
34 other-extensions: QuasiQuotes, TemplateHaskell, MultiWayIf, OverloadedStrings 24 other-extensions: QuasiQuotes, TemplateHaskell, MultiWayIf, OverloadedStrings
35 build-depends: base >=4.10 && <4.11, 25 build-depends: base >=4.10 && <4.11,
36 inline-c >=0.6 && <0.7, 26 inline-c >=0.6 && <0.7,
@@ -41,18 +31,3 @@ executable sundials
41 default-language: Haskell2010 31 default-language: Haskell2010
42 extra-libraries: sundials_arkode 32 extra-libraries: sundials_arkode
43 C-sources: src/helpers.c src/helpers.h 33 C-sources: src/helpers.c src/helpers.h
44
45executable hsundials.dylib
46 main-is: Main.hs
47 -- other-modules:
48 other-extensions: QuasiQuotes, TemplateHaskell, MultiWayIf, OverloadedStrings
49 build-depends: base >=4.10 && <4.11,
50 inline-c >=0.6 && <0.7,
51 vector >=0.12 && <0.13,
52 template-haskell >=2.12 && <2.13,
53 containers >=0.5 && <0.6
54 hs-source-dirs: src
55 ghc-options: -O2 -shared -fPIC -dynamic
56 default-language: Haskell2010
57 extra-libraries: sundials_arkode, HSrts-ghc8.2.2
58 C-sources: src/helpers.c src/helpers.h