source: CIVL/examples/mpi-omp/AMG2013/krylov/HYPRE_pcg.c

main
Last change on this file was ea777aa, checked in by Alex Wilton <awilton@…>, 3 years ago

Moved examples, include, build_default.properties, common.xml, and README out from dev.civl.com into the root of the repo.

git-svn-id: svn://vsl.cis.udel.edu/civl/trunk@5704 fb995dde-84ed-4084-dfe6-e5aef3e2452c

  • Property mode set to 100644
File size: 10.0 KB
RevLine 
[2aa6644]1/*BHEADER**********************************************************************
2 * Copyright (c) 2008, Lawrence Livermore National Security, LLC.
3 * Produced at the Lawrence Livermore National Laboratory.
4 * This file is part of HYPRE. See file COPYRIGHT for details.
5 *
6 * HYPRE is free software; you can redistribute it and/or modify it under the
7 * terms of the GNU Lesser General Public License (as published by the Free
8 * Software Foundation) version 2.1 dated February 1999.
9 *
10 * $Revision: 2.4 $
11 ***********************************************************************EHEADER*/
12
13
14
15
16/******************************************************************************
17 *
18 * HYPRE_PCG interface
19 *
20 *****************************************************************************/
21#include "krylov.h"
22
23/*--------------------------------------------------------------------------
24 * HYPRE_PCGCreate does not exist. Call the appropriate function which
25 * also specifies the vector type, e.g. HYPRE_ParCSRPCGCreate
26 *--------------------------------------------------------------------------*/
27
28/*--------------------------------------------------------------------------
29 * HYPRE_PCGDestroy
30 *--------------------------------------------------------------------------*/
31
32/*
33int
34HYPRE_PCGDestroy( HYPRE_Solver solver )*/
35/* >>> This is something we can't do without knowing the vector_type.
36 We can't save it in and pull it out of solver because that isn't
37 really a known struct. */
38/*
39{
40 if ( vector_type=="ParCSR" ) {
41 return HYPRE_ParCSRPCGDestroy( HYPRE_Solver solver );
42 }
43 else {
44 return 0;
45 }
46}*/
47
48/*--------------------------------------------------------------------------
49 * HYPRE_PCGSetup
50 *--------------------------------------------------------------------------*/
51
52int
53HYPRE_PCGSetup( HYPRE_Solver solver,
54 HYPRE_Matrix A,
55 HYPRE_Vector b,
56 HYPRE_Vector x )
57{
58 return( hypre_PCGSetup( solver,
59 A,
60 b,
61 x ) );
62}
63
64/*--------------------------------------------------------------------------
65 * HYPRE_PCGSolve
66 *--------------------------------------------------------------------------*/
67
68int
69HYPRE_PCGSolve( HYPRE_Solver solver,
70 HYPRE_Matrix A,
71 HYPRE_Vector b,
72 HYPRE_Vector x )
73{
74 return( hypre_PCGSolve( (void *) solver,
75 (void *) A,
76 (void *) b,
77 (void *) x ) );
78}
79
80/*--------------------------------------------------------------------------
81 * HYPRE_PCGSetTol, HYPRE_PCGGetTol
82 *--------------------------------------------------------------------------*/
83
84int
85HYPRE_PCGSetTol( HYPRE_Solver solver,
86 double tol )
87{
88 return( hypre_PCGSetTol( (void *) solver, tol ) );
89}
90
91int
92HYPRE_PCGGetTol( HYPRE_Solver solver,
93 double * tol )
94{
95 return( hypre_PCGGetTol( (void *) solver, tol ) );
96}
97
98/*--------------------------------------------------------------------------
99 * HYPRE_PCGSetAbsoluteTolFactor, HYPRE_PCGGetAbsoluteTolFactor
100 *--------------------------------------------------------------------------*/
101
102int
103HYPRE_PCGSetAbsoluteTolFactor( HYPRE_Solver solver,
104 double abstolf )
105{
106 return( hypre_PCGSetAbsoluteTolFactor( (void *) solver, abstolf ) );
107}
108
109int
110HYPRE_PCGGetAbsoluteTolFactor( HYPRE_Solver solver,
111 double * abstolf )
112{
113 return( hypre_PCGGetAbsoluteTolFactor( (void *) solver, abstolf ) );
114}
115
116/*--------------------------------------------------------------------------
117 * HYPRE_PCGSetConvergenceFactorTol, HYPRE_PCGGetConvergenceFactorTol
118 *--------------------------------------------------------------------------*/
119
120int
121HYPRE_PCGSetConvergenceFactorTol( HYPRE_Solver solver,
122 double cf_tol )
123{
124 return hypre_PCGSetConvergenceFactorTol( (void *) solver,
125 cf_tol );
126}
127
128int
129HYPRE_PCGGetConvergenceFactorTol( HYPRE_Solver solver,
130 double * cf_tol )
131{
132 return hypre_PCGGetConvergenceFactorTol( (void *) solver,
133 cf_tol );
134}
135
136/*--------------------------------------------------------------------------
137 * HYPRE_PCGSetMaxIter, HYPRE_PCGGetMaxIter
138 *--------------------------------------------------------------------------*/
139
140int
141HYPRE_PCGSetMaxIter( HYPRE_Solver solver,
142 int max_iter )
143{
144 return( hypre_PCGSetMaxIter( (void *) solver, max_iter ) );
145}
146
147int
148HYPRE_PCGGetMaxIter( HYPRE_Solver solver,
149 int * max_iter )
150{
151 return( hypre_PCGGetMaxIter( (void *) solver, max_iter ) );
152}
153
154/*--------------------------------------------------------------------------
155 * HYPRE_PCGSetStopCrit, HYPRE_PCGGetStopCrit
156 *--------------------------------------------------------------------------*/
157
158int
159HYPRE_PCGSetStopCrit( HYPRE_Solver solver,
160 int stop_crit )
161{
162 return( hypre_PCGSetStopCrit( (void *) solver, stop_crit ) );
163}
164
165int
166HYPRE_PCGGetStopCrit( HYPRE_Solver solver,
167 int * stop_crit )
168{
169 return( hypre_PCGGetStopCrit( (void *) solver, stop_crit ) );
170}
171
172/*--------------------------------------------------------------------------
173 * HYPRE_PCGSetTwoNorm, HYPRE_PCGGetTwoNorm
174 *--------------------------------------------------------------------------*/
175
176int
177HYPRE_PCGSetTwoNorm( HYPRE_Solver solver,
178 int two_norm )
179{
180 return( hypre_PCGSetTwoNorm( (void *) solver, two_norm ) );
181}
182
183int
184HYPRE_PCGGetTwoNorm( HYPRE_Solver solver,
185 int * two_norm )
186{
187 return( hypre_PCGGetTwoNorm( (void *) solver, two_norm ) );
188}
189
190/*--------------------------------------------------------------------------
191 * HYPRE_PCGSetRelChange, HYPRE_PCGGetRelChange
192 *--------------------------------------------------------------------------*/
193
194int
195HYPRE_PCGSetRelChange( HYPRE_Solver solver,
196 int rel_change )
197{
198 return( hypre_PCGSetRelChange( (void *) solver, rel_change ) );
199}
200
201int
202HYPRE_PCGGetRelChange( HYPRE_Solver solver,
203 int * rel_change )
204{
205 return( hypre_PCGGetRelChange( (void *) solver, rel_change ) );
206}
207
208/*--------------------------------------------------------------------------
209 * HYPRE_PCGSetPrecond
210 *--------------------------------------------------------------------------*/
211
212int
213HYPRE_PCGSetPrecond( HYPRE_Solver solver,
214 HYPRE_PtrToSolverFcn precond,
215 HYPRE_PtrToSolverFcn precond_setup,
216 HYPRE_Solver precond_solver )
217{
218 return( hypre_PCGSetPrecond( (void *) solver,
[f02928c9]219 (int (*)(void *, void *, void *, void *))precond, (int (*)(void *, void *, void *, void *))precond_setup,
[2aa6644]220 (void *) precond_solver ) );
221}
222
223/*--------------------------------------------------------------------------
224 * HYPRE_PCGGetPrecond
225 *--------------------------------------------------------------------------*/
226
227int
228HYPRE_PCGGetPrecond( HYPRE_Solver solver,
229 HYPRE_Solver *precond_data_ptr )
230{
231 return( hypre_PCGGetPrecond( (void *) solver,
232 (HYPRE_Solver *) precond_data_ptr ) );
233}
234
235/*--------------------------------------------------------------------------
236 * HYPRE_PCGSetLogging, HYPRE_PCGGetLogging
237 * SetLogging sets both the print and log level, for backwards compatibility.
238 * Soon the SetPrintLevel call should be deleted.
239 *--------------------------------------------------------------------------*/
240
241int
242HYPRE_PCGSetLogging( HYPRE_Solver solver,
243 int level )
244{
245 return ( hypre_PCGSetLogging( (void *) solver, level ) );
246}
247
248int
249HYPRE_PCGGetLogging( HYPRE_Solver solver,
250 int * level )
251{
252 return ( hypre_PCGGetLogging( (void *) solver, level ) );
253}
254
255/*--------------------------------------------------------------------------
256 * HYPRE_PCGSetPrintLevel, HYPRE_PCGGetPrintLevel
257 *--------------------------------------------------------------------------*/
258
259int
260HYPRE_PCGSetPrintLevel( HYPRE_Solver solver,
261 int level )
262{
263 return( hypre_PCGSetPrintLevel( (void *) solver, level ) );
264}
265
266int
267HYPRE_PCGGetPrintLevel( HYPRE_Solver solver,
268 int * level )
269{
270 return( hypre_PCGGetPrintLevel( (void *) solver, level ) );
271}
272
273/*--------------------------------------------------------------------------
274 * HYPRE_PCGGetNumIterations
275 *--------------------------------------------------------------------------*/
276
277int
278HYPRE_PCGGetNumIterations( HYPRE_Solver solver,
279 int *num_iterations )
280{
281 return( hypre_PCGGetNumIterations( (void *) solver, num_iterations ) );
282}
283
284/*--------------------------------------------------------------------------
285 * HYPRE_PCGGetConverged
286 *--------------------------------------------------------------------------*/
287
288int
289HYPRE_PCGGetConverged( HYPRE_Solver solver,
290 int *converged )
291{
292 return( hypre_PCGGetConverged( (void *) solver, converged ) );
293}
294
295/*--------------------------------------------------------------------------
296 * HYPRE_PCGGetFinalRelativeResidualNorm
297 *--------------------------------------------------------------------------*/
298
299int
300HYPRE_PCGGetFinalRelativeResidualNorm( HYPRE_Solver solver,
301 double *norm )
302{
303 return( hypre_PCGGetFinalRelativeResidualNorm( (void *) solver, norm ) );
304}
305
306/*--------------------------------------------------------------------------
307 * HYPRE_PCGGetResidual
308 *--------------------------------------------------------------------------*/
309
310int HYPRE_PCGGetResidual( HYPRE_Solver solver, void **residual )
311{
312 /* returns a pointer to the residual vector */
313 return hypre_PCGGetResidual( (void *) solver, residual );
314}
315
Note: See TracBrowser for help on using the repository browser.