1 /*-----------------------------------------------------------------
2  * Programmer(s): Daniel R. Reynolds @ SMU
3  *-----------------------------------------------------------------
4  * SUNDIALS Copyright Start
5  * Copyright (c) 2002-2021, Lawrence Livermore National Security
6  * and Southern Methodist University.
7  * All rights reserved.
8  *
9  * See the top-level LICENSE and NOTICE files for details.
10  *
11  * SPDX-License-Identifier: BSD-3-Clause
12  * SUNDIALS Copyright End
13  *-----------------------------------------------------------------
14  * Implementation file for the deprecated Scaled and Preconditioned
15  * Iterative Linear Solver interface in IDAS; these routines now just
16  * wrap the updated IDA generic linear solver interface in idas_ls.h.
17  *-----------------------------------------------------------------*/
18 
19 #include <idas/idas_ls.h>
20 #include <idas/idas_spils.h>
21 
22 #ifdef __cplusplus  /* wrapper to enable C++ usage */
23 extern "C" {
24 #endif
25 
26 /*=================================================================
27   Exported Functions (wrappers for equivalent routines in idas_ls.h)
28   =================================================================*/
29 
IDASpilsSetLinearSolver(void * ida_mem,SUNLinearSolver LS)30 int IDASpilsSetLinearSolver(void *ida_mem, SUNLinearSolver LS)
31 { return(IDASetLinearSolver(ida_mem, LS, NULL)); }
32 
IDASpilsSetPreconditioner(void * ida_mem,IDASpilsPrecSetupFn pset,IDASpilsPrecSolveFn psolve)33 int IDASpilsSetPreconditioner(void *ida_mem, IDASpilsPrecSetupFn pset,
34                               IDASpilsPrecSolveFn psolve)
35 { return(IDASetPreconditioner(ida_mem, pset,  psolve)); }
36 
IDASpilsSetJacTimes(void * ida_mem,IDASpilsJacTimesSetupFn jtsetup,IDASpilsJacTimesVecFn jtimes)37 int IDASpilsSetJacTimes(void *ida_mem, IDASpilsJacTimesSetupFn jtsetup,
38                         IDASpilsJacTimesVecFn jtimes)
39 { return(IDASetJacTimes(ida_mem, jtsetup, jtimes)); }
40 
IDASpilsSetEpsLin(void * ida_mem,realtype eplifac)41 int IDASpilsSetEpsLin(void *ida_mem, realtype eplifac)
42 { return(IDASetEpsLin(ida_mem, eplifac)); }
43 
IDASpilsSetIncrementFactor(void * ida_mem,realtype dqincfac)44 int IDASpilsSetIncrementFactor(void *ida_mem, realtype dqincfac)
45 { return(IDASetIncrementFactor(ida_mem, dqincfac)); }
46 
IDASpilsGetWorkSpace(void * ida_mem,long int * lenrwLS,long int * leniwLS)47 int IDASpilsGetWorkSpace(void *ida_mem, long int *lenrwLS,
48                          long int *leniwLS)
49 { return(IDAGetLinWorkSpace(ida_mem, lenrwLS, leniwLS)); }
50 
IDASpilsGetNumPrecEvals(void * ida_mem,long int * npevals)51 int IDASpilsGetNumPrecEvals(void *ida_mem, long int *npevals)
52 { return(IDAGetNumPrecEvals(ida_mem, npevals)); }
53 
IDASpilsGetNumPrecSolves(void * ida_mem,long int * npsolves)54 int IDASpilsGetNumPrecSolves(void *ida_mem, long int *npsolves)
55 { return(IDAGetNumPrecSolves(ida_mem, npsolves)); }
56 
IDASpilsGetNumLinIters(void * ida_mem,long int * nliters)57 int IDASpilsGetNumLinIters(void *ida_mem, long int *nliters)
58 { return(IDAGetNumLinIters(ida_mem, nliters)); }
59 
IDASpilsGetNumConvFails(void * ida_mem,long int * nlcfails)60 int IDASpilsGetNumConvFails(void *ida_mem, long int *nlcfails)
61 { return(IDAGetNumLinConvFails(ida_mem, nlcfails)); }
62 
IDASpilsGetNumJTSetupEvals(void * ida_mem,long int * njtsetups)63 int IDASpilsGetNumJTSetupEvals(void *ida_mem, long int *njtsetups)
64 { return(IDAGetNumJTSetupEvals(ida_mem, njtsetups)); }
65 
IDASpilsGetNumJtimesEvals(void * ida_mem,long int * njvevals)66 int IDASpilsGetNumJtimesEvals(void *ida_mem, long int *njvevals)
67 { return(IDAGetNumJtimesEvals(ida_mem, njvevals)); }
68 
IDASpilsGetNumResEvals(void * ida_mem,long int * nrevalsLS)69 int IDASpilsGetNumResEvals(void *ida_mem, long int *nrevalsLS)
70 { return(IDAGetNumLinResEvals(ida_mem, nrevalsLS)); }
71 
IDASpilsGetLastFlag(void * ida_mem,long int * flag)72 int IDASpilsGetLastFlag(void *ida_mem, long int *flag)
73 { return(IDAGetLastLinFlag(ida_mem, flag)); }
74 
IDASpilsGetReturnFlagName(long int flag)75 char *IDASpilsGetReturnFlagName(long int flag)
76 { return(IDAGetLinReturnFlagName(flag)); }
77 
IDASpilsSetLinearSolverB(void * ida_mem,int which,SUNLinearSolver LS)78 int IDASpilsSetLinearSolverB(void *ida_mem, int which,
79                              SUNLinearSolver LS)
80 { return(IDASetLinearSolverB(ida_mem, which, LS, NULL)); }
81 
IDASpilsSetEpsLinB(void * ida_mem,int which,realtype eplifacB)82 int IDASpilsSetEpsLinB(void *ida_mem, int which, realtype eplifacB)
83 { return(IDASetEpsLinB(ida_mem, which, eplifacB)); }
84 
IDASpilsSetIncrementFactorB(void * ida_mem,int which,realtype dqincfacB)85 int IDASpilsSetIncrementFactorB(void *ida_mem, int which,
86                                 realtype dqincfacB)
87 { return(IDASetIncrementFactorB(ida_mem, which, dqincfacB)); }
88 
IDASpilsSetPreconditionerB(void * ida_mem,int which,IDASpilsPrecSetupFnB psetB,IDASpilsPrecSolveFnB psolveB)89 int IDASpilsSetPreconditionerB(void *ida_mem, int which,
90                                IDASpilsPrecSetupFnB psetB,
91                                IDASpilsPrecSolveFnB psolveB)
92 { return(IDASetPreconditionerB(ida_mem, which, psetB, psolveB)); }
93 
IDASpilsSetPreconditionerBS(void * ida_mem,int which,IDASpilsPrecSetupFnBS psetBS,IDASpilsPrecSolveFnBS psolveBS)94 int IDASpilsSetPreconditionerBS(void *ida_mem, int which,
95                                 IDASpilsPrecSetupFnBS psetBS,
96                                 IDASpilsPrecSolveFnBS psolveBS)
97 { return(IDASetPreconditionerBS(ida_mem, which, psetBS, psolveBS)); }
98 
IDASpilsSetJacTimesB(void * ida_mem,int which,IDASpilsJacTimesSetupFnB jtsetupB,IDASpilsJacTimesVecFnB jtimesB)99 int IDASpilsSetJacTimesB(void *ida_mem, int which,
100                          IDASpilsJacTimesSetupFnB jtsetupB,
101                          IDASpilsJacTimesVecFnB jtimesB)
102 { return(IDASetJacTimesB(ida_mem, which, jtsetupB, jtimesB)); }
103 
IDASpilsSetJacTimesBS(void * ida_mem,int which,IDASpilsJacTimesSetupFnBS jtsetupBS,IDASpilsJacTimesVecFnBS jtimesBS)104 int IDASpilsSetJacTimesBS(void *ida_mem, int which,
105                           IDASpilsJacTimesSetupFnBS jtsetupBS,
106                           IDASpilsJacTimesVecFnBS jtimesBS)
107 { return(IDASetJacTimesBS(ida_mem, which, jtsetupBS, jtimesBS)); }
108 
109 
110 
111 #ifdef __cplusplus
112 }
113 #endif
114 
115