preCICE v3.1.2
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | List of all members
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 164 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.

◆ Matrix() [2/3]

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

Definition at line 462 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.

◆ ~Matrix()

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

Definition at line 470 of file Petsc.cpp.

Member Function Documentation

◆ assemble()

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

Definition at line 485 of file Petsc.cpp.

◆ blockSize()

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

Returns the block size of the matrix.

Definition at line 602 of file Petsc.cpp.

◆ fillWithRandoms()

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

Definition at line 536 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 522 of file Petsc.cpp.

◆ getLocalSize()

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

Returns (rows, cols) local size.

Definition at line 581 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 574 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 494 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 480 of file Petsc.cpp.

◆ operator=() [1/2]

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

◆ operator=() [2/2]

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

◆ 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 588 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 595 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 619 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 511 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 553 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 529 of file Petsc.cpp.

◆ view()

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

Prints the matrix.

Definition at line 627 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 635 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 611 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 166 of file Petsc.hpp.


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