10 #ifndef IFPACK2_BLOCKTRIDICONTAINER_DECL_HPP 
   11 #define IFPACK2_BLOCKTRIDICONTAINER_DECL_HPP 
   16 #include "Ifpack2_config.h" 
   17 #include "Ifpack2_Container.hpp" 
   18 #include "Tpetra_MultiVector.hpp" 
   19 #include "Tpetra_Map.hpp" 
   20 #include "Tpetra_RowMatrix.hpp" 
   21 #include "Tpetra_BlockCrsMatrix_decl.hpp" 
   22 #include <type_traits> 
   78 namespace BlockTriDiContainerDetails {
 
   83 struct ImplSimdTag {};
 
   84 struct ImplSacadoTag {};
 
   87 struct ImplTag { 
typedef ImplNotAvailTag type; };
 
   89 struct ImplTag<float> { 
typedef ImplSimdTag type; };
 
   91 struct ImplTag<double> { 
typedef ImplSimdTag type; };
 
   93 struct ImplTag<std::complex<float> > { 
typedef ImplSimdTag type; };
 
   95 struct ImplTag<std::complex<double> > { 
typedef ImplSimdTag type; };
 
   98 template <
typename MatrixType>
 
  105 template <
typename MatrixType,
 
  114 template <
typename MatrixType>
 
  125   typedef MatrixType matrix_type;
 
  128   typedef typename MatrixType::scalar_type scalar_type;
 
  130 #if KOKKOS_VERSION >= 40799 
  131   typedef typename KokkosKernels::ArithTraits<scalar_type>::magnitudeType magnitude_type;
 
  133   typedef typename Kokkos::ArithTraits<scalar_type>::magnitudeType magnitude_type;
 
  135   typedef typename Container<MatrixType>::local_ordinal_type local_ordinal_type;
 
  138   typedef typename Container<MatrixType>::global_ordinal_type global_ordinal_type;
 
  140   typedef typename Container<MatrixType>::node_type node_type;
 
  142   typedef typename Container<MatrixType>::mv_type mv_type;
 
  143   typedef typename Container<MatrixType>::map_type map_type;
 
  144   typedef typename Container<MatrixType>::vector_type vector_type;
 
  145   typedef typename Container<MatrixType>::import_type import_type;
 
  148   typedef typename Container<MatrixType>::ConstHostView const_host_view_type;
 
  149   typedef host_view_type HostView;
 
  150   typedef const_host_view_type ConstHostView;
 
  154   typedef Tpetra::CrsMatrix<scalar_type, local_ordinal_type, global_ordinal_type, node_type> crs_matrix_type;
 
  155   typedef Tpetra::BlockCrsMatrix<scalar_type, local_ordinal_type, global_ordinal_type, node_type> block_crs_matrix_type;
 
  165   typedef typename Container<MatrixType>::row_matrix_type row_matrix_type;
 
  167   static_assert(std::is_same<MatrixType, row_matrix_type>::value,
 
  168                 "Ifpack2::BlockTriDiContainer: MatrixType must be a Tpetra::RowMatrix specialization.");
 
  210                       const int n_subparts_per_part = 1,
 
  211                       bool overlapCommAndComp       = 
false,
 
  212                       bool useSequentialMethod      = 
false,
 
  213                       const int block_size          = -1,
 
  214                       const bool explicitConversion = 
false);
 
  219   struct ComputeParameters {
 
  226 #if KOKKOS_VERSION >= 40799 
  227     magnitude_type addRadiallyToDiagonal = KokkosKernels::ArithTraits<magnitude_type>::zero();
 
  229     magnitude_type addRadiallyToDiagonal = Kokkos::ArithTraits<magnitude_type>::zero();
 
  234   struct ApplyParameters {
 
  237     bool zeroStartingSolution = 
false;
 
  239 #if KOKKOS_VERSION >= 40799 
  240     scalar_type dampingFactor = KokkosKernels::ArithTraits<scalar_type>::one();
 
  242     scalar_type dampingFactor            = Kokkos::ArithTraits<scalar_type>::one();
 
  244     int maxNumSweeps = 1;
 
  256 #if KOKKOS_VERSION >= 40799 
  257     magnitude_type tolerance = KokkosKernels::ArithTraits<magnitude_type>::zero();
 
  259     magnitude_type tolerance             = Kokkos::ArithTraits<magnitude_type>::zero();
 
  261     int checkToleranceEvery = 1;
 
  278   void clearBlocks() 
override;
 
  285   void initialize() 
override;
 
  288   void compute() 
override;
 
  291   void applyInverseJacobi(
const mv_type& X, mv_type& Y,
 
  292                           scalar_type dampingFactor,
 
  293                           bool zeroStartingSolution = 
false,
 
  294                           int numSweeps             = 1) 
const override;
 
  297   ComputeParameters createDefaultComputeParameters() 
const;
 
  310   void compute(
const ComputeParameters& input);
 
  313   ApplyParameters createDefaultApplyParameters() 
const;
 
  321   int applyInverseJacobi(
const mv_type& X, mv_type& Y,
 
  322                          const ApplyParameters& input) 
const;
 
  327   const magnitude_type getNorms0() 
const;
 
  331   const magnitude_type getNormsFinal() 
const;
 
  336   apply(const_host_view_type X,
 
  346   weightedApply(const_host_view_type X,
 
  348                 const_host_view_type W,
 
  361   std::ostream& print(std::ostream& os) 
const override;
 
  368   std::string description() 
const override;
 
  379   static std::string getName();
 
  387   int n_subparts_per_part_;
 
  388   int block_size_ = -1;
 
  393                     const bool overlapCommAndComp,
 
  394                     const bool useSeqMethod,
 
  395                     const int block_size          = -1,
 
  396                     const bool explicitConversion = 
false);
 
  398   void clearInternal();
 
  401   bool shouldUseFusedBlockJacobi(
 
  414 template <
typename MatrixType>
 
  418   typedef typename MatrixType::scalar_type scalar_type;
 
  419 #if KOKKOS_VERSION >= 40799 
  420   typedef typename KokkosKernels::ArithTraits<scalar_type>::magnitudeType magnitude_type;
 
  422   typedef typename Kokkos::ArithTraits<scalar_type>::magnitudeType magnitude_type;
 
  424   typedef typename Container<MatrixType>::local_ordinal_type local_ordinal_type;
 
  425   typedef typename Container<MatrixType>::global_ordinal_type global_ordinal_type;
 
  427   typedef typename Container<MatrixType>::mv_type mv_type;
 
  428   typedef typename Container<MatrixType>::import_type import_type;
 
  431   typedef typename Container<MatrixType>::ConstHostView const_host_view_type;
 
  432   typedef typename Container<MatrixType>::row_matrix_type row_matrix_type;
 
  434   static_assert(std::is_same<MatrixType, row_matrix_type>::value,
 
  435                 "Ifpack2::BlockTriDiContainer: MatrixType must be a Tpetra::RowMatrix specialization.");
 
  447   void clearBlocks()
 override {}
 
  451   void applyInverseJacobi(
const mv_type& X, mv_type& Y,
 
  452                           scalar_type dampingFactor,
 
  453                           bool zeroStartingSolution = 
false,
 
  454                           int numSweeps             = 1)
 const override {}
 
  457   apply(const_host_view_type X,
 
  465   weightedApply(const_host_view_type X,
 
  467                 const_host_view_type W,
 
  473   std::ostream& 
print(std::ostream& os)
 const override {
 
  474     return os << 
"Ifpack2::BlockTriDiContainer::ImplNotAvailTag";
 
  477   std::string description()
 const override {
 
  478     return "Ifpack2::BlockTriDiContainer::ImplNotAvailTag";
 
  485     out << 
"Ifpack2::BlockTriDiContainer::ImplNotAvailTag";
 
  488   static std::string getName() {
 
  489     return "Ifpack2::BlockTriDiContainer::ImplNotAvailTag";
 
  495 #endif  // IFPACK2_BLOCKTRIDICONTAINER_DECL_HPP 
Definition: Ifpack2_BlockTriDiContainer_decl.hpp:82
void compute() override
Extract the local diagonal blocks and prepare the solver. 
Definition: Ifpack2_BlockTriDiContainer_decl.hpp:450
Store and solve local block tridiagonal linear problems. 
Definition: Ifpack2_BlockTriDiContainer_decl.hpp:107
void initialize() override
Do all set-up operations that only require matrix structure. 
Definition: Ifpack2_BlockTriDiContainer_decl.hpp:449
#define TEUCHOS_TEST_FOR_EXCEPT_MSG(throw_exception_test, msg)
forward declaration 
Definition: Ifpack2_BlockTriDiContainer_decl.hpp:99
typename mv_type::dual_view_type::t_host HostView
Definition: Ifpack2_Container_decl.hpp:109
std::ostream & print(std::ostream &os) const override
Print basic information about the container to os. 
Definition: Ifpack2_BlockTriDiContainer_decl.hpp:473
void setParameters(const Teuchos::ParameterList &List) override
Set parameters, if any. 
Definition: Ifpack2_BlockTriDiContainer_decl.hpp:446
static const EVerbosityLevel verbLevel_default
Interface for creating and solving a set of local linear problems. 
Definition: Ifpack2_Container_decl.hpp:79