Ifpack_SparseContainer< T > Class Template Reference

Ifpack_SparseContainer: a class for storing and solving linear systems using sparse matrices. More...

#include <Ifpack_SparseContainer.h>

Inheritance diagram for Ifpack_SparseContainer< T >:

Inheritance graph
[legend]
List of all members.
 Ifpack_SparseContainer (const int NumRows, const int NumVectors=1)
 Constructor.
 Ifpack_SparseContainer (const Ifpack_SparseContainer< T > &rhs)
 Copy constructor.
virtual ~Ifpack_SparseContainer ()
 Destructor.
Ifpack_SparseContaineroperator= (const Ifpack_SparseContainer< T > &rhs)
 Operator =.
virtual int NumRows () const
 Returns the number of rows of the matrix and LHS/RHS.
virtual int NumVectors () const
 Returns the number of vectors in LHS/RHS.
virtual int SetNumVectors (const int NumVectors_in)
 Sets the number of vectors for LHS/RHS.
virtual double & LHS (const int i, const int Vector=0)
 Returns the i-th component of the vector Vector of LHS.
virtual double & RHS (const int i, const int Vector=0)
 Returns the i-th component of the vector Vector of RHS.
virtual int & ID (const int i)
 Returns the ID associated to local row i.
virtual int SetMatrixElement (const int row, const int col, const double value)
 Set the matrix element (row,col) to value.
virtual bool IsInitialized () const
 Returns true is the container has been successfully initialized.
virtual bool IsComputed () const
 Returns true is the container has been successfully computed.
virtual int SetParameters (Teuchos::ParameterList &List)
 Sets all necessary parameters.
virtual const char * Label () const
 Returns the label of this container.
const Epetra_MapMap () const
 Returns a pointer to the internally stored map.
const Epetra_MultiVectorLHS () const
 Returns a pointer to the internally stored solution multi-vector.
const Epetra_MultiVectorRHS () const
 Returns a pointer to the internally stored rhs multi-vector.
const Epetra_CrsMatrixMatrix () const
 Returns a pointer to the internally stored matrix.
const Epetra_IntSerialDenseVectorID () const
 Returns a pointer to the internally stored ID's.
const T * Inverse () const
 Returns a pointer to the internally stored inverse operator.
virtual int Initialize ()
 Initializes the container, by completing all the operations based on matrix structure.
virtual int Compute (const Epetra_RowMatrix &Matrix_in)
 Finalizes the linear system matrix and prepares for the application of the inverse.
virtual int Apply ()
 Apply the matrix to RHS, result is stored in LHS.
virtual int ApplyInverse ()
 Apply the inverse of the matrix to RHS, result is stored in LHS.
virtual int Destroy ()
 Destroys all data.

Public Member Functions

virtual double InitializeFlops () const
 Returns the flops in Compute().
virtual double ComputeFlops () const
 Returns the flops in Compute().
virtual double ApplyFlops () const
 Returns the flops in Apply().
virtual double ApplyInverseFlops () const
 Returns the flops in ApplyInverse().
virtual ostream & Print (std::ostream &os) const
 Prints basic information on iostream. This function is used by operator<<.

Private Member Functions

virtual int Extract (const Epetra_RowMatrix &Matrix_in)
 Extract the submatrices identified by the ID set int ID().

Private Attributes

int NumRows_
 Number of rows in the local matrix.
int NumVectors_
 Number of vectors in the local linear system.
Teuchos::RefCountPtr< Epetra_MapMap_
 Linear map on which the local matrix is based.
Teuchos::RefCountPtr< Epetra_CrsMatrixMatrix_
 Pointer to the local matrix.
Teuchos::RefCountPtr< Epetra_MultiVectorLHS_
 Solution vector.
Teuchos::RefCountPtr< Epetra_MultiVectorRHS_
 right-hand side for local problems.
Epetra_IntSerialDenseVector GID_
 Contains the subrows/subcols of A that will be inserted in Matrix_.
bool IsInitialized_
 If true, the container has been successfully initialized.
bool IsComputed_
 If true, the container has been successfully computed.
Teuchos::RefCountPtr< Epetra_CommSerialComm_
 Serial communicator (containing only MPI_COMM_SELF if MPI is used).
