|
DOLFINx 0.12.0.0
DOLFINx C++
|
#include <petsc.h>
Public Member Functions | |
| Matrix (MPI_Comm comm, const SparsityPattern &sp, std::optional< std::string_view > type=std::nullopt) | |
| Create holder for a PETSc Mat object from a sparsity pattern. | |
| Matrix (Mat A, bool inc_ref_count) | |
| Create holder of a PETSc Mat object/pointer. The Mat A object should already be created. | |
| Matrix (const Matrix &A)=delete | |
| Matrix (Matrix &&A) noexcept | |
| Move constructor. | |
| ~Matrix () | |
| Destructor. | |
| Matrix & | operator= (const Matrix &A)=delete |
| Matrix & | operator= (Matrix &&A) noexcept |
| Move assignment operator. | |
| std::array< std::int64_t, 2 > | size () const |
| Vec | create_vector (std::size_t dim) const |
| Initialize vector to be compatible with the matrix-vector product y = Ax. In the parallel case, size and layout are both important. | |
| Mat | mat () const |
| Return PETSc Mat pointer. | |
| void | set_options_prefix (std::string_view options_prefix) |
| std::string | get_options_prefix () const |
| void | set_from_options () |
| Call PETSc function MatSetFromOptions on the PETSc Mat object. | |
Static Public Member Functions | |
| static auto | set_fn (Mat A, InsertMode mode) |
| Return a function with an interface for adding or inserting values into the matrix A (calls MatSetValuesLocal). | |
| static auto | set_block_fn (Mat A, InsertMode mode) |
| Return a function with an interface for adding or inserting values into the matrix A using blocked indices (calls MatSetValuesBlockedLocal). | |
| static auto | set_block_expand_fn (Mat A, int bs0, int bs1, InsertMode mode) |
| Return a function with an interface for adding or inserting blocked values to the matrix A using non-blocked insertion (calls MatSetValuesLocal). | |
It is a simple wrapper for a PETSc matrix pointer (Mat). Its main purpose is to assist memory management of PETSc Mat objects.
For advanced usage, access the PETSc Mat pointer using the function mat() and use the standard PETSc interface.
| Matrix | ( | Mat | A, |
| bool | inc_ref_count ) |
Create holder of a PETSc Mat object/pointer. The Mat A object should already be created.
| [in] | A | PETSc Mat object, which must already have been created. The reference count of A is always decreased when this Matrix is destroyed. |
| [in] | inc_ref_count | True if the reference count of A should be incremented. |
| Vec create_vector | ( | std::size_t | dim | ) | const |
Initialize vector to be compatible with the matrix-vector product y = Ax. In the parallel case, size and layout are both important.
| [in] | dim | The dimension (axis): dim = 0 --> z = y, dim = 1 --> z = x |
| std::string get_options_prefix | ( | ) | const |
Returns the prefix used by PETSc when searching the options database
|
inlinestatic |
Return a function with an interface for adding or inserting blocked values to the matrix A using non-blocked insertion (calls MatSetValuesLocal).
Internally it expands the blocked indices into non-blocked arrays.
| [in] | A | The matrix to set values in |
| [in] | bs0 | Block size for the matrix rows |
| [in] | bs1 | Block size for the matrix columns |
| [in] | mode | The PETSc insert mode (ADD_VALUES, INSERT_VALUES, ...) |
|
inlinestatic |
Return a function with an interface for adding or inserting values into the matrix A using blocked indices (calls MatSetValuesBlockedLocal).
| [in] | A | The matrix to set values in |
| [in] | mode | The PETSc insert mode (ADD_VALUES, INSERT_VALUES, ...) |
|
inlinestatic |
Return a function with an interface for adding or inserting values into the matrix A (calls MatSetValuesLocal).
| [in] | A | The matrix to set values in |
| [in] | mode | The PETSc insert mode (ADD_VALUES, INSERT_VALUES, ...) |
| void set_options_prefix | ( | std::string_view | options_prefix | ) |
Sets the prefix used by PETSc when searching the options database
| std::array< std::int64_t, 2 > size | ( | ) | const |
Return number of rows and columns (num_rows, num_cols). PETSc returns -1 if size has not been set.