43 #ifndef IFPACK2_DETAILS_ONELEVELFACTORY_DEF_HPP 44 #define IFPACK2_DETAILS_ONELEVELFACTORY_DEF_HPP 46 #include "Ifpack2_Chebyshev.hpp" 47 #include "Ifpack2_Details_DenseSolver.hpp" 48 #include "Ifpack2_Diagonal.hpp" 49 #include "Ifpack2_IdentitySolver.hpp" 50 #include "Ifpack2_ILUT.hpp" 51 #include "Ifpack2_Relaxation.hpp" 52 #include "Ifpack2_RILUK.hpp" 53 #include "Ifpack2_Experimental_RBILUK.hpp" 54 #include "Ifpack2_BlockRelaxation.hpp" 55 #include "Ifpack2_BandedContainer.hpp" 56 #include "Ifpack2_DenseContainer.hpp" 57 #include "Ifpack2_SparseContainer.hpp" 58 #include "Ifpack2_TriDiContainer.hpp" 59 #include "Ifpack2_LocalSparseTriangularSolver.hpp" 61 #ifdef HAVE_IFPACK2_AMESOS2 62 # include "Ifpack2_Details_Amesos2Wrapper.hpp" 63 #endif // HAVE_IFPACK2_AMESOS2 68 template<
class MatrixType>
79 std::string precTypeUpper (precType);
80 if (precTypeUpper.size () > 0) {
82 for (
size_t k = 0; k < precTypeUpper.size (); ++k) {
83 precTypeUpper[k] = std::toupper<char> (precTypeUpper[k], locale);
87 if (precTypeUpper ==
"CHEBYSHEV") {
90 prec =
rcp (new ::Ifpack2::Chebyshev<row_matrix_type> (matrix));
92 else if (precTypeUpper ==
"DENSE" || precTypeUpper ==
"LAPACK") {
95 else if (precTypeUpper ==
"AMESOS2") {
96 #ifdef HAVE_IFPACK2_AMESOS2 100 true, std::invalid_argument,
"Ifpack2::Details::OneLevelFactory: " 101 "You may not ask for the preconditioner \"AMESOS2\" unless " 102 "you have built Trilinos with the Amesos2 package enabled.");
103 #endif // HAVE_IFPACK2_AMESOS2 105 else if (precTypeUpper ==
"DIAGONAL") {
106 prec =
rcp (
new Diagonal<row_matrix_type> (matrix));
108 else if (precTypeUpper ==
"ILUT") {
111 else if (precTypeUpper ==
"RELAXATION") {
114 else if (precTypeUpper ==
"RILUK") {
117 else if (precTypeUpper ==
"RBILUK") {
120 else if (precTypeUpper ==
"KRYLOV") {
122 (
true, std::invalid_argument,
"The \"KRYLOV\" preconditioner option has " 123 "been deprecated and removed. If you want a Krylov solver, use the " 126 else if (precTypeUpper ==
"BLOCK_RELAXATION" ||
127 precTypeUpper ==
"BLOCK RELAXATION" ||
128 precTypeUpper ==
"BLOCKRELAXATION" ||
129 precTypeUpper ==
"DENSE_BLOCK_RELAXATION" ||
130 precTypeUpper ==
"DENSE BLOCK RELAXATION" ||
131 precTypeUpper ==
"DENSEBLOCKRELAXATION" ) {
137 params.
set (
"relaxation: container",
"Dense");
140 else if (precTypeUpper ==
"SPARSE_BLOCK_RELAXATION" ||
141 precTypeUpper ==
"SPARSE BLOCK RELAXATION" ||
142 precTypeUpper ==
"SPARSEBLOCKRELAXATION" ) {
149 #ifdef HAVE_IFPACK2_AMESOS2 152 params.
set (
"relaxation: container",
"SparseAmesos2");
156 (
true, std::invalid_argument,
"Ifpack2::Details::OneLevelFactory: " 157 "\"SPARSE BLOCK RELAXATION\" requires building Trilinos with Amesos2 enabled.");
160 else if (precTypeUpper ==
"TRIDI_RELAXATION" ||
161 precTypeUpper ==
"TRIDI RELAXATION" ||
162 precTypeUpper ==
"TRIDIRELAXATION" ||
163 precTypeUpper ==
"TRIDIAGONAL_RELAXATION" ||
164 precTypeUpper ==
"TRIDIAGONAL RELAXATION" ||
165 precTypeUpper ==
"TRIDIAGONALRELAXATION") {
168 params.
set (
"relaxation: container",
"TriDi");
171 else if (precTypeUpper ==
"BANDED_RELAXATION" ||
172 precTypeUpper ==
"BANDED RELAXATION" ||
173 precTypeUpper ==
"BANDEDRELAXATION") {
176 params.
set (
"relaxation: container",
"Banded");
179 else if (precTypeUpper ==
"IDENTITY" || precTypeUpper ==
"IDENTITY_SOLVER") {
183 else if (precTypeUpper ==
"LOCAL SPARSE TRIANGULAR SOLVER" ||
184 precTypeUpper ==
"LOCAL_SPARSE_TRIANGULAR_SOLVER" ||
185 precTypeUpper ==
"LOCALSPARSETRIANGULARSOLVER" ||
186 precTypeUpper ==
"SPARSE TRIANGULAR SOLVER" ||
187 precTypeUpper ==
"SPARSE_TRIANGULAR_SOLVER" ||
188 precTypeUpper ==
"SPARSETRIANGULARSOLVER") {
193 true, std::invalid_argument,
"Ifpack2::Details::OneLevelFactory::create: " 194 "Invalid preconditioner type \"" << precType <<
"\".");
198 prec.is_null (), std::logic_error,
"Ifpack2::Details::OneLevelFactory::" 199 "create: Return value is null right before return. This should never " 200 "happen. Please report this bug to the Ifpack2 developers.");
207 #define IFPACK2_DETAILS_ONELEVELFACTORY_INSTANT(S,LO,GO,N) \ 208 template class Ifpack2::Details::OneLevelFactory< Tpetra::RowMatrix<S, LO, GO, N> >; 210 #endif // IFPACK2_DETAILS_ONELEVELFACTORY_DEF_HPP ParameterList & set(std::string const &name, T const &value, std::string const &docString="", RCP< const ParameterEntryValidator > const &validator=null)
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
ILU(k) factorization of a given Tpetra::RowMatrix.
Definition: Ifpack2_RILUK_decl.hpp:254
"Preconditioner" that uses LAPACK's dense LU.
Definition: Ifpack2_Details_DenseSolver_decl.hpp:73
ILUT (incomplete LU factorization with threshold) of a Tpetra sparse matrix.
Definition: Ifpack2_ILUT_decl.hpp:91
Block relaxation preconditioners (or smoothers) for Tpetra::RowMatrix and Tpetra::CrsMatrix sparse ma...
Definition: Ifpack2_BlockRelaxation_decl.hpp:83
Ifpack2 implementation details.
"Identity" preconditioner.
Definition: Ifpack2_IdentitySolver_decl.hpp:59
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
Wrapper class for direct solvers in Amesos2.
Definition: Ifpack2_Details_Amesos2Wrapper_decl.hpp:102
"Preconditioner" that solves local sparse triangular systems.
Definition: Ifpack2_LocalSparseTriangularSolver_decl.hpp:83
ParameterList & setParameters(const ParameterList &source)
Relaxation preconditioners for Tpetra::RowMatrix and Tpetra::CrsMatrix sparse matrices.
Definition: Ifpack2_Relaxation_decl.hpp:226
Preconditioners and smoothers for Tpetra sparse matrices.
Definition: Ifpack2_AdditiveSchwarz_decl.hpp:72
ILU(k) factorization of a given Tpetra::Experimental::BlockCrsMatrix.
Definition: Ifpack2_Experimental_RBILUK_decl.hpp:128
Teuchos::RCP< prec_type > create(const std::string &precType, const Teuchos::RCP< const row_matrix_type > &matrix) const
Create an instance of Preconditioner given the string name of the preconditioner type.
Definition: Ifpack2_Details_OneLevelFactory_def.hpp:70