Ifpack Package Browser (Single Doxygen Collection)  Development
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Private Member Functions | Private Attributes | List of all members
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]

Public Member Functions

virtual double InitializeFlops () const
 Returns the flops in Compute(). More...
 
virtual double ComputeFlops () const
 Returns the flops in Compute(). More...
 
virtual double ApplyFlops () const
 Returns the flops in Apply(). More...
 
virtual double ApplyInverseFlops () const
 Returns the flops in ApplyInverse(). More...
 
virtual std::ostream & Print (std::ostream &os) const
 Prints basic information on iostream. This function is used by operator<<. More...
 
- Public Member Functions inherited from Ifpack_Container
virtual ~Ifpack_Container ()
 Destructor. More...
 

Private Member Functions

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

Private Attributes

int NumRows_
 Number of rows in the local matrix. More...
 
int NumVectors_
 Number of vectors in the local linear system. More...
 
Teuchos::RefCountPtr< Epetra_MapMap_
 Linear map on which the local matrix is based. More...
 
Teuchos::RefCountPtr
< Epetra_CrsMatrix
Matrix_
 Pointer to the local matrix. More...
 
Teuchos::RefCountPtr
< Epetra_MultiVector
LHS_
 Solution vector. More...
 
Teuchos::RefCountPtr
< Epetra_MultiVector
RHS_
 right-hand side for local problems. More...
 
Epetra_IntSerialDenseVector GID_
 Contains the subrows/subcols of A that will be inserted in Matrix_. More...
 
bool IsInitialized_
 If true, the container has been successfully initialized. More...
 
bool IsComputed_
 If true, the container has been successfully computed. More...
 
Teuchos::RefCountPtr< Epetra_CommSerialComm_
 Serial communicator (containing only MPI_COMM_SELF if MPI is used). More...
 
Teuchos::RefCountPtr< T > Inverse_
 Pointer to an Ifpack_Preconditioner object whose ApplyInverse() defined the action of the inverse of the local matrix. More...
 
std::string Label_
 Label for this object. More...
 
Teuchos::ParameterList List_
 
double ApplyFlops_
 
 Ifpack_SparseContainer (const int NumRows, const int NumVectors=1)
 Constructor. More...
 
 Ifpack_SparseContainer (const Ifpack_SparseContainer< T > &rhs)
 Copy constructor. More...
 
virtual ~Ifpack_SparseContainer ()
 Destructor. More...
 
Ifpack_SparseContaineroperator= (const Ifpack_SparseContainer< T > &rhs)
 Operator =. More...
 
virtual int NumRows () const
 Returns the number of rows of the matrix and LHS/RHS. More...
 
virtual int NumVectors () const
 Returns the number of vectors in LHS/RHS. More...
 
virtual int SetNumVectors (const int NumVectors_in)
 Sets the number of vectors for LHS/RHS. More...
 
virtual double & LHS (const int i, const int Vector=0)
 Returns the i-th component of the vector Vector of LHS. More...
 
virtual double & RHS (const int i, const int Vector=0)
 Returns the i-th component of the vector Vector of RHS. More...
 
virtual int & ID (const int i)
 Returns the ID associated to local row i. More...
 
virtual int SetMatrixElement (const int row, const int col, const double value)
 Set the matrix element (row,col) to value. More...
 
virtual bool IsInitialized () const
 Returns true is the container has been successfully initialized. More...
 
virtual bool IsComputed () const
 Returns true is the container has been successfully computed. More...
 
virtual int SetParameters (Teuchos::ParameterList &List)
 Sets all necessary parameters. More...
 
virtual const char * Label () const
 Returns the label of this container. More...
 
Teuchos::RCP< const Epetra_MapMap () const
 Returns a pointer to the internally stored map. More...
 
Teuchos::RCP< const
Epetra_MultiVector
LHS () const
 Returns a pointer to the internally stored solution multi-vector. More...
 
Teuchos::RCP< const
Epetra_MultiVector
RHS () const
 Returns a pointer to the internally stored rhs multi-vector. More...
 
Teuchos::RCP< const
Epetra_CrsMatrix
Matrix () const
 Returns a pointer to the internally stored matrix. More...
 
const Epetra_IntSerialDenseVectorID () const
 Returns a pointer to the internally stored ID's. More...
 
Teuchos::RCP< const T > Inverse () const
 Returns a pointer to the internally stored inverse operator. More...
 
virtual int Initialize ()
 Initializes the container, by completing all the operations based on matrix structure. More...
 
virtual int Compute (const Epetra_RowMatrix &Matrix_in)
 Finalizes the linear system matrix and prepares for the application of the inverse. More...
 
virtual int Apply ()
 Apply the matrix to RHS, result is stored in LHS. More...
 
virtual int ApplyInverse ()
 Apply the inverse of the matrix to RHS, result is stored in LHS. More...
 
