GEOSX
|
Facilitates exporting Petsc matrix and associated vector objects (either in parallel or serial). More...
#include <PetscExport.hpp>
Public Member Functions | |
PetscExport () | |
Parallel export constructor. More... | |
PetscExport (PetscMatrix const &mat, integer targetRank) | |
Single-rank export constructor. More... | |
~PetscExport () | |
Destructor. | |
template<typename OFFSET_TYPE , typename COLUMN_TYPE > | |
void | exportCRS (PetscMatrix const &mat, OFFSET_TYPE *rowOffsets, COLUMN_TYPE *colIndices, real64 *values) const |
Export the matrix into CRS arrays provided by the user. More... | |
void | exportVector (PetscVector const &vec, real64 *values) const |
Export the target vector into an array provided by the user. More... | |
void | importVector (real64 const *values, PetscVector &vec) const |
Import the target vector from an array provided by the user. More... | |
Facilitates exporting Petsc matrix and associated vector objects (either in parallel or serial).
Definition at line 42 of file PetscExport.hpp.
geosx::PetscExport::PetscExport | ( | ) |
Parallel export constructor.
Use this constructor when exporting local part of the matrix on each rank.
geosx::PetscExport::PetscExport | ( | PetscMatrix const & | mat, |
integer | targetRank | ||
) |
Single-rank export constructor.
mat | matrix to export, only used to infer parallel partitioning info (doesn't need to be filled yet) |
targetRank | the rank to gather matrix on |
Use this constructor when exporting the whole matrix on a single rank.
void geosx::PetscExport::exportCRS | ( | PetscMatrix const & | mat, |
OFFSET_TYPE * | rowOffsets, | ||
COLUMN_TYPE * | colIndices, | ||
real64 * | values | ||
) | const |
Export the matrix into CRS arrays provided by the user.
OFFSET_TYPE | row pointer offset type |
COLUMN_TYPE | column index type |
mat | the source matrix |
rowOffsets | pointer to user-managed array of row pointers |
colIndices | pointer to user-managed array of column indices |
values | pointer to user-managed array of matrix values |
This function must be called on all ranks in the matrix's communicator. Only target rank needs to provide meaningful pointer parameters when doing single-rank export.
void geosx::PetscExport::exportVector | ( | PetscVector const & | vec, |
real64 * | values | ||
) | const |
Export the target vector into an array provided by the user.
vec | the source vector, must be compatible with matrix row distribution |
values | pointer to user-managed array of vector values |
This method can be used to extract data from vectors associated with the original matrix. It is mostly useful for single-rank export (gather) of vector values. In parallel users can just call vec.extractLocalVector() and obtain values without copying.
This function must be called on all ranks in the matrix/vector communicator. Only target rank needs to provide meaningful pointer parameter when doing single-rank export.
void geosx::PetscExport::importVector | ( | real64 const * | values, |
PetscVector & | vec | ||
) | const |
Import the target vector from an array provided by the user.
values | pointer to user-managed array of vector values |
vec | the target vector, must be compatible with matrix row distribution |
This method can be used to populate data into vectors associated with the original matrix. It is mostly useful for single-rank import (scatter) of vector values. In parallel users can just call vec.extractLocalVector() and populate values without copying.
This function must be called on all ranks in the matrix/vector communicator. Only target rank needs to provide meaningful pointer parameter when doing single-rank import.