/[ascend]/trunk/base/generic/solver/idalinear.h
ViewVC logotype

Contents of /trunk/base/generic/solver/idalinear.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1012 - (show annotations) (download) (as text)
Wed Jan 3 03:13:20 2007 UTC (15 years, 9 months ago) by johnpye
File MIME type: text/x-chdr
File size: 2697 byte(s)
Added idalinear.[ch], which will expose the linsolqr solver as a linear solver for IDA.
Modified ida.c to support this new linear solver under the name 'ASCEND'.
1 /* ASCEND modelling environment
2 Copyright (C) 2006 Carnegie Mellon University
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2, or (at your option)
7 any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 59 Temple Place - Suite 330,
17 Boston, MA 02111-1307, USA.
18 *//** @file
19 This file presents a linear solver interface that can be utilised by the
20 IDA integrator from the SUNDIALS suite by LLNL. The linear solver uses the
21 ASCEND linsolqr routines internally, and takes advantage of the block
22 decomposition functionality available in ASCEND.
23
24 EXPERIMENTAL -- INCOMPLETE -- UNDER DEVELOPMENT
25
26 This file and idalinear.c are modelled fairly closely on ida_dense.c from
27 the SUNDIALS distribution, which maps out the expected use of ida_lmem
28 data structure, etc.
29
30 @see http://www.llnl.gov/casc/sundials/
31 */
32 #ifndef ASC_IDALINEAR_H
33 #define ASC_IDALINEAR_H
34
35 #include <ida/ida.h>
36 #include <nvector/nvector_serial.h>
37 #include <solver/mtx.h>
38
39 /**
40 Function prototype for sparse jacobian evaluation as required by this linear solver
41 */
42 typedef int IntegratorSparseJacFn(long int Neq, realtype tt
43 , N_Vector yy, N_Vector yp, N_Vector rr
44 , realtype c_j, void *jac_data, mtx_matrix_t Jac
45 , N_Vector tmp1, N_Vector tmp2, N_Vector tmp3
46 );
47
48 #define IDAASCEND_SUCCESS 0
49
50 #define IDAASCEND_JACFUNC_RECVR 1
51
52 #define IDAASCEND_MEM_NULL -1
53 #define IDAASCEND_LMEM_NULL -2
54 #define IDAASCEND_MEM_FAIL -4
55 #define IDAASCEND_JACFN_UNDEF -5
56 #define IDAASCEND_JACFUNC_UNRECVR -6
57 /*------------------------------------
58 User functions (called from ida.c in this directory)
59 */
60
61 /**
62 Configure IDA to use the ASCEND linear solver
63
64 @param size IDA problem size (number of equations)
65 */
66 int IDAASCEND(void *ida_mem, long size);
67
68 /**
69 Register a (sparse mtx) Jacobian evaluation function with the linear solver (required)
70 */
71 int IDAASCENDSetJacFn(void *ida_mem, IntegratorSparseJacFn *jacfn, void *jac_data);
72
73 /**
74 @param flag variable into which the last flag is returned
75 @return non-zero if unable to retrieve the last flag successfully (eg if ida_mem is NULL)
76 */
77 int IDAASCENDGetLastFlag(void *ida_mem, int *flag);
78
79 /**
80 You need to free the returned string here.
81 */
82 char *IDAASCENDGetReturnFlagName(int flag);
83
84 #endif

john.pye@anu.edu.au
ViewVC Help
Powered by ViewVC 1.1.22