DOLFINx 0.8.0
DOLFINx C++ interface
|
PETSc linear algebra functions. More...
Namespaces | |
namespace | options |
Classes | |
class | KrylovSolver |
class | Matrix |
class | Operator |
class | Vector |
Functions | |
void | error (int error_code, std::string filename, std::string petsc_function) |
Print error message for PETSc calls that return an error. | |
std::vector< Vec > | create_vectors (MPI_Comm comm, const std::vector< std::span< const PetscScalar > > &x) |
Vec | create_vector (const common::IndexMap &map, int bs) |
Vec | create_vector (MPI_Comm comm, std::array< std::int64_t, 2 > range, std::span< const std::int64_t > ghosts, int bs) |
Vec | create_vector_wrap (const common::IndexMap &map, int bs, std::span< const PetscScalar > x) |
template<class V > | |
Vec | create_vector_wrap (const la::Vector< V > &x) |
std::vector< IS > | create_index_sets (const std::vector< std::pair< std::reference_wrapper< const common::IndexMap >, int > > &maps) |
std::vector< std::vector< PetscScalar > > | get_local_vectors (const Vec x, const std::vector< std::pair< std::reference_wrapper< const common::IndexMap >, int > > &maps) |
Copy blocks from Vec into local vectors. | |
void | scatter_local_vectors (Vec x, const std::vector< std::span< const PetscScalar > > &x_b, const std::vector< std::pair< std::reference_wrapper< const common::IndexMap >, int > > &maps) |
Scatter local vectors to Vec. | |
Mat | create_matrix (MPI_Comm comm, const SparsityPattern &sp, std::string type=std::string()) |
MatNullSpace | create_nullspace (MPI_Comm comm, std::span< const Vec > basis) |
PETSc linear algebra functions.
std::vector< IS > create_index_sets | ( | const std::vector< std::pair< std::reference_wrapper< const common::IndexMap >, int > > & | maps | ) |
Compute PETSc IndexSets (IS) for a stack of index maps. E.g., if map[0] = {0, 1, 2, 3, 4, 5, 6}
and map[1] = {0, 1, 2, 4}
(in local indices) then IS[0] = {0, 1, 2, 3, 4, 5, 6}
and IS[1] = {7, 8, 9, 10}
.
[in] | maps | Vector of IndexMaps and corresponding block sizes |
PETSC_COMM_SELF
Mat create_matrix | ( | MPI_Comm | comm, |
const SparsityPattern & | sp, | ||
std::string | type = std::string() ) |
Create a PETSc Mat. Caller is responsible for destroying the returned object.
MatNullSpace create_nullspace | ( | MPI_Comm | comm, |
std::span< const Vec > | basis ) |
Create PETSc MatNullSpace. Caller is responsible for destruction returned object.
[in] | comm | The MPI communicator |
[in] | basis | The nullspace basis vectors |
Vec create_vector | ( | const common::IndexMap & | map, |
int | bs ) |
Create a ghosted PETSc Vec
[in] | map | The index map describing the parallel layout (by block) |
[in] | bs | The block size |
Vec create_vector | ( | MPI_Comm | comm, |
std::array< std::int64_t, 2 > | range, | ||
std::span< const std::int64_t > | ghosts, | ||
int | bs ) |
Create a ghosted PETSc Vec from a local range and ghost indices
[in] | comm | The MPI communicator |
[in] | range | The local ownership range (by blocks) |
[in] | ghosts | Ghost blocks |
[in] | bs | The block size. The total number of local entries is bs * (range[1] - range[0]) . |
Vec create_vector_wrap | ( | const common::IndexMap & | map, |
int | bs, | ||
std::span< const PetscScalar > | x ) |
Create a PETSc Vec that wraps the data in an array
[in] | map | The index map that describes the parallel layout of the distributed vector (by block) |
[in] | bs | Block size |
[in] | x | The local part of the vector, including ghost entries |
x
x
must be kept alive to use the PETSc Vec object Vec create_vector_wrap | ( | const la::Vector< V > & | x | ) |
Create a PETSc Vec that wraps the data in an array
[in] | x | The vector to be wrapped |
x
std::vector< Vec > create_vectors | ( | MPI_Comm | comm, |
const std::vector< std::span< const PetscScalar > > & | x ) |
Create PETsc vectors from the local data. The data is copied into the PETSc vectors and is not shared.
[in] | comm | The MPI communicator |
[in] | x | The vector data owned by the calling rank. All components must have the same length. |