DOLFIN
DOLFIN C++ interface
Public Member Functions | Static Public Member Functions | List of all members
dolfin::TAOLinearBoundSolver Class Reference

#include <TAOLinearBoundSolver.h>

Inheritance diagram for dolfin::TAOLinearBoundSolver:
Inheritance graph
[legend]
Collaboration diagram for dolfin::TAOLinearBoundSolver:
Collaboration graph
[legend]

Public Member Functions

 TAOLinearBoundSolver (MPI_Comm comm)
 Create TAO bound constrained solver.
 
 TAOLinearBoundSolver (const std::string method="default", const std::string ksp_type="default", const std::string pc_type="default")
 Create TAO bound constrained solver.
 
 ~TAOLinearBoundSolver ()
 Destructor.
 
std::size_t solve (const GenericMatrix &A, GenericVector &x, const GenericVector &b, const GenericVector &xl, const GenericVector &xu)
 
std::size_t solve (const PETScMatrix &A, PETScVector &x, const PETScVector &b, const PETScVector &xl, const PETScVector &xu)
 
void set_solver (const std::string &)
 Set the TAO solver type.
 
void set_ksp (const std::string ksp_type="default")
 Set PETSC Krylov Solver (ksp) used by TAO.
 
Tao tao () const
 Return TAO solver pointer.
 
std::shared_ptr< const PETScMatrixget_matrix () const
 Return Matrix shared pointer.
 
std::shared_ptr< const PETScVectorget_vector () const
 Return load vector shared pointer.
 
- Public Member Functions inherited from dolfin::Variable
 Variable ()
 Create unnamed variable.
 
 Variable (const std::string name, const std::string label)
 Create variable with given name and label.
 
 Variable (const Variable &variable)
 Copy constructor.
 
virtual ~Variable ()
 Destructor.
 
const Variableoperator= (const Variable &variable)
 Assignment operator.
 
void rename (const std::string name, const std::string label)
 Rename variable.
 
std::string name () const
 Return name.
 
std::string label () const
 Return label (description)
 
std::size_t id () const
 
virtual std::string str (bool verbose) const
 Return informal string representation (pretty-print)
 
- Public Member Functions inherited from dolfin::PETScObject
 PETScObject ()
 Constructor. Ensures that PETSc has been initialised.
 
virtual ~PETScObject ()
 Destructor.
 

Static Public Member Functions

static std::map< std::string, std::string > methods ()
 Return a list of available Tao solver methods.
 
static std::map< std::string, std::string > krylov_solvers ()
 Return a list of available krylov solvers.
 
static std::map< std::string, std::string > preconditioners ()
 Return a list of available preconditioners.
 
static Parameters default_parameters ()
 Default parameter values.
 
- Static Public Member Functions inherited from dolfin::PETScObject
static void petsc_error (int error_code, std::string filename, std::string petsc_function)
 Print error message for PETSc calls that return an error.
 

Additional Inherited Members

- Public Attributes inherited from dolfin::Variable
Parameters parameters
 Parameters.
 

Detailed Description

This class provides a bound constrained solver for a linear variational inequality defined by a matrix A and a vector b. It solves the problem:

Find :math:x_l\leq x\leq x_u such that :math:(Ax-b)\cdot (y-x)\geq 0,\; \forall x_l\leq y\leq x_u

It is a wrapper for the TAO bound constrained solver.

# Assemble the linear system
A, b = assemble_system(a, L, bc)
# Define the constraints
constraint_u = Constant(1.)
constraint_l = Constant(0.)
u_min = interpolate(constraint_l, V)
u_max = interpolate(constraint_u, V)
# Define the function to store the solution
usol=Function(V)
# Create the TAOLinearBoundSolver
solver=TAOLinearBoundSolver("tao_gpcg","gmres")
# Set some parameters
solver.parameters["monitor_convergence"]=True
solver.parameters["report"]=True
# Solve the problem
solver.solve(A, usol.vector(), b , u_min.vector(), u_max.vector())
info(solver.parameters,True)

Member Function Documentation

◆ solve() [1/2]

std::size_t TAOLinearBoundSolver::solve ( const GenericMatrix A,
GenericVector x,
const GenericVector b,
const GenericVector xl,
const GenericVector xu 
)

Solve the linear variational inequality defined by A and b with xl =< x <= xu

◆ solve() [2/2]

std::size_t TAOLinearBoundSolver::solve ( const PETScMatrix A,
PETScVector x,
const PETScVector b,
const PETScVector xl,
const PETScVector xu 
)

Solve the linear variational inequality defined by A and b with xl =< x <= xu


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