Teuchos::RefCountPtr< T > Inverse_
 Pointer to an Ifpack_Preconditioner object whose ApplyInverse() defined the action of the inverse of the local matrix.
string Label_
 Label for this object.
Teuchos::ParameterList List_
double ApplyFlops_

Detailed Description

template<typename T>
class Ifpack_SparseContainer< T >

Ifpack_SparseContainer: a class for storing and solving linear systems using sparse matrices.

To understand what an IFPACK container is, please refer to the documentation of the pure virtual class Ifpack_Container. Currently, containers are used by class Ifpack_BlockRelaxation.

Using block methods, one needs to store all diagonal blocks and to be also to apply the inverse of each diagonal block. Using class Ifpack_DenseContainer, one can store the blocks as sparse matrices (Epetra_CrsMatrix), which can be advantageous when the blocks are large. Otherwise, class Ifpack_DenseContainer is probably more appropriate.

Sparse containers are templated with a type T, which represent the class to use in the application of the inverse. (T is not used in Ifpack_DenseContainer). In SparseContainer, T must be an Ifpack_Preconditioner derived class. The container will allocate a T object, use SetParameters() and Compute(), then use T every time the linear system as to be solved (using the ApplyInverse() method of T).

Author:
Marzio Sala, SNL 9214.
Date:
Last modified on Nov-04.

Definition at line 80 of file Ifpack_SparseContainer.h.


Constructor & Destructor Documentation

template<typename T>
Ifpack_SparseContainer< T >::Ifpack_SparseContainer ( const int  NumRows,
const int  NumVectors = 1 
)

Constructor.

Definition at line 297 of file Ifpack_SparseContainer.h.

template<typename T>
Ifpack_SparseContainer< T >::Ifpack_SparseContainer ( const Ifpack_SparseContainer< T > &  rhs  ) 

Copy constructor.

Definition at line 316 of file Ifpack_SparseContainer.h.

template<typename T>
Ifpack_SparseContainer< T >::~Ifpack_SparseContainer (  )  [virtual]

Destructor.

Definition at line 344 of file Ifpack_SparseContainer.h.


Member Function Documentation

template<typename T>
Ifpack_SparseContainer& Ifpack_SparseContainer< T >::operator= ( const Ifpack_SparseContainer< T > &  rhs  ) 

Operator =.

template<typename T>
int Ifpack_SparseContainer< T >::NumRows (  )  const [virtual]

Returns the number of rows of the matrix and LHS/RHS.

Implements Ifpack_Container.

Definition at line 351 of file Ifpack_SparseContainer.h.

template<typename T>
virtual int Ifpack_SparseContainer< T >::NumVectors (  )  const [inline, virtual]

Returns the number of vectors in LHS/RHS.

Implements Ifpack_Container.

Definition at line 106 of file Ifpack_SparseContainer.h.

template<typename T>
virtual int Ifpack_SparseContainer< T >::SetNumVectors ( const int  NumVectors_in  )  [inline, virtual]

Sets the number of vectors for LHS/RHS.

Implements Ifpack_Container.

Definition at line 112 of file Ifpack_SparseContainer.h.

template<typename T>
double & Ifpack_SparseContainer< T >::LHS ( const int  i,
const int  Vector = 0 
) [virtual]

Returns the i-th component of the vector Vector of LHS.

Implements Ifpack_Container.

Definition at line 398 of file Ifpack_SparseContainer.h.

template<typename T>
double & Ifpack_SparseContainer< T >::RHS ( const int  i,
const int  Vector = 0 
) [virtual]

Returns the i-th component of the vector Vector of RHS.

Implements Ifpack_Container.

Definition at line 405 of file Ifpack_SparseContainer.h.

template<typename T>
int & Ifpack_SparseContainer< T >::ID ( const int  i  )  [virtual]

Returns the ID associated to local row i.

The set of (local) rows assigned to this container is defined by calling ID(i) = j, where i (from 0 to NumRows()) indicates the container-row, and j indicates the local row in the calling process.

This is usually used to recorder the local row ID (on calling process) of the i-th row in the container.

Implements Ifpack_Container.

Definition at line 501 of file Ifpack_SparseContainer.h.

template<typename T>
int Ifpack_SparseContainer< T >::SetMatrixElement ( const int  row,
const int  col,
const double  value 
) [virtual]

Set the matrix element (row,col) to value.

