43 #ifndef IFPACK2_CONTAINERFACTORY_DEF_H 
   44 #define IFPACK2_CONTAINERFACTORY_DEF_H 
   47 #include "Ifpack2_TriDiContainer.hpp" 
   48 #include "Ifpack2_DenseContainer.hpp" 
   49 #include "Ifpack2_SparseContainer.hpp" 
   50 #include "Ifpack2_BandedContainer.hpp" 
   51 #include "Ifpack2_BlockTriDiContainer.hpp" 
   52 #include "Ifpack2_ILUT.hpp" 
   53 #include "Teuchos_ArrayView.hpp" 
   59 template<
typename MatrixType>
 
   60 void ContainerFactory<MatrixType>::
 
   63   registerContainer<Ifpack2::TriDiContainer<MatrixType, scalar_type>>(
"TriDi");
 
   64   registerContainer<Ifpack2::DenseContainer<MatrixType, scalar_type>>(
"Dense");
 
   65   registerContainer<Ifpack2::BandedContainer<MatrixType, scalar_type>>(
"Banded");
 
   66   registerContainer<SparseContainer<MatrixType, ILUT<MatrixType>>>(
"SparseILUT");
 
   67 #ifdef HAVE_IFPACK2_AMESOS2 
   68   registerContainer<SparseContainer<MatrixType, Details::Amesos2Wrapper<MatrixType>>>(
"SparseAmesos");
 
   69   registerContainer<SparseContainer<MatrixType, Details::Amesos2Wrapper<MatrixType>>>(
"SparseAmesos2");
 
   71 #ifdef HAVE_IFPACK2_EXPERIMENTAL_KOKKOSKERNELS_FEATURES 
   72   registerContainer<Ifpack2::BlockTriDiContainer<MatrixType>>(
"BlockTriDi");
 
   74   registeredDefaults = 
true;
 
   77 template<
typename MatrixType>
 
   78 template<
typename ContainerType>
 
   83   table[containerType] = 
Teuchos::rcp(
new Details::ContainerFactoryEntry<MatrixType, ContainerType>());
 
   86 template<
typename MatrixType>
 
   89 build(std::string containerType,
 
   95   if(!registeredDefaults)
 
  100   #ifndef HAVE_IFPACK2_AMESOS2 
  101   if(containerType == 
"SparseAmesos" || containerType == 
"SparseAmesos2")
 
  103     throw std::invalid_argument(
"Container type SparseAmesos (aka SparseAmesos2) was requested but Amesos2 isn't enabled.\n" 
  104                                 "Add the CMake option \"-D Trilinos_ENABLE_Amesos2=ON\" to enable it.");
 
  107   if(containerType == 
"BlockTriDi" && pointIndexed)
 
  109     throw std::runtime_error(
"Ifpack2::BlockTriDi does not support decoupled blocks or split rows.\n");
 
  111   auto it = table.find(containerType);
 
  112   if(it == table.end())
 
  114     std::ostringstream oss;
 
  115     oss << 
"Container type \"" << containerType << 
"\" not registered.\n";
 
  116     oss << 
"Call ContainerFactory<MatrixType>::registerContainer<ContainerType>(containerName) first.\n";
 
  117     oss << 
"Currently registered Container types: ";
 
  120       oss << 
'\"' << r.first << 
"\" ";
 
  123     auto str = oss.str();
 
  124     str = str.substr(0, str.length() - 1);
 
  125     throw std::invalid_argument(str);
 
  127   return it->second->build(A, localRows, importer, pointIndexed);
 
  130 template<
typename MatrixType>
 
  134   auto it = table.find(containerType);
 
  135   if(it != table.end())
 
  143 template<
typename MatrixType>
 
  146 template<
typename MatrixType>
 
  152 #define IFPACK2_CONTAINERFACTORY_INSTANT(S,LO,GO,N) \ 
  153 template struct Ifpack2::ContainerFactory<Tpetra::RowMatrix<S, LO, GO, N>>; 
  155 #endif // IFPACK2_DETAILS_CONTAINERFACTORY_H 
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
 
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
 
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
 
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
 
Ifpack2::ContainerFactory class declaration.