IFPACK
Development
Toggle main menu visibility
Loading...
Searching...
No Matches
src
Ifpack.h
1
/*@HEADER
2
// ***********************************************************************
3
//
4
// Ifpack: Object-Oriented Algebraic Preconditioner Package
5
// Copyright (2002) Sandia Corporation
6
//
7
// Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
8
// license for use of this work by or on behalf of the U.S. Government.
9
//
10
// Redistribution and use in source and binary forms, with or without
11
// modification, are permitted provided that the following conditions are
12
// met:
13
//
14
// 1. Redistributions of source code must retain the above copyright
15
// notice, this list of conditions and the following disclaimer.
16
//
17
// 2. Redistributions in binary form must reproduce the above copyright
18
// notice, this list of conditions and the following disclaimer in the
19
// documentation and/or other materials provided with the distribution.
20
//
21
// 3. Neither the name of the Corporation nor the names of the
22
// contributors may be used to endorse or promote products derived from
23
// this software without specific prior written permission.
24
//
25
// THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
26
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
29
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
30
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
31
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
32
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
33
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
34
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
35
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36
//
37
// Questions? Contact Michael A. Heroux (maherou@sandia.gov)
38
//
39
// ***********************************************************************
40
//@HEADER
41
*/
42
43
#ifndef IFPACK_H
44
#define IFPACK_H
45
46
47
#include "Ifpack_ConfigDefs.h"
48
#include "Ifpack_Preconditioner.h"
49
#include "Teuchos_iostream_helpers.hpp"
50
51
52
#ifdef HAVE_HYPRE
53
#include "Ifpack_Hypre.h"
54
#endif
55
56
58
91
basic usage of this class.
92
\code
93
#include "Ifpack.h"
94
95
...
96
97
Ifpack Factory;
98
99
Epetra_RowMatrix* A; // A is FillComplete()'d.
100
std::string PrecType = "ILU"; // use incomplete LU on each process
101
int OverlapLevel = 1; // one row of overlap among the processes
102
Ifpack_Preconditioner* Prec = Factory.Create(PrecType, A, OverlapLevel);
103
assert (Prec != 0);
104
105
Teuchos::ParameterList List;
106
List.set("fact: level-of-fill", 5); // use ILU(5)
107
108
IFPACK_CHK_ERR(Prec->SetParameters(List));
109
IFPACK_CHK_ERR(Prec->Initialize());
110
IFPACK_CHK_ERR(Prec->Compute());
111
112
// now Prec can be used as AztecOO preconditioner
113
// like for instance
114
AztecOO AztecOOSolver(*Problem);
115
116
// specify solver
117
AztecOOSolver.SetAztecOption(AZ_solver,AZ_gmres);
118
AztecOOSolver.SetAztecOption(AZ_output,32);
119
120
// Set Prec as preconditioning operator
121
AztecOOSolver.SetPrecOperator(Prec);
122
123
// Call the solver
124
AztecOOSolver.Iterate(1550,1e-8);
125
126
// print information on stdout
127
cout << *Prec;
128
129
// delete the preconditioner
130
delete Prec;
131
\endcode
132
133
\author Marzio Sala, (formally) SNL org. 1414
134
135
\date Last updated on 25-Jan-05.
136
*/
137
138
class
Ifpack
{
139
public
:
140
142
enum
EPrecType
{
143
POINT_RELAXATION
144
,POINT_RELAXATION_STAND_ALONE
145
,BLOCK_RELAXATION
146
,BLOCK_RELAXATION_STAND_ALONE
147
,BLOCK_RELAXATION_STAND_ALONE_ILU
148
,BLOCK_RELAXATION_STAND_ALONE_ILUT
149
,BLOCK_RELAXATION_STAND_ALONE_IC
150
#ifdef HAVE_IFPACK_SUPERLU
151
,BLOCK_RELAXATION_STAND_ALONE_SILU
152
#endif
153
#ifdef HAVE_IFPACK_AMESOS
154
,BLOCK_RELAXATION_STAND_ALONE_AMESOS
155
,BLOCK_RELAXATION_AMESOS
156
,AMESOS
157
,AMESOS_STAND_ALONE
158
#endif
// HAVE_IFPACK_AMESOS
159
,IC
160
,IC_STAND_ALONE
161
,ICT
162
,ICT_STAND_ALONE
163
,ILU
164
,ILU_STAND_ALONE
165
,ILUT
166
,ILUT_STAND_ALONE
167
#ifdef HAVE_IFPACK_SPARSKIT
168
,SPARSKIT
169
#endif
// HAVE_IFPACK_SPARSKIT
170
#ifdef HAVE_IFPACK_HIPS
171
,HIPS
172
#endif
173
#ifdef HAVE_HYPRE
174
,HYPRE
175
#endif
176
#ifdef HAVE_IFPACK_SUPERLU
177
,SILU
178
#endif
179
#if defined (HAVE_IFPACK_SUPPORTGRAPH) && defined (HAVE_IFPACK_AMESOS)
180
,MSF_AMESOS
181
#endif
182
#ifdef HAVE_IFPACK_SUPPORTGRAPH
183
,MSF_IC
184
#endif
185
,CHEBYSHEV
186
,POLYNOMIAL
187
,KRYLOV
188
,IHSS
189
,SORA
190
,TRIDI_RELAXATION
191
,TRIDI_RELAXATION_STAND_ALONE
192
};
193
195
static
const
int
numPrecTypes
=
196
+7
197
#ifdef HAVE_IFPACK_AMESOS
198
+4
199
#endif
200
+8
201
#ifdef HAVE_IFPACK_SPARSKIT
202
+1
203
#endif
204
#ifdef HAVE_IFPACK_HIPS
205
+1
206
#endif
207
#ifdef HAVE_HYPRE
208
+1
209
#endif
210
#ifdef HAVE_IFPACK_SUPERLU
211
+2
212
#endif
213
#if defined (HAVE_IFPACK_SUPPORTGRAPH) && defined (HAVE_IFPACK_AMESOS)
214
+1
215
#endif
216
#ifdef HAVE_IFPACK_SUPPORTGRAPH
217
+1
218
#endif
219
+7
220
;
221
223
static
const
EPrecType
precTypeValues
[
numPrecTypes
];
224
226
static
const
char
*
precTypeNames
[
numPrecTypes
];
227
230
static
const
bool
supportsUnsymmetric
[
numPrecTypes
];
231
234
static
const
char
*
toString
(
const
EPrecType
precType)
235
{
return
precTypeNames
[precType]; }
236
246
static
Ifpack_Preconditioner
* Create(
247
EPrecType PrecType,
Epetra_RowMatrix
* Matrix,
const
int
overlap = 0,
bool
overrideSerialDefault =
false
248
);
249
251
264
Ifpack_Preconditioner
* Create(
const
std::string PrecType,
265
Epetra_RowMatrix
* Matrix,
266
const
int
overlap = 0,
267
bool
overrideSerialDefault =
false
);
268
276
int
SetParameters(
int
argc,
char
* argv[],
277
Teuchos::ParameterList& List, std::string& PrecType,
278
int
& Overlap);
279
280
};
281
282
283
TEUCHOS_ENUM_INPUT_STREAM_OPERATOR(Ifpack::EPrecType)
284
285
286
#endif
Epetra_RowMatrix
Ifpack_Preconditioner
Ifpack_Preconditioner: basic class for preconditioning in Ifpack.
Definition
Ifpack_Preconditioner.h:136
Ifpack
Ifpack: a function class to define Ifpack preconditioners.
Definition
Ifpack.h:138
Ifpack::numPrecTypes
static const int numPrecTypes
Definition
Ifpack.h:195
Ifpack::EPrecType
EPrecType
Enum for the type of preconditioner.
Definition
Ifpack.h:142
Ifpack::supportsUnsymmetric
static const bool supportsUnsymmetric[numPrecTypes]
List of bools that determines if the preconditioner type supports unsymmetric matrices.
Definition
Ifpack.h:199
Ifpack::precTypeNames
static const char * precTypeNames[numPrecTypes]
List of preconditioner types as std::string values.
Definition
Ifpack.h:145
Ifpack::toString
static const char * toString(const EPrecType precType)
Function that gives the std::string name for preconditioner given its enumerication value.
Definition
Ifpack.h:234
Ifpack::precTypeValues
static const EPrecType precTypeValues[numPrecTypes]
List of the preconditioner types as enum values .
Definition
Ifpack.h:91
Generated by
1.17.0