source: CIVL/examples/mpi-omp/AMG2013/krylov/gmres.h

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: 4.8 KB
Line 
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 * GMRES gmres
18 *
19 *****************************************************************************/
20
21#ifndef HYPRE_KRYLOV_GMRES_HEADER
22#define HYPRE_KRYLOV_GMRES_HEADER
23
24/*--------------------------------------------------------------------------
25 *--------------------------------------------------------------------------*/
26
27/**
28 * @name Generic GMRES Interface
29 *
30 * A general description of the interface goes here...
31 *
32 * @memo A generic GMRES linear solver interface
33 * @version 0.1
34 * @author Jeffrey F. Painter
35 **/
36/*@{*/
37
38/*--------------------------------------------------------------------------
39 *--------------------------------------------------------------------------*/
40
41/*--------------------------------------------------------------------------
42 * hypre_GMRESData and hypre_GMRESFunctions
43 *--------------------------------------------------------------------------*/
44
45
46/**
47 * @name GMRES structs
48 *
49 * Description...
50 **/
51/*@{*/
52
53/**
54 * The {\tt hypre\_GMRESFunctions} object ...
55 **/
56
57typedef struct
58{
59 char * (*CAlloc) ( int count, int elt_size );
60 int (*Free) ( char *ptr );
61 int (*CommInfo) ( void *A, int *my_id, int *num_procs );
62 void * (*CreateVector) ( void *vector );
63 void * (*CreateVectorArray) ( int size, void *vectors );
64 int (*DestroyVector) ( void *vector );
65 void * (*MatvecCreate) ( void *A, void *x );
66 int (*Matvec) ( void *matvec_data, double alpha, void *A,
67 void *x, double beta, void *y );
68 int (*MatvecDestroy) ( void *matvec_data );
69 double (*InnerProd) ( void *x, void *y );
70 int (*CopyVector) ( void *x, void *y );
71 int (*ClearVector) ( void *x );
72 int (*ScaleVector) ( double alpha, void *x );
73 int (*Axpy) ( double alpha, void *x, void *y );
74
75 int (*precond)(void *vdata, void *A, void *b, void *x );
76 int (*precond_setup)(void *vdata, void *A, void *b, void *x );
77
78} hypre_GMRESFunctions;
79
80/**
81 * The {\tt hypre\_GMRESData} object ...
82 **/
83
84/* rel_change!=0 means: if pass the other stopping criteria,
85 also check the relative change in the solution x.
86 stop_crit!=0 means: absolute error tolerance rather than
87 the usual relative error tolerance on the residual. Never
88 applies if rel_change!=0.
89*/
90
91typedef struct
92{
93 int k_dim;
94 int min_iter;
95 int max_iter;
96 int rel_change;
97 int stop_crit;
98 int converged;
99 double tol;
100 int cf_tol;
101 double rel_residual_norm;
102
103 void *A;
104 void *r;
105 void *w;
106 void **p;
107
108 void *matvec_data;
109 void *precond_data;
110
111 hypre_GMRESFunctions * functions;
112
113 /* log info (always logged) */
114 int num_iterations;
115
116 int print_level; /* printing when print_level>0 */
117 int logging; /* extra computations for logging when logging>0 */
118 double *norms;
119 char *log_file_name;
120
121} hypre_GMRESData;
122
123#ifdef __cplusplus
124extern "C" {
125#endif
126
127/**
128 * @name generic GMRES Solver
129 *
130 * Description...
131 **/
132/*@{*/
133
134/**
135 * Description...
136 *
137 * @param param [IN] ...
138 **/
139
140hypre_GMRESFunctions *
141hypre_GMRESFunctionsCreate(
142 char * (*CAlloc) ( int count, int elt_size ),
143 int (*Free) ( char *ptr ),
144 int (*CommInfo) ( void *A, int *my_id, int *num_procs ),
145 void * (*CreateVector) ( void *vector ),
146 void * (*CreateVectorArray) ( int size, void *vectors ),
147 int (*DestroyVector) ( void *vector ),
148 void * (*MatvecCreate) ( void *A, void *x ),
149 int (*Matvec) ( void *matvec_data, double alpha, void *A,
150 void *x, double beta, void *y ),
151 int (*MatvecDestroy) ( void *matvec_data ),
152 double (*InnerProd) ( void *x, void *y ),
153 int (*CopyVector) ( void *x, void *y ),
154 int (*ClearVector) ( void *x ),
155 int (*ScaleVector) ( double alpha, void *x ),
156 int (*Axpy) ( double alpha, void *x, void *y ),
157 int (*PrecondSetup) ( void *vdata, void *A, void *b, void *x ),
158 int (*Precond) ( void *vdata, void *A, void *b, void *x )
159 );
160
161/**
162 * Description...
163 *
164 * @param param [IN] ...
165 **/
166
167void *
168hypre_GMRESCreate( hypre_GMRESFunctions *gmres_functions );
169
170#ifdef __cplusplus
171}
172#endif
173#endif
Note: See TracBrowser for help on using the repository browser.