Reference documentation for deal.II version Git df7f5f2 2015-07-05 13:06:38 -0400
Classes | Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members

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

Inheritance diagram for SparseDirectUMFPACK:
[legend]

Classes

class  AdditionalData
 

Public Types

typedef types::global_dof_index size_type
 

Public Member Functions

 SparseDirectUMFPACK ()
 
 ~SparseDirectUMFPACK ()
 
 DeclException2 (ExcUMFPACKError, char *, int,<< "UMFPACK routine "<< arg1<< " returned error status "<< arg2<< "."<< "\n\n"<< ("A complete list of error codes can be found in the file ""<bundled/umfpack/UMFPACK/Include/umfpack.h>.""\n\n""That said, the two most common errors that can happen are ""that your matrix cannot be factorized because it is ""rank deficient, and that UMFPACK runs out of memory ""because your problem is too large.""\n\n""The first of these cases most often happens if you ""forget terms in your bilinear form necessary to ensure ""that the matrix has full rank, or if your equation has a ""spatially variable coefficient (or nonlinearity) that is ""supposed to be strictly positive but, for whatever ""reasons, is negative or zero. In either case, you probably ""want to check your assembly procedure. Similarly, a ""matrix can be rank deficient if you forgot to apply the ""appropriate boundary conditions. For example, the ""Laplace equation without boundary conditions has a ""single zero eigenvalue and its rank is therefore ""deficient by one.""\n\n""The other common situation is that you run out of memory.""On a typical laptop or desktop, it should easily be possible ""to solve problems with 100,000 unknowns in 2d. If you are ""solving problems with many more unknowns than that, in ""particular if you are in 3d, then you may be running out ""of memory and you will need to consider iterative ""solvers instead of the direct solver employed by ""UMFPACK."))
 
Setting up a sparse factorization
void initialize (const SparsityPattern &sparsity_pattern)
 
template<class Matrix >
void factorize (const Matrix &matrix)
 
template<class Matrix >
void initialize (const Matrix &matrix, const AdditionalData additional_data=AdditionalData())
 
Functions that represent the inverse of a matrix
void vmult (Vector< double > &dst, const Vector< double > &src) const
 
void vmult (BlockVector< double > &dst, const BlockVector< double > &src) const
 
void Tvmult (Vector< double > &dst, const Vector< double > &src) const
 
void Tvmult (BlockVector< double > &dst, const BlockVector< double > &src) const
 
Functions that solve linear systems
void solve (Vector< double > &rhs_and_solution, bool transpose=false) const
 
void solve (BlockVector< double > &rhs_and_solution, bool transpose=false) const
 
template<class Matrix >
void solve (const Matrix &matrix, Vector< double > &rhs_and_solution, bool transpose=false)
 
template<class Matrix >
void solve (const Matrix &matrix, BlockVector< double > &rhs_and_solution, bool transpose=false)
 
- Public Member Functions inherited from Subscriptor
 Subscriptor ()
 
 Subscriptor (const Subscriptor &)
 
virtual ~Subscriptor ()
 
Subscriptoroperator= (const Subscriptor &)
 
void subscribe (const char *identifier=0) const
 
void unsubscribe (const char *identifier=0) const
 
unsigned int n_subscriptions () const
 
void list_subscribers () const
 
 DeclException3 (ExcInUse, int, char *, std::string &,<< "Object of class "<< arg2<< " is still used by "<< arg1<< " other objects."<< "\n\n"<< "(Additional information: "<< arg3<< ")\n\n"<< "See the entry in the Frequently Asked Questions of "<< "deal.II (linked to from http://www.dealii.org/) for "<< "a lot more information on what this error means and "<< "how to fix programs in which it happens.")
 
 DeclException2 (ExcNoSubscriber, char *, char *,<< "No subscriber with identifier <"<< arg2<< "> subscribes to this object of class "<< arg1<< ". Consequently, it cannot be unsubscribed.")
 
template<class Archive >
void serialize (Archive &ar, const unsigned int version)
 

Private Member Functions

void clear ()
 
template<typename number >
void sort_arrays (const SparseMatrixEZ< number > &)
 
