DOLFIN-X
DOLFIN-X C++ interface
|
Linear algebra interface. More...
Classes | |
class | PETScKrylovSolver |
This class implements Krylov methods for linear systems of the form Ax = b. It is a wrapper for the Krylov solvers of PETSc. More... | |
class | PETScMatrix |
It is a simple wrapper for a PETSc matrix pointer (Mat). Its main purpose is to assist memory management of PETSc Mat objects. More... | |
class | PETScOperator |
This class is a base class for matrices that can be used in PETScKrylovSolver. More... | |
class | PETScOptions |
These class provides static functions that permit users to set and retrieve PETSc options via the PETSc option/parameter system. The option must not be prefixed by '-', e.g. More... | |
class | PETScVector |
A simple wrapper for a PETSc vector pointer (Vec). Its main purpose is to assist with memory/lifetime management of PETSc Vec objects. More... | |
class | SparsityPattern |
This class provides a sparsity pattern data structure that can be used to initialize sparse matrices. More... | |
class | Vector |
Distributed vector. More... | |
class | VectorSpaceBasis |
This class defines a basis for vector spaces, typically used for expressing nullspaces of singular operators and 'near nullspaces' used in smoothed aggregation algebraic multigrid. More... | |
Enumerations | |
enum class | Norm { l1 , l2 , linf , frobenius } |
Norm types. | |
Functions | |
Mat | create_petsc_matrix (MPI_Comm comm, const SparsityPattern &sparsity_pattern, const std::string &type=std::string()) |
Create a PETSc Mat. Caller is responsible for destroying the returned object. | |
MatNullSpace | create_petsc_nullspace (MPI_Comm comm, const VectorSpaceBasis &nullspace) |
Create PETSc MatNullSpace. Caller is responsible for destruction returned object. | |
Vec | create_ghosted_vector (const common::IndexMap &map, int bs, tcb::span< PetscScalar > x) |
Create a PETSc Vec that wraps the data in an array. More... | |
void | petsc_error (int error_code, std::string filename, std::string petsc_function) |
Print error message for PETSc calls that return an error. | |
std::vector< IS > | create_petsc_index_sets (const std::vector< std::pair< std::reference_wrapper< const common::IndexMap >, int >> &maps) |
Vec | create_petsc_vector (const common::IndexMap &map, int bs) |
Create a ghosted PETSc Vec. More... | |
Vec | create_petsc_vector (MPI_Comm comm, std::array< std::int64_t, 2 > range, const std::vector< std::int64_t > &ghosts, int bs) |
Create a ghosted PETSc Vec from a local range and ghost indices. More... | |
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< tcb::span< const PetscScalar >> &x_b, const std::vector< std::pair< std::reference_wrapper< const common::IndexMap >, int >> &maps) |
Scatter local vectors to Vec. | |
Linear algebra interface.
Interface to linear algebra data structures and solvers
Vec dolfinx::la::create_ghosted_vector | ( | const common::IndexMap & | map, |
int | bs, | ||
tcb::span< 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
. The caller is responsible for destroying the Vec. std::vector< IS > dolfinx::la::create_petsc_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}
.
The caller is responsible for destruction of each IS.
[in] | maps | Vector of IndexMaps and corresponding block sizes |
PETSC_COMM_SELF
Vec dolfinx::la::create_petsc_vector | ( | const common::IndexMap & | map, |
int | bs | ||
) |
Create a ghosted PETSc Vec.
Caller is responsible for destroying the returned object.
[in] | map | The index map describing the parallel layout (by block) |
[in] | bs | The block size |
Vec dolfinx::la::create_petsc_vector | ( | MPI_Comm | comm, |
std::array< std::int64_t, 2 > | range, | ||
const std::vector< std::int64_t > & | ghosts, | ||
int | bs | ||
) |
Create a ghosted PETSc Vec from a local range and ghost indices.
Caller is responsible for destroying the returned object.
[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]) . |