43 #ifndef IFPACK2_CONTAINERFACTORY_DECL_H
44 #define IFPACK2_CONTAINERFACTORY_DECL_H
46 #include "Ifpack2_Container.hpp"
47 #include "Ifpack2_Partitioner.hpp"
48 #ifdef HAVE_IFPACK2_AMESOS2
49 # include "Ifpack2_Details_Amesos2Wrapper.hpp"
51 #include "Tpetra_RowMatrix.hpp"
52 #include "Teuchos_RCP.hpp"
53 #include "Teuchos_Ptr.hpp"
71 template<
typename MatrixType>
72 struct ContainerFactoryEntryBase
74 virtual Teuchos::RCP<Ifpack2::Container<MatrixType>> build(
75 const Teuchos::RCP<const MatrixType>& A,
76 const Teuchos::Array<Teuchos::Array<typename MatrixType::local_ordinal_type>>& partitions,
77 const Teuchos::RCP<
const Tpetra::Import<
78 typename MatrixType::local_ordinal_type,
79 typename MatrixType::global_ordinal_type,
80 typename MatrixType::node_type>> importer,
81 bool pointIndexed) = 0;
82 virtual ~ContainerFactoryEntryBase() {}
85 template<
typename MatrixType,
typename ContainerType>
86 struct ContainerFactoryEntry :
public ContainerFactoryEntryBase<MatrixType>
88 Teuchos::RCP<Ifpack2::Container<MatrixType>> build(
89 const Teuchos::RCP<const MatrixType>& A,
90 const Teuchos::Array<Teuchos::Array<typename MatrixType::local_ordinal_type>>& partitions,
91 const Teuchos::RCP<
const Tpetra::Import<
92 typename MatrixType::local_ordinal_type,
93 typename MatrixType::global_ordinal_type,
94 typename MatrixType::node_type>> importer,
97 return Teuchos::rcp(
new ContainerType(A, partitions, importer, pointIndexed));
99 ~ContainerFactoryEntry() {}
110 template<
typename MatrixType>
126 typedef Tpetra::RowMatrix<scalar_type, local_ordinal_type, global_ordinal_type, node_type>
row_matrix_type;
128 typedef Tpetra::Import<local_ordinal_type, global_ordinal_type, node_type>
import_type;
132 static_assert (std::is_same<
typename std::decay<MatrixType>::type,
row_matrix_type>::value,
133 "MatrixType must be a Tpetra::RowMatrix specialization.");
142 template<
typename ContainerType>
153 static Teuchos::RCP<BaseContainer>
build(std::string containerType,
const Teuchos::RCP<const MatrixType>& A,
154 const Teuchos::Array<Teuchos::Array<local_ordinal_type>>& partitions,
const Teuchos::RCP<const import_type> importer,
bool pointIndexed);
164 static std::map<std::string, Teuchos::RCP<Details::ContainerFactoryEntryBase<MatrixType>>> table;
165 static bool registeredDefaults;
166 static void registerDefaults();
171 #endif // IFPACK2_DETAILS_CONTAINERFACTORY_H