43 #ifndef IFPACK2_RELAXATION_DECL_HPP 44 #define IFPACK2_RELAXATION_DECL_HPP 48 #include "Ifpack2_Parameters.hpp" 49 #include "Tpetra_Vector.hpp" 50 #include "Teuchos_ScalarTraits.hpp" 51 #include "Tpetra_CrsMatrix_decl.hpp" 52 #include "Tpetra_Experimental_BlockCrsMatrix_decl.hpp" 53 #include <type_traits> 221 template<
class MatrixType>
224 typename MatrixType::local_ordinal_type,
225 typename MatrixType::global_ordinal_type,
226 typename MatrixType::node_type>,
228 typename MatrixType::local_ordinal_type,
229 typename MatrixType::global_ordinal_type,
230 typename MatrixType::node_type> >
249 typedef typename Teuchos::ScalarTraits<scalar_type>::magnitudeType
magnitude_type;
252 typedef Tpetra::RowMatrix<scalar_type, local_ordinal_type,
255 static_assert(std::is_same<MatrixType, row_matrix_type>::value,
"Ifpack2::Relaxation: Please use MatrixType = Tpetra::RowMatrix. This saves build times, library sizes, and executable sizes. Don't worry, this class still works with CrsMatrix and BlockCrsMatrix; those are both subclasses of RowMatrix.");
294 explicit Relaxation (
const Teuchos::RCP<const row_matrix_type>& A);
380 void setParameters (
const Teuchos::ParameterList& params);
383 Teuchos::RCP<const Teuchos::ParameterList>
398 return isInitialized_;
443 setMatrix (
const Teuchos::RCP<const row_matrix_type>& A);
465 apply (
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 Teuchos::ETransp mode = Teuchos::NO_TRANS,
468 scalar_type alpha = Teuchos::ScalarTraits<scalar_type>::one(),
469 scalar_type beta = Teuchos::ScalarTraits<scalar_type>::zero())
const;
472 Teuchos::RCP<const Tpetra::Map<local_ordinal_type,global_ordinal_type,node_type> >
473 getDomainMap ()
const;
476 Teuchos::RCP<const Tpetra::Map<local_ordinal_type,global_ordinal_type,node_type> >
477 getRangeMap ()
const;
480 bool hasTransposeApply ()
const;
495 applyMat (
const Tpetra::MultiVector<scalar_type,local_ordinal_type,global_ordinal_type,node_type>& X,
496 Tpetra::MultiVector<scalar_type,local_ordinal_type,global_ordinal_type,node_type>& Y,
497 Teuchos::ETransp mode = Teuchos::NO_TRANS)
const;
504 Teuchos::RCP<const Teuchos::Comm<int> > getComm()
const;
507 Teuchos::RCP<const row_matrix_type> getMatrix ()
const;
510 double getComputeFlops()
const;
513 double getApplyFlops()
const;
516 int getNumInitialize()
const;
519 int getNumCompute()
const;
522 int getNumApply()
const;
525 double getInitializeTime()
const;
528 double getComputeTime()
const;
531 double getApplyTime()
const;
543 std::string description ()
const;
568 describe (Teuchos::FancyOStream &out,
569 const Teuchos::EVerbosityLevel verbLevel =
570 Teuchos::Describable::verbLevel_default)
const;
577 typedef Teuchos::ScalarTraits<scalar_type> STS;
578 typedef Teuchos::ScalarTraits<magnitude_type> STM;
584 typedef Tpetra::CrsMatrix<scalar_type, local_ordinal_type,
585 global_ordinal_type, node_type> crs_matrix_type;
586 typedef Tpetra::Experimental::BlockCrsMatrix<scalar_type, local_ordinal_type,
587 global_ordinal_type, node_type> block_crs_matrix_type;
588 typedef Tpetra::Experimental::BlockMultiVector<scalar_type, local_ordinal_type,
589 global_ordinal_type, node_type> block_multivector_type;
608 void setParametersImpl (Teuchos::ParameterList& params);
611 void ApplyInverseJacobi(
612 const Tpetra::MultiVector<scalar_type,local_ordinal_type,global_ordinal_type,node_type>& X,
613 Tpetra::MultiVector<scalar_type,local_ordinal_type,global_ordinal_type,node_type>& Y)
const;
616 void ApplyInverseJacobi_BlockCrsMatrix(
617 const Tpetra::MultiVector<scalar_type,local_ordinal_type,global_ordinal_type,node_type>& X,
618 Tpetra::MultiVector<scalar_type,local_ordinal_type,global_ordinal_type,node_type>& Y)
const;
622 const Tpetra::MultiVector<scalar_type,local_ordinal_type,global_ordinal_type,node_type>& X,
623 Tpetra::MultiVector<scalar_type,local_ordinal_type,global_ordinal_type,node_type>& Y)
const;
626 void ApplyInverseGS_RowMatrix(
627 const Tpetra::MultiVector<scalar_type,local_ordinal_type,global_ordinal_type,node_type>& X,
628 Tpetra::MultiVector<scalar_type,local_ordinal_type,global_ordinal_type,node_type>& Y)
const;
632 ApplyInverseGS_CrsMatrix (
const crs_matrix_type& A,
633 const Tpetra::MultiVector<scalar_type,local_ordinal_type,global_ordinal_type,node_type>& X,
634 Tpetra::MultiVector<scalar_type,local_ordinal_type,global_ordinal_type,node_type>& Y)
const;
638 ApplyInverseGS_BlockCrsMatrix (
const block_crs_matrix_type& A,
639 const Tpetra::MultiVector<scalar_type,local_ordinal_type,global_ordinal_type,node_type>& X,
640 Tpetra::MultiVector<scalar_type,local_ordinal_type,global_ordinal_type,node_type>& Y);
643 void ApplyInverseSGS(
644 const Tpetra::MultiVector<scalar_type,local_ordinal_type,global_ordinal_type,node_type>& X,
645 Tpetra::MultiVector<scalar_type,local_ordinal_type,global_ordinal_type,node_type>& Y)
const;
648 void ApplyInverseSGS_RowMatrix(
649 const Tpetra::MultiVector<scalar_type,local_ordinal_type,global_ordinal_type,node_type>& X,
650 Tpetra::MultiVector<scalar_type,local_ordinal_type,global_ordinal_type,node_type>& Y)
const;
654 ApplyInverseSGS_CrsMatrix (
const crs_matrix_type& A,
655 const Tpetra::MultiVector<scalar_type,local_ordinal_type,global_ordinal_type,node_type>& X,
656 Tpetra::MultiVector<scalar_type,local_ordinal_type,global_ordinal_type,node_type>& Y)
const;
660 ApplyInverseSGS_BlockCrsMatrix (
const block_crs_matrix_type& A,
661 const Tpetra::MultiVector<scalar_type,local_ordinal_type,global_ordinal_type,node_type>& X,
662 Tpetra::MultiVector<scalar_type,local_ordinal_type,global_ordinal_type,node_type>& Y);
664 void computeBlockCrs ();
677 mutable Teuchos::RCP<const Teuchos::ParameterList> validParams_;
680 Teuchos::RCP<const row_matrix_type> A_;
682 Teuchos::RCP<Teuchos::Time> Time_;
684 Teuchos::RCP<const Tpetra::Import<local_ordinal_type,global_ordinal_type,node_type> > Importer_;
686 Teuchos::RCP<Tpetra::Vector<scalar_type,local_ordinal_type,global_ordinal_type,node_type> > Diagonal_;
689 typedef Kokkos::View<
typename block_crs_matrix_type::impl_scalar_type***,
690 typename block_crs_matrix_type::device_type> block_diag_type;
691 typedef Kokkos::View<
typename block_crs_matrix_type::impl_scalar_type***,
692 typename block_crs_matrix_type::device_type,
693 Kokkos::MemoryUnmanaged> unmanaged_block_diag_type;
709 block_diag_type blockDiag_;
711 typedef Kokkos::View<int**, typename block_crs_matrix_type::device_type> pivots_type;
712 typedef Kokkos::View<
int**,
typename block_crs_matrix_type::device_type,
713 Kokkos::MemoryUnmanaged> unmanaged_pivots_type;
728 pivots_type blockDiagFactPivots_;
730 Teuchos::RCP<block_multivector_type> yBlockColumnPointMap_;
735 Details::RelaxationType PrecType_;
737 scalar_type DampingFactor_;
741 bool ZeroStartingSolution_;
747 magnitude_type L1Eta_;
749 scalar_type MinDiagonalValue_;
751 bool fixTinyDiagEntries_;
753 bool checkDiagEntries_;
764 mutable int NumApply_;
766 double InitializeTime_;
770 mutable double ApplyTime_;
772 double ComputeFlops_;
774 mutable double ApplyFlops_;
777 magnitude_type globalMinMagDiagEntryMag_;
779 magnitude_type globalMaxMagDiagEntryMag_;
781 size_t globalNumSmallDiagEntries_;
783 size_t globalNumZeroDiagEntries_;
785 size_t globalNumNegDiagEntries_;
790 magnitude_type globalDiagNormDiff_;
797 Teuchos::ArrayRCP<size_t> diagOffsets_;
803 bool savedDiagOffsets_;
805 bool hasBlockCrsMatrix_;
808 Teuchos::ArrayRCP<local_ordinal_type> localSmoothingIndices_;
815 #endif // IFPACK2_RELAXATION_DECL_HPP Mix-in interface for preconditioners that can change their matrix after construction.
Definition: Ifpack2_Details_CanChangeMatrix.hpp:93
MatrixType::node_type node_type
The Node type used by the input MatrixType.
Definition: Ifpack2_Relaxation_decl.hpp:246
Interface for all Ifpack2 preconditioners.
Definition: Ifpack2_Preconditioner.hpp:107
bool isComputed() const
Return true if compute() has been called.
Definition: Ifpack2_Relaxation_decl.hpp:412
MatrixType::global_ordinal_type global_ordinal_type
The type of global indices in the input MatrixType.
Definition: Ifpack2_Relaxation_decl.hpp:243
Declaration of interface for preconditioners that can change their matrix after construction.
Definition: Ifpack2_Details_Amesos2Wrapper_decl.hpp:63
MatrixType::local_ordinal_type local_ordinal_type
The type of local indices in the input MatrixType.
Definition: Ifpack2_Relaxation_decl.hpp:240
MatrixType::scalar_type scalar_type
The type of the entries of the input MatrixType.
Definition: Ifpack2_Relaxation_decl.hpp:237
bool isInitialized() const
Returns true if the preconditioner has been successfully initialized.
Definition: Ifpack2_Relaxation_decl.hpp:397
Relaxation preconditioners for Tpetra::RowMatrix and Tpetra::CrsMatrix sparse matrices.
Definition: Ifpack2_Relaxation_decl.hpp:222
Preconditioners and smoothers for Tpetra sparse matrices.
Definition: Ifpack2_AdditiveSchwarz_decl.hpp:72
void getValidParameters(Teuchos::ParameterList ¶ms)
Fills a list which contains all the parameters possibly used by Ifpack2.
Definition: Ifpack2_Parameters.cpp:50
Tpetra::RowMatrix< scalar_type, local_ordinal_type, global_ordinal_type, node_type > row_matrix_type
Tpetra::RowMatrix specialization used by this class.
Definition: Ifpack2_Relaxation_decl.hpp:253
Teuchos::ScalarTraits< scalar_type >::magnitudeType magnitude_type
The type of the magnitude (absolute value) of a matrix entry.
Definition: Ifpack2_Relaxation_decl.hpp:249