virtual int Destroy ()
 Destroys all data. More...
 

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 93 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 314 of file Ifpack_SparseContainer.h.

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

Copy constructor.

Definition at line 333 of file Ifpack_SparseContainer.h.

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

Destructor.

Definition at line 361 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 368 of file Ifpack_SparseContainer.h.

template<typename T>
virtual int Ifpack_SparseContainer< T >::NumVectors ( ) const
inlinevirtual

Returns the number of vectors in LHS/RHS.

Implements Ifpack_Container.

Definition at line 119 of file Ifpack_SparseContainer.h.

template<typename T>
virtual int Ifpack_SparseContainer< T >::SetNumVectors ( const int  NumVectors_in)
inlinevirtual

Sets the number of vectors for LHS/RHS.

Implements Ifpack_Container.

Definition at line 125 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 421 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 428 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 542 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 436 of file Ifpack_SparseContainer.h.

template<typename T>
virtual bool Ifpack_SparseContainer< T >::IsInitialized ( ) const
inlinevirtual

Returns true is the container has been successfully initialized.

Implements Ifpack_Container.

Definition at line 160 of file Ifpack_SparseContainer.h.

template<typename T>
virtual bool Ifpack_SparseContainer< T >::IsComputed ( ) const
inlinevirtual

Returns true is the container has been successfully computed.

Implements Ifpack_Container.

Definition at line 166 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 550 of file Ifpack_SparseContainer.h.

template<typename T>
virtual const char* Ifpack_SparseContainer< T >::Label ( ) const
inlinevirtual

Returns the label of this container.

Implements Ifpack_Container.

Definition at line 175 of file Ifpack_SparseContainer.h.

template<typename T>
Teuchos::RCP<const Epetra_Map> Ifpack_SparseContainer< T >::Map ( ) const
inline

Returns a pointer to the internally stored map.

Definition at line 181 of file Ifpack_SparseContainer.h.

template<typename T>
Teuchos::RCP<const Epetra_MultiVector> Ifpack_SparseContainer< T >::LHS ( ) const
inline

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

Definition at line 187 of file Ifpack_SparseContainer.h.

template<typename T>
Teuchos::RCP<const Epetra_MultiVector> Ifpack_SparseContainer< T >::RHS ( ) const
inline

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

Definition at line 193 of file Ifpack_SparseContainer.h.

template<typename T>
Teuchos::RCP<const Epetra_CrsMatrix> Ifpack_SparseContainer< T >::Matrix ( ) const
inline

Returns a pointer to the internally stored matrix.

Definition at line 199 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 205 of file Ifpack_SparseContainer.h.

template<typename T>
Teuchos::RCP<const T> Ifpack_SparseContainer< T >::Inverse ( ) const
inline

Returns a pointer to the internally stored inverse operator.

Definition at line 211 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 378 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 480 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 506 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 520 of file Ifpack_SparseContainer.h.

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

Destroys all data.

Definition at line 533 of file Ifpack_SparseContainer.h.

template<typename T>
virtual double Ifpack_SparseContainer< T >::InitializeFlops ( ) const
inlinevirtual

Returns the flops in Compute().

Implements Ifpack_Container.

Definition at line 242 of file Ifpack_SparseContainer.h.

template<typename T>
virtual double Ifpack_SparseContainer< T >::ComputeFlops ( ) const
inlinevirtual

Returns the flops in Compute().

Implements Ifpack_Container.

Definition at line 251 of file Ifpack_SparseContainer.h.

template<typename T>
virtual double Ifpack_SparseContainer< T >::ApplyFlops ( ) const
inlinevirtual

Returns the flops in Apply().

Implements Ifpack_Container.

Definition at line 260 of file Ifpack_SparseContainer.h.

template<typename T>
virtual double Ifpack_SparseContainer< T >::ApplyInverseFlops ( ) const
inlinevirtual

Returns the flops in ApplyInverse().

Implements Ifpack_Container.

Definition at line 266 of file Ifpack_SparseContainer.h.

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

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

Implements Ifpack_Container.

Definition at line 617 of file Ifpack_SparseContainer.h.

template<typename T >
int Ifpack_SparseContainer< T >::Extract ( const Epetra_RowMatrix Matrix_in)
privatevirtual

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

Definition at line 559 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 283 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 285 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 287 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 289 of file Ifpack_SparseContainer.h.

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

Solution vector.

Definition at line 291 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 293 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 295 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 297 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 299 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 301 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 303 of file Ifpack_SparseContainer.h.

template<typename T>
std::string Ifpack_SparseContainer< T >::Label_
private

Label for this object.

Definition at line 305 of file Ifpack_SparseContainer.h.

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

Definition at line 306 of file Ifpack_SparseContainer.h.

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

Definition at line 307 of file Ifpack_SparseContainer.h.


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