1 | |
---|
2 | SUBROUTINE mexFunction( nlhs, plhs, nrhs, prhs ) |
---|
3 | C~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
4 | C Matlab Gateway for the Sparse Jacobian Function Jac_SP |
---|
5 | C~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
6 | |
---|
7 | INTEGER nlhs, nrhs |
---|
8 | INTEGER plhs(*), prhs(*) |
---|
9 | INTEGER mxGetPr, mxCreateFull, mxGetM, mxgetN |
---|
10 | INTEGER VPtr, FPtr, RPtr, JVSPtr |
---|
11 | KPP_REAL V(KPP_NVAR), F(KPP_NFIX), RCT(KPP_NREACT) |
---|
12 | KPP_REAL JVS(KPP_LU_NONZERO) |
---|
13 | |
---|
14 | C Check for the right number of input arguments |
---|
15 | IF ( nrhs .ne. 3 ) THEN |
---|
16 | CALL mexErrMsgTxt('Jac_SP requires 3 input vectors: |
---|
17 | &V(KPP_NVAR), F(KPP_NFIX), RCT(KPP_NREACT)') |
---|
18 | END IF |
---|
19 | C Check for the right number of output arguments |
---|
20 | IF ( nlhs .ne. 1 ) THEN |
---|
21 | CALL mexErrMsgTxt('Jac_SP requires 1 output vector: |
---|
22 | &JVS(KPP_LU_NONZERO)') |
---|
23 | END IF |
---|
24 | |
---|
25 | plhs(1) = mxCreateDoubleMatrix(KPP_LU_NONZERO,1,0) |
---|
26 | |
---|
27 | VPtr = mxGetPr(prhs(1)) |
---|
28 | CALL mxCopyPtrToReal8(VPtr,V,KPP_NVAR) |
---|
29 | |
---|
30 | FPtr = mxGetPr(prhs(2)) |
---|
31 | CALL mxCopyPtrToReal8(FPtr,F,KPP_NFIX) |
---|
32 | |
---|
33 | RPtr = mxGetPr(prhs(3)) |
---|
34 | CALL mxCopyPtrToReal8(RPtr,RCT,KPP_NREACT) |
---|
35 | |
---|
36 | JVSPtr = mxGetPr(plhs(1)) |
---|
37 | |
---|
38 | CALL Jac_SP( V, F, RCT, JVS ) |
---|
39 | |
---|
40 | CALL mxCopyReal8ToPtr(JVS, JVSPtr, KPP_LU_NONZERO) |
---|
41 | |
---|
42 | RETURN |
---|
43 | END |
---|