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 MatrixType::node_type node_type
The node_type from the input MatrixType.
Definition: Ifpack2_ContainerFactory_decl.hpp:123
Tpetra::RowMatrix< scalar_type, local_ordinal_type, global_ordinal_type, node_type > row_matrix_type
Tpetra::RowMatrix specialization (superclass of MatrixType)
Definition: Ifpack2_ContainerFactory_decl.hpp:126
MatrixType::global_ordinal_type global_ordinal_type
The global_ordinal_type from the input MatrixType.
Definition: Ifpack2_ContainerFactory_decl.hpp:121
static void registerContainer(std::string containerType)
Registers a specialization of Ifpack2::Container by binding a key (string) to it. ...
Definition: Ifpack2_ContainerFactory_def.hpp:80
A static "factory" that provides a way to register and construct arbitrary Ifpack2::Container subclas...
Definition: Ifpack2_ContainerFactory_decl.hpp:111
Tpetra::Import< local_ordinal_type, global_ordinal_type, node_type > import_type
Tpetra::Importer specialization for use with MatrixType and compatible MultiVectors.
Definition: Ifpack2_ContainerFactory_decl.hpp:128
Ifpack2 implementation details.
MatrixType::local_ordinal_type local_ordinal_type
The local_ordinal_type from the input MatrixType.
Definition: Ifpack2_ContainerFactory_decl.hpp:119
static void deregisterContainer(std::string containerType)
Registers a specialization of Ifpack2::Container by binding a key (string) to it. ...
Definition: Ifpack2_ContainerFactory_def.hpp:132
Interface for creating and solving a set of local linear problems.
Definition: Ifpack2_Container_decl.hpp:112
static Teuchos::RCP< BaseContainer > build(std::string containerType, const Teuchos::RCP< const MatrixType > &A, const Teuchos::Array< Teuchos::Array< local_ordinal_type >> &partitions, const Teuchos::RCP< const import_type > importer, bool pointIndexed)
Build a specialization of Ifpack2::Container given a key that has been registered.
Definition: Ifpack2_ContainerFactory_def.hpp:89
Preconditioners and smoothers for Tpetra sparse matrices.
Definition: Ifpack2_AdditiveSchwarz_decl.hpp:73
MatrixType::scalar_type scalar_type
The type of the entries of the input MatrixType.
Definition: Ifpack2_ContainerFactory_decl.hpp:117