IFPACK  Development
 All Classes Namespaces Files Functions Variables Enumerations Friends Pages
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 
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 
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 
247  EPrecType PrecType, Epetra_RowMatrix* Matrix, const int overlap = 0, bool overrideSerialDefault = false
248  );
249 
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
static const int numPrecTypes
Definition: Ifpack.h:195
static const EPrecType precTypeValues[numPrecTypes]
List of the preconditioner types as enum values .
Definition: Ifpack.h:223
int SetParameters(int argc, char *argv[], Teuchos::ParameterList &List, std::string &PrecType, int &Overlap)
Sets the options in List from the command line.
Definition: Ifpack.cpp:413
EPrecType
Enum for the type of preconditioner.
Definition: Ifpack.h:142
static const char * toString(const EPrecType precType)
Function that gives the std::string name for preconditioner given its enumerication value...
Definition: Ifpack.h:234
static const char * precTypeNames[numPrecTypes]
List of preconditioner types as std::string values.
Definition: Ifpack.h:226
Ifpack_Preconditioner: basic class for preconditioning in Ifpack.
Ifpack: a function class to define Ifpack preconditioners.
Definition: Ifpack.h:138
static Ifpack_Preconditioner * Create(EPrecType PrecType, Epetra_RowMatrix *Matrix, const int overlap=0, bool overrideSerialDefault=false)
Creates an instance of Ifpack_Preconditioner given the enum value of the preconditioner type (can not...
Definition: Ifpack.cpp:253
static const bool supportsUnsymmetric[numPrecTypes]
List of bools that determines if the preconditioner type supports unsymmetric matrices.
Definition: Ifpack.h:230