43 #ifndef IFPACK2_DETAILS_CONTAINERFACTORY_H 44 #define IFPACK2_DETAILS_CONTAINERFACTORY_H 47 #include "Ifpack2_TriDiContainer.hpp" 48 #include "Ifpack2_DenseContainer.hpp" 49 #include "Ifpack2_SparseContainer.hpp" 50 #include "Ifpack2_BandedContainer.hpp" 51 #include "Ifpack2_Partitioner.hpp" 53 #ifdef HAVE_IFPACK2_AMESOS2 54 # include "Ifpack2_Details_Amesos2Wrapper.hpp" 56 #include "Tpetra_RowMatrix_decl.hpp" 57 #include "Teuchos_RCP.hpp" 58 #include "Teuchos_Ptr.hpp" 59 #include "Teuchos_ArrayViewDecl.hpp" 75 template <
typename MatrixType>
77 typename MatrixType::local_ordinal_type,
78 typename MatrixType::global_ordinal_type,
79 typename MatrixType::node_type> > >
80 createContainer (
const std::string& containerName,
81 const Teuchos::RCP< const MatrixType>& A,
82 const Teuchos::Array< Teuchos::Array< typename MatrixType::local_ordinal_type> >& localRows,
83 const Teuchos::RCP<
const Tpetra::Import<
typename MatrixType::local_ordinal_type,
84 typename MatrixType::global_ordinal_type,
85 typename MatrixType::node_type> > importer,
87 typename MatrixType::scalar_type DampingFactor)
90 typedef Tpetra::RowMatrix<
typename MatrixType::scalar_type,
91 typename MatrixType::local_ordinal_type,
92 typename MatrixType::global_ordinal_type,
93 typename MatrixType::node_type> row_matrix_type;
95 static_assert (std::is_same<
typename std::decay<MatrixType>::type, row_matrix_type>::value,
96 "MatrixType must be a Tpetra::RowMatrix specialization.");
98 if (containerName ==
"TriDi") {
99 return rcp (
new TriDiContainer<MatrixType, typename MatrixType::scalar_type> (A, localRows, importer, OverlapLevel, DampingFactor));
101 else if (containerName ==
"Dense") {
102 return rcp (
new DenseContainer<MatrixType, typename MatrixType::scalar_type> (A, localRows, importer, OverlapLevel, DampingFactor));
104 else if (containerName ==
"SparseILUT") {
105 return rcp (
new SparseContainer<MatrixType, ILUT<MatrixType> > (A, localRows, importer, OverlapLevel, DampingFactor));
107 #ifdef HAVE_IFPACK2_AMESOS2 108 else if (containerName ==
"SparseAmesos2" || containerName ==
"SparseAmesos") {
109 return rcp (
new SparseContainer<MatrixType, Amesos2Wrapper<MatrixType> > (A, localRows, importer, OverlapLevel, DampingFactor));
112 else if (containerName ==
"Banded") {
113 return rcp (
new BandedContainer<MatrixType, typename MatrixType::scalar_type> (A, localRows, importer, OverlapLevel, DampingFactor));
116 TEUCHOS_TEST_FOR_EXCEPTION
117 (
true, std::invalid_argument,
"Ifpack2::Details::createContainer: Input " 118 "argument containerName=\"" << containerName <<
"\" is invalid. Valid " 119 "values include: \"TriDi\", \"Dense\", \"SparseILUT\", \"SparseAmesos2\", " 126 #endif // IFPACK2_DETAILS_CONTAINERFACTORY_H Ifpack2::Container class declaration.
Ifpack2 implementation details.
Interface for creating and solving a local linear problem.
Definition: Ifpack2_Container.hpp:114
Preconditioners and smoothers for Tpetra sparse matrices.
Definition: Ifpack2_AdditiveSchwarz_decl.hpp:72
Declaration of ILUT preconditioner.