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_CGNR interface
11 *
12 *****************************************************************************/
13 #include "krylov.h"
14
15 /*--------------------------------------------------------------------------
16 * HYPRE_CGNRCreate does not exist. Call the appropriate function which
17 * also specifies the vector type, e.g. HYPRE_ParCSRCGNRCreate
18 *--------------------------------------------------------------------------*/
19
20 /*--------------------------------------------------------------------------
21 * HYPRE_CGNRDestroy
22 *--------------------------------------------------------------------------*/
23
24 HYPRE_Int
HYPRE_CGNRDestroy(HYPRE_Solver solver)25 HYPRE_CGNRDestroy( HYPRE_Solver solver )
26 {
27 return( hypre_CGNRDestroy( (void *) solver ) );
28 }
29
30 /*--------------------------------------------------------------------------
31 * HYPRE_CGNRSetup
32 *--------------------------------------------------------------------------*/
33
34 HYPRE_Int
HYPRE_CGNRSetup(HYPRE_Solver solver,HYPRE_Matrix A,HYPRE_Vector b,HYPRE_Vector x)35 HYPRE_CGNRSetup( HYPRE_Solver solver,
36 HYPRE_Matrix A,
37 HYPRE_Vector b,
38 HYPRE_Vector x )
39 {
40 return( hypre_CGNRSetup( solver, A, b, x ) );
41 }
42
43 /*--------------------------------------------------------------------------
44 * HYPRE_CGNRSolve
45 *--------------------------------------------------------------------------*/
46
47 HYPRE_Int
HYPRE_CGNRSolve(HYPRE_Solver solver,HYPRE_Matrix A,HYPRE_Vector b,HYPRE_Vector x)48 HYPRE_CGNRSolve( HYPRE_Solver solver,
49 HYPRE_Matrix A,
50 HYPRE_Vector b,
51 HYPRE_Vector x )
52 {
53 return( hypre_CGNRSolve( solver, A, b, x ) );
54 }
55
56 /*--------------------------------------------------------------------------
57 * HYPRE_CGNRSetTol
58 *--------------------------------------------------------------------------*/
59
60 HYPRE_Int
HYPRE_CGNRSetTol(HYPRE_Solver solver,HYPRE_Real tol)61 HYPRE_CGNRSetTol( HYPRE_Solver solver,
62 HYPRE_Real tol )
63 {
64 return( hypre_CGNRSetTol( (void *) solver, tol ) );
65 }
66
67 /*--------------------------------------------------------------------------
68 * HYPRE_CGNRSetMinIter
69 *--------------------------------------------------------------------------*/
70
71 HYPRE_Int
HYPRE_CGNRSetMinIter(HYPRE_Solver solver,HYPRE_Int min_iter)72 HYPRE_CGNRSetMinIter( HYPRE_Solver solver,
73 HYPRE_Int min_iter )
74 {
75 return( hypre_CGNRSetMinIter( (void *) solver, min_iter ) );
76 }
77
78 /*--------------------------------------------------------------------------
79 * HYPRE_CGNRSetMaxIter
80 *--------------------------------------------------------------------------*/
81
82 HYPRE_Int
HYPRE_CGNRSetMaxIter(HYPRE_Solver solver,HYPRE_Int max_iter)83 HYPRE_CGNRSetMaxIter( HYPRE_Solver solver,
84 HYPRE_Int max_iter )
85 {
86 return( hypre_CGNRSetMaxIter( (void *) solver, max_iter ) );
87 }
88
89 /*--------------------------------------------------------------------------
90 * HYPRE_CGNRSetStopCrit
91 *--------------------------------------------------------------------------*/
92
93 HYPRE_Int
HYPRE_CGNRSetStopCrit(HYPRE_Solver solver,HYPRE_Int stop_crit)94 HYPRE_CGNRSetStopCrit( HYPRE_Solver solver,
95 HYPRE_Int stop_crit )
96 {
97 return( hypre_CGNRSetStopCrit( (void *) solver, stop_crit ) );
98 }
99
100 /*--------------------------------------------------------------------------
101 * HYPRE_CGNRSetPrecond
102 *--------------------------------------------------------------------------*/
103
104 HYPRE_Int
HYPRE_CGNRSetPrecond(HYPRE_Solver solver,HYPRE_PtrToSolverFcn precond,HYPRE_PtrToSolverFcn precondT,HYPRE_PtrToSolverFcn precond_setup,HYPRE_Solver precond_solver)105 HYPRE_CGNRSetPrecond( HYPRE_Solver solver,
106 HYPRE_PtrToSolverFcn precond,
107 HYPRE_PtrToSolverFcn precondT,
108 HYPRE_PtrToSolverFcn precond_setup,
109 HYPRE_Solver precond_solver )
110 {
111 return( hypre_CGNRSetPrecond( (void *) solver,
112 (HYPRE_Int (*)(void*, void*, void*, void*))precond,
113 (HYPRE_Int (*)(void*, void*, void*, void*))precondT,
114 (HYPRE_Int (*)(void*, void*, void*, void*))precond_setup,
115 (void *) precond_solver ) );
116 }
117
118 /*--------------------------------------------------------------------------
119 * HYPRE_CGNRGetPrecond
120 *--------------------------------------------------------------------------*/
121
122 HYPRE_Int
HYPRE_CGNRGetPrecond(HYPRE_Solver solver,HYPRE_Solver * precond_data_ptr)123 HYPRE_CGNRGetPrecond( HYPRE_Solver solver,
124 HYPRE_Solver *precond_data_ptr )
125 {
126 return( hypre_CGNRGetPrecond( (void *) solver,
127 (HYPRE_Solver *) precond_data_ptr ) );
128 }
129
130 /*--------------------------------------------------------------------------
131 * HYPRE_CGNRSetLogging
132 *--------------------------------------------------------------------------*/
133
134 HYPRE_Int
HYPRE_CGNRSetLogging(HYPRE_Solver solver,HYPRE_Int logging)135 HYPRE_CGNRSetLogging( HYPRE_Solver solver,
136 HYPRE_Int logging)
137 {
138 return( hypre_CGNRSetLogging( (void *) solver, logging ) );
139 }
140
141 /*--------------------------------------------------------------------------
142 * HYPRE_CGNRGetNumIterations
143 *--------------------------------------------------------------------------*/
144
145 HYPRE_Int
HYPRE_CGNRGetNumIterations(HYPRE_Solver solver,HYPRE_Int * num_iterations)146 HYPRE_CGNRGetNumIterations( HYPRE_Solver solver,
147 HYPRE_Int *num_iterations )
148 {
149 return( hypre_CGNRGetNumIterations( (void *) solver, num_iterations ) );
150 }
151
152 /*--------------------------------------------------------------------------
153 * HYPRE_CGNRGetFinalRelativeResidualNorm
154 *--------------------------------------------------------------------------*/
155
156 HYPRE_Int
HYPRE_CGNRGetFinalRelativeResidualNorm(HYPRE_Solver solver,HYPRE_Real * norm)157 HYPRE_CGNRGetFinalRelativeResidualNorm( HYPRE_Solver solver,
158 HYPRE_Real *norm )
159 {
160 return( hypre_CGNRGetFinalRelativeResidualNorm( (void *) solver, norm ) );
161 }
162