preCICE v3.2.0
Loading...
Searching...
No Matches
precice::utils::petsc::Matrix Class Reference

#include <Petsc.hpp>

Public Member Functions

 Matrix (const Matrix &)=delete
 Delete copy and assignment constructor.
Matrixoperator= (const Matrix &)=delete
 Matrix (std::string name="")
 Matrix (Matrix &&)=default
 Move constructor, use the implicitly declared.
Matrixoperator= (Matrix &&)=default
 ~Matrix ()
 operator Mat & ()
 Enables implicit conversion into a reference to a PETSc Mat type.
void assemble (MatAssemblyType type=MAT_FINAL_ASSEMBLY)
void init (PetscInt localRows, PetscInt localCols, PetscInt globalRows, PetscInt globalCols, MatType type=nullptr, bool doSetup=true)
 Initializes matrix of given size and type.
void reset ()
 Destroys and recreates the matrix on the same communicator.
MatInfo getInfo (MatInfoType flag) const
 Get the MatInfo struct for the matrix.
void setValue (PetscInt row, PetscInt col, PetscScalar value)
void fillWithRandoms ()
void setColumn (Vector &v, PetscInt col)
std::pair< PetscInt, PetscInt > getSize () const
 Returns (rows, cols) global size.
std::pair< PetscInt, PetscInt > getLocalSize () const
 Returns (rows, cols) local size.
std::pair< PetscInt, PetscInt > ownerRange () const
 Returns a pair that mark the beginning and end of the matrix' ownership range.
std::pair< PetscInt, PetscInt > ownerRangeColumn () const
 Returns a pair that mark the beginning and end of the matrix' column ownership range.
PetscInt blockSize () const
 Returns the block size of the matrix.
void write (const std::string &filename, VIEWERFORMAT format=ASCII) const
 Writes the matrix to file.
void read (const std::string &filename)
 Reads the matrix from file, stored in PETSc binary format.
void view () const
 Prints the matrix.
void viewDraw () const
 Graphically draws the matrix structure.

Public Attributes

Mat matrix = nullptr

Detailed Description

Definition at line 162 of file Petsc.hpp.

Constructor & Destructor Documentation

◆ Matrix() [1/3]

precice::utils::petsc::Matrix::Matrix ( const Matrix & )
delete

Delete copy and assignment constructor.

Copying and assignment of this class would involve copying the pointer to the PETSc object and finally cause double destruction of it.

Here is the call graph for this function:

◆ Matrix() [2/3]

precice::utils::petsc::Matrix::Matrix ( std::string name = "")
explicit

Definition at line 422 of file Petsc.cpp.

Here is the call graph for this function:

◆ Matrix() [3/3]

precice::utils::petsc::Matrix::Matrix ( Matrix && )
default

Move constructor, use the implicitly declared.

Here is the call graph for this function:

◆ ~Matrix()

precice::utils::petsc::Matrix::~Matrix ( )

Definition at line 430 of file Petsc.cpp.

Member Function Documentation

◆ assemble()

void precice::utils::petsc::Matrix::assemble ( MatAssemblyType type = MAT_FINAL_ASSEMBLY)

Definition at line 445 of file Petsc.cpp.

◆ blockSize()

PetscInt precice::utils::petsc::Matrix::blockSize ( ) const

Returns the block size of the matrix.

Definition at line 562 of file Petsc.cpp.

◆ fillWithRandoms()

void precice::utils::petsc::Matrix::fillWithRandoms ( )

Definition at line 496 of file Petsc.cpp.

Here is the call graph for this function:

◆ getInfo()

MatInfo precice::utils::petsc::Matrix::getInfo ( MatInfoType flag) const

Get the MatInfo struct for the matrix.

See http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Mat/MatInfo.html for description of fields.

Definition at line 482 of file Petsc.cpp.

◆ getLocalSize()

std::pair< PetscInt, PetscInt > precice::utils::petsc::Matrix::getLocalSize ( ) const

Returns (rows, cols) local size.

Definition at line 541 of file Petsc.cpp.

Here is the call graph for this function:

◆ getSize()

std::pair< PetscInt, PetscInt > precice::utils::petsc::Matrix::getSize ( ) const

Returns (rows, cols) global size.

Definition at line 534 of file Petsc.cpp.

Here is the call graph for this function:

◆ init()

void precice::utils::petsc::Matrix::init ( PetscInt localRows,
PetscInt localCols,
PetscInt globalRows,
PetscInt globalCols,
MatType type = nullptr,
bool doSetup = true )

Initializes matrix of given size and type.

Parameters
[in]localRows,localColsThe number of rows/cols that are local to the processor
[in]globalRows,globalColsThe number of global rows/cols.
[in]typePETSc type of the matrix
[in]doSetupCall MatSetup(). Not calling MatSetup can have performance gains when using preallocation

Definition at line 454 of file Petsc.cpp.

◆ operator Mat &()

precice::utils::petsc::Matrix::operator Mat & ( )

Enables implicit conversion into a reference to a PETSc Mat type.

Definition at line 440 of file Petsc.cpp.

◆ operator=() [1/2]

Matrix & precice::utils::petsc::Matrix::operator= ( const Matrix & )
delete
Here is the call graph for this function:

◆ operator=() [2/2]

Matrix & precice::utils::petsc::Matrix::operator= ( Matrix && )
default
Here is the call graph for this function:

◆ ownerRange()

std::pair< PetscInt, PetscInt > precice::utils::petsc::Matrix::ownerRange ( ) const

Returns a pair that mark the beginning and end of the matrix' ownership range.

Definition at line 548 of file Petsc.cpp.

Here is the call graph for this function:

◆ ownerRangeColumn()

std::pair< PetscInt, PetscInt > precice::utils::petsc::Matrix::ownerRangeColumn ( ) const

Returns a pair that mark the beginning and end of the matrix' column ownership range.

Definition at line 555 of file Petsc.cpp.

Here is the call graph for this function:

◆ read()

void precice::utils::petsc::Matrix::read ( const std::string & filename)

Reads the matrix from file, stored in PETSc binary format.

Definition at line 579 of file Petsc.cpp.

Here is the call graph for this function:

◆ reset()

void precice::utils::petsc::Matrix::reset ( )

Destroys and recreates the matrix on the same communicator.

Definition at line 471 of file Petsc.cpp.

Here is the call graph for this function:

◆ setColumn()

void precice::utils::petsc::Matrix::setColumn ( Vector & v,
PetscInt col )

Definition at line 513 of file Petsc.cpp.

Here is the call graph for this function:

◆ setValue()

void precice::utils::petsc::Matrix::setValue ( PetscInt row,
PetscInt col,
PetscScalar value )

Definition at line 489 of file Petsc.cpp.

◆ view()

void precice::utils::petsc::Matrix::view ( ) const

Prints the matrix.

Definition at line 587 of file Petsc.cpp.

Here is the call graph for this function:

◆ viewDraw()

void precice::utils::petsc::Matrix::viewDraw ( ) const

Graphically draws the matrix structure.

Definition at line 595 of file Petsc.cpp.

Here is the call graph for this function:

◆ write()

void precice::utils::petsc::Matrix::write ( const std::string & filename,
VIEWERFORMAT format = ASCII ) const

Writes the matrix to file.

Definition at line 571 of file Petsc.cpp.

Here is the call graph for this function:

Member Data Documentation

◆ matrix

Mat precice::utils::petsc::Matrix::matrix = nullptr

Definition at line 164 of file Petsc.hpp.


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