template<typename number >
void sort_arrays (const SparseMatrix< number > &)
 
template<typename number >
void sort_arrays (const BlockSparseMatrix< number > &)
 

Private Attributes

void * symbolic_decomposition
 
void * numeric_decomposition
 
std::vector< SuiteSparse_long > Ap
 
std::vector< SuiteSparse_long > Ai
 
std::vector< doubleAx
 
std::vector< doublecontrol
 

Detailed Description

This class provides an interface to the sparse direct solver UMFPACK (see this link). UMFPACK is a set of routines for solving non-symmetric sparse linear systems, Ax=b, using the Unsymmetric-pattern MultiFrontal method and direct sparse LU factorization. Matrices may have symmetric or unsymmetrix sparsity patterns, and may have unsymmetric entries. The use of this class is explained in the step-22 and step-29 tutorial programs.

This matrix class implements the usual interface of preconditioners, that is a function initialize(const SparseMatrix<double>&matrix,const AdditionalData) for initalizing and the whole set of vmult() functions common to all matrices. Implemented here are only vmult() and vmult_add(), which perform multiplication with the inverse matrix. Furthermore, this class provides an older interface, consisting of the functions factorize() and solve(). Both interfaces are interchangeable.

Note
This class exists if the UMFPACK interface was not explicitly disabled during configuration.
UMFPACK has its own license, independent of that of deal.II. If you want to use the UMFPACK you have to accept that license. It is linked to from the deal.II ReadMe file. UMFPACK is included courtesy of its author, Timothy A. Davis.

Instantiations

There are instantiations of this class for SparseMatrix<double>, SparseMatrix<float>, SparseMatrixEZ<float>, SparseMatrixEZ<double>, BlockSparseMatrix<double>, and BlockSparseMatrix<float>.

Author
Wolfgang Bangerth, 2004

Definition at line 79 of file sparse_direct.h.

Member Typedef Documentation

Declare type for container size.

Definition at line 85 of file sparse_direct.h.

Constructor & Destructor Documentation

SparseDirectUMFPACK::SparseDirectUMFPACK ( )

Constructor. See the documentation of this class for the meaning of the parameters to this function.

SparseDirectUMFPACK::~SparseDirectUMFPACK ( )

Destructor.

Member Function Documentation

void SparseDirectUMFPACK::initialize ( const SparsityPattern sparsity_pattern)

This function does nothing. It is only here to provide a interface consistent with other sparse direct solvers.

template<class Matrix >
void SparseDirectUMFPACK::factorize ( const Matrix &  matrix)

Factorize the matrix. This function may be called multiple times for different matrices, after the object of this class has been initialized for a certain sparsity pattern. You may therefore save some computing time if you want to invert several matrices with the same sparsity pattern. However, note that the bulk of the computing time is actually spent in the factorization, so this functionality may not always be of large benefit.

In contrast to the other direct solver classes, the initialisation method does nothing. Therefore initialise is not automatically called by this method, when the initialization step has not been performed yet.

This function copies the contents of the matrix into its own storage; the matrix can therefore be deleted after this operation, even if subsequent solves are required.

template<class Matrix >
void SparseDirectUMFPACK::initialize ( const Matrix &  matrix,
const AdditionalData  additional_data = AdditionalData() 
)

Initialize memory and call SparseDirectUMFPACK::factorize.

void SparseDirectUMFPACK::vmult ( Vector< double > &  dst,
const Vector< double > &  src 
) const

Preconditioner interface function. Usually, given the source vector, this method returns an approximate solution of Ax = b. As this class provides a wrapper to a direct solver, here it is actually the exact solution (exact within the range of numerical accuracy of course).

In other words, this function actually multiplies with the exact inverse of the matrix, \(A^{-1}\).

void SparseDirectUMFPACK::vmult ( BlockVector< double > &  dst,
const BlockVector< double > &  src 
) const

Same as before, but for block vectors.

void SparseDirectUMFPACK::Tvmult ( Vector< double > &  dst,
const Vector< double > &  src 
) const

Same as before, but uses the transpose of the matrix, i.e. this function multiplies with \(A^{-T}\).

