Wrapper for Hypre's sequential CSR matrix.
More...
#include <TNL/Matrices/HypreParCSRMatrix.h>
|
| HypreParCSRMatrix (const HypreParCSRMatrix &other)=delete |
|
| HypreParCSRMatrix (hypre_ParCSRMatrix *handle, bool take_ownership=true) |
| Convert Hypre's format to HypreParCSRMatrix.
|
|
| HypreParCSRMatrix (HypreParCSRMatrix &&other) noexcept |
|
void | bind (hypre_ParCSRMatrix *handle, bool take_ownership=true) |
| Convert Hypre's format to HypreParCSRMatrix.
|
|
void | bind (MPI_Comm communicator, IndexType global_num_rows, IndexType global_num_cols, LocalRangeType local_row_range, LocalRangeType local_col_range, hypre_CSRMatrix *diag, hypre_CSRMatrix *offd, IndexType *col_map_offd) |
| Binds ParCSRMatrix to local diag and offd blocks.
|
|
IndexType | getColumns () const |
|
MPI_Comm | getCommunicator () const |
|
MatrixType | getDiagonalBlock () |
|
LocalRangeType | getLocalColumnRange () const |
|
LocalRangeType | getLocalRowRange () const |
|
HypreCSRMatrix | getMergedLocalMatrix () const |
| Constructs a local matrix by merging the diagonal and off-diagonal blocks.
|
|
IndexType | getNonzeroElementsCount () const |
|
MatrixType | getOffdiagonalBlock () |
|
Containers::VectorView< HYPRE_Int, HYPRE_Device, HYPRE_Int > | getOffdiagonalColumnsMapping () |
|
IndexType | getRows () const |
|
| operator const hypre_ParCSRMatrix * () const noexcept |
|
| operator HYPRE_ParCSRMatrix () const noexcept |
|
| operator hypre_ParCSRMatrix * () noexcept |
|
HypreParCSRMatrix & | operator= (const HypreParCSRMatrix &other)=delete |
|
HypreParCSRMatrix & | operator= (HypreParCSRMatrix &&other) noexcept |
|
void | reset () |
| Reset the matrix to empty state.
|
|
|
static HypreParCSRMatrix | fromLocalBlocks (MPI_Comm communicator, IndexType global_num_rows, IndexType global_num_cols, LocalRangeType local_row_range, LocalRangeType local_col_range, hypre_CSRMatrix *local_A) |
| Constructs a ParCSRMatrix from local blocks distributed across the processors in communicator.
|
|
static HypreParCSRMatrix | fromMasterRank (hypre_CSRMatrix *matrix, hypre_ParVector *x, hypre_ParVector *b) |
| Constructs a ParCSRMatrix distributed across the processors in communicator from a CSRMatrix on rank 0.
|
|
static HypreParCSRMatrix | fromMasterRank (MPI_Comm communicator, IndexType *global_row_starts, IndexType *global_col_starts, hypre_CSRMatrix *matrix) |
| Constructs a ParCSRMatrix distributed across the processors in communicator from a CSRMatrix on rank 0.
|
|
static HypreParCSRMatrix | wrapCSRMatrix (hypre_CSRMatrix *matrix) |
| Wrap a global hypre_CSRMatrix into HypreParCSRMatrix.
|
|
|
hypre_ParCSRMatrix * | m = nullptr |
|
bool | owns_col_map_offd = true |
|
bool | owns_diag = true |
|
bool | owns_handle = true |
|
bool | owns_offd = true |
|
Wrapper for Hypre's sequential CSR matrix.
Links to upstream sources:
◆ HypreParCSRMatrix()
TNL::Matrices::HypreParCSRMatrix::HypreParCSRMatrix |
( |
hypre_ParCSRMatrix * | handle, |
|
|
bool | take_ownership = true ) |
|
inlineexplicit |
Convert Hypre's format to HypreParCSRMatrix.
- Parameters
-
handle | is the Hypre vector handle. |
take_ownership | indicates if the matrix should take ownership of the handle, i.e. whether to call hypre_CSRMatrixDestroy when it does not need it anymore. |
◆ bind() [1/2]
void TNL::Matrices::HypreParCSRMatrix::bind |
( |
hypre_ParCSRMatrix * | handle, |
|
|
bool | take_ownership = true ) |
|
inline |
Convert Hypre's format to HypreParCSRMatrix.
- Parameters
-
handle | is the Hypre vector handle. |
take_ownership | indicates if the matrix should take ownership of the handle, i.e. whether to call hypre_CSRMatrixDestroy when it does not need it anymore. |
◆ bind() [2/2]
void TNL::Matrices::HypreParCSRMatrix::bind |
( |
MPI_Comm | communicator, |
|
|
IndexType | global_num_rows, |
|
|
IndexType | global_num_cols, |
|
|
LocalRangeType | local_row_range, |
|
|
LocalRangeType | local_col_range, |
|
|
hypre_CSRMatrix * | diag, |
|
|
hypre_CSRMatrix * | offd, |
|
|
IndexType * | col_map_offd ) |
|
inline |
Binds ParCSRMatrix to local diag and offd blocks.
- Parameters
-
communicator | MPI communicator to associate with the matrix. |
global_num_rows | Global number of rows of the distributed matrix. |
global_num_cols | Global number of columns of the distributed matrix. |
local_row_range | The range [begin, end) of rows owned by the calling rank. |
local_col_range | The range [begin, end) of columns owned by the calling rank. For square matrices it should be equal to local_row_range. |
diag | The local diagonal matrix block owned by the calling rank. |
offd | The local off-diagonal matrix block owned by the calling rank. |
col_map_offd | Mapping of local-to-global indices for the columns in the off-diagonal block. It must be always a host pointer. |
◆ fromLocalBlocks()
static HypreParCSRMatrix TNL::Matrices::HypreParCSRMatrix::fromLocalBlocks |
( |
MPI_Comm | communicator, |
|
|
IndexType | global_num_rows, |
|
|
IndexType | global_num_cols, |
|
|
LocalRangeType | local_row_range, |
|
|
LocalRangeType | local_col_range, |
|
|
hypre_CSRMatrix * | local_A ) |
|
inlinestaticnodiscard |
Constructs a ParCSRMatrix from local blocks distributed across the processors in communicator.
- Parameters
-
communicator | MPI communicator to associate with the matrix. |
global_num_rows | Global number of rows of the distributed matrix. |
global_num_cols | Global number of columns of the distributed matrix. |
local_row_range | The range [begin, end) of rows owned by the calling rank. |
local_col_range | The range [begin, end) of columns owned by the calling rank. For square matrices it should be equal to local_row_range. |
local_A | The local matrix block owned by the calling rank. The number of rows must match the size of local_row_range and the column indices must span the whole [0, global_cols) range. |
◆ fromMasterRank() [1/2]
static HypreParCSRMatrix TNL::Matrices::HypreParCSRMatrix::fromMasterRank |
( |
hypre_CSRMatrix * | matrix, |
|
|
hypre_ParVector * | x, |
|
|
hypre_ParVector * | b ) |
|
inlinestaticnodiscard |
Constructs a ParCSRMatrix distributed across the processors in communicator from a CSRMatrix on rank 0.
- Note
- This function can be used only for matrices allocated on the host.
- Parameters
-
matrix | Matrix allocated on the master rank to be distributed. |
x | The values of the vector are unused, but its distribution is used for the distribution of the matrix columns. |
b | The values of the vector are unused, but its distribution is used for the distribution of the matrix rows. |
◆ fromMasterRank() [2/2]
static HypreParCSRMatrix TNL::Matrices::HypreParCSRMatrix::fromMasterRank |
( |
MPI_Comm | communicator, |
|
|
IndexType * | global_row_starts, |
|
|
IndexType * | global_col_starts, |
|
|
hypre_CSRMatrix * | matrix ) |
|
inlinestaticnodiscard |
Constructs a ParCSRMatrix distributed across the processors in communicator from a CSRMatrix on rank 0.
- Note
- This function can be used only for matrices allocated on the host.
- Parameters
-
communicator | MPI communicator to associate with the matrix. |
global_row_starts | Array of nproc + 1 elements, where nproc is the number of ranks in the communicator. |
global_col_starts | Array of nproc + 1 elements, where nproc is the number of ranks in the communicator. |
matrix | Matrix allocated on the master rank to be distributed. |
◆ wrapCSRMatrix()
static HypreParCSRMatrix TNL::Matrices::HypreParCSRMatrix::wrapCSRMatrix |
( |
hypre_CSRMatrix * | matrix | ) |
|
|
inlinestaticnodiscard |
Wrap a global hypre_CSRMatrix into HypreParCSRMatrix.
Each rank will get its own independent HypreParCSRMatrix with the MPI_COMM_SELF
communicator. The data is not copied, but HypreParCSRMatrix keeps a non-owning reference.
The documentation for this class was generated from the following file:
- src/TNL/Matrices/HypreParCSRMatrix.h