13#ifndef dealii_trilinos_tpetra_precondition_h
14#define dealii_trilinos_tpetra_precondition_h
24#ifdef DEAL_II_TRILINOS_WITH_TPETRA
31# include <Teuchos_BLAS_types.hpp>
32# include <Teuchos_ConfigDefs.hpp>
33# include <Teuchos_ParameterList.hpp>
34# include <Teuchos_RCPDecl.hpp>
35# include <Tpetra_Operator.hpp>
41#ifdef DEAL_II_TRILINOS_WITH_TPETRA
44 namespace TpetraWrappers
53 template <
typename Number,
typename MemorySpace = ::MemorySpace::Host>
129 Teuchos::RCP<TpetraTypes::LinearOperator<Number, MemorySpace>>
169 <<
"The sparse matrix the preconditioner is based on "
170 <<
"uses a map that is not compatible to the one in vector " << arg1
171 <<
". Check preconditioner and matrix setup.");
178 "The chosen preconditioner does not support transposing the matrix.");
186 Teuchos::RCP<TpetraTypes::LinearOperator<Number, MemorySpace>>
204# ifdef DEAL_II_TRILINOS_WITH_IFPACK2
214 template <
typename Number,
typename MemorySpace = ::MemorySpace::Host>
244 template <
typename Number,
typename MemorySpace = ::MemorySpace::Host>
272 <<
"You tried to select the preconditioner type <" << arg1 <<
">\n"
273 <<
"but this preconditioner is not supported by Trilinos/Ifpack22\n"
274 <<
"due to one of the following reasons:\n"
275 <<
"* This preconditioner does not exist\n"
276 <<
"* This preconditioner has a specialized constructor not supported by the Ifpack2 Factory.\n"
277 <<
"* This preconditioner is not (yet) supported by Trilinos/Ifpack2\n"
278 <<
"* Trilinos/Ifpack2 was not configured for its use.");
303 template <
typename Number,
typename MemorySpace = ::MemorySpace::Host>
347 template <
typename Number,
typename MemorySpace = ::MemorySpace::Host>
429 template <
typename Number,
typename MemorySpace = ::MemorySpace::Host>
514 template <
typename Number,
typename MemorySpace = ::MemorySpace::Host>
538 const double eta = 1.5,
607 template <
typename Number,
typename MemorySpace = ::MemorySpace::Host>
698 template <
typename Number,
typename MemorySpace = ::MemorySpace::Host>
790 template <
typename Number,
typename MemorySpace = ::MemorySpace::Host>
900 template <
typename Number,
typename MemorySpace = ::MemorySpace::Host>
982 template <
typename Number,
typename MemorySpace = ::MemorySpace::Host>
1084 template <
typename Number,
typename MemorySpace = ::MemorySpace::Host>
1106 const double omega = 1.,
1162 template <
typename Number,
typename MemorySpace = ::MemorySpace::Host>
1183 const double omega = 1,
1235 template <
typename Number,
typename MemorySpace = ::MemorySpace::Host>
1256 const double omega = 1,
1296# ifdef DEAL_II_TRILINOS_WITH_TPETRA_MUELU
1316 template <
typename Number,
typename MemorySpace = ::MemorySpace::Host>
1326 <<
"You tried to select the smoother type <" << arg1 <<
">\n"
1327 <<
"but this is not supported by our interface\n"
1328 <<
"due to one of the following reasons:\n"
1329 <<
"* This smoother does not exist\n"
1330 <<
"* This smoother is not (yet) supported by our interface\n"
1331 <<
"* This smoother is not (yet) supported by MueLu.\n");
1335 <<
"You tried to select the coarse solver type <" << arg1 <<
">\n"
1336 <<
"but this is not supported by our interface\n"
1337 <<
"due to one of the following reasons:\n"
1338 <<
"* This coarse solver does not exist\n"
1339 <<
"* This coarse solver is not (yet) supported by our interface\n"
1340 <<
"* This coarse solver is not (yet) supported by MueLu.\n");
1389 std::vector<std::vector<bool>>(0),
1505 const Teuchos::ParameterList ¶meters);
1524# ifdef DEAL_II_TRILINOS_WITH_SHYLU_DDFROSCH
1538 template <
typename Number,
typename MemorySpace = ::MemorySpace::Host>
1545 enum PreconditionerType
1615 IPOUHarmonicCoarseOperator,
1629 struct AdditionalData
1632 const unsigned int overlap = 1,
1633 const unsigned int dimension = 2,
1634 const enum CombineMethod combine_values_in_overlap = Restricted,
1635 const enum SolverName subdomain_solver = KLU,
1636 const enum CoarseType coarse_operator_type =
1637 IPOUHarmonicCoarseOperator,
1638 const enum SolverName extension_solver = KLU,
1639 const enum SolverName coarse_solver = KLU);
1644 unsigned int overlap;
1649 unsigned int dimension;
1673 enum CombineMethod combine_values_in_overlap;
1688 enum SolverName subdomain_solver;
1701 enum CoarseType coarse_operator_type;
1708 enum SolverName extension_solver;
1715 enum SolverName coarse_solver;
1730 const enum PreconditionerType precondition_type = OneLevel);
1739 set_parameter_list(
const Teuchos::ParameterList ¶meter_list);
1749 const AdditionalData &additional_data = AdditionalData());
1762 template <
int dim,
int spacedim = dim>
1766 const AdditionalData &additional_data = AdditionalData());
1777 const enum PreconditionerType precondition_type;
1784 bool user_provided_parameter_list;
void initialize(const SparseMatrix< Number, MemorySpace > &A, const Teuchos::ParameterList ¶meters)
Full control interface for constructing a MueLu preconditioner.
PreconditionAMGMueLu()=default
void initialize(const SparseMatrix< Number, MemorySpace > &A, const AdditionalData &additional_data=AdditionalData())
Simplified interface for constructing a MueLu preconditioner.
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()
Destructor. Destroys the preconditioner, leaving an object like just after having called the construc...
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.
void initialize(const SparseMatrix< Number, MemorySpace > &A, const AdditionalData &additional_data=AdditionalData())
Compute the preconditioner based on the given matrix and parameters.
PreconditionBlockJacobi()
Constructor.
The class for the Block SOR preconditioner within Ifpack2.
void initialize(const SparseMatrix< Number, MemorySpace > &A, const AdditionalData &additional_data=AdditionalData())
The class for the Block SSOR preconditioner within Ifpack2.
void initialize(const SparseMatrix< Number, MemorySpace > &A, const AdditionalData &additional_data=AdditionalData())
PreconditionChebyshev()
Constructor.
void initialize(const SparseMatrix< Number, MemorySpace > &A, const AdditionalData &additional_data=AdditionalData())
Compute the preconditioner based on the given matrix and parameters.
PreconditionILUT()
Constructor.
void initialize(const SparseMatrix< Number, MemorySpace > &A, const AdditionalData &additional_data=AdditionalData())
Compute the preconditioner based on the given matrix and parameters.
The ILU/ILU(K)/RILU(K) preconditioner.
void initialize(const SparseMatrix< Number, MemorySpace > &A, const AdditionalData &additional_data=AdditionalData())
Compute the preconditioner based on the given matrix and parameters.
PreconditionILU()
Constructor.
Wrapper class for the IdentitySolver preconditioner of Ifpack2.
void initialize(const SparseMatrix< Number, MemorySpace > &A)
Initializes the preconditioner for the matrix A.
PreconditionIdentity()=default
Construct identity preconditioner.
The base class for all Ifpack2 preconditioners which are handled through its Factory.
std::string preconditioner_type
PreconditionIfpackBase(const std::string &preconditioner_type)
Constructor.
void initialize(const SparseMatrix< Number, MemorySpace > &A)
Wrapper to create custom Ifpack2 preconditioners.
void set_parameter_list(Teuchos::ParameterList ¶meter_list)
Set the parameter list for the preconditioner.
PreconditionIfpack(const std::string &preconditioner_type)
Construct a new custom Ifpack2 preconditioner.
The classical Jacobi preconditioner within Ifpack2.
PreconditionJacobi()
Constructor.
void initialize(const SparseMatrix< Number, MemorySpace > &A, const AdditionalData &additional_data=AdditionalData())
Compute the preconditioner based on the given matrix and parameters.
l1 variant of the Gauss-Seidel preconditioner.
void initialize(const SparseMatrix< Number, MemorySpace > &A, const AdditionalData &additional_data=AdditionalData())
Compute the preconditioner based on the given matrix and parameters.
PreconditionL1GaussSeidel()
Constructor.
l1 variant of the Jacobi preconditioner.
void initialize(const SparseMatrix< Number, MemorySpace > &A, const AdditionalData &additional_data=AdditionalData())
Compute the preconditioner based on the given matrix and parameters.
PreconditionL1Jacobi()
Constructor.
The class for the SOR preconditioner within Ifpack2.
PreconditionSOR()
Constructor.
void initialize(const SparseMatrix< Number, MemorySpace > &A, const AdditionalData &additional_data=AdditionalData())
Compute the preconditioner based on the given matrix and parameters.
void initialize(const SparseMatrix< Number, MemorySpace > &A, const AdditionalData &additional_data=AdditionalData())
Compute the preconditioner based on the given matrix and parameters.
PreconditionSSOR()
Constructor.
#define DEAL_II_NAMESPACE_OPEN
#define DEAL_II_NAMESPACE_CLOSE
static ::ExceptionBase & ExcTrilinosMueLuSmootherUnsupported(std::string arg1)
static ::ExceptionBase & ExcTrilinosIpack2PreconditionerUnsupported(std::string arg1)
static ::ExceptionBase & ExcNonMatchingMaps(std::string arg1)
#define DeclExceptionMsg(Exception, defaulttext)
#define DeclException1(Exception1, type1, outsequence)
static ::ExceptionBase & ExcTransposeNotSupported()
static ::ExceptionBase & ExcTrilinosMueLuCoarseSolverUnsupported(std::string arg1)
Tpetra::Operator< Number, LO, GO, NodeType< MemorySpace > > LinearOperator
The set of additional parameters to tune the preconditioner.
AdditionalData(const bool elliptic=true, const bool symmetric=true, const bool w_cycle=false, const double aggregation_threshold=1e-4, const std::vector< std::vector< bool > > &constant_modes=std::vector< std::vector< bool > >(0), const int smoother_sweeps=2, const int smoother_overlap=0, const bool output_details=false, const std::string &smoother_type="Chebyshev", const std::string &coarse_type="KLU2")
Constructor.
bool elliptic
Optimize for elliptic problems.
std::vector< std::vector< bool > > constant_modes
std::string smoother_type
Determines which smoother to use for the AMG cycle The following possibilities are implemented in thi...
std::string coarse_type
Type of smoother to use on the finer levels.
int smoother_sweeps
Number of times pre- and post-smoothing are applied.
int smoother_overlap
Determine the overlap in the smoother when run in parallel.
bool symmetric
Assume A is symmetric.
bool w_cycle
Use W cycle instead of V cycle.
bool output_details
Print internal information details of MueLu to screen.
double aggregation_threshold
Threshold for coarsening.
Standardized data struct to pipe additional flags to the preconditioner.
The set of additional parameters to tune the preconditioner.
int block_overlap
Amount of overlap between blocks.
double omega
Relaxation damping factor.
int n_local_parts
Number of blocks per processor.
int n_sweeps
Set how often the preconditioner should be applied during vmult() or Tvmult().
AdditionalData(const int n_local_parts=1, const double omega=1., const int block_overlap=0, const int n_sweeps=1)
Constructor.
The set of additional parameters to tune the preconditioner.
int n_local_parts
Number of blocks per processor.
int n_sweeps
Set how often the preconditioner should be applied during vmult() or Tvmult().
int overlap
Overlap between processor local matrices.
AdditionalData(const int n_local_parts=1, const double omega=1, const int overlap=0, const int n_sweeps=1)
Constructor.
double omega
Relaxation damping factor.
The set of additional parameters to tune the preconditioner.
int overlap
Overlap between processor local matrices.
int n_local_parts
Number of blocks per processor.
int n_sweeps
Set how often the preconditioner should be applied during vmult() or Tvmult().
AdditionalData(const int n_local_parts=1, const double omega=1, const int overlap=1, const int n_sweeps=1)
Constructor.
double omega
Relaxation damping factor.
The set of additional parameters to tune the preconditioner.
double eigenvalue_ratio
Estimated ratio between maximum and minimum eigenvalue.
AdditionalData(const int degree=1, const double max_eigenvalue=10., const double min_eigenvalue=1., const double eigenvalue_ratio=30., const double min_diagonal=1e-12, const bool nonzero_starting=false)
Constructor.
int degree
Degree of the Chebyshev polynomial.
bool nonzero_starting
Do not zero starting entries of solution vector.
double min_diagonal
Threshold below which entries will be fixed.
The set of additional parameters to tune the preconditioner.
AdditionalData(const double ilut_drop=0., const double ilut_fill=0., const double ilut_atol=0., const double ilut_rtol=1., const int overlap=0)
Constructor.
double ilut_rtol
Factor to scale all diagonal entries by before factorization.
double ilut_fill
Amount of additional fill-in.
double ilut_atol
Constant to be added to each diagonal entry before factorization.
int overlap
Overlap between processor local matrices.
double ilut_drop
Threshold for dropping entries.
The set of additional parameters to tune the preconditioner.
double ilu_atol
Constant to be added to each diagonal entry before factorization.
int ilu_fill
Amount of additional fill-in.
AdditionalData(const int ilu_fill=0, const double ilu_atol=0., const double ilu_rtol=1., const int overlap=0)
Constructor.
double ilu_rtol
Factor to scale all diagonal entries by before factorization.
int overlap
Overlap between processor local matrices.
The set of additional parameters to tune the preconditioner.
double omega
Relaxation damping factor.
int n_sweeps
Set how often the preconditioner should be applied during vmult() or Tvmult().
double min_diagonal
Threshold below which entries will be fixed.
bool fix_diagonal
Whether or not to enlarge entries below a threshold.
AdditionalData(const double omega=1., const bool fix_diagonal=false, const double min_diagonal=0., const int n_sweeps=1)
Constructor.
The set of additional parameters to tune the preconditioner.
bool fix_diagonal
Whether or not to enlarge entries below a threshold.
double eta
Threshold parameter for diagonal correction.
double omega
Relaxation damping factor.
int n_sweeps
Set how often the preconditioner should be applied during vmult() or Tvmult().
AdditionalData(const double omega=1, const double eta=1.5, const bool fix_diagonal=false, const double min_diagonal=0, const int n_sweeps=1)
Constructor.
double min_diagonal
Threshold below which entries will be fixed.
The set of additional parameters to tune the preconditioner.
double omega
Relaxation damping factor.
AdditionalData(const double omega=1., const bool fix_diagonal=false, const double min_diagonal=0., const int n_sweeps=1)
Constructor.
bool fix_diagonal
Whether or not to enlarge entries below a threshold.
double min_diagonal
Threshold below which entries will be fixed.
int n_sweeps
Set how often the preconditioner should be applied during vmult() or Tvmult().
The set of additional parameters to tune the preconditioner.
bool fix_diagonal
Whether or not to enlarge entries below a threshold.
double omega
Relaxation damping factor.
int overlap
Overlap between processor local matrices.
AdditionalData(const double omega=1., const int overlap=0, const bool fix_diagonal=false, const double min_diagonal=0., const int n_sweeps=1)
Constructor.
int n_sweeps
Set how often the preconditioner should be applied during vmult() or Tvmult().
double min_diagonal
Threshold below which entries will be fixed.
The set of additional parameters to tune the preconditioner.
bool fix_diagonal
Whether or not to enlarge entries below a threshold.
int n_sweeps
Set how often the preconditioner should be applied during vmult() or Tvmult().
AdditionalData(const double omega=1., const int overlap=0, const bool fix_diagonal=false, const double min_diagonal=0., const int n_sweeps=1)
Constructor.
double min_diagonal
Threshold below which entries will be fixed.
int overlap
Overlap between processor local matrices.
double omega
Relaxation damping factor.