15#ifndef dealii_trilinos_tpetra_precondition_h
16#define dealii_trilinos_tpetra_precondition_h
26#include <Teuchos_BLAS_types.hpp>
29#ifdef DEAL_II_TRILINOS_WITH_TPETRA
36# include <Teuchos_ConfigDefs.hpp>
37# include <Teuchos_ParameterList.hpp>
38# include <Teuchos_RCPDecl.hpp>
39# include <Tpetra_Operator.hpp>
46 namespace TpetraWrappers
55 template <
typename Number,
typename MemorySpace = ::MemorySpace::Host>
133 Teuchos::RCP<TpetraTypes::LinearOperator<Number, MemorySpace>>
173 <<
"The sparse matrix the preconditioner is based on "
174 <<
"uses a map that is not compatible to the one in vector " << arg1
175 <<
". Check preconditioner and matrix setup.");
182 "The chosen preconditioner does not support transposing the matrix.");
190 Teuchos::RCP<TpetraTypes::LinearOperator<Number, MemorySpace>>
209# ifdef DEAL_II_TRILINOS_WITH_IFPACK2
219 template <
typename Number,
typename MemorySpace = ::MemorySpace::Host>
250 template <
typename Number,
typename MemorySpace = ::MemorySpace::Host>
251 class PreconditionIfpackBase :
public PreconditionBase<Number, MemorySpace>
263 PreconditionIfpackBase(
const std::string &preconditioner_type);
277 ExcTrilinosIpack2PreconditionerUnsupported,
279 <<
"You tried to select the preconditioner type <" << arg1 <<
">\n"
280 <<
"but this preconditioner is not supported by Trilinos/Ifpack22\n"
281 <<
"due to one of the following reasons:\n"
282 <<
"* This preconditioner does not exist\n"
283 <<
"* This preconditioner has a specialized constructor not supported by the Ifpack2 Factory.\n"
284 <<
"* This preconditioner is not (yet) supported by Trilinos/Ifpack2\n"
285 <<
"* Trilinos/Ifpack2 was not configured for its use.");
292 std::string preconditioner_type;
310 template <
typename Number,
typename MemorySpace = ::MemorySpace::Host>
311 class PreconditionIfpack
312 :
public PreconditionIfpackBase<Number, MemorySpace>
331 PreconditionIfpack(
const std::string &preconditioner_type);
343 set_parameter_list(Teuchos::ParameterList ¶meter_list);
355 template <
typename Number,
typename MemorySpace = ::MemorySpace::Host>
357 :
public PreconditionIfpackBase<Number, MemorySpace>
364 struct AdditionalData
377 AdditionalData(
const double omega = 1.,
378 const bool fix_diagonal =
false,
379 const double min_diagonal = 0.,
380 const int n_sweeps = 1);
424 const AdditionalData &additional_data = AdditionalData());
439 template <
typename Number,
typename MemorySpace = ::MemorySpace::Host>
440 class PreconditionL1Jacobi
441 :
public PreconditionIfpackBase<Number, MemorySpace>
448 struct AdditionalData
462 AdditionalData(
const double omega = 1.,
463 const bool fix_diagonal =
false,
464 const double min_diagonal = 0.,
465 const int n_sweeps = 1);
500 PreconditionL1Jacobi();
510 const AdditionalData &additional_data = AdditionalData());
526 template <
typename Number,
typename MemorySpace = ::MemorySpace::Host>
527 class PreconditionL1GaussSeidel
528 :
public PreconditionIfpackBase<Number, MemorySpace>
535 struct AdditionalData
550 AdditionalData(
const double omega = 1,
551 const double eta = 1.5,
552 const bool fix_diagonal =
false,
553 const double min_diagonal = 0,
554 const int n_sweeps = 1);
598 PreconditionL1GaussSeidel();
608 const AdditionalData &additional_data = AdditionalData());
622 template <
typename Number,
typename MemorySpace = ::MemorySpace::Host>
623 class PreconditionSOR :
public PreconditionIfpackBase<Number, MemorySpace>
630 struct AdditionalData
644 AdditionalData(
const double omega = 1.,
645 const int overlap = 0,
646 const bool fix_diagonal =
false,
647 const double min_diagonal = 0.,
648 const int n_sweeps = 1);
703 const AdditionalData &additional_data = AdditionalData());
714 template <
typename Number,
typename MemorySpace = ::MemorySpace::Host>
722 struct AdditionalData
736 AdditionalData(
const double omega = 1.,
737 const int overlap = 0,
738 const bool fix_diagonal =
false,
739 const double min_diagonal = 0.,
740 const int n_sweeps = 1);
796 const AdditionalData &additional_data = AdditionalData());
807 template <
typename Number,
typename MemorySpace = ::MemorySpace::Host>
809 :
public PreconditionIfpackBase<Number, MemorySpace>
816 struct AdditionalData
828 AdditionalData(
const int degree = 1,
829 const double max_eigenvalue = 10.,
830 const double min_eigenvalue = 1.,
831 const double eigenvalue_ratio = 30.,
832 const double min_diagonal = 1e-12,
833 const bool nonzero_starting =
false);
849 double max_eigenvalue;
854 double min_eigenvalue;
859 double eigenvalue_ratio;
880 bool nonzero_starting;
897 const AdditionalData &additional_data = AdditionalData());
919 template <
typename Number,
typename MemorySpace = ::MemorySpace::Host>
920 class PreconditionILU :
public PreconditionIfpackBase<Number, MemorySpace>
927 struct AdditionalData
942 AdditionalData(
const int ilu_fill = 0,
943 const double ilu_atol = 0.,
944 const double ilu_rtol = 1.,
945 const int overlap = 0);
991 const AdditionalData &additional_data = AdditionalData());
1003 template <
typename Number,
typename MemorySpace = ::MemorySpace::Host>
1004 class PreconditionILUT :
public PreconditionIfpackBase<Number, MemorySpace>
1011 struct AdditionalData
1027 AdditionalData(
const double ilut_drop = 0.,
1028 const double ilut_fill = 0.,
1029 const double ilut_atol = 0.,
1030 const double ilut_rtol = 1.,
1031 const int overlap = 0);
1088 const AdditionalData &additional_data = AdditionalData());
1106 template <
typename Number,
typename MemorySpace = ::MemorySpace::Host>
1108 :
public PreconditionIfpackBase<Number, MemorySpace>
1115 struct AdditionalData
1128 AdditionalData(
const int n_local_parts = 1,
1129 const double omega = 1.,
1130 const int block_overlap = 0,
1131 const int n_sweeps = 1);
1172 const AdditionalData &additional_data = AdditionalData());
1186 template <
typename Number,
typename MemorySpace = ::MemorySpace::Host>
1188 :
public PreconditionIfpackBase<Number, MemorySpace>
1195 struct AdditionalData
1207 AdditionalData(
const int n_local_parts = 1,
1208 const double omega = 1,
1209 const int overlap = 0,
1210 const int n_sweeps = 1);
1245 const AdditionalData &additional_data = AdditionalData());
1259 template <
typename Number,
typename MemorySpace = ::MemorySpace::Host>
1261 :
public PreconditionIfpackBase<Number, MemorySpace>
1268 struct AdditionalData
1280 AdditionalData(
const int n_local_parts = 1,
1281 const double omega = 1,
1282 const int overlap = 1,
1283 const int n_sweeps = 1);
1317 const AdditionalData &additional_data = AdditionalData());
IndexSet locally_owned_range_indices() const
virtual void Tvmult(Vector< Number, MemorySpace > &dst, const Vector< Number, MemorySpace > &src) const
Apply the transpose preconditioner.
IndexSet locally_owned_domain_indices() const
Teuchos::ParameterList parameter_list
The list of preconditioner parameters.
void clear()
Desctructor. Destroys the preconditioner, leaving an object like just after having called the constru...
virtual void vmult(::Vector< Number > &dst, ::Vector< Number > &src) const
Apply the preconditioner.
Teuchos::RCP< TpetraTypes::LinearOperator< Number, MemorySpace > > preconditioner
Teuchos::RCP< TpetraTypes::LinearOperator< Number, MemorySpace > > trilinos_rcp() const
Access to underlying Trilinos data.
virtual void Tvmult(::Vector< Number > &dst, ::Vector< Number > &src) const
Apply the transpose preconditioner.
PreconditionBase()=default
Constructor. Does not do anything. The initialize function of the derived classes will have to create...
const TpetraTypes::LinearOperator< Number, MemorySpace > & trilinos_operator() const
Access to underlying Trilinos data.
virtual void vmult(Vector< Number, MemorySpace > &dst, const Vector< Number, MemorySpace > &src) const
Apply the preconditioner.
#define DEAL_II_NAMESPACE_OPEN
#define DEAL_II_NAMESPACE_CLOSE
static ::ExceptionBase & ExcNonMatchingMaps(std::string arg1)
#define DeclExceptionMsg(Exception, defaulttext)
#define DeclException1(Exception1, type1, outsequence)
static ::ExceptionBase & ExcTransposeNotSupported()
PETScWrappers::PreconditionILU PreconditionILU
Tpetra::Operator< Number, LO, GO, NodeType< MemorySpace > > LinearOperator
Standardized data struct to pipe additional flags to the preconditioner.