IFPACK Development
|
Ifpack_DenseContainer: a class to define containers for dense matrices. More...
#include <Ifpack_DenseContainer.h>
Public Member Functions | |
Ifpack_DenseContainer (const int NumRows_in, const int NumVectors_in=1) | |
Default constructor. | |
Ifpack_DenseContainer (const Ifpack_DenseContainer &rhs) | |
Copy constructor. | |
virtual | ~Ifpack_DenseContainer () |
Destructor. | |
Ifpack_DenseContainer & | operator= (const Ifpack_DenseContainer &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 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 Epetra_SerialDenseMatrix & | LHS () const |
Returns the dense vector containing the LHS. | |
virtual const Epetra_SerialDenseMatrix & | RHS () const |
Returns the dense vector containing the RHS. | |
virtual const Epetra_SerialDenseMatrix & | Matrix () const |
Returns the dense matrix or its factors. | |
virtual const Epetra_SerialDenseMatrix & | NonFactoredMatrix () const |
Returns the non-factored dense matrix (only if stored). | |
virtual const Epetra_IntSerialDenseVector & | 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. | |
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<<. | |
![]() | |
virtual | ~Ifpack_Container () |
Destructor. | |
virtual int | NumRows () const =0 |
Returns the number of rows of the matrix and LHS/RHS. | |
virtual int | NumVectors () const =0 |
Returns the number of vectors in LHS/RHS. | |
virtual int | SetNumVectors (const int i)=0 |
Sets the number of vectors for LHS/RHS. | |
virtual double & | LHS (const int i, const int Vector=0)=0 |
Returns the i-th component of the vector Vector of LHS. | |
virtual double & | RHS (const int i, const int Vector=0)=0 |
Returns the i-th component of the vector Vector of RHS. | |
virtual int & | ID (const int i)=0 |
Returns the ID associated to local row i. | |
virtual int | SetMatrixElement (const int row, const int col, const double value)=0 |
Set the matrix element (row,col) to value . | |
virtual int | Initialize ()=0 |
Initializes the container, by performing all operations that only require matrix structure. | |
virtual int | Compute (const Epetra_RowMatrix &A)=0 |
Finalizes the linear system matrix and prepares for the application of the inverse. | |
virtual int | SetParameters (Teuchos::ParameterList &List)=0 |
Sets all necessary parameters. | |
virtual bool | IsInitialized () const =0 |
Returns true is the container has been successfully initialized. | |
virtual bool | IsComputed () const =0 |
Returns true is the container has been successfully computed. | |
virtual int | Apply ()=0 |
Apply the matrix to RHS, results are stored in LHS. | |
virtual int | ApplyInverse ()=0 |
Apply the inverse of the matrix to RHS, results are stored in LHS. | |
virtual const char * | Label () const =0 |
Returns the label of this container. | |
virtual double | InitializeFlops () const =0 |
Returns the flops in Initialize(). | |
virtual double | ComputeFlops () const =0 |
Returns the flops in Compute(). | |
virtual double | ApplyFlops () const =0 |
Returns the flops in Apply(). | |
virtual double | ApplyInverseFlops () const =0 |
Returns the flops in ApplyInverse(). | |
virtual std::ostream & | Print (std::ostream &os) const =0 |
Prints out basic information about the container. | |
Ifpack_DenseContainer: 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_DenseContainer, 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:
A call to Compute() computes the LU factorization of the linear system matrix, using LAPACK (more precisely, by calling the corresponding routines in Epetra_SerialDenseSolver). 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_DenseContainer to maintain in memory a copy of the non-factored matrix.
Definition at line 117 of file Ifpack_DenseContainer.h.
|
inline |
Default constructor.
Definition at line 124 of file Ifpack_DenseContainer.h.
|
inline |
Copy constructor.
Definition at line 136 of file Ifpack_DenseContainer.h.
References ID(), LHS(), Matrix(), NonFactoredMatrix(), and RHS().
|
inlinevirtual |
Destructor.
Definition at line 152 of file Ifpack_DenseContainer.h.
|
virtual |
Apply the matrix to RHS, results are stored in LHS.
Implements Ifpack_Container.
Definition at line 236 of file Ifpack_DenseContainer.cpp.
References IsComputed(), and Epetra_SerialDenseMatrix::Multiply().
|
inlinevirtual |
Returns the flops in Apply().
Implements Ifpack_Container.
Definition at line 329 of file Ifpack_DenseContainer.h.
|
virtual |
Apply the inverse of the matrix to RHS, results are stored in LHS.
Implements Ifpack_Container.
Definition at line 124 of file Ifpack_DenseContainer.cpp.
References IsComputed(), and Epetra_SerialDenseSolver::Solve().
|
inlinevirtual |
Returns the flops in ApplyInverse().
Implements Ifpack_Container.
Definition at line 334 of file Ifpack_DenseContainer.h.
Referenced by Print().
|
virtual |
Finalizes the linear system matrix and prepares for the application of the inverse.
Implements Ifpack_Container.
Definition at line 204 of file Ifpack_DenseContainer.cpp.
References Epetra_SerialDenseSolver::Factor(), Initialize(), and IsInitialized().
|
inlinevirtual |
Returns the flops in Compute().
Implements Ifpack_Container.
Definition at line 324 of file Ifpack_DenseContainer.h.
Referenced by Print().
|
inlinevirtual |
Returns the integer dense vector of IDs.
Definition at line 297 of file Ifpack_DenseContainer.h.
|
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 141 of file Ifpack_DenseContainer.cpp.
Referenced by Ifpack_DenseContainer(), and operator=().
|
virtual |
Initialize the container.
Implements Ifpack_Container.
Definition at line 54 of file Ifpack_DenseContainer.cpp.
References Epetra_IntSerialDenseMatrix::Reshape(), Epetra_SerialDenseMatrix::Reshape(), Epetra_SerialDenseSolver::SetMatrix(), and Epetra_SerialDenseSolver::SetVectors().
Referenced by Compute(), and SetMatrixElement().
|
inlinevirtual |
Returns the flops in Initialize().
Implements Ifpack_Container.
Definition at line 319 of file Ifpack_DenseContainer.h.
|
inlinevirtual |
Returns true
is the container has been successfully computed.
Implements Ifpack_Container.
Definition at line 248 of file Ifpack_DenseContainer.h.
Referenced by Apply(), ApplyInverse(), operator=(), and Print().
|
inlinevirtual |
Returns true
is the container has been successfully initialized.
Implements Ifpack_Container.
Definition at line 242 of file Ifpack_DenseContainer.h.
Referenced by Compute(), Print(), and SetMatrixElement().
|
inlinevirtual |
Returns KeepNonFactoredMatrix_.
Definition at line 267 of file Ifpack_DenseContainer.h.
Referenced by operator=().
|
inlinevirtual |
Returns the label of this container.
Implements Ifpack_Container.
Definition at line 254 of file Ifpack_DenseContainer.h.
|
inlinevirtual |
Returns the dense vector containing the LHS.
Definition at line 273 of file Ifpack_DenseContainer.h.
|
virtual |
Returns the i-th component of the vector Vector of LHS.
Implements Ifpack_Container.
Definition at line 91 of file Ifpack_DenseContainer.cpp.
References Epetra_SerialDenseMatrix::A().
Referenced by Ifpack_DenseContainer(), and operator=().
|
inlinevirtual |
Returns the dense matrix or its factors.
Definition at line 285 of file Ifpack_DenseContainer.h.
Referenced by Ifpack_DenseContainer(), and operator=().
|
inlinevirtual |
Returns the non-factored dense matrix (only if stored).
Definition at line 291 of file Ifpack_DenseContainer.h.
Referenced by Ifpack_DenseContainer(), and operator=().
|
virtual |
Returns the number of rows of the matrix and LHS/RHS.
Implements Ifpack_Container.
Definition at line 48 of file Ifpack_DenseContainer.cpp.
Referenced by operator=(), Print(), and SetMatrixElement().
|
inlinevirtual |
Returns the number of vectors in LHS/RHS.
Implements Ifpack_Container.
Definition at line 186 of file Ifpack_DenseContainer.h.
Referenced by operator=(), and Print().
|
inline |
Operator=.
Definition at line 159 of file Ifpack_DenseContainer.h.
References ID(), IsComputed(), KeepNonFactoredMatrix(), LHS(), Matrix(), NonFactoredMatrix(), NumRows(), NumVectors(), and RHS().
|
virtual |
Prints basic information on iostream. This function is used by operator<<.
Implements Ifpack_Container.
Definition at line 254 of file Ifpack_DenseContainer.cpp.
References ApplyInverseFlops(), ComputeFlops(), IsComputed(), IsInitialized(), NumRows(), and NumVectors().
|
inlinevirtual |
Returns the dense vector containing the RHS.
Definition at line 279 of file Ifpack_DenseContainer.h.
|
virtual |
Returns the i-th component of the vector Vector of RHS.
Implements Ifpack_Container.
Definition at line 97 of file Ifpack_DenseContainer.cpp.
References Epetra_SerialDenseMatrix::A().
Referenced by Ifpack_DenseContainer(), and operator=().
|
inlinevirtual |
If flag
is true
, keeps a copy of the non-factored matrix.
Definition at line 260 of file Ifpack_DenseContainer.h.
|
virtual |
Set the matrix element (row,col) to value
.
Implements Ifpack_Container.
Definition at line 103 of file Ifpack_DenseContainer.cpp.
References Initialize(), IsInitialized(), and NumRows().
|
inlinevirtual |
Sets the number of vectors for LHS/RHS.
Implements Ifpack_Container.
Definition at line 192 of file Ifpack_DenseContainer.h.
References Epetra_SerialDenseMatrix::Reshape(), and Epetra_SerialDenseSolver::SetVectors().
|
inlinevirtual |
Sets all necessary parameters.
Implements Ifpack_Container.
Definition at line 236 of file Ifpack_DenseContainer.h.