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" 55 #include "Teuchos_SerialDenseMatrix.hpp" 56 #include "Tpetra_Experimental_BlockCrsMatrix_decl.hpp" 105 template<
class MatrixType,
106 class LocalScalarType,
107 const bool supportsLocalScalarType =
113 template<
typename MatrixType,
typename LocalScalarType>
139 static_assert(std::is_same<MatrixType,
140 Tpetra::RowMatrix<
typename MatrixType::scalar_type,
141 typename MatrixType::local_ordinal_type,
142 typename MatrixType::global_ordinal_type,
143 typename MatrixType::node_type> >::value,
144 "Ifpack2::DenseContainer: Please use MatrixType = Tpetra::RowMatrix.");
154 typedef typename Container<MatrixType>::row_matrix_type
row_matrix_type;
156 typedef Tpetra::Experimental::BlockCrsMatrix<scalar_type, local_ordinal_type,
157 global_ordinal_type, node_type> block_crs_matrix_type;
176 DenseContainer (
const Teuchos::RCP<const row_matrix_type>& matrix,
177 const Teuchos::ArrayView<const local_ordinal_type>& localRows);
196 return IsInitialized_;
205 virtual void setParameters(
const Teuchos::ParameterList& List);
212 virtual void initialize ();
215 virtual void compute ();
219 applyBlockCrs (
const Tpetra::MultiVector<scalar_type,local_ordinal_type,global_ordinal_type,node_type>& X,
220 Tpetra::MultiVector<scalar_type,local_ordinal_type,global_ordinal_type,node_type>& Y,
221 Teuchos::ETransp mode=Teuchos::NO_TRANS,
222 scalar_type alpha=Teuchos::ScalarTraits<scalar_type>::one(),
223 scalar_type beta=Teuchos::ScalarTraits<scalar_type>::zero())
const;
227 apply (
const Tpetra::MultiVector<scalar_type,local_ordinal_type,global_ordinal_type,node_type>& X,
228 Tpetra::MultiVector<scalar_type,local_ordinal_type,global_ordinal_type,node_type>& Y,
229 Teuchos::ETransp mode=Teuchos::NO_TRANS,
230 scalar_type alpha=Teuchos::ScalarTraits<scalar_type>::one(),
231 scalar_type beta=Teuchos::ScalarTraits<scalar_type>::zero())
const;
235 weightedApply (
const Tpetra::MultiVector<scalar_type,local_ordinal_type,global_ordinal_type,node_type>& X,
236 Tpetra::MultiVector<scalar_type,local_ordinal_type,global_ordinal_type,node_type>& Y,
237 const Tpetra::Vector<scalar_type,local_ordinal_type,global_ordinal_type,node_type>& D,
238 Teuchos::ETransp mode=Teuchos::NO_TRANS,
239 scalar_type alpha=Teuchos::ScalarTraits<scalar_type>::one(),
240 scalar_type beta=Teuchos::ScalarTraits<scalar_type>::zero())
const;
249 virtual std::ostream& print (std::ostream& os)
const;
256 virtual std::string description ()
const;
260 describe (Teuchos::FancyOStream &out,
261 const Teuchos::EVerbosityLevel verbLevel =
262 Teuchos::Describable::verbLevel_default)
const;
271 void extractBlockCrs (
const Teuchos::RCP<const block_crs_matrix_type>& globalMatrix);
274 void extract (
const Teuchos::RCP<const row_matrix_type>& globalMatrix);
281 typedef Tpetra::MultiVector<local_scalar_type, local_ordinal_type,
282 global_ordinal_type, node_type> local_mv_type;
284 typedef Tpetra::Experimental::BlockMultiVector<local_scalar_type, local_ordinal_type,
285 global_ordinal_type, node_type> local_block_mv_type;
296 applyImpl (
const local_mv_type& X,
298 Teuchos::ETransp mode,
299 const local_scalar_type alpha,
300 const local_scalar_type beta)
const;
303 applyImplBlockCrs (
const local_mv_type& X,
305 Teuchos::ETransp mode,
306 const local_scalar_type alpha,
307 const local_scalar_type beta)
const;
309 bool hasBlockCrsMatrix_;
317 Teuchos::SerialDenseMatrix<int, local_scalar_type> diagBlock_;
320 Teuchos::Array<int> ipiv_;
323 Teuchos::RCP<const Tpetra::Map<local_ordinal_type, global_ordinal_type, node_type> > localMap_;
326 mutable Teuchos::RCP<local_mv_type> Y_;
329 mutable Teuchos::RCP<local_mv_type> X_;
331 mutable Teuchos::RCP<local_block_mv_type> blockY_;
332 mutable Teuchos::RCP<local_block_mv_type> blockX_;
343 template<
class MatrixType,
class LocalScalarType>
369 static_assert(std::is_same<MatrixType,
370 Tpetra::RowMatrix<
typename MatrixType::scalar_type,
371 typename MatrixType::local_ordinal_type,
372 typename MatrixType::global_ordinal_type,
373 typename MatrixType::node_type> >::value,
374 "Ifpack2::DenseContainer: Please use MatrixType = Tpetra::RowMatrix.");
384 typedef typename Container<MatrixType>::row_matrix_type
row_matrix_type;
386 typedef Tpetra::Experimental::BlockCrsMatrix<scalar_type, local_ordinal_type,
387 global_ordinal_type, node_type> block_crs_matrix_type;
406 DenseContainer (
const Teuchos::RCP<const row_matrix_type>& matrix,
407 const Teuchos::ArrayView<const local_ordinal_type>& localRows);
426 return IsInitialized_;
435 virtual void setParameters(
const Teuchos::ParameterList& List);
442 virtual void initialize ();
445 virtual void compute ();
449 applyBlockCrs (
const Tpetra::MultiVector<scalar_type,local_ordinal_type,global_ordinal_type,node_type>& X,
450 Tpetra::MultiVector<scalar_type,local_ordinal_type,global_ordinal_type,node_type>& Y,
451 Teuchos::ETransp mode=Teuchos::NO_TRANS,
452 scalar_type alpha=Teuchos::ScalarTraits<scalar_type>::one(),
453 scalar_type beta=Teuchos::ScalarTraits<scalar_type>::zero())
const;
457 apply (
const Tpetra::MultiVector<scalar_type,local_ordinal_type,global_ordinal_type,node_type>& X,
458 Tpetra::MultiVector<scalar_type,local_ordinal_type,global_ordinal_type,node_type>& Y,
459 Teuchos::ETransp mode=Teuchos::NO_TRANS,
460 scalar_type alpha=Teuchos::ScalarTraits<scalar_type>::one(),
461 scalar_type beta=Teuchos::ScalarTraits<scalar_type>::zero())
const;
465 weightedApply (
const Tpetra::MultiVector<scalar_type,local_ordinal_type,global_ordinal_type,node_type>& X,
466 Tpetra::MultiVector<scalar_type,local_ordinal_type,global_ordinal_type,node_type>& Y,
467 const Tpetra::Vector<scalar_type,local_ordinal_type,global_ordinal_type,node_type>& D,
468 Teuchos::ETransp mode=Teuchos::NO_TRANS,
469 scalar_type alpha=Teuchos::ScalarTraits<scalar_type>::one(),
470 scalar_type beta=Teuchos::ScalarTraits<scalar_type>::zero())
const;
479 virtual std::ostream& print (std::ostream& os)
const;
486 virtual std::string description ()
const;
490 describe (Teuchos::FancyOStream &out,
491 const Teuchos::EVerbosityLevel verbLevel =
492 Teuchos::Describable::verbLevel_default)
const;
500 void extractBlockCrs (
const Teuchos::RCP<const block_crs_matrix_type>& globalMatrix);
503 void extract (
const Teuchos::RCP<const row_matrix_type>& globalMatrix);
510 typedef Tpetra::MultiVector<local_scalar_type, local_ordinal_type,
511 global_ordinal_type, node_type> local_mv_type;
513 typedef Tpetra::Experimental::BlockMultiVector<local_scalar_type, local_ordinal_type,
514 global_ordinal_type, node_type> local_block_mv_type;
525 applyImpl (
const local_mv_type& X,
527 Teuchos::ETransp mode,
528 const local_scalar_type alpha,
529 const local_scalar_type beta)
const;
532 applyImplBlockCrs (
const local_mv_type& X,
534 Teuchos::ETransp mode,
535 const local_scalar_type alpha,
536 const local_scalar_type beta)
const;
544 Teuchos::SerialDenseMatrix<int, local_scalar_type> diagBlock_;
547 Teuchos::Array<int> ipiv_;
550 Teuchos::RCP<const Tpetra::Map<local_ordinal_type, global_ordinal_type, node_type> > localMap_;
553 mutable Teuchos::RCP<local_mv_type> Y_;
556 mutable Teuchos::RCP<local_mv_type> X_;
558 mutable Teuchos::RCP<local_block_mv_type> blockY_;
559 mutable Teuchos::RCP<local_block_mv_type> blockX_;
570 #endif // IFPACK2_DENSECONTAINER_DECL_HPP virtual bool isComputed() const
Whether the container has been successfully computed.
Definition: Ifpack2_DenseContainer_decl.hpp:430
Ifpack2::Container class declaration.
Container< MatrixType >::row_matrix_type row_matrix_type
The (base class) type of the input matrix.
Definition: Ifpack2_DenseContainer_decl.hpp:374
MatrixType::global_ordinal_type global_ordinal_type
The type of global indices in the input (global) matrix.
Definition: Ifpack2_DenseContainer_decl.hpp:365
virtual bool isInitialized() const
Whether the container has been successfully initialized.
Definition: Ifpack2_DenseContainer_decl.hpp:425
Declaration and definition of the Ifpack2::Details::MultiVectorLocalGatherScatter class...
virtual bool isInitialized() const
Whether the container has been successfully initialized.
Definition: Ifpack2_DenseContainer_decl.hpp:195
Store and solve a local dense linear problem.
Definition: Ifpack2_DenseContainer_decl.hpp:109
LocalScalarType local_scalar_type
The second template parameter of this class.
Definition: Ifpack2_DenseContainer_decl.hpp:358
MatrixType::global_ordinal_type global_ordinal_type
The type of global indices in the input (global) matrix.
Definition: Ifpack2_DenseContainer_decl.hpp:135
Container< MatrixType >::row_matrix_type row_matrix_type
The (base class) type of the input matrix.
Definition: Ifpack2_DenseContainer_decl.hpp:144
MatrixType::local_ordinal_type local_ordinal_type
The type of local indices in the input (global) matrix.
Definition: Ifpack2_DenseContainer_decl.hpp:363
LocalScalarType local_scalar_type
The second template parameter of this class.
Definition: Ifpack2_DenseContainer_decl.hpp:128
MatrixType::node_type node_type
The Node type of the input (global) matrix.
Definition: Ifpack2_DenseContainer_decl.hpp:137
MatrixType::scalar_type scalar_type
The type of entries in the input (global) matrix.
Definition: Ifpack2_DenseContainer_decl.hpp:361
MatrixType matrix_type
The first template parameter of this class.
Definition: Ifpack2_DenseContainer_decl.hpp:126
MatrixType::scalar_type scalar_type
The type of entries in the input (global) matrix.
Definition: Ifpack2_DenseContainer_decl.hpp:131
MatrixType::local_ordinal_type local_ordinal_type
The type of local indices in the input (global) matrix.
Definition: Ifpack2_DenseContainer_decl.hpp:133
virtual bool isComputed() const
Whether the container has been successfully computed.
Definition: Ifpack2_DenseContainer_decl.hpp:200
Interface for creating and solving a local linear problem.
Definition: Ifpack2_Container.hpp:103
MatrixType::node_type node_type
The Node type of the input (global) matrix.
Definition: Ifpack2_DenseContainer_decl.hpp:367
Preconditioners and smoothers for Tpetra sparse matrices.
Definition: Ifpack2_AdditiveSchwarz_decl.hpp:72
MatrixType matrix_type
The first template parameter of this class.
Definition: Ifpack2_DenseContainer_decl.hpp:356
virtual size_t getNumRows() const
The number of rows in the local matrix on the calling process.
Definition: Ifpack2_DenseContainer_decl.hpp:190
virtual size_t getNumRows() const
The number of rows in the local matrix on the calling process.
Definition: Ifpack2_DenseContainer_decl.hpp:420
Type traits class that says whether Teuchos::LAPACK has a valid implementation for the given ScalarTy...
Definition: Ifpack2_Details_LapackSupportsScalar.hpp:17