46 #ifndef IFPACK2_CRSRILUK_DECL_HPP 47 #define IFPACK2_CRSRILUK_DECL_HPP 51 #include "Tpetra_CrsMatrix_decl.hpp" 56 #include <type_traits> 242 template<
class MatrixType>
245 typename MatrixType::local_ordinal_type,
246 typename MatrixType::global_ordinal_type,
247 typename MatrixType::node_type>,
249 typename MatrixType::local_ordinal_type,
250 typename MatrixType::global_ordinal_type,
251 typename MatrixType::node_type> >
267 typedef typename Teuchos::ScalarTraits<scalar_type>::magnitudeType
magnitude_type;
270 typedef Tpetra::RowMatrix<scalar_type,
275 static_assert(std::is_same<MatrixType, row_matrix_type>::value,
"Ifpack2::RILUK: The template parameter MatrixType must be a Tpetra::RowMatrix specialization. Please don't use Tpetra::CrsMatrix (a subclass of Tpetra::RowMatrix) here anymore.");
278 typedef Tpetra::CrsMatrix<scalar_type,
283 template <
class NewMatrixType>
friend class RILUK;
288 RILUK (
const Teuchos::RCP<const row_matrix_type>& A_in);
297 RILUK (
const Teuchos::RCP<const crs_matrix_type>& A_in);
310 template <
typename NewMatrixType>
311 Teuchos::RCP< RILUK< NewMatrixType > >
312 clone (
const Teuchos::RCP<const NewMatrixType>& A_newnode)
const;
324 void setParameters (
const Teuchos::ParameterList& params);
341 return isInitialized_;
350 return numInitialize_;
363 return initializeTime_;
400 setMatrix (
const Teuchos::RCP<const row_matrix_type>& A);
407 std::string description ()
const;
414 Teuchos::RCP<const Tpetra::Map<local_ordinal_type,global_ordinal_type,node_type> >
415 getDomainMap ()
const;
418 Teuchos::RCP<const Tpetra::Map<local_ordinal_type,global_ordinal_type,node_type> >
419 getRangeMap ()
const;
451 apply (
const Tpetra::MultiVector<scalar_type,local_ordinal_type,global_ordinal_type,node_type>& X,
452 Tpetra::MultiVector<scalar_type,local_ordinal_type,global_ordinal_type,node_type>& Y,
453 Teuchos::ETransp mode = Teuchos::NO_TRANS,
454 scalar_type alpha = Teuchos::ScalarTraits<scalar_type>::one (),
455 scalar_type beta = Teuchos::ScalarTraits<scalar_type>::zero ())
const;
481 multiply (
const Tpetra::MultiVector<scalar_type,local_ordinal_type,global_ordinal_type,node_type>& X,
482 Tpetra::MultiVector<scalar_type,local_ordinal_type,global_ordinal_type,node_type>& Y,
483 const Teuchos::ETransp mode = Teuchos::NO_TRANS)
const;
487 Teuchos::RCP<const row_matrix_type> getMatrix ()
const;
505 TEUCHOS_TEST_FOR_EXCEPTION(
506 true, std::logic_error,
"Ifpack2::RILUK::SetOverlapMode: " 507 "RILUK no longer implements overlap on its own. " 508 "Use RILUK with AdditiveSchwarz if you want overlap.");
513 return getL ().getGlobalNumEntries () + getU ().getGlobalNumEntries ();
517 Teuchos::RCP<Ifpack2::IlukGraph<Tpetra::CrsGraph<local_ordinal_type,global_ordinal_type,node_type> > >
getGraph ()
const {
522 const crs_matrix_type& getL ()
const;
525 const Tpetra::Vector<scalar_type,local_ordinal_type,global_ordinal_type,node_type>&
529 const crs_matrix_type& getU ()
const;
532 Teuchos::RCP<const crs_matrix_type> getCrsMatrix ()
const;
535 typedef Tpetra::MultiVector<scalar_type,local_ordinal_type,global_ordinal_type,node_type> MV;
536 typedef Teuchos::ScalarTraits<scalar_type> STS;
537 typedef Teuchos::ScalarTraits<magnitude_type> STM;
539 void allocate_L_and_U();
540 void initAllValues (
const row_matrix_type& A);
547 static Teuchos::RCP<const row_matrix_type>
548 makeLocalFilter (
const Teuchos::RCP<const row_matrix_type>& A);
551 typedef Tpetra::Vector<scalar_type,local_ordinal_type,global_ordinal_type,node_type> vec_type;
554 Teuchos::RCP<const row_matrix_type>
A_;
571 Teuchos::RCP<crs_matrix_type>
L_;
573 Teuchos::RCP<crs_matrix_type>
U_;
575 Teuchos::RCP<vec_type>
D_;
585 mutable int numApply_;
587 double initializeTime_;
589 mutable double applyTime_;
591 magnitude_type RelaxValue_;
592 magnitude_type Athresh_;
593 magnitude_type Rthresh_;
603 template<
class MatrixType,
class NodeType>
604 struct setLocalSolveParams{
605 static Teuchos::RCP<Teuchos::ParameterList>
606 setParams (
const Teuchos::RCP<Teuchos::ParameterList>& param) {
612 template <
class MatrixType>
613 template <
typename NewMatrixType>
614 Teuchos::RCP<RILUK<NewMatrixType> >
616 clone (
const Teuchos::RCP<const NewMatrixType>& A_newnode)
const 618 using Teuchos::ParameterList;
622 typedef typename NewMatrixType::scalar_type new_scalar_type;
623 typedef typename NewMatrixType::local_ordinal_type new_local_ordinal_type;
624 typedef typename NewMatrixType::global_ordinal_type new_global_ordinal_type;
625 typedef typename NewMatrixType::node_type new_node_type;
626 typedef Tpetra::RowMatrix<new_scalar_type, new_local_ordinal_type,
627 new_global_ordinal_type, new_node_type> new_row_matrix_type;
630 RCP<new_riluk_type> new_riluk = rcp (
new new_riluk_type (A_newnode));
632 RCP<ParameterList> plClone = Teuchos::parameterList ();
633 plClone = detail::setLocalSolveParams<NewMatrixType, new_node_type>::setParams (plClone);
635 RCP<new_node_type> new_node = A_newnode->getNode ();
636 new_riluk->L_ = L_->clone (new_node, plClone);
637 new_riluk->U_ = U_->clone (new_node, plClone);
638 new_riluk->D_ = D_->clone (new_node);
640 new_riluk->LevelOfFill_ = LevelOfFill_;
642 new_riluk->isAllocated_ = isAllocated_;
643 new_riluk->isInitialized_ = isInitialized_;
644 new_riluk->isComputed_ = isComputed_;
646 new_riluk->numInitialize_ = numInitialize_;
647 new_riluk->numCompute_ = numCompute_;
648 new_riluk->numApply_ = numApply_;
650 new_riluk->RelaxValue_ = RelaxValue_;
651 new_riluk->Athresh_ = Athresh_;
652 new_riluk->Rthresh_ = Rthresh_;
Mix-in interface for preconditioners that can change their matrix after construction.
Definition: Ifpack2_Details_CanChangeMatrix.hpp:93
Declaration and definition of IlukGraph.
magnitude_type getRelaxValue() const
Get RILU(k) relaxation parameter.
Definition: Ifpack2_RILUK_decl.hpp:492
magnitude_type getAbsoluteThreshold() const
Get absolute threshold value.
Definition: Ifpack2_RILUK_decl.hpp:495
Ifpack2::ScalingType enumerable type.
MatrixType::global_ordinal_type global_ordinal_type
The type of global indices in the input MatrixType.
Definition: Ifpack2_RILUK_decl.hpp:261
Teuchos::RCP< crs_matrix_type > L_
The L (lower triangular) factor of ILU(k).
Definition: Ifpack2_RILUK_decl.hpp:571
Tpetra::RowMatrix< scalar_type, local_ordinal_type, global_ordinal_type, node_type > row_matrix_type
Tpetra::RowMatrix specialization used by this class.
Definition: Ifpack2_RILUK_decl.hpp:273
double getApplyTime() const
Total time in seconds taken by all successful apply() calls for this object.
Definition: Ifpack2_RILUK_decl.hpp:370
ILU(k) factorization of a given Tpetra::RowMatrix.
Definition: Ifpack2_RILUK_decl.hpp:243
Tpetra::CombineMode getOverlapMode()
Get overlap mode type.
Definition: Ifpack2_RILUK_decl.hpp:504
Teuchos::RCP< Ifpack2::IlukGraph< Tpetra::CrsGraph< local_ordinal_type, global_ordinal_type, node_type > > > getGraph() const
Return the Ifpack2::IlukGraph associated with this factored matrix.
Definition: Ifpack2_RILUK_decl.hpp:517
bool isComputed() const
Whether compute() has been called on this object.
Definition: Ifpack2_RILUK_decl.hpp:344
Tpetra::CrsMatrix< scalar_type, local_ordinal_type, global_ordinal_type, node_type > crs_matrix_type
Tpetra::CrsMatrix specialization used by this class for representing L and U.
Definition: Ifpack2_RILUK_decl.hpp:275
MatrixType::node_type node_type
The Node type used by the input MatrixType.
Definition: Ifpack2_RILUK_decl.hpp:264
MatrixType::local_ordinal_type local_ordinal_type
The type of local indices in the input MatrixType.
Definition: Ifpack2_RILUK_decl.hpp:258
Teuchos::RCP< const crs_matrix_type > A_local_crs_
The matrix used to to compute ILU(k).
Definition: Ifpack2_RILUK_decl.hpp:568
int getLevelOfFill() const
Get level of fill (the "k" in ILU(k)).
Definition: Ifpack2_RILUK_decl.hpp:501
Teuchos::RCP< Ifpack2::IlukGraph< Tpetra::CrsGraph< local_ordinal_type, global_ordinal_type, node_type > > > Graph_
The ILU(k) graph.
Definition: Ifpack2_RILUK_decl.hpp:559
Interface for all Ifpack2 preconditioners.
Definition: Ifpack2_Preconditioner.hpp:107
magnitude_type getRelativeThreshold() const
Get relative threshold value.
Definition: Ifpack2_RILUK_decl.hpp:498
Teuchos::ScalarTraits< scalar_type >::magnitudeType magnitude_type
The type of the magnitude (absolute value) of a matrix entry.
Definition: Ifpack2_RILUK_decl.hpp:267
Construct a level filled graph for use in computing an ILU(k) incomplete factorization.
Definition: Ifpack2_IlukGraph.hpp:97
Declaration of interface for preconditioners that can change their matrix after construction.
bool isInitialized() const
Whether initialize() has been called on this object.
Definition: Ifpack2_RILUK_decl.hpp:340
Teuchos::RCP< const row_matrix_type > A_
The (original) input matrix for which to compute ILU(k).
Definition: Ifpack2_RILUK_decl.hpp:554
Definition: Ifpack2_Details_Amesos2Wrapper_decl.hpp:63
double getComputeTime() const
Total time in seconds taken by all successful compute() calls for this object.
Definition: Ifpack2_RILUK_decl.hpp:366
Teuchos::RCP< vec_type > D_
The diagonal entries of the ILU(k) factorization.
Definition: Ifpack2_RILUK_decl.hpp:575
int getNumCompute() const
Number of successful compute() calls for this object.
Definition: Ifpack2_RILUK_decl.hpp:353
int getNumApply() const
Number of successful apply() calls for this object.
Definition: Ifpack2_RILUK_decl.hpp:357
Tpetra::global_size_t getGlobalNumEntries() const
Returns the number of nonzero entries in the global graph.
Definition: Ifpack2_RILUK_decl.hpp:512
Preconditioners and smoothers for Tpetra sparse matrices.
Definition: Ifpack2_AdditiveSchwarz_decl.hpp:72
double getInitializeTime() const
Total time in seconds taken by all successful initialize() calls for this object. ...
Definition: Ifpack2_RILUK_decl.hpp:362
Teuchos::RCP< crs_matrix_type > U_
The U (upper triangular) factor of ILU(k).
Definition: Ifpack2_RILUK_decl.hpp:573
int getNumInitialize() const
Number of successful initialize() calls for this object.
Definition: Ifpack2_RILUK_decl.hpp:349
MatrixType::scalar_type scalar_type
The type of the entries of the input MatrixType.
Definition: Ifpack2_RILUK_decl.hpp:255