1 /******************************************************************************
2 * Copyright 1998-2019 Lawrence Livermore National Security, LLC and other
3 * HYPRE Project Developers. See the top-level COPYRIGHT file for details.
4 *
5 * SPDX-License-Identifier: (Apache-2.0 OR MIT)
6 ******************************************************************************/
7
8 /******************************************************************************
9 *
10 * HYPRE_COGMRES interface
11 *
12 *****************************************************************************/
13 #include "krylov.h"
14
15 /*--------------------------------------------------------------------------
16 * HYPRE_COGMRESDestroy
17 *--------------------------------------------------------------------------*/
18 /* to do, not trivial */
19 /*
20 HYPRE_Int
21 HYPRE_ParCSRCOGMRESDestroy( HYPRE_Solver solver )
22 {
23 return( hypre_COGMRESDestroy( (void *) solver ) );
24 }
25 */
26
27 /*--------------------------------------------------------------------------
28 * HYPRE_COGMRESSetup
29 *--------------------------------------------------------------------------*/
30
31 HYPRE_Int
HYPRE_COGMRESSetup(HYPRE_Solver solver,HYPRE_Matrix A,HYPRE_Vector b,HYPRE_Vector x)32 HYPRE_COGMRESSetup( HYPRE_Solver solver,
33 HYPRE_Matrix A,
34 HYPRE_Vector b,
35 HYPRE_Vector x )
36 {
37 return( hypre_COGMRESSetup( solver,
38 A,
39 b,
40 x ) );
41 }
42
43 /*--------------------------------------------------------------------------
44 * HYPRE_COGMRESSolve
45 *--------------------------------------------------------------------------*/
46
47 HYPRE_Int
HYPRE_COGMRESSolve(HYPRE_Solver solver,HYPRE_Matrix A,HYPRE_Vector b,HYPRE_Vector x)48 HYPRE_COGMRESSolve( HYPRE_Solver solver,
49 HYPRE_Matrix A,
50 HYPRE_Vector b,
51 HYPRE_Vector x )
52 {
53 return( hypre_COGMRESSolve( solver,
54 A,
55 b,
56 x ) );
57 }
58
59 /*--------------------------------------------------------------------------
60 * HYPRE_COGMRESSetKDim, HYPRE_COGMRESGetKDim
61 *--------------------------------------------------------------------------*/
62
63 HYPRE_Int
HYPRE_COGMRESSetKDim(HYPRE_Solver solver,HYPRE_Int k_dim)64 HYPRE_COGMRESSetKDim( HYPRE_Solver solver,
65 HYPRE_Int k_dim )
66 {
67 return( hypre_COGMRESSetKDim( (void *) solver, k_dim ) );
68 }
69
70 HYPRE_Int
HYPRE_COGMRESGetKDim(HYPRE_Solver solver,HYPRE_Int * k_dim)71 HYPRE_COGMRESGetKDim( HYPRE_Solver solver,
72 HYPRE_Int * k_dim )
73 {
74 return( hypre_COGMRESGetKDim( (void *) solver, k_dim ) );
75 }
76
77 /*--------------------------------------------------------------------------
78 * HYPRE_COGMRESSetUnroll, HYPRE_COGMRESGetUnroll
79 *--------------------------------------------------------------------------*/
80
81 HYPRE_Int
HYPRE_COGMRESSetUnroll(HYPRE_Solver solver,HYPRE_Int unroll)82 HYPRE_COGMRESSetUnroll( HYPRE_Solver solver,
83 HYPRE_Int unroll )
84 {
85 return( hypre_COGMRESSetUnroll( (void *) solver, unroll ) );
86 }
87
88 HYPRE_Int
HYPRE_COGMRESGetUnroll(HYPRE_Solver solver,HYPRE_Int * unroll)89 HYPRE_COGMRESGetUnroll( HYPRE_Solver solver,
90 HYPRE_Int * unroll )
91 {
92 return( hypre_COGMRESGetUnroll( (void *) solver, unroll ) );
93 }
94
95 /*--------------------------------------------------------------------------
96 * HYPRE_COGMRESSetCGS, HYPRE_COGMRESGetCGS
97 *--------------------------------------------------------------------------*/
98
99 HYPRE_Int
HYPRE_COGMRESSetCGS(HYPRE_Solver solver,HYPRE_Int cgs)100 HYPRE_COGMRESSetCGS( HYPRE_Solver solver,
101 HYPRE_Int cgs )
102 {
103 return( hypre_COGMRESSetCGS( (void *) solver, cgs ) );
104 }
105
106 HYPRE_Int
HYPRE_COGMRESGetCGS(HYPRE_Solver solver,HYPRE_Int * cgs)107 HYPRE_COGMRESGetCGS( HYPRE_Solver solver,
108 HYPRE_Int * cgs )
109 {
110 return( hypre_COGMRESGetCGS( (void *) solver, cgs ) );
111 }
112
113 /*--------------------------------------------------------------------------
114 * HYPRE_COGMRESSetTol, HYPRE_COGMRESGetTol
115 *--------------------------------------------------------------------------*/
116
117 HYPRE_Int
HYPRE_COGMRESSetTol(HYPRE_Solver solver,HYPRE_Real tol)118 HYPRE_COGMRESSetTol( HYPRE_Solver solver,
119 HYPRE_Real tol )
120 {
121 return( hypre_COGMRESSetTol( (void *) solver, tol ) );
122 }
123
124 HYPRE_Int
HYPRE_COGMRESGetTol(HYPRE_Solver solver,HYPRE_Real * tol)125 HYPRE_COGMRESGetTol( HYPRE_Solver solver,
126 HYPRE_Real * tol )
127 {
128 return( hypre_COGMRESGetTol( (void *) solver, tol ) );
129 }
130 /*--------------------------------------------------------------------------
131 * HYPRE_COGMRESSetAbsoluteTol, HYPRE_COGMRESGetAbsoluteTol
132 *--------------------------------------------------------------------------*/
133
134 HYPRE_Int
HYPRE_COGMRESSetAbsoluteTol(HYPRE_Solver solver,HYPRE_Real a_tol)135 HYPRE_COGMRESSetAbsoluteTol( HYPRE_Solver solver,
136 HYPRE_Real a_tol )
137 {
138 return( hypre_COGMRESSetAbsoluteTol( (void *) solver, a_tol ) );
139 }
140
141 HYPRE_Int
HYPRE_COGMRESGetAbsoluteTol(HYPRE_Solver solver,HYPRE_Real * a_tol)142 HYPRE_COGMRESGetAbsoluteTol( HYPRE_Solver solver,
143 HYPRE_Real * a_tol )
144 {
145 return( hypre_COGMRESGetAbsoluteTol( (void *) solver, a_tol ) );
146 }
147
148 /*--------------------------------------------------------------------------
149 * HYPRE_COGMRESSetConvergenceFactorTol, HYPRE_COGMRESGetConvergenceFactorTol
150 *--------------------------------------------------------------------------*/
151
152 HYPRE_Int
HYPRE_COGMRESSetConvergenceFactorTol(HYPRE_Solver solver,HYPRE_Real cf_tol)153 HYPRE_COGMRESSetConvergenceFactorTol( HYPRE_Solver solver,
154 HYPRE_Real cf_tol )
155 {
156 return( hypre_COGMRESSetConvergenceFactorTol( (void *) solver, cf_tol ) );
157 }
158
159 HYPRE_Int
HYPRE_COGMRESGetConvergenceFactorTol(HYPRE_Solver solver,HYPRE_Real * cf_tol)160 HYPRE_COGMRESGetConvergenceFactorTol( HYPRE_Solver solver,
161 HYPRE_Real * cf_tol )
162 {
163 return( hypre_COGMRESGetConvergenceFactorTol( (void *) solver, cf_tol ) );
164 }
165
166 /*--------------------------------------------------------------------------
167 * HYPRE_COGMRESSetMinIter, HYPRE_COGMRESGetMinIter
168 *--------------------------------------------------------------------------*/
169
170 HYPRE_Int
HYPRE_COGMRESSetMinIter(HYPRE_Solver solver,HYPRE_Int min_iter)171 HYPRE_COGMRESSetMinIter( HYPRE_Solver solver,
172 HYPRE_Int min_iter )
173 {
174 return( hypre_COGMRESSetMinIter( (void *) solver, min_iter ) );
175 }
176
177 HYPRE_Int
HYPRE_COGMRESGetMinIter(HYPRE_Solver solver,HYPRE_Int * min_iter)178 HYPRE_COGMRESGetMinIter( HYPRE_Solver solver,
179 HYPRE_Int * min_iter )
180 {
181 return( hypre_COGMRESGetMinIter( (void *) solver, min_iter ) );
182 }
183
184 /*--------------------------------------------------------------------------
185 * HYPRE_COGMRESSetMaxIter, HYPRE_COGMRESGetMaxIter
186 *--------------------------------------------------------------------------*/
187
188 HYPRE_Int
HYPRE_COGMRESSetMaxIter(HYPRE_Solver solver,HYPRE_Int max_iter)189 HYPRE_COGMRESSetMaxIter( HYPRE_Solver solver,
190 HYPRE_Int max_iter )
191 {
192 return( hypre_COGMRESSetMaxIter( (void *) solver, max_iter ) );
193 }
194
195 HYPRE_Int
HYPRE_COGMRESGetMaxIter(HYPRE_Solver solver,HYPRE_Int * max_iter)196 HYPRE_COGMRESGetMaxIter( HYPRE_Solver solver,
197 HYPRE_Int * max_iter )
198 {
199 return( hypre_COGMRESGetMaxIter( (void *) solver, max_iter ) );
200 }
201
202
203
204 /*--------------------------------------------------------------------------
205 * HYPRE_COGMRESSetPrecond
206 *--------------------------------------------------------------------------*/
207
208 HYPRE_Int
HYPRE_COGMRESSetPrecond(HYPRE_Solver solver,HYPRE_PtrToSolverFcn precond,HYPRE_PtrToSolverFcn precond_setup,HYPRE_Solver precond_solver)209 HYPRE_COGMRESSetPrecond( HYPRE_Solver solver,
210 HYPRE_PtrToSolverFcn precond,
211 HYPRE_PtrToSolverFcn precond_setup,
212 HYPRE_Solver precond_solver )
213 {
214 return( hypre_COGMRESSetPrecond( (void *) solver,
215 (HYPRE_Int (*)(void*, void*, void*, void*))precond,
216 (HYPRE_Int (*)(void*, void*, void*, void*))precond_setup,
217 (void *) precond_solver ) );
218 }
219
220 /*--------------------------------------------------------------------------
221 * HYPRE_COGMRESGetPrecond
222 *--------------------------------------------------------------------------*/
223
224 HYPRE_Int
HYPRE_COGMRESGetPrecond(HYPRE_Solver solver,HYPRE_Solver * precond_data_ptr)225 HYPRE_COGMRESGetPrecond( HYPRE_Solver solver,
226 HYPRE_Solver *precond_data_ptr )
227 {
228 return( hypre_COGMRESGetPrecond( (void *) solver,
229 (HYPRE_Solver *) precond_data_ptr ) );
230 }
231
232 /*--------------------------------------------------------------------------
233 * HYPRE_COGMRESSetPrintLevel, HYPRE_COGMRESGetPrintLevel
234 *--------------------------------------------------------------------------*/
235
236 HYPRE_Int
HYPRE_COGMRESSetPrintLevel(HYPRE_Solver solver,HYPRE_Int level)237 HYPRE_COGMRESSetPrintLevel( HYPRE_Solver solver,
238 HYPRE_Int level )
239 {
240 return( hypre_COGMRESSetPrintLevel( (void *) solver, level ) );
241 }
242
243 HYPRE_Int
HYPRE_COGMRESGetPrintLevel(HYPRE_Solver solver,HYPRE_Int * level)244 HYPRE_COGMRESGetPrintLevel( HYPRE_Solver solver,
245 HYPRE_Int * level )
246 {
247 return( hypre_COGMRESGetPrintLevel( (void *) solver, level ) );
248 }
249
250 /*--------------------------------------------------------------------------
251 * HYPRE_COGMRESSetLogging, HYPRE_COGMRESGetLogging
252 *--------------------------------------------------------------------------*/
253
254 HYPRE_Int
HYPRE_COGMRESSetLogging(HYPRE_Solver solver,HYPRE_Int level)255 HYPRE_COGMRESSetLogging( HYPRE_Solver solver,
256 HYPRE_Int level )
257 {
258 return( hypre_COGMRESSetLogging( (void *) solver, level ) );
259 }
260
261 HYPRE_Int
HYPRE_COGMRESGetLogging(HYPRE_Solver solver,HYPRE_Int * level)262 HYPRE_COGMRESGetLogging( HYPRE_Solver solver,
263 HYPRE_Int * level )
264 {
265 return( hypre_COGMRESGetLogging( (void *) solver, level ) );
266 }
267
268 /*--------------------------------------------------------------------------
269 * HYPRE_COGMRESGetNumIterations
270 *--------------------------------------------------------------------------*/
271
272 HYPRE_Int
HYPRE_COGMRESGetNumIterations(HYPRE_Solver solver,HYPRE_Int * num_iterations)273 HYPRE_COGMRESGetNumIterations( HYPRE_Solver solver,
274 HYPRE_Int *num_iterations )
275 {
276 return( hypre_COGMRESGetNumIterations( (void *) solver, num_iterations ) );
277 }
278
279 /*--------------------------------------------------------------------------
280 * HYPRE_COGMRESGetConverged
281 *--------------------------------------------------------------------------*/
282
283 HYPRE_Int
HYPRE_COGMRESGetConverged(HYPRE_Solver solver,HYPRE_Int * converged)284 HYPRE_COGMRESGetConverged( HYPRE_Solver solver,
285 HYPRE_Int *converged )
286 {
287 return( hypre_COGMRESGetConverged( (void *) solver, converged ) );
288 }
289
290 /*--------------------------------------------------------------------------
291 * HYPRE_COGMRESGetFinalRelativeResidualNorm
292 *--------------------------------------------------------------------------*/
293
294 HYPRE_Int
HYPRE_COGMRESGetFinalRelativeResidualNorm(HYPRE_Solver solver,HYPRE_Real * norm)295 HYPRE_COGMRESGetFinalRelativeResidualNorm( HYPRE_Solver solver,
296 HYPRE_Real *norm )
297 {
298 return( hypre_COGMRESGetFinalRelativeResidualNorm( (void *) solver, norm ) );
299 }
300
301 /*--------------------------------------------------------------------------
302 * HYPRE_COGMRESGetResidual
303 *--------------------------------------------------------------------------*/
304
HYPRE_COGMRESGetResidual(HYPRE_Solver solver,void * residual)305 HYPRE_Int HYPRE_COGMRESGetResidual( HYPRE_Solver solver, void *residual )
306 {
307 /* returns a pointer to the residual vector */
308 return hypre_COGMRESGetResidual( (void *) solver, (void **) residual );
309
310 }
311
312 /*--------------------------------------------------------------------------
313 * HYPRE_COGMRESSetModifyPC
314 *--------------------------------------------------------------------------*/
315
316
HYPRE_COGMRESSetModifyPC(HYPRE_Solver solver,HYPRE_Int (* modify_pc)(HYPRE_Solver,HYPRE_Int,HYPRE_Real))317 HYPRE_Int HYPRE_COGMRESSetModifyPC( HYPRE_Solver solver,
318 HYPRE_Int (*modify_pc)(HYPRE_Solver, HYPRE_Int, HYPRE_Real) )
319 {
320 return hypre_COGMRESSetModifyPC( (void *) solver, (HYPRE_Int(*)(void*, HYPRE_Int, HYPRE_Real))modify_pc);
321
322 }
323
324
325