42 #include "Ifpack_ConfigDefs.h"
44 #include "Ifpack_Preconditioner.h"
45 #include "Ifpack_PointRelaxation.h"
46 #include "Ifpack_BlockRelaxation.h"
47 #include "Ifpack_IC.h"
48 #include "Ifpack_ICT.h"
49 #include "Ifpack_ILU.h"
50 #include "Ifpack_SILU.h"
51 #include "Ifpack_ILUT.h"
52 #include "Ifpack_SPARSKIT.h"
53 #include "Ifpack_AdditiveSchwarz.h"
54 #include "Ifpack_DenseContainer.h"
55 #include "Ifpack_TriDiContainer.h"
56 #include "Ifpack_SparseContainer.h"
57 #ifdef HAVE_IFPACK_AMESOS
58 #include "Ifpack_Amesos.h"
60 #ifdef HAVE_IFPACK_HIPS
61 #include "Ifpack_HIPS.h"
63 #ifdef HAVE_IFPACK_SUPERLU
64 #include "Ifpack_SILU.h"
66 #ifdef HAVE_IFPACK_SUPPORTGRAPH
67 #include "Ifpack_SupportGraph.h"
70 #include "Ifpack_Chebyshev.h"
71 #include "Ifpack_Polynomial.h"
72 #include "Ifpack_Krylov.h"
73 #include "Ifpack_IHSS.h"
74 #include "Ifpack_SORa.h"
76 #include "Teuchos_CommandLineProcessor.hpp"
77 #include "Teuchos_StringToIntMap.hpp"
78 #include "Epetra_CrsMatrix.h"
83 const Teuchos::StringToIntMap
94 ,POINT_RELAXATION_STAND_ALONE
96 ,BLOCK_RELAXATION_STAND_ALONE
97 ,BLOCK_RELAXATION_STAND_ALONE_ILU
98 ,BLOCK_RELAXATION_STAND_ALONE_ILUT
99 ,BLOCK_RELAXATION_STAND_ALONE_IC
100 #ifdef HAVE_IFPACK_SUPERLU
101 ,BLOCK_RELAXATION_STAND_ALONE_SILU
103 #ifdef HAVE_IFPACK_AMESOS
104 ,BLOCK_RELAXATION_STAND_ALONE_AMESOS
105 ,BLOCK_RELAXATION_AMESOS
108 #endif // HAVE_IFPACK_AMESOS
117 #ifdef HAVE_IFPACK_SPARSKIT
119 #endif // HAVE_IFPACK_SPARSKIT
120 #ifdef HAVE_IFPACK_HIPS
123 #ifdef HAVE_IFPACK_HYPRE
126 #ifdef HAVE_IFPACK_SUPERLU
129 #if defined (HAVE_IFPACK_SUPPORTGRAPH) && defined (HAVE_IFPACK_AMESOS)
132 #ifdef HAVE_IFPACK_SUPPORTGRAPH
141 ,TRIDI_RELAXATION_STAND_ALONE
148 ,
"point relaxation stand-alone"
150 ,
"block relaxation stand-alone"
151 ,
"block relaxation stand-alone (ILU)"
152 ,
"block relaxation stand-alone (ILUT)"
153 ,
"block relaxation stand-alone (IC)"
154 #ifdef HAVE_IFPACK_SUPERLU
155 ,
"block relaxation stand-alone (SILU)"
157 #ifdef HAVE_IFPACK_AMESOS
158 ,
"block relaxation stand-alone (Amesos)"
159 ,
"block relaxation (Amesos)"
161 ,
"Amesos stand-alone"
171 #ifdef HAVE_IFPACK_SPARSKIT
174 #ifdef HAVE_IFPACK_HIPS
177 #ifdef HAVE_IFPACK_HYPRE
180 #ifdef HAVE_IFPACK_SUPERLU
183 #if defined (HAVE_IFPACK_SUPPORTGRAPH) && defined (HAVE_IFPACK_AMESOS)
186 #ifdef HAVE_IFPACK_SUPPORTGRAPH
195 ,
"tridi relaxation stand-alone"
208 #ifdef HAVE_IFPACK_SUPERLU
211 #ifdef HAVE_IFPACK_AMESOS
225 #ifdef HAVE_IFPACK_SPARSKIT
228 #ifdef HAVE_IFPACK_HIPS
231 #ifdef HAVE_IFPACK_HYPRE
234 #ifdef HAVE_IFPACK_SUPERLU
237 #if defined (HAVE_IFPACK_SUPPORTGRAPH) && defined (HAVE_IFPACK_AMESOS)
240 #ifdef HAVE_IFPACK_SUPPORTGRAPH
256 bool overrideSerialDefault)
258 const bool serial = (Matrix->
Comm().
NumProc() == 1);
261 case POINT_RELAXATION:
262 if (serial && !overrideSerialDefault)
266 case POINT_RELAXATION_STAND_ALONE:
268 case BLOCK_RELAXATION:
269 if (serial && !overrideSerialDefault)
274 case BLOCK_RELAXATION_STAND_ALONE:
276 case BLOCK_RELAXATION_STAND_ALONE_ILU:
278 case BLOCK_RELAXATION_STAND_ALONE_ILUT:
280 case BLOCK_RELAXATION_STAND_ALONE_IC:
282 #ifdef HAVE_IFPACK_SUPERLU
283 case BLOCK_RELAXATION_STAND_ALONE_SILU:
286 #ifdef HAVE_IFPACK_AMESOS
287 case BLOCK_RELAXATION_STAND_ALONE_AMESOS:
289 case BLOCK_RELAXATION_AMESOS:
293 if (serial && !overrideSerialDefault)
297 case AMESOS_STAND_ALONE:
301 if (serial && !overrideSerialDefault)
308 if (serial && !overrideSerialDefault)
312 case ICT_STAND_ALONE:
315 if (serial && !overrideSerialDefault)
319 case ILU_STAND_ALONE:
322 if (serial && !overrideSerialDefault)
326 case ILUT_STAND_ALONE:
328 #ifdef HAVE_IFPACK_SPARSKIT
330 return(
new Ifpack_SPARSKIT(Matrix));
332 #ifdef HAVE_IFPACK_HIPS
334 return(
new Ifpack_HIPS(Matrix));
336 #ifdef HAVE_IFPACK_HYPRE
338 return(
new Ifpack_Hypre(Matrix));
340 #ifdef HAVE_IFPACK_SUPERLU
344 #if defined (HAVE_IFPACK_SUPPORTGRAPH) && defined (HAVE_IFPACK_AMESOS)
346 if (serial && !overrideSerialDefault)
351 #ifdef HAVE_IFPACK_SUPPORTGRAPH
353 if (serial && !overrideSerialDefault)
369 #ifdef HAVE_IFPACK_EPETRAEXT
371 return(
new Ifpack_IHSS(Matrix));
373 return(
new Ifpack_SORa(Matrix));
375 case TRIDI_RELAXATION:
376 if (serial && !overrideSerialDefault)
381 case TRIDI_RELAXATION_STAND_ALONE:
384 TEUCHOS_TEST_FOR_EXCEPT(
true);
396 bool overrideSerialDefault)
399 return Ifpack::Create(Teuchos::get<EPrecType>(::precTypeNameToIntMap,PrecType),Matrix,Overlap,overrideSerialDefault);
401 catch(
const Teuchos::StringToIntMap::DoesNotExist &excpt ) {
414 Teuchos::ParameterList& List, std::string& PrecType,
419 Teuchos::CommandLineProcessor CLP;
422 std::string ifp_prec_type =
"ILU";
423 CLP.setOption(
"ifp-prec-type",&ifp_prec_type,
"Preconditioner type");
426 CLP.setOption(
"ifp-overlap",&ifp_overlap,
"Overlap among processors");
428 std::string ifp_relax_type =
"Jacobi";
429 CLP.setOption(
"ifp-relax-type",&ifp_relax_type,
"Relaxation type");
431 int ifp_relax_sweeps = 1;
432 CLP.setOption(
"ifp-relax-sweeps",
433 &ifp_relax_sweeps,
"Number of sweeps for relaxation");
435 double ifp_relax_damping = 1.0;
436 CLP.setOption(
"ifp-relax-damping",
437 &ifp_relax_damping,
"Damping for relaxation");
439 std::string ifp_part_type =
"greedy";
440 CLP.setOption(
"ifp-part-type",&ifp_part_type,
"Partitioner type");
442 int ifp_part_local = 1;
443 CLP.setOption(
"ifp-part-local",&ifp_part_local,
"number of local partitions");
446 CLP.recogniseAllOptions(
false);
447 CLP.throwExceptions(
false);
448 CLP.parse(argc,argv);
451 PrecType = ifp_prec_type;
452 Overlap = ifp_overlap;
455 List.set(
"relaxation: type", ifp_relax_type);
456 List.set(
"relaxation: sweeps", ifp_relax_sweeps);
457 List.set(
"relaxation: damping factor", ifp_relax_damping);
458 List.set(
"partitioner: type", ifp_part_type);
459 List.set(
"partitioner: local parts", ifp_part_local);
static const int numPrecTypes
Ifpack_BlockRelaxation: a class to define block relaxation preconditioners of Epetra_RowMatrix's.
static const EPrecType precTypeValues[numPrecTypes]
List of the preconditioner types as enum values .
int SetParameters(int argc, char *argv[], Teuchos::ParameterList &List, std::string &PrecType, int &Overlap)
Sets the options in List from the command line.
EPrecType
Enum for the type of preconditioner.
A wrapper to SuperLU 4.0's supernodal ILUT w/ partial pivoting.
static const char * precTypeNames[numPrecTypes]
List of preconditioner types as std::string values.
Ifpack_ILU: A class for constructing and using an incomplete lower/upper (ILU) factorization of a giv...
Ifpack_Amesos: a class to use Amesos' factorizations as preconditioners.
virtual const Epetra_Comm & Comm() const =0
Ifpack_AdditiveSchwarz: a class to define Additive Schwarz preconditioners of Epetra_RowMatrix's.
Ifpack_SparseContainer: a class for storing and solving linear systems using sparse matrices...
Ifpack_Chebyshev: class for preconditioning with Chebyshev polynomials in Ifpack. ...
Ifpack_Preconditioner: basic class for preconditioning in Ifpack.
Ifpack_PointRelaxation: a class to define point relaxation preconditioners of for Epetra_RowMatrix's...
Ifpack_Polynomial: class for preconditioning with least squares polynomials in Ifpack.
Ifpack_Krylov: class for smoothing with Krylov solvers in Ifpack.
virtual int NumProc() const =0
Ifpack_IC: A class for constructing and using an incomplete Cholesky factorization of a given Epetra_...
Ifpack_ICT: A class for constructing and using an incomplete Cholesky factorization of a given Epetra...
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...
static const bool supportsUnsymmetric[numPrecTypes]
List of bools that determines if the preconditioner type supports unsymmetric matrices.
Ifpack_ILUT: A class for constructing and using an incomplete LU factorization of a given Epetra_RowM...