43 #include "Ifpack_ConfigDefs.h" 45 #include "Ifpack_Preconditioner.h" 46 #include "Ifpack_PointRelaxation.h" 47 #include "Ifpack_BlockRelaxation.h" 48 #include "Ifpack_IC.h" 49 #include "Ifpack_ICT.h" 50 #include "Ifpack_ILU.h" 51 #include "Ifpack_SILU.h" 52 #include "Ifpack_ILUT.h" 53 #include "Ifpack_SPARSKIT.h" 54 #include "Ifpack_AdditiveSchwarz.h" 55 #include "Ifpack_DenseContainer.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" 67 #include "Ifpack_Chebyshev.h" 68 #include "Ifpack_Polynomial.h" 69 #include "Ifpack_Krylov.h" 70 #include "Ifpack_IHSS.h" 71 #include "Ifpack_SORa.h" 73 #include "Teuchos_CommandLineProcessor.hpp" 74 #include "Teuchos_StringToIntMap.hpp" 75 #include "Epetra_CrsMatrix.h" 80 const Teuchos::StringToIntMap
91 ,POINT_RELAXATION_STAND_ALONE
93 ,BLOCK_RELAXATION_STAND_ALONE
94 ,BLOCK_RELAXATION_STAND_ALONE_ILU
95 ,BLOCK_RELAXATION_STAND_ALONE_ILUT
96 ,BLOCK_RELAXATION_STAND_ALONE_IC
97 #ifdef HAVE_IFPACK_SUPERLU 98 ,BLOCK_RELAXATION_STAND_ALONE_SILU
100 #ifdef HAVE_IFPACK_AMESOS 101 ,BLOCK_RELAXATION_STAND_ALONE_AMESOS
102 ,BLOCK_RELAXATION_AMESOS
105 #endif // HAVE_IFPACK_AMESOS 114 #ifdef HAVE_IFPACK_SPARSKIT 116 #endif // HAVE_IFPACK_SPARSKIT 117 #ifdef HAVE_IFPACK_HIPS 123 #ifdef HAVE_IFPACK_SUPERLU 137 ,
"point relaxation stand-alone" 139 ,
"block relaxation stand-alone" 140 ,
"block relaxation stand-alone (ILU)" 141 ,
"block relaxation stand-alone (ILUT)" 142 ,
"block relaxation stand-alone (IC)" 143 #ifdef HAVE_IFPACK_SUPERLU 144 ,
"block relaxation stand-alone (SILU)" 146 #ifdef HAVE_IFPACK_AMESOS 147 ,
"block relaxation stand-alone (Amesos)" 148 ,
"block relaxation (Amesos)" 150 ,
"Amesos stand-alone" 160 #ifdef HAVE_IFPACK_SPARSKIT 163 #ifdef HAVE_IFPACK_HIPS 169 #ifdef HAVE_IFPACK_SUPERLU 189 #ifdef HAVE_IFPACK_SUPERLU 192 #ifdef HAVE_IFPACK_AMESOS 206 #ifdef HAVE_IFPACK_SPARSKIT 209 #ifdef HAVE_IFPACK_HIPS 215 #ifdef HAVE_IFPACK_SUPERLU 227 Epetra_RowMatrix* Matrix,
229 bool overrideSerialDefault)
231 const bool serial = (Matrix->Comm().NumProc() == 1);
234 case POINT_RELAXATION:
235 if (serial && !overrideSerialDefault)
239 case POINT_RELAXATION_STAND_ALONE:
241 case BLOCK_RELAXATION:
242 if (serial && !overrideSerialDefault)
247 case BLOCK_RELAXATION_STAND_ALONE:
249 case BLOCK_RELAXATION_STAND_ALONE_ILU:
251 case BLOCK_RELAXATION_STAND_ALONE_ILUT:
253 case BLOCK_RELAXATION_STAND_ALONE_IC:
255 #ifdef HAVE_IFPACK_SUPERLU 256 case BLOCK_RELAXATION_STAND_ALONE_SILU:
259 #ifdef HAVE_IFPACK_AMESOS 260 case BLOCK_RELAXATION_STAND_ALONE_AMESOS:
262 case BLOCK_RELAXATION_AMESOS:
266 if (serial && !overrideSerialDefault)
270 case AMESOS_STAND_ALONE:
274 if (serial && !overrideSerialDefault)
281 if (serial && !overrideSerialDefault)
285 case ICT_STAND_ALONE:
288 if (serial && !overrideSerialDefault)
292 case ILU_STAND_ALONE:
295 if (serial && !overrideSerialDefault)
299 case ILUT_STAND_ALONE:
301 #ifdef HAVE_IFPACK_SPARSKIT 303 return(
new Ifpack_SPARSKIT(Matrix));
305 #ifdef HAVE_IFPACK_HIPS 307 return(
new Ifpack_HIPS(Matrix));
311 return(
new Ifpack_Hypre(Matrix));
313 #ifdef HAVE_IFPACK_SUPERLU 323 #ifdef HAVE_IFPACK_EPETRAEXT 325 return(
new Ifpack_IHSS(Matrix));
327 return(
new Ifpack_SORa(Matrix));
330 TEUCHOS_TEST_FOR_EXCEPT(
true);
340 Epetra_RowMatrix* Matrix,
342 bool overrideSerialDefault)
345 return Ifpack::Create(Teuchos::get<EPrecType>(::precTypeNameToIntMap,PrecType),Matrix,Overlap,overrideSerialDefault);
347 catch(
const Teuchos::StringToIntMap::DoesNotExist &excpt ) {
360 Teuchos::ParameterList& List,
string& PrecType,
365 Teuchos::CommandLineProcessor CLP;
368 string ifp_prec_type =
"ILU";
369 CLP.setOption(
"ifp-prec-type",&ifp_prec_type,
"Preconditioner type");
372 CLP.setOption(
"ifp-overlap",&ifp_overlap,
"Overlap among processors");
374 string ifp_relax_type =
"Jacobi";
375 CLP.setOption(
"ifp-relax-type",&ifp_relax_type,
"Relaxation type");
377 int ifp_relax_sweeps = 1;
378 CLP.setOption(
"ifp-relax-sweeps",
379 &ifp_relax_sweeps,
"Number of sweeps for relaxation");
381 double ifp_relax_damping = 1.0;
382 CLP.setOption(
"ifp-relax-damping",
383 &ifp_relax_damping,
"Damping for relaxation");
385 string ifp_part_type =
"greedy";
386 CLP.setOption(
"ifp-part-type",&ifp_part_type,
"Partitioner type");
388 int ifp_part_local = 1;
389 CLP.setOption(
"ifp-part-local",&ifp_part_local,
"number of local partitions");
392 CLP.recogniseAllOptions(
false);
393 CLP.throwExceptions(
false);
394 CLP.parse(argc,argv);
397 PrecType = ifp_prec_type;
398 Overlap = ifp_overlap;
401 List.set(
"relaxation: type", ifp_relax_type);
402 List.set(
"relaxation: sweeps", ifp_relax_sweeps);
403 List.set(
"relaxation: damping factor", ifp_relax_damping);
404 List.set(
"partitioner: type", ifp_part_type);
405 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 .
EPrecType
Enum for the type of preconditioner.
A wrapper to SuperLU 4.0's supernodal ILUT w/ partial pivoting.
int SetParameters(int argc, char *argv[], Teuchos::ParameterList &List, string &PrecType, int &Overlap)
Sets the options in List from the command line.
static const char * precTypeNames[numPrecTypes]
List of preconditioner types as 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.
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.
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...