43 #ifndef IFPACK2_DENSECONTAINER_DECL_HPP
44 #define IFPACK2_DENSECONTAINER_DECL_HPP
51 #include "Ifpack2_Details_LapackSupportsScalar.hpp"
52 #include "Tpetra_MultiVector.hpp"
53 #include "Tpetra_Map.hpp"
54 #include "Tpetra_RowMatrix.hpp"
56 #include "Tpetra_Experimental_BlockCrsMatrix_decl.hpp"
106 template<
class MatrixType,
class LocalScalarType,
110 template<
class MatrixType,
class LocalScalarType>
122 typedef MatrixType matrix_type;
124 typedef LocalScalarType local_scalar_type;
126 typedef typename Kokkos::Details::ArithTraits<local_scalar_type>::val_type local_impl_scalar_type;
129 typedef typename Container<MatrixType>::scalar_type scalar_type;
131 typedef typename Container<MatrixType>::local_ordinal_type local_ordinal_type;
133 typedef typename Container<MatrixType>::global_ordinal_type global_ordinal_type;
135 typedef typename Container<MatrixType>::node_type node_type;
137 typedef typename Container<MatrixType>::mv_type mv_type;
138 typedef Tpetra::MultiVector<local_scalar_type, local_ordinal_type, global_ordinal_type, node_type> local_mv_type;
139 typedef Tpetra::Vector<local_scalar_type, local_ordinal_type, global_ordinal_type, node_type> local_vector_type;
140 typedef typename Container<MatrixType>::map_type map_type;
141 typedef typename Container<MatrixType>::vector_type vector_type;
143 typedef typename Container<MatrixType>::import_type import_type;
145 typedef typename Container<MatrixType>::HostView HostView;
146 typedef typename local_mv_type::dual_view_type::t_host HostViewLocal;
148 static_assert(std::is_same<MatrixType, Tpetra::RowMatrix<scalar_type, local_ordinal_type, global_ordinal_type, node_type>>::value,
149 "Ifpack2::DenseContainer: Please use MatrixType = Tpetra::RowMatrix.");
159 typedef typename Container<MatrixType>::row_matrix_type row_matrix_type;
161 typedef Tpetra::Experimental::BlockCrsMatrix<scalar_type, local_ordinal_type, global_ordinal_type, node_type> block_crs_matrix_type;
185 scalar_type DampingFactor);
198 virtual bool isInitialized ()
const {
199 return IsInitialized_;
203 virtual bool isComputed ()
const {
215 virtual void initialize ();
218 virtual void compute ();
222 applyBlockCrs (HostView& X,
242 weightedApply (HostView& X,
260 virtual std::ostream& print (std::ostream& os)
const;
267 virtual std::string description ()
const;
278 static std::string getName();
283 DenseContainer (
const DenseContainer<MatrixType, LocalScalarType>& rhs);
286 void extractBlockCrs ();
305 applyImpl (HostViewLocal& X,
310 const local_scalar_type alpha,
311 const local_scalar_type beta)
const;
314 applyImplBlockCrs (HostViewLocal& X,
319 const local_scalar_type alpha,
320 const local_scalar_type beta)
const;
323 std::vector<Teuchos::SerialDenseMatrix<int, local_scalar_type>> diagBlocks_;
326 mutable std::vector<HostViewLocal> X_local;
329 mutable std::vector<HostViewLocal> Y_local;
341 bool hasBlockCrsMatrix_;
344 local_scalar_type* scalars_;
350 template<
class MatrixType,
class LocalScalarType>
351 class DenseContainer<MatrixType, LocalScalarType, false> :
352 public Container<MatrixType> {
362 typedef MatrixType matrix_type;
364 typedef LocalScalarType local_scalar_type;
366 typedef typename Kokkos::Details::ArithTraits<local_scalar_type>::val_type local_impl_scalar_type;
369 typedef typename Container<MatrixType>::scalar_type scalar_type;
371 typedef typename Container<MatrixType>::local_ordinal_type local_ordinal_type;
373 typedef typename Container<MatrixType>::global_ordinal_type global_ordinal_type;
375 typedef typename Container<MatrixType>::node_type node_type;
377 typedef typename Container<MatrixType>::mv_type mv_type;
378 typedef Tpetra::MultiVector<local_scalar_type, local_ordinal_type, global_ordinal_type, node_type> local_mv_type;
379 typedef Tpetra::Vector<local_scalar_type, local_ordinal_type, global_ordinal_type, node_type> local_vector_type;
380 typedef typename Container<MatrixType>::map_type map_type;
381 typedef typename Container<MatrixType>::vector_type vector_type;
382 typedef typename Container<MatrixType>::partitioner_type partitioner_type;
383 typedef typename Container<MatrixType>::import_type import_type;
385 typedef typename Container<MatrixType>::HostView HostView;
386 typedef typename local_mv_type::dual_view_type::t_host HostViewLocal;
388 static_assert(std::is_same<MatrixType, Tpetra::RowMatrix<scalar_type, local_ordinal_type, global_ordinal_type, node_type>>::value,
389 "Ifpack2::DenseContainer: Please use MatrixType = Tpetra::RowMatrix.");
399 typedef typename Container<MatrixType>::row_matrix_type row_matrix_type;
401 typedef Tpetra::Experimental::BlockCrsMatrix<scalar_type, local_ordinal_type, global_ordinal_type, node_type> block_crs_matrix_type;
425 scalar_type DampingFactor);
431 virtual ~DenseContainer ();
438 virtual bool isInitialized ()
const {
439 return IsInitialized_;
443 virtual bool isComputed ()
const {
455 virtual void initialize ();
458 virtual void compute ();
462 applyBlockCrs (HostView& X,
482 weightedApply (HostView& X,
500 virtual std::ostream& print (std::ostream& os)
const;
507 virtual std::string description ()
const;
518 static std::string getName();
523 DenseContainer (
const DenseContainer<MatrixType, LocalScalarType>& rhs);
526 void extractBlockCrs ();
545 applyImpl (HostViewLocal& X,
550 const local_scalar_type alpha,
551 const local_scalar_type beta)
const;
554 applyImplBlockCrs (HostViewLocal& X,
559 const local_scalar_type alpha,
560 const local_scalar_type beta)
const;
563 std::vector<Teuchos::SerialDenseMatrix<int, local_scalar_type>> diagBlocks_;
566 mutable std::vector<HostViewLocal> X_local;
569 mutable std::vector<HostViewLocal> Y_local;
581 bool hasBlockCrsMatrix_;
584 local_scalar_type* scalars_;
592 #endif // IFPACK2_DENSECONTAINER_DECL_HPP
Ifpack2::Container class declaration.
Declaration and definition of the Ifpack2::Details::MultiVectorLocalGatherScatter class...
Ifpack2::Partitioner:
Definition: Ifpack2_Partitioner.hpp:179
Store and solve a local dense linear problem.
Definition: Ifpack2_DenseContainer_decl.hpp:108
static const EVerbosityLevel verbLevel_default
Interface for creating and solving a local linear problem.
Definition: Ifpack2_Container.hpp:114
Type traits class that says whether Teuchos::LAPACK has a valid implementation for the given ScalarTy...
Definition: Ifpack2_Details_LapackSupportsScalar.hpp:17