Implements Ifpack_Container.

Definition at line 413 of file Ifpack_SparseContainer.h.

template<typename T>
virtual bool Ifpack_SparseContainer< T >::IsInitialized (  )  const [inline, virtual]

Returns true is the container has been successfully initialized.

Implements Ifpack_Container.

Definition at line 143 of file Ifpack_SparseContainer.h.

template<typename T>
virtual bool Ifpack_SparseContainer< T >::IsComputed (  )  const [inline, virtual]

Returns true is the container has been successfully computed.

Implements Ifpack_Container.

Definition at line 149 of file Ifpack_SparseContainer.h.

template<typename T>
int Ifpack_SparseContainer< T >::SetParameters ( Teuchos::ParameterList &  List  )  [virtual]

Sets all necessary parameters.

Implements Ifpack_Container.

Definition at line 509 of file Ifpack_SparseContainer.h.

template<typename T>
virtual const char* Ifpack_SparseContainer< T >::Label (  )  const [inline, virtual]

Returns the label of this container.

Implements Ifpack_Container.

Definition at line 158 of file Ifpack_SparseContainer.h.

template<typename T>
const Epetra_Map* Ifpack_SparseContainer< T >::Map (  )  const [inline]

Returns a pointer to the internally stored map.

Definition at line 164 of file Ifpack_SparseContainer.h.

template<typename T>
const Epetra_MultiVector* Ifpack_SparseContainer< T >::LHS (  )  const [inline]

Returns a pointer to the internally stored solution multi-vector.

Definition at line 170 of file Ifpack_SparseContainer.h.

template<typename T>
const Epetra_MultiVector* Ifpack_SparseContainer< T >::RHS (  )  const [inline]

Returns a pointer to the internally stored rhs multi-vector.

Definition at line 176 of file Ifpack_SparseContainer.h.

template<typename T>
const Epetra_CrsMatrix* Ifpack_SparseContainer< T >::Matrix (  )  const [inline]

Returns a pointer to the internally stored matrix.

Definition at line 182 of file Ifpack_SparseContainer.h.

template<typename T>
const Epetra_IntSerialDenseVector* Ifpack_SparseContainer< T >::ID (  )  const [inline]

Returns a pointer to the internally stored ID's.

Definition at line 188 of file Ifpack_SparseContainer.h.

template<typename T>
const T* Ifpack_SparseContainer< T >::Inverse (  )  const [inline]

Returns a pointer to the internally stored inverse operator.

Definition at line 194 of file Ifpack_SparseContainer.h.

template<typename T>
int Ifpack_SparseContainer< T >::Initialize (  )  [virtual]

Initializes the container, by completing all the operations based on matrix structure.

Note:
After a call to Initialize(), no new matrix entries can be added.

Implements Ifpack_Container.

Definition at line 361 of file Ifpack_SparseContainer.h.

template<typename T>
int Ifpack_SparseContainer< T >::Compute ( const Epetra_RowMatrix Matrix_in  )  [virtual]

Finalizes the linear system matrix and prepares for the application of the inverse.

Implements Ifpack_Container.

Definition at line 439 of file Ifpack_SparseContainer.h.

template<typename T>
int Ifpack_SparseContainer< T >::Apply (  )  [virtual]

Apply the matrix to RHS, result is stored in LHS.

Implements Ifpack_Container.

Definition at line 465 of file Ifpack_SparseContainer.h.

template<typename T>
int Ifpack_SparseContainer< T >::ApplyInverse (  )  [virtual]

Apply the inverse of the matrix to RHS, result is stored in LHS.

Implements Ifpack_Container.

Definition at line 479 of file Ifpack_SparseContainer.h.

template<typename T>
int Ifpack_SparseContainer< T >::Destroy (  )  [virtual]

Destroys all data.

Definition at line 492 of file Ifpack_SparseContainer.h.

template<typename T>
virtual double Ifpack_SparseContainer< T >::InitializeFlops (  )  const [inline, virtual]

Returns the flops in Compute().

Implements Ifpack_Container.

Definition at line 225 of file Ifpack_SparseContainer.h.

template<typename T>
virtual double Ifpack_SparseContainer< T >::ComputeFlops (  )  const [inline, virtual]

Returns the flops in Compute().

Implements Ifpack_Container.

