43 #ifndef IFPACK2_FACTORY_DECL_HPP
44 #define IFPACK2_FACTORY_DECL_HPP
46 #include "Ifpack2_ConfigDefs.hpp"
48 #include "Ifpack2_Details_Factory.hpp"
53 #include "Ifpack2_Chebyshev.hpp"
54 #include "Ifpack2_RILUK.hpp"
55 #include "Ifpack2_Experimental_RBILUK.hpp"
57 #include <type_traits>
129 template<
class MatrixType>
132 typename MatrixType::local_ordinal_type,
133 typename MatrixType::global_ordinal_type,
134 typename MatrixType::node_type> >
139 using Teuchos::rcp_implicit_cast;
140 typedef typename MatrixType::scalar_type SC;
141 typedef typename MatrixType::local_ordinal_type LO;
142 typedef typename MatrixType::global_ordinal_type GO;
143 typedef typename MatrixType::node_type NT;
144 typedef Tpetra::RowMatrix<SC, LO, GO, NT> row_matrix_type;
146 RCP<const row_matrix_type> A;
148 A = rcp_implicit_cast<
const row_matrix_type> (matrix);
150 Ifpack2::Details::Factory<SC, LO, GO, NT> factory;
151 return factory.create (precType, A);
169 template<
class MatrixType>
172 typename MatrixType::local_ordinal_type,
173 typename MatrixType::global_ordinal_type,
174 typename MatrixType::node_type> >
180 using Teuchos::rcp_implicit_cast;
181 typedef typename MatrixType::scalar_type SC;
182 typedef typename MatrixType::local_ordinal_type LO;
183 typedef typename MatrixType::global_ordinal_type GO;
184 typedef typename MatrixType::node_type NT;
185 typedef Tpetra::RowMatrix<SC, LO, GO, NT> row_matrix_type;
187 RCP<const row_matrix_type> A;
189 A = rcp_implicit_cast<
const row_matrix_type> (matrix);
191 Ifpack2::Details::Factory<SC, LO, GO, NT> factory;
192 return factory.create (precType, A, overlap);
197 template<
class InputMatrixType,
class OutputMatrixType>
200 typename OutputMatrixType::local_ordinal_type,
201 typename OutputMatrixType::global_ordinal_type,
202 typename OutputMatrixType::node_type> >
204 typename InputMatrixType::local_ordinal_type,
205 typename InputMatrixType::global_ordinal_type,
206 typename InputMatrixType::node_type> >& prec,
213 using Teuchos::rcp_dynamic_cast;
218 typedef typename InputMatrixType::scalar_type scalar_type;
219 typedef typename InputMatrixType::local_ordinal_type local_ordinal_type;
220 typedef typename InputMatrixType::global_ordinal_type global_ordinal_type;
221 typedef typename InputMatrixType::node_type old_node_type;
222 typedef Tpetra::RowMatrix<scalar_type, local_ordinal_type,
223 global_ordinal_type, old_node_type> input_row_matrix_type;
225 static_assert (std::is_same<typename OutputMatrixType::scalar_type, scalar_type>::value,
226 "Input and output scalar_type must be the same.");
227 static_assert (std::is_same<typename OutputMatrixType::local_ordinal_type, local_ordinal_type>::value,
228 "Input and output local_ordinal_type must be the same.");
229 static_assert (std::is_same<typename OutputMatrixType::global_ordinal_type, global_ordinal_type>::value,
230 "Input and output global_ordinal_type must be the same.");
231 typedef typename OutputMatrixType::node_type new_node_type;
233 global_ordinal_type, new_node_type> output_prec_type;
239 RCP<output_prec_type> new_prec;
240 RCP<Chebyshev<input_row_matrix_type> > chebyPrec =
242 if (! chebyPrec.is_null ()) {
243 new_prec = chebyPrec->
clone (matrix, params);
246 RCP<RILUK<input_row_matrix_type> > luPrec;
248 if (luPrec != null) {
249 new_prec = luPrec->
clone (matrix);
252 RCP<Experimental::RBILUK<input_row_matrix_type> > rbilukPrec;
254 if (rbilukPrec != null) {
255 new_prec = rbilukPrec->
clone (matrix);
259 (
true, std::logic_error,
"Ifpack2::Factory::clone: Not implemented for the "
260 "current preconditioner type. The only supported types thus far are "
261 "Chebyshev, RILUK, and RBILUK.");
267 #endif // IFPACK2_FACTORY_DECL_HPP
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
ILU(k) factorization of a given Tpetra::RowMatrix.
Definition: Ifpack2_RILUK_decl.hpp:243
static Teuchos::RCP< Preconditioner< typename OutputMatrixType::scalar_type, typename OutputMatrixType::local_ordinal_type, typename OutputMatrixType::global_ordinal_type, typename OutputMatrixType::node_type > > clone(const Teuchos::RCP< Preconditioner< typename InputMatrixType::scalar_type, typename InputMatrixType::local_ordinal_type, typename InputMatrixType::global_ordinal_type, typename InputMatrixType::node_type > > &prec, const Teuchos::RCP< const OutputMatrixType > &matrix, const Teuchos::ParameterList ¶ms=Teuchos::ParameterList())
Clones a preconditioner for a different node type from an Ifpack2 RILUK or Chebyshev preconditioner...
Definition: Ifpack2_Factory_decl.hpp:203
bool supportsUnsymmetric(const std::string &prec_type)
true if the specified preconditioner type supports nonsymmetric matrices, else false.
Definition: Ifpack2_Factory.cpp:55
Teuchos::RCP< Chebyshev< Tpetra::RowMatrix< typename NewMatrixType::scalar_type, typename NewMatrixType::local_ordinal_type, typename NewMatrixType::global_ordinal_type, typename NewMatrixType::node_type > > > clone(const Teuchos::RCP< const NewMatrixType > &A_newnode, const Teuchos::ParameterList ¶ms) const
Clone this object to one with a different Node type.
Definition: Ifpack2_Chebyshev_decl.hpp:761
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
Diagonally scaled Chebyshev iteration for Tpetra sparse matrices.
Definition: Ifpack2_Chebyshev_decl.hpp:199
Teuchos::RCP< RILUK< NewMatrixType > > clone(const Teuchos::RCP< const NewMatrixType > &A_newnode) const
Clone preconditioner to a new node type.
Definition: Ifpack2_RILUK_decl.hpp:624
Interface for all Ifpack2 preconditioners.
Definition: Ifpack2_Preconditioner.hpp:107
static Teuchos::RCP< Preconditioner< typename MatrixType::scalar_type, typename MatrixType::local_ordinal_type, typename MatrixType::global_ordinal_type, typename MatrixType::node_type > > create(const std::string &precType, const Teuchos::RCP< const MatrixType > &matrix)
Create an instance of Ifpack2_Preconditioner given the string name of the preconditioner type...
Definition: Ifpack2_Factory_decl.hpp:135
"Factory" for creating Ifpack2 preconditioners.
Definition: Ifpack2_Factory_decl.hpp:117
static Teuchos::RCP< Preconditioner< typename MatrixType::scalar_type, typename MatrixType::local_ordinal_type, typename MatrixType::global_ordinal_type, typename MatrixType::node_type > > create(const std::string &precType, const Teuchos::RCP< const MatrixType > &matrix, const int overlap)
Create an instance of Ifpack2_Preconditioner given the string name of the preconditioner type...
Definition: Ifpack2_Factory_decl.hpp:175
ILU(k) factorization of a given Tpetra::BlockCrsMatrix.
Definition: Ifpack2_Experimental_RBILUK_decl.hpp:128