|
GEOS
|
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, arrayView1d< OFFSET_TYPE > const &rowOffsets, arrayView1d< COLUMN_TYPE > const &colIndices, arrayView1d< real64 > const &values) const |
| Export the matrix into CRS arrays provided by the user. More... | |
| void | exportVector (PetscVector const &vec, arrayView1d< real64 > const &values) const |
| Export the target vector into an array provided by the user. More... | |
| void | importVector (arrayView1d< const 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 43 of file PetscExport.hpp.
| geos::PetscExport::PetscExport | ( | ) |
Parallel export constructor.
Use this constructor when exporting local part of the matrix on each rank.
| geos::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 geos::PetscExport::exportCRS | ( | PetscMatrix const & | mat, |
| arrayView1d< OFFSET_TYPE > const & | rowOffsets, | ||
| arrayView1d< COLUMN_TYPE > const & | colIndices, | ||
| arrayView1d< real64 > const & | 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 | array view to user-managed array of row pointers |
| colIndices | array view to user-managed array of column indices |
| values | array view 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 geos::PetscExport::exportVector | ( | PetscVector const & | vec, |
| arrayView1d< real64 > const & | 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 | array view 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 geos::PetscExport::importVector | ( | arrayView1d< const real64 > const & | values, |
| PetscVector & | vec | ||
| ) | const |
Import the target vector from an array provided by the user.
| values | array view 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.