-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsunlinsol_spgmrcomplex.h
More file actions
130 lines (116 loc) · 5.06 KB
/
Copy pathsunlinsol_spgmrcomplex.h
File metadata and controls
130 lines (116 loc) · 5.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
/*
* -----------------------------------------------------------------
* Programmer(s): Daniel Reynolds @ SMU
* Based on code sundials_spgmr.h by: Scott D. Cohen,
* Alan C. Hindmarsh and Radu Serban @ LLNL
* -----------------------------------------------------------------
* SUNDIALS Copyright Start
* Copyright (c) 2002-2024, Lawrence Livermore National Security
* and Southern Methodist University.
* All rights reserved.
*
* See the top-level LICENSE and NOTICE files for details.
*
* SPDX-License-Identifier: BSD-3-Clause
* SUNDIALS Copyright End
* -----------------------------------------------------------------
* This is the header file for the SPGMR implementation of the
* SUNLINSOL module, SUNLINSOL_SPGMR. The SPGMR algorithm is based
* on the Scaled Preconditioned GMRES (Generalized Minimal Residual)
* method.
*
* Note:
* - The definition of the generic SUNLinearSolver structure can
* be found in the header file sundials_linearsolver.h.
* -----------------------------------------------------------------
*/
#ifndef _SUNLINSOL_SPGMRComplex_H
#define _SUNLINSOL_SPGMRComplex_H
#include <stdio.h>
#include <sundials/sundials_linearsolver.h>
#include <sundials/sundials_matrix.h>
#include <sundials/sundials_nvector.h>
#include "nvector_serialcomplex.h"
#include <sundials/sundials_math.h>
#ifdef __cplusplus /* wrapper to enable C++ usage */
extern "C" {
#endif
/* Default SPGMR solver parameters */
#define SUNSPGMRComplex_MAXL_DEFAULT 5
#define SUNSPGMRComplex_MAXRS_DEFAULT 0
#define SUNSPGMRComplex_GSTYPE_DEFAULT SUN_MODIFIED_GS
/* ----------------------------------------
* SPGMR Implementation of SUNLinearSolver
* ---------------------------------------- */
struct _SUNLinearSolverContent_SPGMRComplex
{
int maxl;
int pretype;
int gstype;
int max_restarts;
sunbooleantype zeroguess;
int numiters;
sunrealtype resnorm;
int last_flag;
SUNATimesFn ATimes;
void* ATData;
SUNPSetupFn Psetup;
SUNPSolveFn Psolve;
void* PData;
N_Vector s1;
N_Vector s2;
N_Vector* V;
// sunrealtype** Hes;
// sunrealtype* givens;
suncomplextype** Hes;
suncomplextype* givens;
N_Vector xcor;
// sunrealtype* yg;
suncomplextype* yg;
N_Vector vtemp;
// sunrealtype* cv;
suncomplextype* cv;
N_Vector* Xv;
};
typedef struct _SUNLinearSolverContent_SPGMRComplex* SUNLinearSolverContent_SPGMRComplex;
/* ---------------------------------------
* Exported Functions for SUNLINSOL_SPGMR
* --------------------------------------- */
SUNDIALS_EXPORT SUNLinearSolver SUNLinSol_SPGMRComplex(N_Vector y, int pretype,
int maxl, SUNContext sunctx);
SUNDIALS_EXPORT SUNErrCode SUNLinSol_SPGMRComplex_SetPrecType(SUNLinearSolver S,
int pretype);
SUNDIALS_EXPORT SUNErrCode SUNLinSol_SPGMRComplex_SetGSType(SUNLinearSolver S,
int gstype);
SUNDIALS_EXPORT SUNErrCode SUNLinSol_SPGMRComplex_SetMaxRestarts(SUNLinearSolver S,
int maxrs);
SUNDIALS_EXPORT SUNLinearSolver_Type SUNLinSolGetType_SPGMRComplex(SUNLinearSolver S);
SUNDIALS_EXPORT SUNLinearSolver_ID SUNLinSolGetID_SPGMRComplex(SUNLinearSolver S);
SUNDIALS_EXPORT SUNErrCode SUNLinSolInitialize_SPGMRComplex(SUNLinearSolver S);
SUNDIALS_EXPORT SUNErrCode SUNLinSolSetATimes_SPGMRComplex(SUNLinearSolver S,
void* A_data,
SUNATimesFn ATimes);
SUNDIALS_EXPORT SUNErrCode SUNLinSolSetPreconditioner_SPGMRComplex(SUNLinearSolver S,
void* P_data,
SUNPSetupFn Pset,
SUNPSolveFn Psol);
SUNDIALS_EXPORT SUNErrCode SUNLinSolSetScalingVectors_SPGMRComplex(SUNLinearSolver S,
N_Vector s1,
N_Vector s2);
SUNDIALS_EXPORT SUNErrCode SUNLinSolSetZeroGuess_SPGMRComplex(SUNLinearSolver S,
sunbooleantype onff);
SUNDIALS_EXPORT int SUNLinSolSetup_SPGMRComplex(SUNLinearSolver S, SUNMatrix A);
SUNDIALS_EXPORT int SUNLinSolSolve_SPGMRComplex(SUNLinearSolver S, SUNMatrix A,
N_Vector x, N_Vector b, sunrealtype tol);
SUNDIALS_EXPORT int SUNLinSolNumIters_SPGMRComplex(SUNLinearSolver S);
SUNDIALS_EXPORT sunrealtype SUNLinSolResNorm_SPGMRComplex(SUNLinearSolver S);
SUNDIALS_EXPORT N_Vector SUNLinSolResid_SPGMRComplex(SUNLinearSolver S);
SUNDIALS_EXPORT sunindextype SUNLinSolLastFlag_SPGMRComplex(SUNLinearSolver S);
SUNDIALS_EXPORT SUNErrCode SUNLinSolSpace_SPGMRComplex(SUNLinearSolver S,
long int* lenrwLS,
long int* leniwLS);
SUNDIALS_EXPORT SUNErrCode SUNLinSolFree_SPGMRComplex(SUNLinearSolver S);
#ifdef __cplusplus
}
#endif
#endif