Definition at line 234 of file Ifpack_SparseContainer.h.

template<typename T>
virtual double Ifpack_SparseContainer< T >::ApplyFlops (  )  const [inline, virtual]

Returns the flops in Apply().

Implements Ifpack_Container.

Definition at line 243 of file Ifpack_SparseContainer.h.

template<typename T>
virtual double Ifpack_SparseContainer< T >::ApplyInverseFlops (  )  const [inline, virtual]

Returns the flops in ApplyInverse().

Implements Ifpack_Container.

Definition at line 249 of file Ifpack_SparseContainer.h.

template<typename T>
virtual ostream& Ifpack_SparseContainer< T >::Print ( std::ostream &  os  )  const [virtual]

Prints basic information on iostream. This function is used by operator<<.

Implements Ifpack_Container.

template<typename T>
int Ifpack_SparseContainer< T >::Extract ( const Epetra_RowMatrix Matrix_in  )  [private, virtual]

Extract the submatrices identified by the ID set int ID().

Definition at line 518 of file Ifpack_SparseContainer.h.


Member Data Documentation

template<typename T>
int Ifpack_SparseContainer< T >::NumRows_ [private]

Number of rows in the local matrix.

Definition at line 266 of file Ifpack_SparseContainer.h.

template<typename T>
int Ifpack_SparseContainer< T >::NumVectors_ [private]

Number of vectors in the local linear system.

Definition at line 268 of file Ifpack_SparseContainer.h.

template<typename T>
Teuchos::RefCountPtr<Epetra_Map> Ifpack_SparseContainer< T >::Map_ [private]

Linear map on which the local matrix is based.

Definition at line 270 of file Ifpack_SparseContainer.h.

template<typename T>
Teuchos::RefCountPtr<Epetra_CrsMatrix> Ifpack_SparseContainer< T >::Matrix_ [private]

Pointer to the local matrix.

Definition at line 272 of file Ifpack_SparseContainer.h.

template<typename T>
Teuchos::RefCountPtr<Epetra_MultiVector> Ifpack_SparseContainer< T >::LHS_ [private]

Solution vector.

Definition at line 274 of file Ifpack_SparseContainer.h.

template<typename T>
Teuchos::RefCountPtr<Epetra_MultiVector> Ifpack_SparseContainer< T >::RHS_ [private]

right-hand side for local problems.

Definition at line 276 of file Ifpack_SparseContainer.h.

template<typename T>
Epetra_IntSerialDenseVector Ifpack_SparseContainer< T >::GID_ [private]

Contains the subrows/subcols of A that will be inserted in Matrix_.

Definition at line 278 of file Ifpack_SparseContainer.h.

template<typename T>
bool Ifpack_SparseContainer< T >::IsInitialized_ [private]

If true, the container has been successfully initialized.

Definition at line 280 of file Ifpack_SparseContainer.h.

template<typename T>
bool Ifpack_SparseContainer< T >::IsComputed_ [private]

If true, the container has been successfully computed.

Definition at line 282 of file Ifpack_SparseContainer.h.

template<typename T>
Teuchos::RefCountPtr<Epetra_Comm> Ifpack_SparseContainer< T >::SerialComm_ [private]

Serial communicator (containing only MPI_COMM_SELF if MPI is used).

Definition at line 284 of file Ifpack_SparseContainer.h.

template<typename T>
Teuchos::RefCountPtr<T> Ifpack_SparseContainer< T >::Inverse_ [private]

Pointer to an Ifpack_Preconditioner object whose ApplyInverse() defined the action of the inverse of the local matrix.

Definition at line 286 of file Ifpack_SparseContainer.h.

template<typename T>
string Ifpack_SparseContainer< T >::Label_ [private]

Label for this object.

Definition at line 288 of file Ifpack_SparseContainer.h.

template<typename T>
Teuchos::ParameterList Ifpack_SparseContainer< T >::List_ [private]

Definition at line 289 of file Ifpack_SparseContainer.h.

template<typename T>
double Ifpack_SparseContainer< T >::ApplyFlops_ [private]

Definition at line 290 of file Ifpack_SparseContainer.h.


The documentation for this class was generated from the following file:
Generated on Tue Jul 13 09:27:26 2010 for Ifpack Package Browser (Single Doxygen Collection) by  doxygen 1.4.7