MFEM
v3.1
Finite element discretization library
|
Wrapper for hypre's ParCSR matrix class. More...
#include <hypre.hpp>
Public Member Functions | |
HypreParMatrix () | |
An empty matrix to be used as a reference to an existing matrix. More... | |
HypreParMatrix (hypre_ParCSRMatrix *a) | |
Converts hypre's format to HypreParMatrix. More... | |
HypreParMatrix (MPI_Comm comm, HYPRE_Int glob_size, HYPRE_Int *row_starts, SparseMatrix *diag) | |
HypreParMatrix (MPI_Comm comm, HYPRE_Int global_num_rows, HYPRE_Int global_num_cols, HYPRE_Int *row_starts, HYPRE_Int *col_starts, SparseMatrix *diag) | |
HypreParMatrix (MPI_Comm comm, HYPRE_Int global_num_rows, HYPRE_Int global_num_cols, HYPRE_Int *row_starts, HYPRE_Int *col_starts, SparseMatrix *diag, SparseMatrix *offd, HYPRE_Int *cmap) | |
HypreParMatrix (MPI_Comm comm, HYPRE_Int global_num_rows, HYPRE_Int global_num_cols, HYPRE_Int *row_starts, HYPRE_Int *col_starts, HYPRE_Int *diag_i, HYPRE_Int *diag_j, double *diag_data, HYPRE_Int *offd_i, HYPRE_Int *offd_j, double *offd_data, HYPRE_Int offd_num_cols, HYPRE_Int *offd_col_map) | |
HypreParMatrix (MPI_Comm comm, HYPRE_Int *row_starts, HYPRE_Int *col_starts, SparseMatrix *a) | |
Creates a parallel matrix from SparseMatrix on processor 0. More... | |
HypreParMatrix (MPI_Comm comm, HYPRE_Int global_num_rows, HYPRE_Int global_num_cols, HYPRE_Int *row_starts, HYPRE_Int *col_starts, Table *diag) | |
HypreParMatrix (MPI_Comm comm, int id, int np, HYPRE_Int *row, HYPRE_Int *col, HYPRE_Int *i_diag, HYPRE_Int *j_diag, HYPRE_Int *i_offd, HYPRE_Int *j_offd, HYPRE_Int *cmap, HYPRE_Int cmap_size) | |
HypreParMatrix (MPI_Comm comm, int nrows, HYPRE_Int glob_nrows, HYPRE_Int glob_ncols, int *I, HYPRE_Int *J, double *data, HYPRE_Int *rows, HYPRE_Int *cols) | |
void | MakeRef (const HypreParMatrix &master) |
Make this HypreParMatrix a reference to 'master'. More... | |
MPI_Comm | GetComm () const |
MPI communicator. More... | |
operator hypre_ParCSRMatrix * () | |
Typecasting to hypre's hypre_ParCSRMatrix*. More... | |
operator HYPRE_ParCSRMatrix () | |
Typecasting to hypre's HYPRE_ParCSRMatrix, a.k.a. void *. More... | |
hypre_ParCSRMatrix * | StealData () |
Changes the ownership of the the matrix. More... | |
void | SetOwnerFlags (char diag, char offd, char colmap) |
Explicitly set the three ownership flags, see docs for diagOwner etc. More... | |
char | OwnsDiag () const |
Get diag ownership flag. More... | |
char | OwnsOffd () const |
Get offd ownership flag. More... | |
char | OwnsColMap () const |
Get colmap ownership flag. More... | |
void | CopyRowStarts () |
void | CopyColStarts () |
HYPRE_Int | NNZ () |
Returns the global number of nonzeros. More... | |
HYPRE_Int * | RowPart () |
Returns the row partitioning. More... | |
HYPRE_Int * | ColPart () |
Returns the column partitioning. More... | |
HYPRE_Int | M () |
Returns the global number of rows. More... | |
HYPRE_Int | N () |
Returns the global number of columns. More... | |
void | GetDiag (Vector &diag) const |
Get the local diagonal of the matrix. More... | |
void | GetDiag (SparseMatrix &diag) const |
Get the local diagonal block. NOTE: 'diag' will not own any data. More... | |
void | GetOffd (SparseMatrix &offd, HYPRE_Int *&cmap) const |
Get the local off-diagonal block. NOTE: 'offd' will not own any data. More... | |
void | GetBlocks (Array2D< HypreParMatrix * > &blocks, bool interleaved_rows=false, bool interleaved_cols=false) const |
HypreParMatrix * | Transpose () |
Returns the transpose of *this. More... | |
int | GetNumRows () const |
Returns the number of rows in the diagonal block of the ParCSRMatrix. More... | |
int | GetNumCols () const |
Returns the number of columns in the diagonal block of the ParCSRMatrix. More... | |
HYPRE_Int | GetGlobalNumRows () const |
HYPRE_Int | GetGlobalNumCols () const |
HYPRE_Int * | GetRowStarts () const |
HYPRE_Int * | GetColStarts () const |
HYPRE_Int | Mult (HypreParVector &x, HypreParVector &y, double alpha=1.0, double beta=0.0) |
Computes y = alpha * A * x + beta * y. More... | |
HYPRE_Int | Mult (HYPRE_ParVector x, HYPRE_ParVector y, double alpha=1.0, double beta=0.0) |
Computes y = alpha * A * x + beta * y. More... | |
HYPRE_Int | MultTranspose (HypreParVector &x, HypreParVector &y, double alpha=1.0, double beta=0.0) |
Computes y = alpha * A^t * x + beta * y. More... | |
void | Mult (double a, const Vector &x, double b, Vector &y) const |
void | MultTranspose (double a, const Vector &x, double b, Vector &y) const |
virtual void | Mult (const Vector &x, Vector &y) const |
Operator application. More... | |
virtual void | MultTranspose (const Vector &x, Vector &y) const |
Action of the transpose operator. More... | |
void | BooleanMult (int alpha, int *x, int beta, int *y) |
HypreParMatrix * | LeftDiagMult (const SparseMatrix &D, HYPRE_Int *row_starts=NULL) const |
void | ScaleRows (const Vector &s) |
Scale the local row i by s(i). More... | |
void | InvScaleRows (const Vector &s) |
Scale the local row i by 1./s(i) More... | |
void | operator*= (double s) |
Scale all entries by s: A_scaled = s*A. More... | |
void | Threshold (double threshold=0.0) |
Remove values smaller in absolute value than some threshold. More... | |
void | EliminateZeroRows () |
If a row contains only zeros, set its diagonal to 1. More... | |
void | EliminateRowsCols (const Array< int > &rows_cols, const HypreParVector &X, HypreParVector &B) |
HypreParMatrix * | EliminateRowsCols (const Array< int > &rows_cols) |
void | Print (const char *fname, HYPRE_Int offi=0, HYPRE_Int offj=0) |
Prints the locally owned rows in parallel. More... | |
void | Read (MPI_Comm comm, const char *fname) |
Reads the matrix from a file. More... | |
virtual | ~HypreParMatrix () |
Calls hypre's destroy function. More... | |
Public Member Functions inherited from mfem::Operator | |
Operator (int s=0) | |
Construct a square Operator with given size s (default 0) More... | |
Operator (int h, int w) | |
int | Height () const |
Get the height (size of output) of the Operator. Synonym with NumRows. More... | |
int | NumRows () const |
int | Width () const |
Get the width (size of input) of the Operator. Synonym with NumCols. More... | |
int | NumCols () const |
virtual Operator & | GetGradient (const Vector &x) const |
Evaluate the gradient operator at the point x. More... | |
void | PrintMatlab (std::ostream &out, int n=0, int m=0) |
Prints operator with input size n and output size m in matlab format. More... | |
virtual | ~Operator () |
Additional Inherited Members | |
Protected Attributes inherited from mfem::Operator | |
int | height |
int | width |
mfem::HypreParMatrix::HypreParMatrix | ( | ) |
|
inline |
Converts hypre's format to HypreParMatrix.
mfem::HypreParMatrix::HypreParMatrix | ( | MPI_Comm | comm, |
HYPRE_Int | glob_size, | ||
HYPRE_Int * | row_starts, | ||
SparseMatrix * | diag | ||
) |
Creates block-diagonal square parallel matrix. Diagonal is given by diag which must be in CSR format (finalized). The new HypreParMatrix does not take ownership of any of the input arrays.
mfem::HypreParMatrix::HypreParMatrix | ( | MPI_Comm | comm, |
HYPRE_Int | global_num_rows, | ||
HYPRE_Int | global_num_cols, | ||
HYPRE_Int * | row_starts, | ||
HYPRE_Int * | col_starts, | ||
SparseMatrix * | diag | ||
) |
Creates block-diagonal rectangular parallel matrix. Diagonal is given by diag which must be in CSR format (finalized). The new HypreParMatrix does not take ownership of any of the input arrays.
mfem::HypreParMatrix::HypreParMatrix | ( | MPI_Comm | comm, |
HYPRE_Int | global_num_rows, | ||
HYPRE_Int | global_num_cols, | ||
HYPRE_Int * | row_starts, | ||
HYPRE_Int * | col_starts, | ||
SparseMatrix * | diag, | ||
SparseMatrix * | offd, | ||
HYPRE_Int * | cmap | ||
) |
Creates general (rectangular) parallel matrix. The new HypreParMatrix does not take ownership of any of the input arrays.
mfem::HypreParMatrix::HypreParMatrix | ( | MPI_Comm | comm, |
HYPRE_Int | global_num_rows, | ||
HYPRE_Int | global_num_cols, | ||
HYPRE_Int * | row_starts, | ||
HYPRE_Int * | col_starts, | ||
HYPRE_Int * | diag_i, | ||
HYPRE_Int * | diag_j, | ||
double * | diag_data, | ||
HYPRE_Int * | offd_i, | ||
HYPRE_Int * | offd_j, | ||
double * | offd_data, | ||
HYPRE_Int | offd_num_cols, | ||
HYPRE_Int * | offd_col_map | ||
) |
Creates general (rectangular) parallel matrix. The new HypreParMatrix takes ownership of all input arrays, except col_starts and row_starts.
mfem::HypreParMatrix::HypreParMatrix | ( | MPI_Comm | comm, |
HYPRE_Int * | row_starts, | ||
HYPRE_Int * | col_starts, | ||
SparseMatrix * | a | ||
) |
Creates a parallel matrix from SparseMatrix on processor 0.
mfem::HypreParMatrix::HypreParMatrix | ( | MPI_Comm | comm, |
HYPRE_Int | global_num_rows, | ||
HYPRE_Int | global_num_cols, | ||
HYPRE_Int * | row_starts, | ||
HYPRE_Int * | col_starts, | ||
Table * | diag | ||
) |
Creates boolean block-diagonal rectangular parallel matrix. The new HypreParMatrix does not take ownership of any of the input arrays.
mfem::HypreParMatrix::HypreParMatrix | ( | MPI_Comm | comm, |
int | id, | ||
int | np, | ||
HYPRE_Int * | row, | ||
HYPRE_Int * | col, | ||
HYPRE_Int * | i_diag, | ||
HYPRE_Int * | j_diag, | ||
HYPRE_Int * | i_offd, | ||
HYPRE_Int * | j_offd, | ||
HYPRE_Int * | cmap, | ||
HYPRE_Int | cmap_size | ||
) |
Creates boolean rectangular parallel matrix. The new HypreParMatrix takes ownership of the arrays i_diag, j_diag, i_offd, j_offd, and cmap; does not take ownership of the arrays row and col.
mfem::HypreParMatrix::HypreParMatrix | ( | MPI_Comm | comm, |
int | nrows, | ||
HYPRE_Int | glob_nrows, | ||
HYPRE_Int | glob_ncols, | ||
int * | I, | ||
HYPRE_Int * | J, | ||
double * | data, | ||
HYPRE_Int * | rows, | ||
HYPRE_Int * | cols | ||
) |
Creates a general parallel matrix from a local CSR matrix on each processor described by the I, J and data arrays. The local matrix should be of size (local) nrows by (global) glob_ncols. The new parallel matrix contains copies of all input arrays (so they can be deleted).
|
inlinevirtual |
|
inline |
|
inline |
void mfem::HypreParMatrix::CopyColStarts | ( | ) |
If the HypreParMatrix does not own the col-starts array, make a copy of it that the HypreParMatrix will own. If the row-starts array is the same as the col-starts array, row-starts is also replaced.
void mfem::HypreParMatrix::CopyRowStarts | ( | ) |
If the HypreParMatrix does not own the row-starts array, make a copy of it that the HypreParMatrix will own. If the col-starts array is the same as the row-starts array, col-starts is also replaced.
void mfem::HypreParMatrix::EliminateRowsCols | ( | const Array< int > & | rows_cols, |
const HypreParVector & | X, | ||
HypreParVector & | B | ||
) |
HypreParMatrix * mfem::HypreParMatrix::EliminateRowsCols | ( | const Array< int > & | rows_cols | ) |
|
inline |
void mfem::HypreParMatrix::GetBlocks | ( | Array2D< HypreParMatrix * > & | blocks, |
bool | interleaved_rows = false , |
||
bool | interleaved_cols = false |
||
) | const |
|
inline |
|
inline |
void mfem::HypreParMatrix::GetDiag | ( | Vector & | diag | ) | const |
void mfem::HypreParMatrix::GetDiag | ( | SparseMatrix & | diag | ) | const |
|
inline |
|
inline |
|
inline |
|
inline |
void mfem::HypreParMatrix::GetOffd | ( | SparseMatrix & | offd, |
HYPRE_Int *& | cmap | ||
) | const |
|
inline |
void mfem::HypreParMatrix::InvScaleRows | ( | const Vector & | s | ) |
HypreParMatrix * mfem::HypreParMatrix::LeftDiagMult | ( | const SparseMatrix & | D, |
HYPRE_Int * | row_starts = NULL |
||
) | const |
Multiply A on the left by a block-diagonal parallel matrix D. Return a new parallel matrix, D*A. If D has a different number of rows than A, D's row starts array needs to be given (as returned by the methods GetDofOffsets/GetTrueDofOffsets of ParFiniteElementSpace). The new matrix D*A uses copies of the row-, column-starts arrays, so "this" matrix and "row_starts" can be deleted. NOTE: this operation is local and does not require communication.
|
inline |
void mfem::HypreParMatrix::MakeRef | ( | const HypreParMatrix & | master | ) |
Make this HypreParMatrix a reference to 'master'.
HYPRE_Int mfem::HypreParMatrix::Mult | ( | HypreParVector & | x, |
HypreParVector & | y, | ||
double | alpha = 1.0 , |
||
double | beta = 0.0 |
||
) |
HYPRE_Int mfem::HypreParMatrix::Mult | ( | HYPRE_ParVector | x, |
HYPRE_ParVector | y, | ||
double | alpha = 1.0 , |
||
double | beta = 0.0 |
||
) |
HYPRE_Int mfem::HypreParMatrix::MultTranspose | ( | HypreParVector & | x, |
HypreParVector & | y, | ||
double | alpha = 1.0 , |
||
double | beta = 0.0 |
||
) |
|
inlinevirtual |
Action of the transpose operator.
Reimplemented from mfem::Operator.
|
inline |
|
inline |
|
inline |
|
inline |
void mfem::HypreParMatrix::operator*= | ( | double | s | ) |
|
inline |
|
inline |
|
inline |
void mfem::HypreParMatrix::Print | ( | const char * | fname, |
HYPRE_Int | offi = 0 , |
||
HYPRE_Int | offj = 0 |
||
) |
void mfem::HypreParMatrix::Read | ( | MPI_Comm | comm, |
const char * | fname | ||
) |
|
inline |
void mfem::HypreParMatrix::ScaleRows | ( | const Vector & | s | ) |
|
inline |
hypre_ParCSRMatrix * mfem::HypreParMatrix::StealData | ( | ) |
void mfem::HypreParMatrix::Threshold | ( | double | threshold = 0.0 | ) |
HypreParMatrix * mfem::HypreParMatrix::Transpose | ( | ) |