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  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  Norm { l1, l2, linf, frobenius }
 Norm types.
 

Functions

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.
 
Vec create_ghosted_vector (const common::IndexMap &map, const Eigen::Matrix< PetscScalar, Eigen::Dynamic, 1 > &x)
 Create a PETSc Vec that wraps the data in x. 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< const common::IndexMap * > &maps)
 
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.
 
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)
 Scatter local Eigen vectors to Vec.
 

Detailed Description

Linear algebra interface.

Interface to linear algebra data structures and solvers

Function Documentation

◆ create_ghosted_vector()

Vec dolfinx::la::create_ghosted_vector ( const common::IndexMap map,
const Eigen::Matrix< PetscScalar, Eigen::Dynamic, 1 > &  x 
)

Create a PETSc Vec that wraps the data in x.

Parameters
[in]mapThe index map that described the parallel layout of the distributed vector
[in]xThe local part of the vector, including ghost entries
Returns
A PETSc Vec object that share the x data. The caller is responsible for destroying the Vec.

◆ create_petsc_index_sets()

std::vector< IS > dolfinx::la::create_petsc_index_sets ( const std::vector< const common::IndexMap * > &  maps)
Todo:
This function could take just the local sizes

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.

Parameters
[in]mapsVector of IndexMaps
Returns
Vector of PETSc Index Sets, created on PETSc_COMM_SELF