DOLFIN-X
DOLFIN-X C++ interface
Classes | Enumerations | Functions
dolfinx::la Namespace Reference

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
 It is a simple wrapper for a PETSc vector pointer (Vec). Its main purpose is to assist memory 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  VecReadWrapper
 Read-only wrapper around a PETSc Vec object, to simplify direct access to data. 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...
 
class  VecWrapper
 Wrapper around a PETSc Vec object, to simplify direct access to data. More...
 

Enumerations

enum  Norm { l1, l2, linf, frobenius }
 Norm types.
 

Functions

Vec create_petsc_vector (const common::IndexMap &map)
 Create a ghosted PETSc Vec. Caller is responsible for destroying the returned object.
 
Vec create_petsc_vector (MPI_Comm comm, std::array< std::int64_t, 2 > range, const Eigen::Ref< const Eigen::Array< std::int64_t, Eigen::Dynamic, 1 >> &ghost_indices, int block_size)
 Create a ghosted PETSc Vec. Caller is responsible for destroying the returned object.
 
Mat create_petsc_matrix (MPI_Comm comm, const SparsityPattern &sparsity_pattern)
 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.
 
std::vector< IS > create_petsc_index_sets (const std::vector< const common::IndexMap * > &maps)
 Compute IndexSets (IS) for stacked index maps. E.g., if map[0] = {0, 1, 2, 3, 4, 5, 6} and map[1] = {0, 1, 2, 4} (in local indices), IS[0] = {0, 1, 2, 3, 4, 5, 6} and IS[1] = {7, 8, 9, 10}. Caller is responsible for destruction of each IS. 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< Eigen::Matrix< PetscScalar, Eigen::Dynamic, 1 > > get_local_vectors (const Vec x, const std::vector< const common::IndexMap * > &maps)
 Copy blocks from Vec into Eigen vectors.
 
void scatter_local_vectors (Vec x, const std::vector< Eigen::Matrix< PetscScalar, Eigen::Dynamic, 1 >> &x_b, const std::vector< const common::IndexMap * > &maps)
 Copy blocks from Vec into local Vec objects. More...
 

Detailed Description

Linear algebra interface.

Interface to linear algebra data structures and solvers

Function Documentation

◆ create_petsc_index_sets()

std::vector< IS > dolfinx::la::create_petsc_index_sets ( const std::vector< const common::IndexMap * > &  maps)

Compute IndexSets (IS) for stacked index maps. E.g., if map[0] = {0, 1, 2, 3, 4, 5, 6} and map[1] = {0, 1, 2, 4} (in local indices), IS[0] = {0, 1, 2, 3, 4, 5, 6} and IS[1] = {7, 8, 9, 10}. Caller is responsible for destruction of each IS.

Todo:
This function could take just the local sizes
Parameters
[in]mapsVector of IndexMaps
Returns
Vector of PETSc Index Sets, created on PETSc_COMM_SELF

◆ scatter_local_vectors()

void dolfinx::la::scatter_local_vectors ( Vec  x,
const std::vector< Eigen::Matrix< PetscScalar, Eigen::Dynamic, 1 >> &  x_b,
const std::vector< const common::IndexMap * > &  maps 
)

Copy blocks from Vec into local Vec objects.

Scatter local Eigen vectors to Vec