10#ifndef IFPACK2_CONTAINERFACTORY_DECL_H
11#define IFPACK2_CONTAINERFACTORY_DECL_H
13#include "Ifpack2_Container.hpp"
14#include "Ifpack2_Partitioner.hpp"
15#ifdef HAVE_IFPACK2_AMESOS2
16# include "Ifpack2_Details_Amesos2Wrapper.hpp"
18#include "Tpetra_RowMatrix.hpp"
19#include "Teuchos_RCP.hpp"
20#include "Teuchos_Ptr.hpp"
38template<
typename MatrixType>
39struct ContainerFactoryEntryBase
41 virtual Teuchos::RCP<Ifpack2::Container<MatrixType>> build(
42 const Teuchos::RCP<const MatrixType>& A,
43 const Teuchos::Array<Teuchos::Array<typename MatrixType::local_ordinal_type>>& partitions,
44 const Teuchos::RCP<
const Tpetra::Import<
45 typename MatrixType::local_ordinal_type,
46 typename MatrixType::global_ordinal_type,
47 typename MatrixType::node_type>> importer,
48 bool pointIndexed) = 0;
49 virtual ~ContainerFactoryEntryBase() {}
52template<
typename MatrixType,
typename ContainerType>
53struct ContainerFactoryEntry :
public ContainerFactoryEntryBase<MatrixType>
55 Teuchos::RCP<Ifpack2::Container<MatrixType>> build(
56 const Teuchos::RCP<const MatrixType>& A,
57 const Teuchos::Array<Teuchos::Array<typename MatrixType::local_ordinal_type>>& partitions,
58 const Teuchos::RCP<
const Tpetra::Import<
59 typename MatrixType::local_ordinal_type,
60 typename MatrixType::global_ordinal_type,
61 typename MatrixType::node_type>> importer,
64 return Teuchos::rcp(
new ContainerType(A, partitions, importer, pointIndexed));
66 ~ContainerFactoryEntry() {}
77template<
typename MatrixType>
93 typedef Tpetra::RowMatrix<scalar_type, local_ordinal_type, global_ordinal_type, node_type>
row_matrix_type;
95 typedef Tpetra::Import<local_ordinal_type, global_ordinal_type, node_type>
import_type;
99 static_assert (std::is_same<typename std::decay<MatrixType>::type,
row_matrix_type>::value,
100 "MatrixType must be a Tpetra::RowMatrix specialization.");
109 template<
typename ContainerType>
120 static Teuchos::RCP<BaseContainer>
build(std::string containerType,
const Teuchos::RCP<const MatrixType>& A,
121 const Teuchos::Array<Teuchos::Array<local_ordinal_type>>& partitions,
const Teuchos::RCP<const import_type> importer,
bool pointIndexed);
131 static std::map<std::string, Teuchos::RCP<Details::ContainerFactoryEntryBase<MatrixType>>> table;
132 static bool registeredDefaults;
133 static void registerDefaults();
Interface for creating and solving a set of local linear problems.
Definition Ifpack2_Container_decl.hpp:80
Preconditioners and smoothers for Tpetra sparse matrices.
Definition Ifpack2_AdditiveSchwarz_decl.hpp:41
A static "factory" that provides a way to register and construct arbitrary Ifpack2::Container subclas...
Definition Ifpack2_ContainerFactory_decl.hpp:79
MatrixType::scalar_type scalar_type
The type of the entries of the input MatrixType.
Definition Ifpack2_ContainerFactory_decl.hpp:84
static void deregisterContainer(std::string containerType)
Registers a specialization of Ifpack2::Container by binding a key (string) to it.
Definition Ifpack2_ContainerFactory_def.hpp:99
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:56
MatrixType::local_ordinal_type local_ordinal_type
The local_ordinal_type from the input MatrixType.
Definition Ifpack2_ContainerFactory_decl.hpp:86
MatrixType::node_type node_type
The node_type from the input MatrixType.
Definition Ifpack2_ContainerFactory_decl.hpp:90
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:93
static void registerContainer(std::string containerType)
Registers a specialization of Ifpack2::Container by binding a key (string) to it.
Definition Ifpack2_ContainerFactory_def.hpp:47
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:95
MatrixType::global_ordinal_type global_ordinal_type
The global_ordinal_type from the input MatrixType.
Definition Ifpack2_ContainerFactory_decl.hpp:88