43 #ifndef IFPACK2_CONTAINERFACTORY_DECL_H 44 #define IFPACK2_CONTAINERFACTORY_DECL_H 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>>& localRows,
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,
82 typename MatrixType::scalar_type DampingFactor) = 0;
83 virtual ~ContainerFactoryEntryBase<MatrixType>() {}
86 template<
typename MatrixType,
typename ContainerType>
87 struct ContainerFactoryEntry :
public ContainerFactoryEntryBase<MatrixType>
89 Teuchos::RCP<Ifpack2::Container<MatrixType>> build(
90 const Teuchos::RCP<const MatrixType>& A,
91 const Teuchos::Array<Teuchos::Array<typename MatrixType::local_ordinal_type>>& localRows,
92 const Teuchos::RCP<
const Tpetra::Import<
93 typename MatrixType::local_ordinal_type,
94 typename MatrixType::global_ordinal_type,
95 typename MatrixType::node_type>> importer,
97 typename MatrixType::scalar_type DampingFactor)
99 return Teuchos::rcp(
new ContainerType(A, localRows, importer, OverlapLevel, DampingFactor));
101 ~ContainerFactoryEntry<MatrixType, ContainerType>() {}
112 template<
typename MatrixType>
128 typedef Tpetra::RowMatrix<scalar_type, local_ordinal_type, global_ordinal_type, node_type>
row_matrix_type;
130 typedef Tpetra::Import<local_ordinal_type, global_ordinal_type, node_type>
import_type;
134 static_assert (std::is_same<
typename std::decay<MatrixType>::type,
row_matrix_type>::value,
135 "MatrixType must be a Tpetra::RowMatrix specialization.");
144 template<
typename ContainerType>
156 static Teuchos::RCP<BaseContainer>
build(std::string containerType,
const Teuchos::RCP<const MatrixType>& A,
157 const Teuchos::Array<Teuchos::Array<local_ordinal_type>>& localRows,
const Teuchos::RCP<const import_type> importer,
168 static std::map<std::string, Teuchos::RCP<Details::ContainerFactoryEntryBase<MatrixType>>> table;
169 static bool registeredDefaults;
170 static void registerDefaults();
175 #endif // IFPACK2_DETAILS_CONTAINERFACTORY_H Ifpack2::Container class declaration.
MatrixType::node_type node_type
The node_type from the input MatrixType.
Definition: Ifpack2_ContainerFactory_decl.hpp:125
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:128
static Teuchos::RCP< BaseContainer > build(std::string containerType, const Teuchos::RCP< const MatrixType > &A, const Teuchos::Array< Teuchos::Array< local_ordinal_type >> &localRows, const Teuchos::RCP< const import_type > importer, int OverlapLevel, scalar_type DampingFactor)
Build a specialization of Ifpack2::Container given a key that has been registered.
Definition: Ifpack2_ContainerFactory_def.hpp:89
MatrixType::global_ordinal_type global_ordinal_type
The global_ordinal_type from the input MatrixType.
Definition: Ifpack2_ContainerFactory_decl.hpp:123
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:113
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:130
Ifpack2 implementation details.
MatrixType::local_ordinal_type local_ordinal_type
The local_ordinal_type from the input MatrixType.
Definition: Ifpack2_ContainerFactory_decl.hpp:121
static void deregisterContainer(std::string containerType)
Registers a specialization of Ifpack2::Container by binding a key (string) to it. ...
Definition: Ifpack2_ContainerFactory_def.hpp:126
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
MatrixType::scalar_type scalar_type
The type of the entries of the input MatrixType.
Definition: Ifpack2_ContainerFactory_decl.hpp:119