void SparseDirectUMFPACK::Tvmult ( BlockVector< double > &  dst,
const BlockVector< double > &  src 
) const

Same as before, but for block vectors

void SparseDirectUMFPACK::solve ( Vector< double > &  rhs_and_solution,
bool  transpose = false 
) const

Solve for a certain right hand side vector. This function may be called multiple times for different right hand side vectors after the matrix has been factorized. This yields a big saving in computing time, since the actual solution is fast, compared to the factorization of the matrix.

The solution will be returned in place of the right hand side vector.

If the factorization has not happened before, strange things will happen. Note that we can't actually call the factorize() function from here if it has not yet been called, since we have no access to the actual matrix.

If transpose is set to true this function solves for the transpose of the matrix, i.e. \(x=A^{-T}b\).

void SparseDirectUMFPACK::solve ( BlockVector< double > &  rhs_and_solution,
bool  transpose = false 
) const

Same as before, but for block vectors.

template<class Matrix >
void SparseDirectUMFPACK::solve ( const Matrix &  matrix,
Vector< double > &  rhs_and_solution,
bool  transpose = false 
)

Call the two functions factorize() and solve() in that order, i.e. perform the whole solution process for the given right hand side vector.

The solution will be returned in place of the right hand side vector.

template<class Matrix >
void SparseDirectUMFPACK::solve ( const Matrix &  matrix,
BlockVector< double > &  rhs_and_solution,
bool  transpose = false 
)

Same as before, but for block vectors.

SparseDirectUMFPACK::DeclException2 ( ExcUMFPACKError  ,
char *  ,
int  ,
<< "UMFPACK routine "<< arg1<< " returned error status "<< arg2<< "."<< "\n\n"<<   "A complete list of error codes can be found in the file ""<bundled/umfpack/UMFPACK/Include/umfpack.h>.""\n\n""That said, the two most common errors that can happen are ""that your matrix cannot be factorized because it is ""rank deficient, and that UMFPACK runs out of memory ""because your problem is too large.""\n\n""The first of these cases most often happens if you ""forget terms in your bilinear form necessary to ensure ""that the matrix has full rank, or if your equation has a ""spatially variable coefficient (or nonlinearity) that is ""supposed to be strictly positive but, for whatever ""reasons, is negative or zero. In either case, you probably ""want to check your assembly procedure. Similarly, a ""matrix can be rank deficient if you forgot to apply the ""appropriate boundary conditions. For example, the ""Laplace equation without boundary conditions has a ""single zero eigenvalue and its rank is therefore ""deficient by one.""\n\n""The other common situation is that you run out of memory.""On a typical laptop or desktop, it should easily be possible ""to solve problems with 100,000 unknowns in 2d. If you are ""solving problems with many more unknowns than that, in ""particular if you are in 3d, then you may be running out ""of memory and you will need to consider iterative ""solvers instead of the direct solver employed by ""UMFPACK." 
)

One of the UMFPack routines threw an error. The error code is included in the output and can be looked up in the UMFPack user manual. The name of the routine is included for reference.

void SparseDirectUMFPACK::clear ( )
private

Free all memory that hasn't been freed yet.

template<typename number >
void SparseDirectUMFPACK::sort_arrays ( const SparseMatrixEZ< number > &  )
private

Make sure that the arrays Ai and Ap are sorted in each row. UMFPACK wants it this way. We need to have three versions of this function, one for the usual SparseMatrix, one for the SparseMatrixEZ, and one for the BlockSparseMatrix classes

Member Data Documentation

void* SparseDirectUMFPACK::symbolic_decomposition
private

The UMFPACK routines allocate objects in which they store information about symbolic and numeric values of the decomposition. The actual data type of these objects is opaque, and only passed around as void pointers.

Definition at line 289 of file sparse_direct.h.

std::vector<SuiteSparse_long> SparseDirectUMFPACK::Ap
private

The arrays in which we store the data for the solver. SuiteSparse_long has to be used here for Windows 64 build, if we used only long int, compilation would fail.

Definition at line 317 of file sparse_direct.h.

std::vector<double> SparseDirectUMFPACK::control
private

Control and info arrays for the solver routines.

Definition at line 324 of file sparse_direct.h.


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