IFPACK  Development
 All Classes Namespaces Files Functions Variables Enumerations Friends Pages
Public Member Functions | List of all members
Ifpack_TriDiContainer Class Reference

Ifpack_TriDiContainer: a class to define containers for dense matrices. More...

#include <Ifpack_TriDiContainer.h>

Inheritance diagram for Ifpack_TriDiContainer:
Inheritance graph
Collaboration diagram for Ifpack_TriDiContainer:
Collaboration graph

Public Member Functions

virtual double InitializeFlops () const
 Returns the flops in Initialize().
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 std::ostream & Print (std::ostream &os) const
 Prints basic information on iostream. This function is used by operator<<.
 Ifpack_TriDiContainer (const int NumRows_in, const int NumVectors_in=1)
 Default constructor.
 Ifpack_TriDiContainer (const Ifpack_TriDiContainer &rhs)
 Copy constructor.
virtual ~Ifpack_TriDiContainer ()
Ifpack_TriDiContaineroperator= (const Ifpack_TriDiContainer &rhs)
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. More...
virtual int SetMatrixElement (const int row, const int col, const double value)
 Set the matrix element (row,col) to value.
virtual int SetParameters (Teuchos::ParameterList &)
 Sets all necessary parameters.
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 const char * Label () const
 Returns the label of this container.
virtual int SetKeepNonFactoredMatrix (const bool flag)
 If flag is true, keeps a copy of the non-factored matrix.
virtual bool KeepNonFactoredMatrix () const
 Returns KeepNonFactoredMatrix_.
virtual const
LHS () const
 Returns the dense vector containing the LHS.
virtual const
RHS () const
 Returns the dense vector containing the RHS.
virtual const
Matrix () const
 Returns the dense matrix or its factors.
virtual const
NonFactoredMatrix () const
 Returns the non-factored dense matrix (only if stored).
virtual const
ID () const
 Returns the integer dense vector of IDs.
virtual int Initialize ()
 Initialize the container.
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, results are stored in LHS.
virtual int ApplyInverse ()
 Apply the inverse of the matrix to RHS, results are stored in LHS.
- Public Member Functions inherited from Ifpack_Container
virtual ~Ifpack_Container ()

Detailed Description

Ifpack_TriDiContainer: a class to define containers for dense 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_TriDiContainer, one can store the blocks as dense matrices, which can be advantageous when the blocks are small. Otherwise, class Ifpack_SparseContainer is probably more appropriate.

A typical use of a container is as follows:

#include "Ifpack_TriDiContainer.h"
// local matrix of (5,5), with two vectors for solution and rhs.
Ifpack_Container* Container = new
// assign local rows 1, 5, 12, 13, 16 to this container
Container(0) = 1;
Container(1) = 5;
Container(2) = 12;
Container(3) = 13;
Container(4) = 16;
// Now extract the submatrix corresponding to rows and columns:
// 1. initialize the container.
// 2. extract matrix values from an Epetra_RowMatrix A,
// and compute LU factors of the submatrix identified by rows
// and columns 1, 5, 12, 13 and 16 using LAPACK
// We can set the RHS as follows:
Container.RHS(0) = 1.0;
Container.RHS(1) = 2.0;
Container.RHS(2) = 3.0;
Container.RHS(3) = 4.0;
Container.RHS(4) = 5.0;
// The linear system with the submatrix is solved as follows:

A call to Compute() computes the LU factorization of the linear system matrix, using LAPACK (more precisely, by calling the corresponding routines in Ifpack_SerialTriDiSolver). The default behavior is to store the matrix factors by overwriting the linear system matrix itself. This way, method Apply() fails, as the original matrix does no longer exists. An alternative is to call KeepNonFactoredMatrix(true), which forces Ifpack_TriDiContainer to maintain in memory a copy of the non-factored matrix.

Marzio Sala, SNL 9214.
Last update Nov-04.

Definition at line 118 of file Ifpack_TriDiContainer.h.

Member Function Documentation

int & Ifpack_TriDiContainer::ID ( const int  i)

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 145 of file Ifpack_TriDiContainer.cpp.

Referenced by Ifpack_TriDiContainer(), and operator=().

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