Reference documentation for deal.II version Git 497f915867 2021-09-17 22:46:48 +0200
\(\newcommand{\dealvcentcolon}{\mathrel{\mathop{:}}}\) \(\newcommand{\dealcoloneq}{\dealvcentcolon\mathrel{\mkern-1.2mu}=}\) \(\newcommand{\jump}[1]{\left[\!\left[ #1 \right]\!\right]}\) \(\newcommand{\average}[1]{\left\{\!\left\{ #1 \right\}\!\right\}}\)
Classes | Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Protected Attributes | List of all members
TrilinosWrappers::SolverCG Class Reference

#include <deal.II/lac/trilinos_solver.h>

Inheritance diagram for TrilinosWrappers::SolverCG:
[legend]

Classes

struct  AdditionalData
 

Public Types

enum  SolverName {
  cg, cgs, gmres, bicgstab,
  tfqmr
}
 

Public Member Functions

 SolverCG (SolverControl &cn, const AdditionalData &data=AdditionalData())
 
void solve (const SparseMatrix &A, MPI::Vector &x, const MPI::Vector &b, const PreconditionBase &preconditioner)
 
void solve (const Epetra_Operator &A, MPI::Vector &x, const MPI::Vector &b, const PreconditionBase &preconditioner)
 
void solve (const Epetra_Operator &A, MPI::Vector &x, const MPI::Vector &b, const Epetra_Operator &preconditioner)
 
void solve (const Epetra_Operator &A, Epetra_MultiVector &x, const Epetra_MultiVector &b, const PreconditionBase &preconditioner)
 
void solve (const Epetra_Operator &A, Epetra_MultiVector &x, const Epetra_MultiVector &b, const Epetra_Operator &preconditioner)
 
void solve (const SparseMatrix &A, ::Vector< double > &x, const ::Vector< double > &b, const PreconditionBase &preconditioner)
 
void solve (Epetra_Operator &A, ::Vector< double > &x, const ::Vector< double > &b, const PreconditionBase &preconditioner)
 
void solve (const SparseMatrix &A, ::LinearAlgebra::distributed::Vector< double > &x, const ::LinearAlgebra::distributed::Vector< double > &b, const PreconditionBase &preconditioner)
 
void solve (Epetra_Operator &A, ::LinearAlgebra::distributed::Vector< double > &x, const ::LinearAlgebra::distributed::Vector< double > &b, const PreconditionBase &preconditioner)
 
SolverControlcontrol () const
 
template<>
void set_preconditioner (AztecOO &solver, const PreconditionBase &preconditioner)
 
template<>
void set_preconditioner (AztecOO &solver, const Epetra_Operator &preconditioner)
 

Static Public Member Functions

static ::ExceptionBaseExcTrilinosError (int arg1)
 

Public Attributes

enum TrilinosWrappers::SolverBase::SolverName solver_name
 

Protected Attributes

const AdditionalData additional_data
 
SolverControlsolver_control
 

Detailed Description

An implementation of the solver interface using the Trilinos CG solver.

Definition at line 362 of file trilinos_solver.h.

Member Enumeration Documentation

◆ SolverName

Enumeration object that is set in the constructor of the derived classes and tells Trilinos which solver to use. This option can also be set in the user program, so one might use this base class instead of one of the specialized derived classes when the solver should be set at runtime. Currently enabled options are:

Enumerator
cg 

Use the conjugate gradient (CG) algorithm.

cgs 

Use the conjugate gradient squared (CGS) algorithm.

gmres 

Use the generalized minimum residual (GMRES) algorithm.

bicgstab 

Use the biconjugate gradient stabilized (BICGStab) algorithm.

tfqmr 

Use the transpose-free quasi-minimal residual (TFQMR) method.

Definition at line 76 of file trilinos_solver.h.

Constructor & Destructor Documentation

◆ SolverCG()

Constructor. In contrast to deal.II's own solvers, there is no need to give a vector memory object.

The last argument takes a structure with additional, solver dependent flags for tuning.

Definition at line 600 of file trilinos_solver.cc.

Member Function Documentation

◆ solve() [1/9]

void SolverBase< VectorType >::solve ( const SparseMatrix A,
MPI::Vector x,
const MPI::Vector b,
const PreconditionBase preconditioner 
)
inherited

Solve the linear system Ax=b. Depending on the information provided by derived classes and the object passed as a preconditioner, one of the linear solvers and preconditioners of Trilinos is chosen.

Definition at line 76 of file trilinos_solver.cc.

◆ solve() [2/9]

void SolverBase< VectorType >::solve ( const Epetra_Operator A,
MPI::Vector x,
const MPI::Vector b,
const PreconditionBase preconditioner 
)
inherited

Solve the linear system Ax=b where A is an operator. This function can be used for matrix free computation. Depending on the information provided by derived classes and the object passed as a preconditioner, one of the linear solvers and preconditioners of Trilinos is chosen.

Definition at line 96 of file trilinos_solver.cc.

◆ solve() [3/9]

void SolverBase< VectorType >::solve ( const Epetra_Operator A,
MPI::Vector x,
const MPI::Vector b,
const Epetra_Operator preconditioner 
)
inherited

Solve the linear system Ax=b where both A and its preconditioner are an operator. This function can be used when both A and the preconditioner are LinearOperators derived from a TrilinosPayload. Depending on the information provided by derived classes and the object passed as a preconditioner, one of the linear solvers and preconditioners of Trilinos is chosen.

Definition at line 117 of file trilinos_solver.cc.

◆ solve() [4/9]

void SolverBase< VectorType >::solve ( const Epetra_Operator A,
Epetra_MultiVector &  x,
const Epetra_MultiVector &  b,
const PreconditionBase preconditioner 
)
inherited

Solve the linear system Ax=b where A is an operator, and the vectors x and b are native Trilinos vector types. This function can be used when A is a LinearOperators derived from a TrilinosPayload. Depending on the information provided by derived classes and the object passed as a preconditioner, one of the linear solvers and preconditioners of Trilinos is chosen.

Definition at line 138 of file trilinos_solver.cc.

◆ solve() [5/9]

void SolverBase< VectorType >::solve ( const Epetra_Operator A,
Epetra_MultiVector &  x,
const Epetra_MultiVector &  b,
const Epetra_Operator preconditioner 
)
inherited

Solve the linear system Ax=b where both A and its preconditioner are an operator, and the vectors x and b are native Trilinos vector types. This function can be used when both A and the preconditioner are LinearOperators derived from a TrilinosPayload. Depending on the information provided by derived classes and the object passed as a preconditioner, one of the linear solvers and preconditioners of Trilinos is chosen.

Definition at line 159 of file trilinos_solver.cc.

◆ solve() [6/9]

void SolverBase< VectorType >::solve ( const SparseMatrix A,
::Vector< double > &  x,
const ::Vector< double > &  b,
const PreconditionBase preconditioner 
)
inherited

Solve the linear system Ax=b. Depending on the information provided by derived classes and the object passed as a preconditioner, one of the linear solvers and preconditioners of Trilinos is chosen. This class works with matrices according to the TrilinosWrappers format, but can take deal.II vectors as argument. Since deal.II are serial vectors (not distributed), this function does only what you expect in case the matrix is locally owned. Otherwise, an exception will be thrown.

Definition at line 178 of file trilinos_solver.cc.

◆ solve() [7/9]

void SolverBase< VectorType >::solve ( Epetra_Operator A,
::Vector< double > &  x,
const ::Vector< double > &  b,
const PreconditionBase preconditioner 
)
inherited

Solve the linear system Ax=b where A is an operator. This function can be used for matrix free computations. Depending on the information provided by derived classes and the object passed as a preconditioner, one of the linear solvers and preconditioners of Trilinos is chosen. This class works with matrices according to the TrilinosWrappers format, but can take deal.II vectors as argument. Since deal.II are serial vectors (not distributed), this function does only what you expect in case the matrix is locally owned. Otherwise, an exception will be thrown.

Definition at line 208 of file trilinos_solver.cc.

◆ solve() [8/9]

void SolverBase< VectorType >::solve ( const SparseMatrix A,
::LinearAlgebra::distributed::Vector< double > &  x,
const ::LinearAlgebra::distributed::Vector< double > &  b,
const PreconditionBase preconditioner 
)
inherited

Solve the linear system Ax=b for deal.II's parallel distributed vectors. Depending on the information provided by derived classes and the object passed as a preconditioner, one of the linear solvers and preconditioners of Trilinos is chosen.

Definition at line 228 of file trilinos_solver.cc.

◆ solve() [9/9]

void SolverBase< VectorType >::solve ( Epetra_Operator A,
::LinearAlgebra::distributed::Vector< double > &  x,
const ::LinearAlgebra::distributed::Vector< double > &  b,
const PreconditionBase preconditioner 
)
inherited

Solve the linear system Ax=b where A is an operator. This function can be used for matrix free computation. Depending on the information provided by derived classes and the object passed as a preconditioner, one of the linear solvers and preconditioners of Trilinos is chosen.

Definition at line 256 of file trilinos_solver.cc.

◆ control()

SolverControl & SolverBase< VectorType >::control ( ) const
inherited

Access to object that controls convergence.

Definition at line 68 of file trilinos_solver.cc.

◆ set_preconditioner() [1/2]

void SolverBase<>::set_preconditioner ( AztecOO &  solver,
const PreconditionBase preconditioner 
)
inherited

Definition at line 565 of file trilinos_solver.cc.

◆ set_preconditioner() [2/2]

void SolverBase<>::set_preconditioner ( AztecOO &  solver,
const Epetra_Operator preconditioner 
)
inherited

Definition at line 583 of file trilinos_solver.cc.

Member Data Documentation

◆ additional_data

const AdditionalData TrilinosWrappers::SolverCG::additional_data
protected

Store a copy of the flags for this particular solver.

Definition at line 390 of file trilinos_solver.h.

◆ solver_name

enum TrilinosWrappers::SolverBase::SolverName TrilinosWrappers::SolverBase::solver_name
inherited

◆ solver_control

SolverControl& TrilinosWrappers::SolverBase::solver_control
protectedinherited

Reference to the object that controls convergence of the iterative solver. In fact, for these Trilinos wrappers, Trilinos does so itself, but we copy the data from this object before starting the solution process, and copy the data back into it afterwards.

Definition at line 300 of file trilinos_solver.h.


The documentation for this class was generated from the following files: