1 /*
2  * -----------------------------------------------------------------
3  * $Revision: 4378 $
4  * $Date: 2015-02-19 10:55:14 -0800 (Thu, 19 Feb 2015) $
5  * -----------------------------------------------------------------
6  * Programmer(s): Allan Taylor, Alan Hindmarsh, Radu Serban, and
7  *                Aaron Collier @ LLNL
8  *  -----------------------------------------------------------------
9  * LLNS Copyright Start
10  * Copyright (c) 2014, Lawrence Livermore National Security
11  * This work was performed under the auspices of the U.S. Department
12  * of Energy by Lawrence Livermore National Laboratory in part under
13  * Contract W-7405-Eng-48 and in part under Contract DE-AC52-07NA27344.
14  * Produced at the Lawrence Livermore National Laboratory.
15  * All rights reserved.
16  * For details, see the LICENSE file.
17  * LLNS Copyright End
18  * -----------------------------------------------------------------
19  * KINBBDPRE module header file (private version)
20  * -----------------------------------------------------------------
21  */
22 
23 #ifndef _KINBBDPRE_IMPL_H
24 #define _KINBBDPRE_IMPL_H
25 
26 #include <kinsol/kinsol_bbdpre.h>
27 #include <sundials/sundials_band.h>
28 #include "kinsol_impl.h"
29 
30 #ifdef __cplusplus  /* wrapper to enable C++ usage */
31 extern "C" {
32 #endif
33 
34 /*
35  * -----------------------------------------------------------------
36  * Definition of KBBDData
37  * -----------------------------------------------------------------
38  */
39 
40 typedef struct KBBDPrecDataRec {
41 
42   /* passed by user to KINBBDPrecAlloc, used by pset/psolve functions */
43 
44   long int mudq, mldq, mukeep, mlkeep;
45   KINLocalFn gloc;
46   KINCommFn gcomm;
47 
48   /* relative error for the Jacobian DQ routine */
49 
50   realtype rel_uu;
51 
52   /* allocated for use by KINBBDPrecSetup */
53 
54   N_Vector vtemp3;
55 
56   /* set by KINBBDPrecSetup and used by KINBBDPrecSolve */
57 
58   DlsMat PP;
59   long int *lpivots;
60 
61   /* set by KINBBDPrecAlloc and used by KINBBDPrecSetup */
62 
63   long int n_local;
64 
65   /* available for optional output */
66 
67   long int rpwsize;
68   long int ipwsize;
69   long int nge;
70 
71   /* pointer to KINSol memory */
72 
73   void *kin_mem;
74 
75 } *KBBDPrecData;
76 
77 /*
78  *-----------------------------------------------------------------
79  * KINBBDPRE error messages
80  *-----------------------------------------------------------------
81  */
82 
83 #define MSGBBD_MEM_NULL    "KINSOL Memory is NULL."
84 #define MSGBBD_LMEM_NULL   "Linear solver memory is NULL. One of the SPILS linear solvers must be attached."
85 #define MSGBBD_MEM_FAIL    "A memory request failed."
86 #define MSGBBD_BAD_NVECTOR "A required vector operation is not implemented."
87 #define MSGBBD_FUNC_FAILED "The gloc or cfn routine failed in an unrecoverable manner."
88 #define MSGBBD_PMEM_NULL   "BBD peconditioner memory is NULL. IDABBDPrecInit must be called."
89 
90 #ifdef __cplusplus
91 }
92 #endif
93 
94 #endif
95