43 #ifndef IFPACK2_FACTORY_HPP 44 #define IFPACK2_FACTORY_HPP 46 #include "Ifpack2_ConfigDefs.hpp" 47 #include "Ifpack2_Preconditioner.hpp" 48 #include "Ifpack2_Relaxation.hpp" 49 #include "Ifpack2_Diagonal.hpp" 50 #include "Ifpack2_Chebyshev.hpp" 51 #include "Ifpack2_RILUK.hpp" 52 #include "Ifpack2_ILUT.hpp" 53 #include "Ifpack2_Krylov.hpp" 54 #include "Ifpack2_AdditiveSchwarz.hpp" 134 template<
class MatrixType>
137 typename MatrixType::local_ordinal_type,
138 typename MatrixType::global_ordinal_type,
139 typename MatrixType::node_type> >
140 create(
const std::string& prec_type,
141 const Teuchos::RCP<const MatrixType>& matrix,
142 const int overlap = 0);
148 template<
class MatrixType>
149 Teuchos::RCP<Ifpack2::Preconditioner<typename MatrixType::scalar_type,typename MatrixType::local_ordinal_type,typename MatrixType::global_ordinal_type,typename MatrixType::node_type> >
151 const Teuchos::RCP<const MatrixType>& matrix,
154 typedef typename MatrixType::scalar_type Scalar;
155 typedef typename MatrixType::local_ordinal_type LocalOrdinal;
156 typedef typename MatrixType::global_ordinal_type GlobalOrdinal;
157 typedef typename MatrixType::node_type Node;
159 Teuchos::RCP<Ifpack2::Preconditioner<Scalar,LocalOrdinal,GlobalOrdinal,Node> > prec;
161 bool one_mpi_rank=(matrix->getComm()->getSize()==1);
163 if (prec_type ==
"ILUT") {
168 else if (prec_type ==
"RILUK") {
171 else if (prec_type ==
"RELAXATION") {
174 else if (prec_type ==
"CHEBYSHEV") {
175 prec = Teuchos::rcp(
new Ifpack2::Chebyshev<MatrixType>(matrix));
177 else if (prec_type ==
"DIAGONAL") {
180 else if (prec_type ==
"SCHWARZ") {
183 else if (prec_type ==
"KRYLOV") {
187 std::ostringstream os;
188 os <<
"Ifpack2::Factory::Create ERROR, invalid preconditioner type (" 190 std::string str = os.str();
191 throw std::runtime_error(str);
A class for diagonal preconditioning.
Definition: Ifpack2_Diagonal_decl.hpp:68
ILU(k) (incomplete LU with fill level k) factorization of a given Tpetra::RowMatrix.
Definition: Ifpack2_RILUK_decl.hpp:214
bool supportsUnsymmetric(const std::string &prec_type)
Return true if the specified preconditioner type supports unsymmetric matrices.
Definition: Ifpack2_Factory.cpp:49
ILUT incomplete factorization of a Tpetra sparse matrix.
Definition: Ifpack2_ILUT_decl.hpp:96
Base class for all Ifpack2 preconditioners.
Definition: Ifpack2_Preconditioner.hpp:130
A class for constructing and using a CG/GMRES smoother.
Definition: Ifpack2_Krylov_decl.hpp:110
Additive Schwarz domain decomposition for Tpetra::RowMatrix objects.
Definition: Ifpack2_AdditiveSchwarz_decl.hpp:123
A factory class to create Ifpack2 preconditioners.
Definition: Ifpack2_Factory.hpp:117
static Teuchos::RCP< Ifpack2::Preconditioner< typename MatrixType::scalar_type, typename MatrixType::local_ordinal_type, typename MatrixType::global_ordinal_type, typename MatrixType::node_type > > create(const std::string &prec_type, const Teuchos::RCP< const MatrixType > &matrix, const int overlap=0)
Creates an instance of Ifpack2_Preconditioner given the string name of the preconditioner type (throw...
Definition: Ifpack2_Factory.hpp:150
Relaxation preconditioners for Tpetra::RowMatrix and Tpetra::CrsMatrix sparse matrices.
Definition: Ifpack2_Relaxation_decl.hpp:231
Ifpack2::Container: a pure virtual class for creating and solving local linear problems.
Definition: Ifpack2_AdditiveSchwarz_decl.hpp:67