GEOSX
Public Member Functions | List of all members
geos::PetscExport Class Reference

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...
 

Detailed Description

Facilitates exporting Petsc matrix and associated vector objects (either in parallel or serial).

Definition at line 42 of file PetscExport.hpp.

Constructor & Destructor Documentation

◆ PetscExport() [1/2]

geos::PetscExport::PetscExport ( )

Parallel export constructor.

Use this constructor when exporting local part of the matrix on each rank.

◆ PetscExport() [2/2]

geos::PetscExport::PetscExport ( PetscMatrix const &  mat,
integer  targetRank 
)

Single-rank export constructor.

Parameters
matmatrix to export, only used to infer parallel partitioning info (doesn't need to be filled yet)
targetRankthe rank to gather matrix on

Use this constructor when exporting the whole matrix on a single rank.

Member Function Documentation

◆ exportCRS()

template<typename OFFSET_TYPE , typename COLUMN_TYPE >
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.

Template Parameters
OFFSET_TYPErow pointer offset type
COLUMN_TYPEcolumn index type
Parameters
matthe source matrix
rowOffsetsarray view to user-managed array of row pointers
colIndicesarray view to user-managed array of column indices
valuesarray 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.

◆ exportVector()

void geos::PetscExport::exportVector ( PetscVector const &  vec,
arrayView1d< real64 > const &  values 
) const

Export the target vector into an array provided by the user.

Parameters
vecthe source vector, must be compatible with matrix row distribution
valuesarray 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.

◆ importVector()

void geos::PetscExport::importVector ( arrayView1d< const real64 > const &  values,
PetscVector vec 
) const

Import the target vector from an array provided by the user.

Parameters
valuesarray view to user-managed array of vector values
vecthe 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.


The documentation for this class was generated from the following file: