dolfin/la¶
Documentation for C++ code found in dolfin/la/*.h
Contents
- dolfin/la
- Functions
- as_type
- has_krylov_solver_method
- has_krylov_solver_preconditioner
- has_linear_algebra_backend
- has_lu_solver_method
- has_type
- in_nullspace
- krylov_solver_methods
- krylov_solver_preconditioners
- linear_algebra_backends
- linear_solver_methods
- list_krylov_solver_methods
- list_krylov_solver_preconditioners
- list_linear_algebra_backends
- list_linear_solver_methods
- list_lu_solver_methods
- lu_solver_methods
- norm
- normalize
- residual
- solve
- usermult
- Classes
- Amesos2LUSolver
- BelosKrylovSolver
- BlockMatrix
- BlockVector
- CoordinateMatrix
- DefaultFactory
- EigenFactory
- EigenKrylovSolver
- EigenLUSolver
- EigenMatrix
- EigenVector
- GenericLinearAlgebraFactory
- GenericLinearOperator
- GenericLinearSolver
- GenericMatrix
- GenericTensor
- GenericVector
- Ifpack2Preconditioner
- IndexMap
- KrylovSolver
- LUSolver
- LinearAlgebraObject
- LinearOperator
- LinearSolver
- Matrix
- MueluPreconditioner
- PETScBaseMatrix
- PETScFactory
- PETScKrylovSolver
- PETScLUSolver
- PETScLinearOperator
- PETScMatrix
- PETScObject
- PETScOptions
- PETScPreconditioner
- PETScVector
- Scalar
- SparsityPattern
- TensorLayout
- TpetraFactory
- TpetraMatrix
- TpetraVector
- TrilinosParameters
- TrilinosPreconditioner
- Vector
- VectorSpaceBasis
- Functions
Functions¶
as_type¶
C++ documentation for as_type
from dolfin/la/LinearAlgebraObject.h
:
-
Y &
dolfin::
as_type
(X &x)¶ Cast object to its derived class, if possible (non-const version). An error is thrown if the cast is unsuccessful.
Parameters: x –
C++ documentation for as_type
from dolfin/la/LinearAlgebraObject.h
:
Cast shared pointer object to its derived class, if possible. Caller must check for success (returns null if cast fails).
Parameters: x –
has_krylov_solver_method¶
C++ documentation for has_krylov_solver_method
from dolfin/la/solve.h
:
-
bool
dolfin::
has_krylov_solver_method
(std::string method)¶ Return true if Krylov method for the current linear algebra backend is available
Parameters: method –
has_krylov_solver_preconditioner¶
C++ documentation for has_krylov_solver_preconditioner
from dolfin/la/solve.h
:
-
bool
dolfin::
has_krylov_solver_preconditioner
(std::string preconditioner)¶ Return true if Preconditioner for the current linear algebra backend is available
Parameters: preconditioner –
has_linear_algebra_backend¶
C++ documentation for has_linear_algebra_backend
from dolfin/la/solve.h
:
-
bool
dolfin::
has_linear_algebra_backend
(std::string backend)¶ Return true if a specific linear algebra backend is supported.
Parameters: backend –
has_lu_solver_method¶
C++ documentation for has_lu_solver_method
from dolfin/la/solve.h
:
-
bool
dolfin::
has_lu_solver_method
(std::string method)¶ Return true if LU method for the current linear algebra backend is available
Parameters: method –
has_type¶
C++ documentation for has_type
from dolfin/la/LinearAlgebraObject.h
:
-
bool
dolfin::
has_type
(const X &x)¶ Check whether the object matches a specific type.
Parameters: x –
in_nullspace¶
C++ documentation for in_nullspace
from dolfin/la/test_nullspace.h
:
-
bool
dolfin::
in_nullspace
(const GenericLinearOperator &A, const VectorSpaceBasis &x, std::string type = "right")¶ Check whether a vector space basis is in the nullspace of a given operator. The string option ‘type’ can be “right” for the right nullspace (Ax=0) or “left” for the left nullspace (A^Tx = 0). To test the left nullspace, A must also be of type
GenericMatrix
.Parameters: - A –
- x –
- type –
krylov_solver_methods¶
C++ documentation for krylov_solver_methods
from dolfin/la/solve.h
:
-
std::map<std::string, std::string>
dolfin::
krylov_solver_methods
()¶ Return a list of available Krylov methods for current linear algebra backend
krylov_solver_preconditioners¶
C++ documentation for krylov_solver_preconditioners
from dolfin/la/solve.h
:
-
std::map<std::string, std::string>
dolfin::
krylov_solver_preconditioners
()¶ Return a list of available preconditioners for current linear algebra backend
linear_algebra_backends¶
C++ documentation for linear_algebra_backends
from dolfin/la/solve.h
:
-
std::map<std::string, std::string>
dolfin::
linear_algebra_backends
()¶ Return available linear algebra backends.
linear_solver_methods¶
C++ documentation for linear_solver_methods
from dolfin/la/solve.h
:
-
std::map<std::string, std::string>
dolfin::
linear_solver_methods
()¶ Return a list of available solver methods for current linear algebra backend
list_krylov_solver_methods¶
C++ documentation for list_krylov_solver_methods
from dolfin/la/solve.h
:
-
void
dolfin::
list_krylov_solver_methods
()¶ List available Krylov methods for current linear algebra backend.
list_krylov_solver_preconditioners¶
C++ documentation for list_krylov_solver_preconditioners
from dolfin/la/solve.h
:
-
void
dolfin::
list_krylov_solver_preconditioners
()¶ List available preconditioners for current linear algebra backend
list_linear_algebra_backends¶
C++ documentation for list_linear_algebra_backends
from dolfin/la/solve.h
:
-
void
dolfin::
list_linear_algebra_backends
()¶ List available linear algebra backends.
list_linear_solver_methods¶
C++ documentation for list_linear_solver_methods
from dolfin/la/solve.h
:
-
void
dolfin::
list_linear_solver_methods
()¶ List available solver methods for current linear algebra backend.
list_lu_solver_methods¶
C++ documentation for list_lu_solver_methods
from dolfin/la/solve.h
:
-
void
dolfin::
list_lu_solver_methods
()¶ List available LU methods for current linear algebra backend.
lu_solver_methods¶
C++ documentation for lu_solver_methods
from dolfin/la/solve.h
:
-
std::map<std::string, std::string>
dolfin::
lu_solver_methods
()¶ Return a list of available LU methods for current linear algebra backend
norm¶
C++ documentation for norm
from dolfin/la/solve.h
:
-
double
dolfin::
norm
(const GenericVector &x, std::string norm_type = "l2")¶ Compute norm of vector. Valid norm types are “l2”, “l1” and “linf”.
Parameters: - x –
- norm_type –
normalize¶
C++ documentation for normalize
from dolfin/la/solve.h
:
-
double
dolfin::
normalize
(GenericVector &x, std::string normalization_type = "average")¶ Normalize vector according to given normalization type.
Parameters: - x –
- normalization_type –
residual¶
C++ documentation for residual
from dolfin/la/solve.h
:
-
double
dolfin::
residual
(const GenericLinearOperator &A, const GenericVector &x, const GenericVector &b)¶ Compute residual ||Ax - b||.
Parameters: - A –
- x –
- b –
solve¶
C++ documentation for solve
from dolfin/la/solve.h
:
-
std::size_t
dolfin::
solve
(const GenericLinearOperator &A, GenericVector &x, const GenericVector &b, std::string method = "lu", std::string preconditioner = "none")¶ Solve linear system Ax = b.
Parameters: - A –
- x –
- b –
- method –
- preconditioner –
Classes¶
Amesos2LUSolver¶
C++ documentation for Amesos2LUSolver
from dolfin/la/Amesos2LUSolver.h
:
-
class
dolfin::
Amesos2LUSolver
: public dolfin::GenericLinearSolver¶ This class implements the direct solution (LU factorization) for linear systems of the form Ax = b. It is a wrapper for the Trilinos Amesos2 LU solver.
Constructor.
Parameters: - A –
- method –
-
dolfin::Amesos2LUSolver::
Amesos2LUSolver
(std::string method = "default")¶ Constructor.
Parameters: method –
-
const GenericLinearOperator &
dolfin::Amesos2LUSolver::
get_operator
() const¶ Get operator (matrix)
-
void
dolfin::Amesos2LUSolver::
init_solver
(std::string &method)¶ Parameters: method –
-
std::map<std::string, std::string>
dolfin::Amesos2LUSolver::
methods
()¶ Return a list of available solver methods.
-
std::string
dolfin::Amesos2LUSolver::
parameter_type
() const¶ Return parameter type: “krylov_solver” or “lu_solver”.
Set
operator (matrix)Parameters: A –
Set
operator (matrix)Parameters: A –
-
std::size_t
dolfin::Amesos2LUSolver::
solve
(GenericVector &x, const GenericVector &b)¶ Solve linear system Ax = b.
Parameters: - x –
- b –
-
std::size_t
dolfin::Amesos2LUSolver::
solve
(const GenericLinearOperator &A, GenericVector &x, const GenericVector &b)¶ Solve linear system Ax = b.
Parameters: - A –
- x –
- b –
-
std::size_t
dolfin::Amesos2LUSolver::
solve
(const TpetraMatrix &A, TpetraVector &x, const TpetraVector &b)¶ Solve linear system Ax = b.
Parameters: - A –
- x –
- b –
-
std::string
dolfin::Amesos2LUSolver::
str
(bool verbose) const¶ Return informal string representation (pretty-print)
Parameters: verbose –
-
dolfin::Amesos2LUSolver::
~Amesos2LUSolver
()¶ Destructor.
BelosKrylovSolver¶
C++ documentation for BelosKrylovSolver
from dolfin/la/BelosKrylovSolver.h
:
-
class
dolfin::
BelosKrylovSolver
: public dolfin::GenericLinearSolver¶ This class implements Krylov methods for linear systems of the form Ax = b. It is a wrapper for the Belos iterative solver from Trilinos
Friends:
Ifpack2Preconditioner
,MueluPreconditioner
.Create Krylov solver for a particular method and
TrilinosPreconditioner
.Parameters: - method –
- preconditioner –
-
dolfin::BelosKrylovSolver::
BelosKrylovSolver
(std::string method = "default", std::string preconditioner = "default")¶ Create Krylov solver for a particular method and names preconditioner
Parameters: - method –
- preconditioner –
-
void
dolfin::BelosKrylovSolver::
check_dimensions
(const TpetraMatrix &A, const GenericVector &x, const GenericVector &b) const¶ Parameters: - A –
- x –
- b –
-
const TpetraMatrix &
dolfin::BelosKrylovSolver::
get_operator
() const¶ Get operator (matrix)
-
void
dolfin::BelosKrylovSolver::
init
(const std::string &method)¶ Parameters: method –
-
std::map<std::string, std::string>
dolfin::BelosKrylovSolver::
methods
()¶ Return a list of available solver methods.
-
type
dolfin::BelosKrylovSolver::
op_type
¶ Tpetra operator type.
-
std::string
dolfin::BelosKrylovSolver::
parameter_type
() const¶ Return parameter type: “krylov_solver” or “lu_solver”.
-
std::map<std::string, std::string>
dolfin::BelosKrylovSolver::
preconditioners
()¶ Return a list of available preconditioners.
-
type
dolfin::BelosKrylovSolver::
problem_type
¶ Belos problem type.
Set
operator (matrix)Parameters: A –
Set
operator (matrix) and preconditioner matrix.Parameters: - A –
- P –
-
void
dolfin::BelosKrylovSolver::
set_options
()¶
-
std::size_t
dolfin::BelosKrylovSolver::
solve
(GenericVector &x, const GenericVector &b)¶ Solve linear system Ax = b and return number of iterations.
Parameters: - x –
- b –
-
std::size_t
dolfin::BelosKrylovSolver::
solve
(const GenericLinearOperator &A, GenericVector &x, const GenericVector &b)¶ Solve linear system Ax = b and return number of iterations.
Parameters: - A –
- x –
- b –
-
std::string
dolfin::BelosKrylovSolver::
str
(bool verbose) const¶ Return informal string representation (pretty-print)
Parameters: verbose –
-
dolfin::BelosKrylovSolver::
~BelosKrylovSolver
()¶ Destructor.
BlockMatrix¶
C++ documentation for BlockMatrix
from dolfin/la/BlockMatrix.h
:
-
class
dolfin::
BlockMatrix
¶ Block
Matrix
.-
dolfin::BlockMatrix::
BlockMatrix
(std::size_t m = 0, std::size_t n = 0)¶ Constructor.
Parameters: - m –
- n –
-
void
dolfin::BlockMatrix::
apply
(std::string mode)¶ Finalize assembly of tensor.
Parameters: mode –
-
std::shared_ptr<GenericMatrix>
dolfin::BlockMatrix::
get_block
(std::size_t i, std::size_t j)¶ Get block.
Parameters: - i –
- j –
-
std::shared_ptr<const GenericMatrix>
dolfin::BlockMatrix::
get_block
(std::size_t i, std::size_t j) const¶ Get block (const version)
Parameters: - i –
- j –
-
boost::multi_array<std::shared_ptr<GenericMatrix>, 2>
dolfin::BlockMatrix::
matrices
¶
-
void
dolfin::BlockMatrix::
mult
(const BlockVector &x, BlockVector &y, bool transposed = false) const¶ Matrix-vector product, y = Ax.
Parameters: - x –
- y –
- transposed –
-
std::shared_ptr<GenericMatrix>
dolfin::BlockMatrix::
schur_approximation
(bool symmetry = true) const¶ Create a crude explicit Schur approximation of S = D - C A^-1 B of (A B; C D) If symmetry != 0, then the caller promises that B = symmetry * transpose(C).
Parameters: symmetry –
Set
block.Parameters: - i –
- j –
- m –
-
std::size_t
dolfin::BlockMatrix::
size
(std::size_t dim) const¶ Return size of given dimension.
Parameters: dim –
-
std::string
dolfin::BlockMatrix::
str
(bool verbose) const¶ Return informal string representation (pretty-print)
Parameters: verbose –
-
dolfin::BlockMatrix::
~BlockMatrix
()¶ Destructor.
-
BlockVector¶
C++ documentation for BlockVector
from dolfin/la/BlockVector.h
:
-
class
dolfin::
BlockVector
¶ Block vector.
-
dolfin::BlockVector::
BlockVector
(std::size_t n = 0)¶ Constructor.
Parameters: n –
-
void
dolfin::BlockVector::
axpy
(double a, const BlockVector &x)¶ Add multiple of given vector (AXPY operation)
Parameters: - a –
- x –
-
BlockVector *
dolfin::BlockVector::
copy
() const¶ Return copy of tensor.
-
bool
dolfin::BlockVector::
empty
() const¶ Return true if empty.
-
std::shared_ptr<const GenericVector>
dolfin::BlockVector::
get_block
(std::size_t i) const¶ Get sub-vector (const)
Parameters: i –
-
std::shared_ptr<GenericVector>
dolfin::BlockVector::
get_block
(std::size_t)¶ Get sub-vector (non-const)
Parameters: i –
-
double
dolfin::BlockVector::
inner
(const BlockVector &x) const¶ Return inner product with given vector.
Parameters: x –
-
double
dolfin::BlockVector::
max
() const¶ Return maximum value of vector.
-
double
dolfin::BlockVector::
min
() const¶ Return minimum value of vector.
-
double
dolfin::BlockVector::
norm
(std::string norm_type) const¶ Return norm of vector.
Parameters: norm_type –
-
const BlockVector &
dolfin::BlockVector::
operator*=
(double a)¶ Multiply vector by given number.
Parameters: a –
-
const BlockVector &
dolfin::BlockVector::
operator+=
(const BlockVector &x)¶ Add given vector.
Parameters: x –
-
const BlockVector &
dolfin::BlockVector::
operator-=
(const BlockVector &x)¶ Subtract given vector.
Parameters: x –
-
const BlockVector &
dolfin::BlockVector::
operator/=
(double a)¶ Divide vector by given number.
Parameters: a –
-
const BlockVector &
dolfin::BlockVector::
operator=
(const BlockVector &x)¶ Assignment operator.
Parameters: x –
-
const BlockVector &
dolfin::BlockVector::
operator=
(double a)¶ Assignment operator.
Parameters: a –
Set
function.Parameters: - i –
- v –
-
std::size_t
dolfin::BlockVector::
size
() const¶ Number of vectors.
-
std::string
dolfin::BlockVector::
str
(bool verbose) const¶ Return informal string representation (pretty-print)
Parameters: verbose –
-
std::vector<std::shared_ptr<GenericVector>>
dolfin::BlockVector::
vectors
¶
-
dolfin::BlockVector::
~BlockVector
()¶ Destructor.
-
CoordinateMatrix¶
C++ documentation for CoordinateMatrix
from dolfin/la/CoordinateMatrix.h
:
-
class
dolfin::
CoordinateMatrix
¶ Coordinate sparse matrix.
-
dolfin::CoordinateMatrix::
CoordinateMatrix
(const GenericMatrix &A, bool symmetric, bool base_one)¶ Constructor.
Parameters: - A –
- symmetric –
- base_one –
-
bool
dolfin::CoordinateMatrix::
base_one
() const¶ Whether indices start from 0 (C-style) or 1 (FORTRAN-style)
-
const std::vector<std::size_t> &
dolfin::CoordinateMatrix::
columns
() const¶ Get column indices.
-
MPI_Comm
dolfin::CoordinateMatrix::
mpi_comm
() const¶ Get MPI_Comm.
-
double
dolfin::CoordinateMatrix::
norm
(std::string norm_type) const¶ Return norm of matrix.
Parameters: norm_type –
-
const std::vector<std::size_t> &
dolfin::CoordinateMatrix::
rows
() const¶ Get row indices.
-
std::size_t
dolfin::CoordinateMatrix::
size
(std::size_t dim) const¶ Size
Parameters: dim – (std::size_t) Dimension (0 or 1)
-
const std::vector<double> &
dolfin::CoordinateMatrix::
values
() const¶ Get values.
-
dolfin::CoordinateMatrix::
~CoordinateMatrix
()¶ Destructor.
-
DefaultFactory¶
C++ documentation for DefaultFactory
from dolfin/la/DefaultFactory.h
:
-
class
dolfin::
DefaultFactory
¶ Default linear algebra factory based on global parameter “linear_algebra_backend”.
-
dolfin::DefaultFactory::
DefaultFactory
()¶ Constructor.
-
std::shared_ptr<dolfin::GenericLinearSolver>
dolfin::DefaultFactory::
create_krylov_solver
(MPI_Comm comm, std::string method, std::string preconditioner) const¶ Create Krylov solver.
Parameters: - comm –
- method –
- preconditioner –
-
std::shared_ptr<TensorLayout>
dolfin::DefaultFactory::
create_layout
(MPI_Comm comm, std::size_t rank) const¶ Create empty tensor layout.
Parameters: - comm –
- rank –
-
std::shared_ptr<GenericLinearOperator>
dolfin::DefaultFactory::
create_linear_operator
(MPI_Comm comm) const¶ Create empty linear operator.
Parameters: comm –
-
std::shared_ptr<dolfin::GenericLinearSolver>
dolfin::DefaultFactory::
create_lu_solver
(MPI_Comm comm, std::string method) const¶ Create LU solver.
Parameters: - comm –
- method –
-
std::shared_ptr<GenericMatrix>
dolfin::DefaultFactory::
create_matrix
(MPI_Comm comm) const¶ Create empty matrix.
Parameters: comm –
-
std::shared_ptr<GenericVector>
dolfin::DefaultFactory::
create_vector
(MPI_Comm comm) const¶ Create empty vector.
Parameters: comm –
-
GenericLinearAlgebraFactory &
dolfin::DefaultFactory::
factory
()¶ Return instance of default backend.
-
std::map<std::string, std::string>
dolfin::DefaultFactory::
krylov_solver_methods
() const¶ Return a list of available Krylov solver methods.
-
std::map<std::string, std::string>
dolfin::DefaultFactory::
krylov_solver_preconditioners
() const¶ Return a list of available preconditioners.
-
std::map<std::string, std::string>
dolfin::DefaultFactory::
lu_solver_methods
() const¶ Return a list of available LU solver methods.
-
dolfin::DefaultFactory::
~DefaultFactory
()¶ Destructor.
-
EigenFactory¶
C++ documentation for EigenFactory
from dolfin/la/EigenFactory.h
:
-
class
dolfin::
EigenFactory
¶ Eigen linear algebra factory.
-
dolfin::EigenFactory::
EigenFactory
()¶
-
std::shared_ptr<GenericLinearSolver>
dolfin::EigenFactory::
create_krylov_solver
(MPI_Comm comm, std::string method, std::string preconditioner) const¶ Create Krylov solver.
Parameters: - comm –
- method –
- preconditioner –
-
std::shared_ptr<TensorLayout>
dolfin::EigenFactory::
create_layout
(MPI_Comm comm, std::size_t rank) const¶ Create empty tensor layout.
Parameters: - comm –
- rank –
-
std::shared_ptr<GenericLinearOperator>
dolfin::EigenFactory::
create_linear_operator
(MPI_Comm comm) const¶ Create empty linear operator.
Parameters: comm –
-
std::shared_ptr<GenericLinearSolver>
dolfin::EigenFactory::
create_lu_solver
(MPI_Comm comm, std::string method) const¶ Create LU solver.
Parameters: - comm –
- method –
-
std::shared_ptr<GenericMatrix>
dolfin::EigenFactory::
create_matrix
(MPI_Comm comm) const¶ Create empty matrix.
Parameters: comm –
-
std::shared_ptr<GenericVector>
dolfin::EigenFactory::
create_vector
(MPI_Comm comm) const¶ Create empty vector.
Parameters: comm –
-
EigenFactory
dolfin::EigenFactory::
factory
¶
-
EigenFactory &
dolfin::EigenFactory::
instance
()¶ Return singleton instance.
-
std::map<std::string, std::string>
dolfin::EigenFactory::
krylov_solver_methods
() const¶ Return a list of available Krylov solver methods.
-
std::map<std::string, std::string>
dolfin::EigenFactory::
krylov_solver_preconditioners
() const¶ Return a list of available preconditioners.
-
std::map<std::string, std::string>
dolfin::EigenFactory::
lu_solver_methods
() const¶ Return a list of available LU solver methods.
-
dolfin::EigenFactory::
~EigenFactory
()¶ Destructor.
-
EigenKrylovSolver¶
C++ documentation for EigenKrylovSolver
from dolfin/la/EigenKrylovSolver.h
:
-
class
dolfin::
EigenKrylovSolver
: public dolfin::GenericLinearSolver¶ This class implements Krylov methods for linear systems of the form Ax = b. It is a wrapper for the Krylov solvers of Eigen.
-
dolfin::EigenKrylovSolver::
EigenKrylovSolver
(std::string method = "default", std::string preconditioner = "default")¶ Create Krylov solver for a particular method and names preconditioner
Parameters: - method –
- preconditioner –
-
std::size_t
dolfin::EigenKrylovSolver::
call_solver
(Solver &solver, GenericVector &x, const GenericVector &b)¶ Parameters: - solver –
- x –
- b –
-
std::shared_ptr<const EigenMatrix>
dolfin::EigenKrylovSolver::
get_operator
() const¶ Get operator (matrix)
-
void
dolfin::EigenKrylovSolver::
init
(const std::string method, const std::string pc = "default")¶ Parameters: - method –
- pc –
-
std::map<std::string, std::string>
dolfin::EigenKrylovSolver::
methods
()¶ Return a list of available solver methods.
-
std::string
dolfin::EigenKrylovSolver::
parameter_type
() const¶ Return parameter type: “krylov_solver” or “lu_solver”.
-
std::map<std::string, std::string>
dolfin::EigenKrylovSolver::
preconditioners
()¶ Return a list of available preconditioners.
Set
operator (matrix)Parameters: A –
Set
operator (matrix)Parameters: A –
Set
operator (matrix) and preconditioner matrix.Parameters: - A –
- P –
Set
operator (matrix) and preconditioner matrix.Parameters: - A –
- P –
-
std::size_t
dolfin::EigenKrylovSolver::
solve
(EigenVector &x, const EigenVector &b)¶ Solve linear system Ax = b and return number of iterations.
Parameters: - x –
- b –
-
std::size_t
dolfin::EigenKrylovSolver::
solve
(GenericVector &x, const GenericVector &b)¶ Solve linear system Ax = b and return number of iterations.
Parameters: - x –
- b –
-
std::size_t
dolfin::EigenKrylovSolver::
solve
(const EigenMatrix &A, EigenVector &x, const EigenVector &b)¶ Solve linear system Ax = b and return number of iterations.
Parameters: - A –
- x –
- b –
-
std::size_t
dolfin::EigenKrylovSolver::
solve
(const GenericLinearOperator &A, GenericVector &x, const GenericVector &b)¶ Solve linear system Ax = b and return number of iterations.
Parameters: - A –
- x –
- b –
-
std::string
dolfin::EigenKrylovSolver::
str
(bool verbose) const¶ Return informal string representation (pretty-print)
Parameters: verbose –
-
dolfin::EigenKrylovSolver::
~EigenKrylovSolver
()¶ Destructor.
-
EigenLUSolver¶
C++ documentation for EigenLUSolver
from dolfin/la/EigenLUSolver.h
:
-
class
dolfin::
EigenLUSolver
: public dolfin::GenericLinearSolver¶ This class implements the direct solution (LU factorization) for linear systems of the form Ax = b.
Constructor.
Parameters: - A –
- method –
-
dolfin::EigenLUSolver::
EigenLUSolver
(std::string method = "default")¶ Constructor.
Parameters: method –
-
void
dolfin::EigenLUSolver::
call_solver
(Solver &solver, GenericVector &x, const GenericVector &b)¶ Parameters: - solver –
- x –
- b –
-
const GenericLinearOperator &
dolfin::EigenLUSolver::
get_operator
() const¶ Get operator (matrix)
-
std::map<std::string, std::string>
dolfin::EigenLUSolver::
methods
()¶ Return a list of available solver methods.
-
std::string
dolfin::EigenLUSolver::
parameter_type
() const¶ Return parameter type: “krylov_solver” or “lu_solver”.
-
std::string
dolfin::EigenLUSolver::
select_solver
(const std::string method) const¶ Parameters: method –
Set
operator (matrix)Parameters: A –
Set
operator (matrix)Parameters: A –
-
std::size_t
dolfin::EigenLUSolver::
solve
(GenericVector &x, const GenericVector &b)¶ Solve linear system Ax = b.
Parameters: - x –
- b –
-
std::size_t
dolfin::EigenLUSolver::
solve
(const EigenMatrix &A, EigenVector &x, const EigenVector &b)¶ Solve linear system Ax = b.
Parameters: - A –
- x –
- b –
-
std::size_t
dolfin::EigenLUSolver::
solve
(const GenericLinearOperator &A, GenericVector &x, const GenericVector &b)¶ Solve linear system Ax = b.
Parameters: - A –
- x –
- b –
-
std::string
dolfin::EigenLUSolver::
str
(bool verbose) const¶ Return informal string representation (pretty-print)
Parameters: verbose –
-
dolfin::EigenLUSolver::
~EigenLUSolver
()¶ Destructor.
EigenMatrix¶
C++ documentation for EigenMatrix
from dolfin/la/EigenMatrix.h
:
-
class
dolfin::
EigenMatrix
: public dolfin::GenericMatrix¶ This class provides a sparse matrix class based on Eigen. It is a simple wrapper for Eigen::SparseMatrix implementing the
GenericMatrix
interface. The interface is intentionally simple. For advanced usage, access the underlying Eigen matrix and use the standard Eigen interface which is documented at http://eigen.tuxfamily.org-
dolfin::EigenMatrix::
EigenMatrix
()¶ Create empty matrix.
-
dolfin::EigenMatrix::
EigenMatrix
(const EigenMatrix &A)¶ Copy constructor.
Parameters: A –
-
dolfin::EigenMatrix::
EigenMatrix
(std::size_t M, std::size_t N)¶ Create M x N matrix.
Parameters: - M –
- N –
-
void
dolfin::EigenMatrix::
add
(const double *block, std::size_t m, const dolfin::la_index *rows, std::size_t n, const dolfin::la_index *cols)¶ Add block of values using global indices.
Parameters: - block –
- m –
- rows –
- n –
- cols –
-
void
dolfin::EigenMatrix::
add_local
(const double *block, std::size_t m, const dolfin::la_index *rows, std::size_t n, const dolfin::la_index *cols)¶ Add block of values using local indices.
Parameters: - block –
- m –
- rows –
- n –
- cols –
-
void
dolfin::EigenMatrix::
apply
(std::string mode)¶ Finalize assembly of tensor.
Parameters: mode –
-
void
dolfin::EigenMatrix::
axpy
(double a, const GenericMatrix &A, bool same_nonzero_pattern)¶ Add multiple of given matrix (AXPY operation)
Parameters: - a –
- A –
- same_nonzero_pattern –
-
void
dolfin::EigenMatrix::
compress
()¶ Compress matrix (eliminate all zeros from a sparse matrix)
-
std::shared_ptr<GenericMatrix>
dolfin::EigenMatrix::
copy
() const¶ Return copy of matrix.
-
std::tuple<const int *, const int *, const double *, std::size_t>
dolfin::EigenMatrix::
data
() const¶ Return pointers to underlying compressed storage data See
GenericMatrix
for documentation.
-
bool
dolfin::EigenMatrix::
empty
() const¶ Return true if empty.
-
GenericLinearAlgebraFactory &
dolfin::EigenMatrix::
factory
() const¶ Return linear algebra backend factory.
-
void
dolfin::EigenMatrix::
get
(double *block, std::size_t m, const dolfin::la_index *rows, std::size_t n, const dolfin::la_index *cols) const¶ Get block of values.
Parameters: - block –
- m –
- rows –
- n –
- cols –
-
void
dolfin::EigenMatrix::
get_diagonal
(GenericVector &x) const¶ Get diagonal of a matrix.
Parameters: x –
-
void
dolfin::EigenMatrix::
getrow
(std::size_t row, std::vector<std::size_t> &columns, std::vector<double> &values) const¶ Get non-zero values of given row.
Parameters: - row –
- columns –
- values –
-
void
dolfin::EigenMatrix::
ident
(std::size_t m, const dolfin::la_index *rows)¶ Set
given rows to identity matrix.Parameters: - m –
- rows –
-
void
dolfin::EigenMatrix::
ident_local
(std::size_t m, const dolfin::la_index *rows)¶ Set
given rows to identity matrix.Parameters: - m –
- rows –
-
void
dolfin::EigenMatrix::
init
(const TensorLayout &tensor_layout)¶ Initialize zero tensor using tenor layout.
Parameters: tensor_layout –
-
void
dolfin::EigenMatrix::
init_vector
(GenericVector &z, std::size_t dim) const¶ Initialise vector z to be compatible with the matrix-vector product y = Ax.
Parameters: - z – (
GenericVector
&)Vector
to initialise - dim – (std::size_t) The dimension (axis): dim = 0 –> z = y, dim = 1 –> z = x
- z – (
-
std::pair<std::int64_t, std::int64_t>
dolfin::EigenMatrix::
local_range
(std::size_t dim) const¶ Return local ownership range.
Parameters: dim –
-
eigen_matrix_type &
dolfin::EigenMatrix::
mat
()¶ Return reference to Eigen matrix (non-const version)
-
const eigen_matrix_type &
dolfin::EigenMatrix::
mat
() const¶ Return reference to Eigen matrix (const version)
-
void
dolfin::EigenMatrix::
mult
(const GenericVector &x, GenericVector &y) const¶ Matrix-vector product, y = Ax.
Parameters: - x –
- y –
-
std::size_t
dolfin::EigenMatrix::
nnz
() const¶ Return number of non-zero entries in matrix.
-
double
dolfin::EigenMatrix::
norm
(std::string norm_type) const¶ Return norm of matrix.
Parameters: norm_type –
-
double
dolfin::EigenMatrix::
operator()
(dolfin::la_index i, dolfin::la_index j) const¶ Access value of given entry.
Parameters: - i –
- j –
-
const EigenMatrix &
dolfin::EigenMatrix::
operator*=
(double a)¶ Multiply matrix by given number.
Parameters: a –
-
const EigenMatrix &
dolfin::EigenMatrix::
operator/=
(double a)¶ Divide matrix by given number.
Parameters: a –
-
const EigenMatrix &
dolfin::EigenMatrix::
operator=
(const EigenMatrix &A)¶ Assignment operator.
Parameters: A –
-
const GenericMatrix &
dolfin::EigenMatrix::
operator=
(const GenericMatrix &A)¶ Assignment operator.
Parameters: A –
-
void
dolfin::EigenMatrix::
resize
(std::size_t M, std::size_t N)¶ Resize matrix to M x N.
Parameters: - M –
- N –
-
void
dolfin::EigenMatrix::
set
(const double *block, std::size_t m, const dolfin::la_index *rows, std::size_t n, const dolfin::la_index *cols)¶ Set
block of values using global indices.Parameters: - block –
- m –
- rows –
- n –
- cols –
-
void
dolfin::EigenMatrix::
set_diagonal
(const GenericVector &x)¶ Set
diagonal of a matrix.Parameters: x –
-
void
dolfin::EigenMatrix::
set_local
(const double *block, std::size_t m, const dolfin::la_index *rows, std::size_t n, const dolfin::la_index *cols)¶ Set
block of values using local indices.Parameters: - block –
- m –
- rows –
- n –
- cols –
-
void
dolfin::EigenMatrix::
setrow
(std::size_t row_idx, const std::vector<std::size_t> &columns, const std::vector<double> &values)¶ Set
values for given row.Parameters: - row_idx –
- columns –
- values –
-
std::size_t
dolfin::EigenMatrix::
size
(std::size_t dim) const¶ Return size of given dimension.
Parameters: dim –
-
std::string
dolfin::EigenMatrix::
str
(bool verbose) const¶ Return informal string representation (pretty-print)
Parameters: verbose –
-
void
dolfin::EigenMatrix::
transpmult
(const GenericVector &x, GenericVector &y) const¶ Matrix-vector product, y = A^T x.
Parameters: - x –
- y –
-
void
dolfin::EigenMatrix::
zero
(std::size_t m, const dolfin::la_index *rows)¶ Set
given rows (global row indices) to zero.Parameters: - m –
- rows –
-
void
dolfin::EigenMatrix::
zero_local
(std::size_t m, const dolfin::la_index *rows)¶ Set
given rows (local row indices) to zero.Parameters: - m –
- rows –
-
dolfin::EigenMatrix::
~EigenMatrix
()¶ Destructor.
-
EigenVector¶
C++ documentation for EigenVector
from dolfin/la/EigenVector.h
:
-
class
dolfin::
EigenVector
: public dolfin::GenericVector¶ This class provides a simple vector class based on Eigen. It is a simple wrapper for a Eigen vector implementing the
GenericVector
interface. The interface is intentionally simple. For advanced usage, access the underlying Eigen vector and use the standard Eigen interface which is documented at http://eigen.tuxfamily.org-
dolfin::EigenVector::
EigenVector
()¶ Create empty vector (on MPI_COMM_SELF)
-
dolfin::EigenVector::
EigenVector
(MPI_Comm comm)¶ Create empty vector.
Parameters: comm –
-
dolfin::EigenVector::
EigenVector
(MPI_Comm comm, std::size_t N)¶ Create vector of size N.
Parameters: - comm –
- N –
-
dolfin::EigenVector::
EigenVector
(const EigenVector &x)¶ Copy constructor.
Parameters: x –
Construct vector from an Eigen shared_ptr.
Parameters: x –
-
void
dolfin::EigenVector::
abs
()¶ Replace all entries in the vector by their absolute values.
-
void
dolfin::EigenVector::
add
(const double *block, std::size_t m, const dolfin::la_index *rows)¶ Add block of values using global indices.
Parameters: - block –
- m –
- rows –
-
void
dolfin::EigenVector::
add_local
(const Array<double> &values)¶ Add values to each entry on local process.
Parameters: values –
-
void
dolfin::EigenVector::
add_local
(const double *block, std::size_t m, const dolfin::la_index *rows)¶ Add block of values using local indices.
Parameters: - block –
- m –
- rows –
-
void
dolfin::EigenVector::
apply
(std::string mode)¶ Finalize assembly of tensor.
Parameters: mode –
-
void
dolfin::EigenVector::
axpy
(double a, const GenericVector &x)¶ Add multiple of given vector (AXPY operation)
Parameters: - a –
- x –
-
void
dolfin::EigenVector::
check_mpi_size
(const MPI_Comm comm)¶ Parameters: comm –
-
std::shared_ptr<GenericVector>
dolfin::EigenVector::
copy
() const¶ Create copy of tensor.
-
double *
dolfin::EigenVector::
data
()¶ Return pointer to underlying data.
-
const double *
dolfin::EigenVector::
data
() const¶ Return pointer to underlying data (const version)
-
bool
dolfin::EigenVector::
empty
() const¶ Return true if vector is empty.
-
GenericLinearAlgebraFactory &
dolfin::EigenVector::
factory
() const¶ Return linear algebra backend factory.
-
void
dolfin::EigenVector::
gather
(GenericVector &x, const std::vector<dolfin::la_index> &indices) const¶ Gather entries into local vector x.
Parameters: - x –
- indices –
-
void
dolfin::EigenVector::
gather
(std::vector<double> &x, const std::vector<dolfin::la_index> &indices) const¶ Gather entries into x.
Parameters: - x –
- indices –
-
void
dolfin::EigenVector::
gather_on_zero
(std::vector<double> &x) const¶ Gather all entries into x on process 0.
Parameters: x –
-
void
dolfin::EigenVector::
get
(double *block, std::size_t m, const dolfin::la_index *rows) const¶ Get block of values using global indices.
Parameters: - block –
- m –
- rows –
-
void
dolfin::EigenVector::
get_local
(double *block, std::size_t m, const dolfin::la_index *rows) const¶ Get block of values using local indices.
Parameters: - block –
- m –
- rows –
-
void
dolfin::EigenVector::
get_local
(std::vector<double> &values) const¶ Get all values on local process.
Parameters: values –
-
void
dolfin::EigenVector::
init
(std::pair<std::size_t, std::size_t> range)¶ Resize vector with given ownership range.
Parameters: range –
-
void
dolfin::EigenVector::
init
(std::pair<std::size_t, std::size_t> range, const std::vector<std::size_t> &local_to_global_map, const std::vector<la_index> &ghost_indices)¶ Resize vector with given ownership range and with ghost values.
Parameters: - range –
- local_to_global_map –
- ghost_indices –
-
void
dolfin::EigenVector::
init
(std::size_t N)¶ Initialize vector to size N.
Parameters: N –
-
double
dolfin::EigenVector::
inner
(const GenericVector &x) const¶ Return inner product with given vector.
Parameters: x –
-
std::pair<std::int64_t, std::int64_t>
dolfin::EigenVector::
local_range
() const¶ Return local ownership range of a vector.
-
std::size_t
dolfin::EigenVector::
local_size
() const¶ Return local size of vector.
-
double
dolfin::EigenVector::
max
() const¶ Return maximum value of vector.
-
double
dolfin::EigenVector::
min
() const¶ Return minimum value of vector.
-
double
dolfin::EigenVector::
norm
(std::string norm_type) const¶ Compute norm of vector.
Parameters: norm_type –
-
const EigenVector &
dolfin::EigenVector::
operator*=
(const GenericVector &x)¶ Multiply vector by another vector pointwise.
Parameters: x –
-
const EigenVector &
dolfin::EigenVector::
operator*=
(double a)¶ Multiply vector by given number.
Parameters: a –
-
const EigenVector &
dolfin::EigenVector::
operator+=
(const GenericVector &x)¶ Add given vector.
Parameters: x –
-
const EigenVector &
dolfin::EigenVector::
operator+=
(double a)¶ Add number to all components of a vector.
Parameters: a –
-
const EigenVector &
dolfin::EigenVector::
operator-=
(const GenericVector &x)¶ Subtract given vector.
Parameters: x –
-
const EigenVector &
dolfin::EigenVector::
operator-=
(double a)¶ Subtract number from all components of a vector.
Parameters: a –
-
const EigenVector &
dolfin::EigenVector::
operator/=
(double a)¶ Divide vector by given number.
Parameters: a –
-
const EigenVector &
dolfin::EigenVector::
operator=
(const EigenVector &x)¶ Assignment operator.
Parameters: x –
-
const GenericVector &
dolfin::EigenVector::
operator=
(const GenericVector &x)¶ Assignment operator.
Parameters: x –
-
const EigenVector &
dolfin::EigenVector::
operator=
(double a)¶ Assignment operator.
Parameters: a –
-
double &
dolfin::EigenVector::
operator[]
(dolfin::la_index i)¶ Access value of given entry (non-const version)
Parameters: i –
-
double
dolfin::EigenVector::
operator[]
(dolfin::la_index i) const¶ Access value of given entry (const version)
Parameters: i –
-
bool
dolfin::EigenVector::
owns_index
(std::size_t i) const¶ Determine whether global vector index is owned by this process.
Parameters: i –
-
void
dolfin::EigenVector::
resize
(std::size_t N)¶ Resize vector to size N.
Parameters: N –
-
void
dolfin::EigenVector::
set
(const double *block, std::size_t m, const dolfin::la_index *rows)¶ Set
block of values using global indices.Parameters: - block –
- m –
- rows –
-
void
dolfin::EigenVector::
set_local
(const double *block, std::size_t m, const dolfin::la_index *rows)¶ Set
block of values using local indices.Parameters: - block –
- m –
- rows –
-
void
dolfin::EigenVector::
set_local
(const std::vector<double> &values)¶ Set
all values on local process.Parameters: values –
-
std::size_t
dolfin::EigenVector::
size
() const¶ Return true if vector is empty.
-
std::string
dolfin::EigenVector::
str
(bool verbose) const¶ Return informal string representation (pretty-print)
Parameters: verbose –
-
double
dolfin::EigenVector::
sum
() const¶ Return sum of values of vector.
-
double
dolfin::EigenVector::
sum
(const Array<std::size_t> &rows) const¶ Return sum of selected rows in vector. Repeated entries are only summed once.
Parameters: rows –
-
std::shared_ptr<Eigen::VectorXd>
dolfin::EigenVector::
vec
()¶ Return reference to Eigen vector (non-const version)
-
std::shared_ptr<const Eigen::VectorXd>
dolfin::EigenVector::
vec
() const¶ Return reference to Eigen vector (const version)
-
dolfin::EigenVector::
~EigenVector
()¶ Destructor.
-
GenericLinearAlgebraFactory¶
C++ documentation for GenericLinearAlgebraFactory
from dolfin/la/GenericLinearAlgebraFactory.h
:
-
class
dolfin::
GenericLinearAlgebraFactory
¶ Base class for LinearAlgebra factories.
-
dolfin::GenericLinearAlgebraFactory::
GenericLinearAlgebraFactory
()¶ Constructor.
-
std::shared_ptr<GenericLinearSolver>
dolfin::GenericLinearAlgebraFactory::
create_krylov_solver
(MPI_Comm comm, std::string method, std::string preconditioner) const = 0¶ Create Krylov solver.
Parameters: - comm –
- method –
- preconditioner –
-
std::shared_ptr<TensorLayout>
dolfin::GenericLinearAlgebraFactory::
create_layout
(MPI_Comm comm, std::size_t rank) const = 0¶ Create empty tensor layout.
Parameters: - comm –
- rank –
-
std::shared_ptr<GenericLinearOperator>
dolfin::GenericLinearAlgebraFactory::
create_linear_operator
(MPI_Comm comm) const = 0¶ Create empty linear operator.
Parameters: comm –
-
std::shared_ptr<GenericLinearSolver>
dolfin::GenericLinearAlgebraFactory::
create_lu_solver
(MPI_Comm comm, std::string method) const = 0¶ Create LU solver.
Parameters: - comm –
- method –
-
std::shared_ptr<GenericMatrix>
dolfin::GenericLinearAlgebraFactory::
create_matrix
(MPI_Comm comm) const = 0¶ Create empty matrix.
Parameters: comm –
-
std::shared_ptr<GenericVector>
dolfin::GenericLinearAlgebraFactory::
create_vector
(MPI_Comm comm) const = 0¶ Create empty vector.
Parameters: comm –
-
std::map<std::string, std::string>
dolfin::GenericLinearAlgebraFactory::
krylov_solver_methods
() const¶ Return a list of available Krylov solver methods. This function should be overloaded by subclass if non-empty.
-
std::map<std::string, std::string>
dolfin::GenericLinearAlgebraFactory::
krylov_solver_preconditioners
() const¶ Return a list of available preconditioners. This function should be overloaded by subclass if non-empty.
-
std::map<std::string, std::string>
dolfin::GenericLinearAlgebraFactory::
lu_solver_methods
() const¶ Return a list of available LU solver methods. This function should be overloaded by subclass if non-empty.
-
dolfin::GenericLinearAlgebraFactory::
~GenericLinearAlgebraFactory
()¶ Destructor.
-
GenericLinearOperator¶
C++ documentation for GenericLinearOperator
from dolfin/la/GenericLinearOperator.h
:
-
class
dolfin::
GenericLinearOperator
: public dolfin::LinearAlgebraObject¶ This class defines a common interface for linear operators, including actual matrices (class
GenericMatrix
) and linear operators only defined in terms of their action on vectors. This class is used internally by DOLFIN to define a class hierarchy of backend independent linear operators and solvers. Users should not interface to this class directly but instead use theLinearOperator
class.Friends:
LinearOperator
.-
void
dolfin::GenericLinearOperator::
init_layout
(const GenericVector &x, const GenericVector &y, GenericLinearOperator *wrapper)¶ Initialize linear operator to match parallel layout of vectors x and y for product y = Ax. Needs to be implemented by backend.
Parameters: - x –
- y –
- wrapper –
-
void
dolfin::GenericLinearOperator::
mult
(const GenericVector &x, GenericVector &y) const = 0¶ Compute matrix-vector product y = Ax.
Parameters: - x –
- y –
-
std::size_t
dolfin::GenericLinearOperator::
size
(std::size_t dim) const = 0¶ Return size of given dimension.
Parameters: dim –
-
std::string
dolfin::GenericLinearOperator::
str
(bool verbose) const = 0¶ Return informal string representation (pretty-print)
Parameters: verbose –
-
dolfin::GenericLinearOperator::
~GenericLinearOperator
()¶
-
void
GenericLinearSolver¶
C++ documentation for GenericLinearSolver
from dolfin/la/GenericLinearSolver.h
:
-
class
dolfin::
GenericLinearSolver
¶ This class provides a general solver for linear systems Ax = b.
-
std::string
dolfin::GenericLinearSolver::
parameter_type
() const¶ Return parameter type: “krylov_solver” or “lu_solver”.
-
const GenericMatrix &
dolfin::GenericLinearSolver::
require_matrix
(const GenericLinearOperator &A)¶ Down-cast
GenericLinearOperator
toGenericMatrix
when an actual matrix is required, not only a linear operator. This is the const reference version of the down-cast.Parameters: A –
Down-cast
GenericLinearOperator
toGenericMatrix
when an actual matrix is required, not only a linear operator. This is the const reference version of the down-cast.Parameters: A –
Set
operator (matrix)Parameters: A –
Set
operator (matrix) and preconditioner matrix.Parameters: - A –
- P –
-
std::size_t
dolfin::GenericLinearSolver::
solve
(GenericVector &x, const GenericVector &b) = 0¶ Solve linear system Ax = b.
Parameters: - x –
- b –
-
std::size_t
dolfin::GenericLinearSolver::
solve
(const GenericLinearOperator &A, GenericVector &x, const GenericVector &b)¶ Solve linear system Ax = b.
Parameters: - A –
- x –
- b –
-
void
dolfin::GenericLinearSolver::
update_parameters
(const Parameters ¶meters)¶ Update solver parameters (useful for
LinearSolver
wrapper)Parameters: parameters –
-
std::string
GenericMatrix¶
C++ documentation for GenericMatrix
from dolfin/la/GenericMatrix.h
:
-
class
dolfin::
GenericMatrix
: public dolfin::GenericLinearOperator, dolfin::GenericTensor¶ This class defines a common interface for matrices.
-
void
dolfin::GenericMatrix::
add
(const double *block, const dolfin::la_index *num_rows, const dolfin::la_index *const *rows)¶ Add block of values using global indices.
Parameters: - block –
- num_rows –
- rows –
-
void
dolfin::GenericMatrix::
add
(const double *block, const std::vector<ArrayView<const dolfin::la_index>> &rows)¶ Add block of values using global indices.
Parameters: - block –
- rows –
-
void
dolfin::GenericMatrix::
add
(const double *block, std::size_t m, const dolfin::la_index *rows, std::size_t n, const dolfin::la_index *cols) = 0¶ Add block of values using global indices.
Parameters: - block –
- m –
- rows –
- n –
- cols –
-
void
dolfin::GenericMatrix::
add_local
(const double *block, const dolfin::la_index *num_rows, const dolfin::la_index *const *rows)¶ Add block of values using local indices.
Parameters: - block –
- num_rows –
- rows –
-
void
dolfin::GenericMatrix::
add_local
(const double *block, const std::vector<ArrayView<const dolfin::la_index>> &rows)¶ Add block of values using local indices.
Parameters: - block –
- rows –
-
void
dolfin::GenericMatrix::
add_local
(const double *block, std::size_t m, const dolfin::la_index *rows, std::size_t n, const dolfin::la_index *cols) = 0¶ Add block of values using local indices.
Parameters: - block –
- m –
- rows –
- n –
- cols –
-
void
dolfin::GenericMatrix::
apply
(std::string mode) = 0¶ Finalize assembly of tensor.
Parameters: mode –
-
void
dolfin::GenericMatrix::
axpy
(double a, const GenericMatrix &A, bool same_nonzero_pattern) = 0¶ Add multiple of given matrix (AXPY operation)
Parameters: - a –
- A –
- same_nonzero_pattern –
-
std::shared_ptr<GenericMatrix>
dolfin::GenericMatrix::
copy
() const = 0¶ Return copy of matrix.
-
void
dolfin::GenericMatrix::
get
(double *block, const dolfin::la_index *num_rows, const dolfin::la_index *const *rows) const¶ Get block of values.
Parameters: - block –
- num_rows –
- rows –
-
void
dolfin::GenericMatrix::
get
(double *block, std::size_t m, const dolfin::la_index *rows, std::size_t n, const dolfin::la_index *cols) const = 0¶ Get block of values.
Parameters: - block –
- m –
- rows –
- n –
- cols –
-
void
dolfin::GenericMatrix::
get_diagonal
(GenericVector &x) const = 0¶ Get diagonal of a matrix.
Parameters: x –
-
double
dolfin::GenericMatrix::
getitem
(std::pair<dolfin::la_index, dolfin::la_index> ij) const¶ Get value of given entry.
Parameters: ij –
-
void
dolfin::GenericMatrix::
getrow
(std::size_t row, std::vector<std::size_t> &columns, std::vector<double> &values) const = 0¶ Get non-zero values of given row (global index) on local process.
Parameters: - row –
- columns –
- values –
-
void
dolfin::GenericMatrix::
ident
(std::size_t m, const dolfin::la_index *rows) = 0¶ Set
given rows (global row indices) to identity matrix.Parameters: - m –
- rows –
-
void
dolfin::GenericMatrix::
ident_local
(std::size_t m, const dolfin::la_index *rows) = 0¶ Set
given rows (local row indices) to identity matrix.Parameters: - m –
- rows –
-
void
dolfin::GenericMatrix::
ident_zeros
(double tol = DOLFIN_EPS)¶ Insert one on the diagonal for all zero rows.
Parameters: tol –
-
void
dolfin::GenericMatrix::
init_vector
(GenericVector &z, std::size_t dim) const = 0¶ Initialize vector z to be compatible with the matrix-vector product y = Ax. In the parallel case, both size and layout are important.
Parameters: - z – (
GenericVector
&)Vector
to initialise - dim – (std::size_t) The dimension (axis): dim = 0 –> z = y, dim = 1 –> z = x
- z – (
-
bool
dolfin::GenericMatrix::
is_symmetric
(double tol) const¶ Test if matrix is symmetric.
Parameters: tol –
-
std::pair<std::int64_t, std::int64_t>
dolfin::GenericMatrix::
local_range
(std::size_t dim) const = 0¶ Return local ownership range.
Parameters: dim –
-
std::size_t
dolfin::GenericMatrix::
nnz
() const = 0¶ Return number of non-zero entries in matrix (collective)
-
double
dolfin::GenericMatrix::
norm
(std::string norm_type) const = 0¶ Return norm of matrix.
Parameters: norm_type –
-
double
dolfin::GenericMatrix::
operator()
(dolfin::la_index i, dolfin::la_index j) const¶ Get value of given entry.
Parameters: - i –
- j –
-
const GenericMatrix &
dolfin::GenericMatrix::
operator*=
(double a) = 0¶ Multiply matrix by given number.
Parameters: a –
-
const GenericMatrix &
dolfin::GenericMatrix::
operator+=
(const GenericMatrix &A)¶ Add given matrix.
Parameters: A –
-
const GenericMatrix &
dolfin::GenericMatrix::
operator-=
(const GenericMatrix &A)¶ Subtract given matrix.
Parameters: A –
-
const GenericMatrix &
dolfin::GenericMatrix::
operator/=
(double a) = 0¶ Divide matrix by given number.
Parameters: a –
-
const GenericMatrix &
dolfin::GenericMatrix::
operator=
(const GenericMatrix &x) = 0¶ Assignment operator.
Parameters: x –
-
std::size_t
dolfin::GenericMatrix::
rank
() const¶ Return tensor rank (number of dimensions)
-
void
dolfin::GenericMatrix::
set
(const double *block, const dolfin::la_index *num_rows, const dolfin::la_index *const *rows)¶ Set
block of values using global indices.Parameters: - block –
- num_rows –
- rows –
-
void
dolfin::GenericMatrix::
set
(const double *block, std::size_t m, const dolfin::la_index *rows, std::size_t n, const dolfin::la_index *cols) = 0¶ Set
block of values using global indices.Parameters: - block –
- m –
- rows –
- n –
- cols –
-
void
dolfin::GenericMatrix::
set_diagonal
(const GenericVector &x) = 0¶ Set
diagonal of a matrix.Parameters: x –
-
void
dolfin::GenericMatrix::
set_local
(const double *block, const dolfin::la_index *num_rows, const dolfin::la_index *const *rows)¶ Set
block of values using local indices.Parameters: - block –
- num_rows –
- rows –
-
void
dolfin::GenericMatrix::
set_local
(const double *block, std::size_t m, const dolfin::la_index *rows, std::size_t n, const dolfin::la_index *cols) = 0¶ Set
block of values using local indices.Parameters: - block –
- m –
- rows –
- n –
- cols –
-
void
dolfin::GenericMatrix::
setitem
(std::pair<dolfin::la_index, dolfin::la_index> ij, double value)¶ Set
given entry to value. apply(“insert”) must be called before using using the object.Parameters: - ij –
- value –
-
void
dolfin::GenericMatrix::
setrow
(std::size_t row, const std::vector<std::size_t> &columns, const std::vector<double> &values) = 0¶ Set
values for given row (global index) on local process.Parameters: - row –
- columns –
- values –
-
std::size_t
dolfin::GenericMatrix::
size
(std::size_t dim) const = 0¶ Return size of given dimension.
Parameters: dim –
-
std::string
dolfin::GenericMatrix::
str
(bool verbose) const = 0¶ Return informal string representation (pretty-print)
Parameters: verbose –
-
void
dolfin::GenericMatrix::
transpmult
(const GenericVector &x, GenericVector &y) const = 0¶ Matrix-vector product, y = A^T x. The y vector must either be zero-sized or have correct size and parallel layout.
Parameters: - x –
- y –
-
void
dolfin::GenericMatrix::
zero
(std::size_t m, const dolfin::la_index *rows) = 0¶ Set
given rows (global row indices) to zero.Parameters: - m –
- rows –
-
void
dolfin::GenericMatrix::
zero_local
(std::size_t m, const dolfin::la_index *rows) = 0¶ Set
given rows (local row indices) to zero.Parameters: - m –
- rows –
-
dolfin::GenericMatrix::
~GenericMatrix
()¶ Destructor.
-
void
GenericTensor¶
C++ documentation for GenericTensor
from dolfin/la/GenericTensor.h
:
-
class
dolfin::
GenericTensor
: public dolfin::LinearAlgebraObject¶ A common interface for arbitrary rank tensors.
-
void
dolfin::GenericTensor::
add
(const double *block, const dolfin::la_index *num_rows, const dolfin::la_index *const *rows) = 0¶ Add block of values using global indices.
Parameters: - block –
- num_rows –
- rows –
-
void
dolfin::GenericTensor::
add
(const double *block, const std::vector<ArrayView<const dolfin::la_index>> &rows) = 0¶ Add block of values using global indices.
Parameters: - block –
- rows –
-
void
dolfin::GenericTensor::
add_local
(const double *block, const dolfin::la_index *num_rows, const dolfin::la_index *const *rows) = 0¶ Add block of values using local indices.
Parameters: - block –
- num_rows –
- rows –
-
void
dolfin::GenericTensor::
add_local
(const double *block, const std::vector<ArrayView<const dolfin::la_index>> &rows) = 0¶ Add block of values using local indices.
Parameters: - block –
- rows –
-
void
dolfin::GenericTensor::
apply
(std::string mode) = 0¶ Finalize assembly of tensor.
Parameters: mode –
-
bool
dolfin::GenericTensor::
empty
() const = 0¶ Return true if empty.
-
GenericLinearAlgebraFactory &
dolfin::GenericTensor::
factory
() const = 0¶ Return linear algebra backend factory.
-
void
dolfin::GenericTensor::
get
(double *block, const dolfin::la_index *num_rows, const dolfin::la_index *const *rows) const = 0¶ Get block of values.
Parameters: - block –
- num_rows –
- rows –
-
void
dolfin::GenericTensor::
init
(const TensorLayout &tensor_layout) = 0¶ Initialize zero tensor using tensor layout.
Parameters: tensor_layout –
-
std::pair<std::int64_t, std::int64_t>
dolfin::GenericTensor::
local_range
(std::size_t dim) const = 0¶ Return local ownership range.
Parameters: dim –
-
std::size_t
dolfin::GenericTensor::
rank
() const = 0¶ Return tensor rank (number of dimensions)
-
void
dolfin::GenericTensor::
set
(const double *block, const dolfin::la_index *num_rows, const dolfin::la_index *const *rows) = 0¶ Set
block of values using global indices.Parameters: - block –
- num_rows –
- rows –
-
void
dolfin::GenericTensor::
set_local
(const double *block, const dolfin::la_index *num_rows, const dolfin::la_index *const *rows) = 0¶ Set
block of values using local indices.Parameters: - block –
- num_rows –
- rows –
-
std::size_t
dolfin::GenericTensor::
size
(std::size_t dim) const = 0¶ Return size of given dimension.
Parameters: dim –
-
std::string
dolfin::GenericTensor::
str
(bool verbose) const = 0¶ Return
MPI
communicator. Return informal string representation (pretty-print)Parameters: verbose –
-
dolfin::GenericTensor::
~GenericTensor
()¶ Destructor.
-
void
GenericVector¶
C++ documentation for GenericVector
from dolfin/la/GenericVector.h
:
-
class
dolfin::
GenericVector
: public dolfin::GenericTensor¶ This class defines a common interface for vectors.
-
void
dolfin::GenericVector::
abs
() = 0¶ Replace all entries in the vector by their absolute values.
-
void
dolfin::GenericVector::
add
(const double *block, const dolfin::la_index *num_rows, const dolfin::la_index *const *rows)¶ Add block of values using global indices.
Parameters: - block –
- num_rows –
- rows –
-
void
dolfin::GenericVector::
add
(const double *block, const std::vector<ArrayView<const dolfin::la_index>> &rows)¶ Add block of values using global indices.
Parameters: - block –
- rows –
-
void
dolfin::GenericVector::
add
(const double *block, std::size_t m, const dolfin::la_index *rows) = 0¶ Add block of values using global indices.
Parameters: - block –
- m –
- rows –
-
void
dolfin::GenericVector::
add_local
(const Array<double> &values) = 0¶ Add values to each entry on local process.
Parameters: values –
-
void
dolfin::GenericVector::
add_local
(const double *block, const dolfin::la_index *num_rows, const dolfin::la_index *const *rows)¶ Add block of values using local indices.
Parameters: - block –
- num_rows –
- rows –
-
void
dolfin::GenericVector::
add_local
(const double *block, const std::vector<ArrayView<const dolfin::la_index>> &rows)¶ Add block of values using local indices.
Parameters: - block –
- rows –
-
void
dolfin::GenericVector::
add_local
(const double *block, std::size_t m, const dolfin::la_index *rows) = 0¶ Add block of values using local indices.
Parameters: - block –
- m –
- rows –
-
void
dolfin::GenericVector::
apply
(std::string mode) = 0¶ Finalize assembly of tensor.
Parameters: mode –
-
void
dolfin::GenericVector::
axpy
(double a, const GenericVector &x) = 0¶ Add multiple of given vector (AXPY operation)
Parameters: - a –
- x –
-
std::shared_ptr<GenericVector>
dolfin::GenericVector::
copy
() const = 0¶ Return copy of vector.
-
void
dolfin::GenericVector::
gather
(GenericVector &x, const std::vector<dolfin::la_index> &indices) const = 0¶ Gather entries (given by global indices) into local vector x
Parameters: - x –
- indices –
-
void
dolfin::GenericVector::
gather
(std::vector<double> &x, const std::vector<dolfin::la_index> &indices) const = 0¶ Gather entries (given by global indices) into x.
Parameters: - x –
- indices –
-
void
dolfin::GenericVector::
gather_on_zero
(std::vector<double> &x) const = 0¶ Gather all entries into x on process 0.
Parameters: x –
-
void
dolfin::GenericVector::
get
(double *block, const dolfin::la_index *num_rows, const dolfin::la_index *const *rows) const¶ Get block of values using global indices.
Parameters: - block –
- num_rows –
- rows –
-
void
dolfin::GenericVector::
get
(double *block, std::size_t m, const dolfin::la_index *rows) const = 0¶ Get block of values using global indices (values must all live on the local process, ghosts cannot be accessed)
Parameters: - block –
- m –
- rows –
-
void
dolfin::GenericVector::
get_local
(double *block, const dolfin::la_index *num_rows, const dolfin::la_index *const *rows) const¶ Get block of values using local indices.
Parameters: - block –
- num_rows –
- rows –
-
void
dolfin::GenericVector::
get_local
(double *block, std::size_t m, const dolfin::la_index *rows) const = 0¶ Get block of values using local indices (values must all live on the local process, ghost are accessible)
Parameters: - block –
- m –
- rows –
-
void
dolfin::GenericVector::
get_local
(std::vector<double> &values) const = 0¶ Get all values on local process.
Parameters: values –
-
double
dolfin::GenericVector::
getitem
(dolfin::la_index i) const¶ Get value of given entry.
Parameters: i –
-
void
dolfin::GenericVector::
init
(const TensorLayout &tensor_layout)¶ Initialize zero tensor using sparsity pattern FIXME: This needs to be implemented on backend side! Remove it!
Parameters: tensor_layout –
-
void
dolfin::GenericVector::
init
(std::pair<std::size_t, std::size_t> range) = 0¶ Initialize vector with given local ownership range.
Parameters: range –
-
void
dolfin::GenericVector::
init
(std::pair<std::size_t, std::size_t> range, const std::vector<std::size_t> &local_to_global_map, const std::vector<la_index> &ghost_indices) = 0¶ Initialise vector with given ownership range and with ghost values FIXME: Reimplement using
init(const TensorLayout&)
and deprecateParameters: - range –
- local_to_global_map –
- ghost_indices –
-
void
dolfin::GenericVector::
init
(std::size_t N) = 0¶ Initialize vector to global size N.
Parameters: N –
-
double
dolfin::GenericVector::
inner
(const GenericVector &x) const = 0¶ Return inner product with given vector.
Parameters: x –
-
std::pair<std::int64_t, std::int64_t>
dolfin::GenericVector::
local_range
() const = 0¶ Return local ownership range of a vector.
-
std::pair<std::int64_t, std::int64_t>
dolfin::GenericVector::
local_range
(std::size_t dim) const¶ Return local ownership range.
Parameters: dim –
-
std::size_t
dolfin::GenericVector::
local_size
() const = 0¶ Return local size of vector.
-
double
dolfin::GenericVector::
max
() const = 0¶ Return maximum value of vector.
-
double
dolfin::GenericVector::
min
() const = 0¶ Return minimum value of vector.
-
double
dolfin::GenericVector::
norm
(std::string norm_type) const = 0¶ Return norm of vector.
Parameters: norm_type –
-
std::shared_ptr<GenericVector>
dolfin::GenericVector::
operator*
(double a)¶ Multiply vector by a scalar (returns a new vector)
Parameters: a –
-
const GenericVector &
dolfin::GenericVector::
operator*=
(const GenericVector &x) = 0¶ Multiply vector by another vector pointwise.
Parameters: x –
-
const GenericVector &
dolfin::GenericVector::
operator*=
(double a) = 0¶ Multiply vector by given number.
Parameters: a –
-
std::shared_ptr<GenericVector>
dolfin::GenericVector::
operator+
(const GenericVector &x)¶ Sum two vectors (returns a new vector)
Parameters: x –
-
std::shared_ptr<GenericVector>
dolfin::GenericVector::
operator+
(double a)¶ Add scalar to a vector (returns a new vector)
Parameters: a –
-
const GenericVector &
dolfin::GenericVector::
operator+=
(const GenericVector &x) = 0¶ Add given vector.
Parameters: x –
-
const GenericVector &
dolfin::GenericVector::
operator+=
(double a) = 0¶ Add number to all components of a vector.
Parameters: a –
-
const GenericVector &
dolfin::GenericVector::
operator-=
(const GenericVector &x) = 0¶ Subtract given vector.
Parameters: x –
-
const GenericVector &
dolfin::GenericVector::
operator-=
(double a) = 0¶ Subtract number from all components of a vector.
Parameters: a –
-
const GenericVector &
dolfin::GenericVector::
operator/=
(double a) = 0¶ Divide vector by given number.
Parameters: a –
-
const GenericVector &
dolfin::GenericVector::
operator=
(const GenericVector &x) = 0¶ Assignment operator.
Parameters: x –
-
const GenericVector &
dolfin::GenericVector::
operator=
(double a) = 0¶ Assignment operator.
Parameters: a –
-
double
dolfin::GenericVector::
operator[]
(dolfin::la_index i) const¶ Get value of given entry.
Parameters: i –
-
bool
dolfin::GenericVector::
owns_index
(std::size_t i) const = 0¶ Determine whether global vector index is owned by this process.
Parameters: i –
-
std::size_t
dolfin::GenericVector::
rank
() const¶ Return tensor rank (number of dimensions)
-
void
dolfin::GenericVector::
set
(const double *block, const dolfin::la_index *num_rows, const dolfin::la_index *const *rows)¶ Set
block of values using global indices.Parameters: - block –
- num_rows –
- rows –
-
void
dolfin::GenericVector::
set
(const double *block, std::size_t m, const dolfin::la_index *rows) = 0¶ Set
block of values using global indices.Parameters: - block –
- m –
- rows –
-
void
dolfin::GenericVector::
set_local
(const double *block, const dolfin::la_index *num_rows, const dolfin::la_index *const *rows)¶ Set
block of values using local indices.Parameters: - block –
- num_rows –
- rows –
-
void
dolfin::GenericVector::
set_local
(const double *block, std::size_t m, const dolfin::la_index *rows) = 0¶ Set
block of values using local indices.Parameters: - block –
- m –
- rows –
-
void
dolfin::GenericVector::
set_local
(const std::vector<double> &values) = 0¶ Set
all values on local process.Parameters: values –
-
void
dolfin::GenericVector::
setitem
(dolfin::la_index i, double value)¶ Set
given entry to value. apply(“insert”) should be called before using using the object.Parameters: - i –
- value –
-
std::size_t
dolfin::GenericVector::
size
() const = 0¶ Return global size of vector.
-
std::size_t
dolfin::GenericVector::
size
(std::size_t dim) const¶ Return size of given dimension.
Parameters: dim –
-
std::string
dolfin::GenericVector::
str
(bool verbose) const = 0¶ Return informal string representation (pretty-print)
Parameters: verbose –
-
double
dolfin::GenericVector::
sum
() const = 0¶ Return sum of vector.
-
double
dolfin::GenericVector::
sum
(const Array<std::size_t> &rows) const = 0¶ Return sum of selected rows in vector. Repeated entries are only summed once.
Parameters: rows –
-
dolfin::GenericVector::
~GenericVector
()¶ Destructor.
-
void
Ifpack2Preconditioner¶
C++ documentation for Ifpack2Preconditioner
from dolfin/la/Ifpack2Preconditioner.h
:
-
class
dolfin::
Ifpack2Preconditioner
¶ Implements preconditioners using Ifpack2 from Trilinos.
-
dolfin::Ifpack2Preconditioner::
Ifpack2Preconditioner
(std::string type = "default")¶ Create a particular preconditioner object.
Parameters: type –
Initialise preconditioner based on Operator P.
Parameters: P –
-
type
dolfin::Ifpack2Preconditioner::
prec_type
¶
-
std::map<std::string, std::string>
dolfin::Ifpack2Preconditioner::
preconditioners
()¶ Return a list of available preconditioners.
-
void
dolfin::Ifpack2Preconditioner::
set
(BelosKrylovSolver &solver)¶ Set
the preconditioner type on a solver.Parameters: solver –
-
std::string
dolfin::Ifpack2Preconditioner::
str
(bool verbose) const¶ Return informal string representation (pretty-print)
Parameters: verbose –
-
dolfin::Ifpack2Preconditioner::
~Ifpack2Preconditioner
()¶ Destructor.
-
IndexMap¶
C++ documentation for IndexMap
from dolfin/la/IndexMap.h
:
-
class
dolfin::
IndexMap
¶ This class represents the distribution index arrays across processes. An index array is a contiguous collection of N+1 indices [0, 1, . . ., N] that are distributed across processes M processes. On a given process, the
IndexMap
stores a portion of the index set using local indices [0, 1, . . . , n], and a map from the local indices to a unique global index.-
dolfin::IndexMap::
IndexMap
()¶ Constructor.
-
dolfin::IndexMap::
IndexMap
(MPI_Comm mpi_comm)¶ Index map with no data.
Parameters: mpi_comm –
-
dolfin::IndexMap::
IndexMap
(MPI_Comm mpi_comm, std::size_t local_size, std::size_t block_size)¶ Index map with local size on each process. This constructor is collective
Parameters: - mpi_comm –
- local_size –
- block_size –
-
enum
dolfin::IndexMap::
MapSize
¶ MapSize (ALL = all local indices, OWNED = owned local indices, UNOWNED = unowned local indices, GLOBAL = total indices globally)
-
enumerator
dolfin::IndexMap::MapSize::
ALL
= 0¶
-
enumerator
dolfin::IndexMap::MapSize::
OWNED
= 1¶
-
enumerator
dolfin::IndexMap::MapSize::
UNOWNED
= 2¶
-
enumerator
dolfin::IndexMap::MapSize::
GLOBAL
= 3¶
-
enumerator
-
int
dolfin::IndexMap::
block_size
() const¶ Get block size.
-
int
dolfin::IndexMap::
global_index_owner
(std::size_t index) const¶ Get process owner of any global index.
Parameters: index –
-
void
dolfin::IndexMap::
init
(std::size_t local_size, std::size_t block_size)¶ Initialise with number of local entries and block size. This function is collective
Parameters: - local_size –
- block_size –
-
std::pair<std::size_t, std::size_t>
dolfin::IndexMap::
local_range
() const¶ Local range of indices.
-
std::size_t
dolfin::IndexMap::
local_to_global
(std::size_t i) const¶ Get global index of local index i.
Parameters: i –
-
const std::vector<std::size_t> &
dolfin::IndexMap::
local_to_global_unowned
() const¶ Get local to global map for unowned indices (local indexing beyond end of local range)
-
const std::vector<int> &
dolfin::IndexMap::
off_process_owner
() const¶ Get off process owner for unowned indices.
-
void
dolfin::IndexMap::
set_local_to_global
(const std::vector<std::size_t> &indices)¶ Set
local_to_global map for unowned indices (beyond end of local range). Computes and stores off-process owner array.Parameters: indices –
-
std::size_t
dolfin::IndexMap::
size
(MapSize type) const¶ Get number of local indices of type MapSize::OWNED, MapSize::UNOWNED, MapSize::ALL or MapSize::GLOBAL
Parameters: type –
-
dolfin::IndexMap::
~IndexMap
()¶ Destructor.
-
KrylovSolver¶
C++ documentation for KrylovSolver
from dolfin/la/KrylovSolver.h
:
-
class
dolfin::
KrylovSolver
: public dolfin::GenericLinearSolver¶ This class defines an interface for a Krylov solver. The appropriate solver is chosen on the basis of the matrix/vector type.
Constructor.
Parameters: - comm –
- A –
- method –
- preconditioner –
-
dolfin::KrylovSolver::
KrylovSolver
(MPI_Comm comm, std::string method = "default", std::string preconditioner = "default")¶ Constructor.
Parameters: - comm –
- method –
- preconditioner –
Constructor.
Parameters: - A –
- method –
- preconditioner –
-
dolfin::KrylovSolver::
KrylovSolver
(std::string method = "default", std::string preconditioner = "default")¶ Constructor.
Parameters: - method –
- preconditioner –
-
void
dolfin::KrylovSolver::
init
(std::string method, std::string preconditioner, MPI_Comm comm)¶ Parameters: - method –
- preconditioner –
- comm –
-
std::string
dolfin::KrylovSolver::
parameter_type
() const¶ Return parameter type: “krylov_solver” or “lu_solver”.
Set
operator (matrix)Parameters: A –
Set
operator (matrix) and preconditioner matrix.Parameters: - A –
- P –
-
std::size_t
dolfin::KrylovSolver::
solve
(GenericVector &x, const GenericVector &b)¶ Solve linear system Ax = b.
Parameters: - x –
- b –
-
std::size_t
dolfin::KrylovSolver::
solve
(const GenericLinearOperator &A, GenericVector &x, const GenericVector &b)¶ Solve linear system Ax = b.
Parameters: - A –
- x –
- b –
-
std::shared_ptr<GenericLinearSolver>
dolfin::KrylovSolver::
solver
¶
-
void
dolfin::KrylovSolver::
update_parameters
(const Parameters ¶meters)¶ Update solver parameters (pass parameters down to wrapped implementation)
Parameters: parameters –
-
dolfin::KrylovSolver::
~KrylovSolver
()¶ Destructor.
LUSolver¶
C++ documentation for LUSolver
from dolfin/la/LUSolver.h
:
-
class
dolfin::
LUSolver
: public dolfin::GenericLinearSolver¶ LU solver for the built-in LA backends.
Constructor.
Parameters: - comm –
- A –
- method –
-
dolfin::LUSolver::
LUSolver
(MPI_Comm comm, std::string method = "default")¶ Constructor.
Parameters: - comm –
- method –
Constructor.
Parameters: - A –
- method –
-
dolfin::LUSolver::
LUSolver
(std::string method = "default")¶ Constructor.
Parameters: method –
-
void
dolfin::LUSolver::
init
(MPI_Comm comm, std::string method)¶ Parameters: - comm –
- method –
-
std::string
dolfin::LUSolver::
parameter_type
() const¶ Return parameter type: “krylov_solver” or “lu_solver”.
Set
operator (matrix)Parameters: A –
-
std::size_t
dolfin::LUSolver::
solve
(GenericVector &x, const GenericVector &b)¶ Solve linear system Ax = b.
Parameters: - x –
- b –
-
std::size_t
dolfin::LUSolver::
solve
(const GenericLinearOperator &A, GenericVector &x, const GenericVector &b)¶ Solve linear system.
Parameters: - A –
- x –
- b –
-
std::shared_ptr<GenericLinearSolver>
dolfin::LUSolver::
solver
¶
-
void
dolfin::LUSolver::
update_parameters
(const Parameters ¶meters)¶ Update solver parameters (pass parameters down to wrapped implementation)
Parameters: parameters –
-
dolfin::LUSolver::
~LUSolver
()¶ Destructor.
LinearAlgebraObject¶
C++ documentation for LinearAlgebraObject
from dolfin/la/LinearAlgebraObject.h
:
-
class
dolfin::
LinearAlgebraObject
¶ This is a common base class for all DOLFIN linear algebra objects. In particular, it provides casting mechanisms between different types.
-
LinearAlgebraObject *
dolfin::LinearAlgebraObject::
instance
()¶ Return concrete instance / unwrap (non-const version)
-
const LinearAlgebraObject *
dolfin::LinearAlgebraObject::
instance
() const¶ Return concrete instance / unwrap (const version)
Return concrete shared ptr instance / unwrap (non-const version)
Return concrete shared ptr instance / unwrap (const version)
-
LinearAlgebraObject *
LinearOperator¶
C++ documentation for LinearOperator
from dolfin/la/LinearOperator.h
:
-
class
dolfin::
LinearOperator
: public dolfin::GenericLinearOperator¶ This class defines an interface for linear operators defined only in terms of their action (matrix-vector product) and can be used for matrix-free solution of linear systems. The linear algebra backend is decided at run-time based on the present value of the “linear_algebra_backend” parameter. To define a linear operator, users need to inherit from this class and overload the function mult(x, y) which defines the action of the matrix on the vector x as y = Ax.
-
dolfin::LinearOperator::
LinearOperator
()¶ Create linear operator.
-
dolfin::LinearOperator::
LinearOperator
(const GenericVector &x, const GenericVector &y)¶ Create linear operator to match parallel layout of vectors x and y for product y = Ax.
Parameters: - x –
- y –
-
GenericLinearOperator *
dolfin::LinearOperator::
instance
()¶ Return concrete instance / unwrap (non-const version)
-
const GenericLinearOperator *
dolfin::LinearOperator::
instance
() const¶ Return concrete instance / unwrap (const version)
-
void
dolfin::LinearOperator::
mult
(const GenericVector &x, GenericVector &y) const = 0¶ Compute matrix-vector product y = Ax.
Parameters: - x –
- y –
Return concrete instance / unwrap (shared pointer version)
Return concrete instance / unwrap (const shared pointer version)
-
std::size_t
dolfin::LinearOperator::
size
(std::size_t dim) const = 0¶ Return size of given dimension.
Parameters: dim –
-
std::string
dolfin::LinearOperator::
str
(bool verbose) const¶ Return informal string representation (pretty-print)
Parameters: verbose –
-
dolfin::LinearOperator::
~LinearOperator
()¶ Destructor.
-
LinearSolver¶
C++ documentation for LinearSolver
from dolfin/la/LinearSolver.h
:
-
class
dolfin::
LinearSolver
: public dolfin::GenericLinearSolver¶ This class provides a general solver for linear systems Ax = b.
Friends:
KrylovSolver
,LUSolver
,LinearVariationalSolver
,NewtonSolver
.-
dolfin::LinearSolver::
LinearSolver
(MPI_Comm comm, std::string method = "default", std::string preconditioner = "default")¶ Create linear solver.
Parameters: - comm –
- method –
- preconditioner –
-
dolfin::LinearSolver::
LinearSolver
(std::string method = "default", std::string preconditioner = "default")¶ Create linear solver.
Parameters: - method –
- preconditioner –
-
bool
dolfin::LinearSolver::
in_list
(const std::string &method, const std::map<std::string, std::string> &methods)¶ Parameters: - method –
- methods –
-
std::string
dolfin::LinearSolver::
parameter_type
() const¶ Return parameter type: “krylov_solver” or “lu_solver”.
Set
the operator (matrix)Parameters: A –
Set
the operator (matrix) and preconditioner matrix.Parameters: - A –
- P –
-
std::size_t
dolfin::LinearSolver::
solve
(GenericVector &x, const GenericVector &b)¶ Solve linear system Ax = b.
Parameters: - x –
- b –
-
std::size_t
dolfin::LinearSolver::
solve
(const GenericLinearOperator &A, GenericVector &x, const GenericVector &b)¶ Solve linear system Ax = b.
Parameters: - A –
- x –
- b –
-
std::unique_ptr<GenericLinearSolver>
dolfin::LinearSolver::
solver
¶
-
void
dolfin::LinearSolver::
update_parameters
(const Parameters ¶meters)¶ Update solver parameters (pass parameters down to wrapped implementation)
Parameters: parameters –
-
dolfin::LinearSolver::
~LinearSolver
()¶ Destructor.
-
Matrix¶
C++ documentation for Matrix
from dolfin/la/Matrix.h
:
-
class
dolfin::
Matrix
: public dolfin::GenericMatrix¶ This class provides the default DOLFIN matrix class, based on the default DOLFIN linear algebra backend.
-
dolfin::Matrix::
Matrix
()¶ Create empty matrix.
-
dolfin::Matrix::
Matrix
(MPI_Comm comm)¶ Create empty matrix.
Parameters: comm –
-
dolfin::Matrix::
Matrix
(const GenericMatrix &A)¶ Create a
Vector
from aGenericVector
.Parameters: A –
-
void
dolfin::Matrix::
add
(const double *block, std::size_t m, const dolfin::la_index *rows, std::size_t n, const dolfin::la_index *cols)¶ Add block of values using global indices.
Parameters: - block –
- m –
- rows –
- n –
- cols –
-
void
dolfin::Matrix::
add_local
(const double *block, std::size_t m, const dolfin::la_index *rows, std::size_t n, const dolfin::la_index *cols)¶ Add block of values using local indices.
Parameters: - block –
- m –
- rows –
- n –
- cols –
-
void
dolfin::Matrix::
apply
(std::string mode)¶ Finalize assembly of tensor.
Parameters: mode –
-
void
dolfin::Matrix::
axpy
(double a, const GenericMatrix &A, bool same_nonzero_pattern)¶ Add multiple of given matrix (AXPY operation)
Parameters: - a –
- A –
- same_nonzero_pattern –
-
std::shared_ptr<GenericMatrix>
dolfin::Matrix::
copy
() const¶ Return copy of matrix.
-
bool
dolfin::Matrix::
empty
() const¶ Return true if matrix is empty.
-
GenericLinearAlgebraFactory &
dolfin::Matrix::
factory
() const¶ Return linear algebra backend factory.
-
void
dolfin::Matrix::
get
(double *block, std::size_t m, const dolfin::la_index *rows, std::size_t n, const dolfin::la_index *cols) const¶ Get block of values.
Parameters: - block –
- m –
- rows –
- n –
- cols –
-
void
dolfin::Matrix::
get_diagonal
(GenericVector &x) const¶ Get diagonal of a matrix.
Parameters: x –
-
void
dolfin::Matrix::
getrow
(std::size_t row, std::vector<std::size_t> &columns, std::vector<double> &values) const¶ Get non-zero values of given row.
Parameters: - row –
- columns –
- values –
-
void
dolfin::Matrix::
ident
(std::size_t m, const dolfin::la_index *rows)¶ Set
given rows (global row indices) to identity matrix.Parameters: - m –
- rows –
-
void
dolfin::Matrix::
ident_local
(std::size_t m, const dolfin::la_index *rows)¶ Set
given rows (local row indices) to identity matrix.Parameters: - m –
- rows –
-
void
dolfin::Matrix::
init
(const TensorLayout &tensor_layout)¶ Initialize zero tensor using tensor layout.
Parameters: tensor_layout –
-
void
dolfin::Matrix::
init_vector
(GenericVector &y, std::size_t dim) const¶ Resize vector y such that is it compatible with matrix for multiplication Ax = b (dim = 0 -> b, dim = 1 -> x) In parallel case, size and layout are important.
Parameters: - y –
- dim –
-
GenericMatrix *
dolfin::Matrix::
instance
()¶ Return concrete instance / unwrap (non-const version)
-
const GenericMatrix *
dolfin::Matrix::
instance
() const¶ Return concrete instance / unwrap (const version)
-
bool
dolfin::Matrix::
is_symmetric
(double tol) const¶ Test if matrix is symmetric.
Parameters: tol –
-
std::pair<std::int64_t, std::int64_t>
dolfin::Matrix::
local_range
(std::size_t dim) const¶ Return local ownership range.
Parameters: dim –
-
std::shared_ptr<GenericMatrix>
dolfin::Matrix::
matrix
¶
-
void
dolfin::Matrix::
mult
(const GenericVector &x, GenericVector &y) const¶ Compute matrix-vector product y = Ax.
Parameters: - x –
- y –
-
std::size_t
dolfin::Matrix::
nnz
() const¶ Return number of non-zero entries in matrix (collective)
-
double
dolfin::Matrix::
norm
(std::string norm_type) const¶ Return norm of matrix.
Parameters: norm_type –
-
const Matrix &
dolfin::Matrix::
operator*=
(double a)¶ Multiply matrix by given number.
Parameters: a –
-
const Matrix &
dolfin::Matrix::
operator/=
(double a)¶ Divide matrix by given number.
Parameters: a –
-
const GenericMatrix &
dolfin::Matrix::
operator=
(const GenericMatrix &A)¶ Assignment operator.
Parameters: A –
-
const Matrix &
dolfin::Matrix::
operator=
(const Matrix &A)¶ Assignment operator.
Parameters: A –
-
void
dolfin::Matrix::
set
(const double *block, std::size_t m, const dolfin::la_index *rows, std::size_t n, const dolfin::la_index *cols)¶ Set
block of values using global indices.Parameters: - block –
- m –
- rows –
- n –
- cols –
-
void
dolfin::Matrix::
set_diagonal
(const GenericVector &x)¶ Set
diagonal of a matrix.Parameters: x –
-
void
dolfin::Matrix::
set_local
(const double *block, std::size_t m, const dolfin::la_index *rows, std::size_t n, const dolfin::la_index *cols)¶ Set
block of values using local indices.Parameters: - block –
- m –
- rows –
- n –
- cols –
-
void
dolfin::Matrix::
setrow
(std::size_t row, const std::vector<std::size_t> &columns, const std::vector<double> &values)¶ Set
values for given row.Parameters: - row –
- columns –
- values –
Return concrete shared ptr instance / unwrap (non-const version)
Return concrete shared ptr instance / unwrap (const version)
-
std::size_t
dolfin::Matrix::
size
(std::size_t dim) const¶ Return size of given dimension.
Parameters: dim –
-
std::string
dolfin::Matrix::
str
(bool verbose) const¶ Return informal string representation (pretty-print)
Parameters: verbose –
-
void
dolfin::Matrix::
transpmult
(const GenericVector &x, GenericVector &y) const¶ Matrix-vector product, y = A^T x. The y vector must either be zero-sized or have correct size and parallel layout.
Parameters: - x –
- y –
-
void
dolfin::Matrix::
zero
(std::size_t m, const dolfin::la_index *rows)¶ Set
given rows to zero.Parameters: - m –
- rows –
-
void
dolfin::Matrix::
zero_local
(std::size_t m, const dolfin::la_index *rows)¶ Set
given rows (local row indices) to zero.Parameters: - m –
- rows –
-
dolfin::Matrix::
~Matrix
()¶ Destructor.
-
MueluPreconditioner¶
C++ documentation for MueluPreconditioner
from dolfin/la/MueluPreconditioner.h
:
-
class
dolfin::
MueluPreconditioner
¶ Implements Muelu preconditioner from Trilinos.
-
dolfin::MueluPreconditioner::
MueluPreconditioner
()¶ Create a particular preconditioner object.
Initialise preconditioner based on Operator P.
Parameters: P –
-
type
dolfin::MueluPreconditioner::
op_type
¶
-
type
dolfin::MueluPreconditioner::
prec_type
¶
-
void
dolfin::MueluPreconditioner::
set
(BelosKrylovSolver &solver)¶ Set
the preconditioner on a solver.Parameters: solver –
-
std::string
dolfin::MueluPreconditioner::
str
(bool verbose) const¶ Return informal string representation (pretty-print)
Parameters: verbose –
-
dolfin::MueluPreconditioner::
~MueluPreconditioner
()¶ Destructor.
-
PETScBaseMatrix¶
C++ documentation for PETScBaseMatrix
from dolfin/la/PETScBaseMatrix.h
:
-
class
dolfin::
PETScBaseMatrix
¶ This class is a base class for matrices that can be used in
PETScKrylovSolver
.-
dolfin::PETScBaseMatrix::
PETScBaseMatrix
()¶ Constructor.
-
dolfin::PETScBaseMatrix::
PETScBaseMatrix
(Mat A)¶ Constructor.
Parameters: A –
-
dolfin::PETScBaseMatrix::
PETScBaseMatrix
(const PETScBaseMatrix &A)¶ Copy constructor.
Parameters: A –
-
void
dolfin::PETScBaseMatrix::
init_vector
(GenericVector &z, std::size_t dim) const¶ Initialize vector to be compatible with the matrix-vector product y = Ax. In the parallel case, both size and layout are important.
Parameters: - z – (
GenericVector
&)Vector
to initialise - dim – (std::size_t) The dimension (axis): dim = 0 –> z = y, dim = 1 –> z = x
- z – (
-
std::pair<std::int64_t, std::int64_t>
dolfin::PETScBaseMatrix::
local_range
(std::size_t dim) const¶ Return local range along dimension dim.
Parameters: dim –
-
Mat
dolfin::PETScBaseMatrix::
mat
() const¶ Return PETSc Mat pointer.
-
std::pair<std::int64_t, std::int64_t>
dolfin::PETScBaseMatrix::
size
() const¶ Return number of rows and columns (num_rows, num_cols). PETSc returns -1 if size has not been set.
-
std::size_t
dolfin::PETScBaseMatrix::
size
(std::size_t dim) const¶ Return number of rows (dim = 0) or columns (dim = 1)
Parameters: dim –
-
std::string
dolfin::PETScBaseMatrix::
str
(bool verbose) const¶ Return informal string representation (pretty-print)
Parameters: verbose –
-
dolfin::PETScBaseMatrix::
~PETScBaseMatrix
()¶ Destructor.
-
PETScFactory¶
C++ documentation for PETScFactory
from dolfin/la/PETScFactory.h
:
-
class
dolfin::
PETScFactory
¶ PETSc linear algebra factory.
-
dolfin::PETScFactory::
PETScFactory
()¶ Private constructor.
-
std::shared_ptr<GenericLinearSolver>
dolfin::PETScFactory::
create_krylov_solver
(MPI_Comm comm, std::string method, std::string preconditioner) const¶ Create Krylov solver.
Parameters: - comm –
- method –
- preconditioner –
-
std::shared_ptr<TensorLayout>
dolfin::PETScFactory::
create_layout
(MPI_Comm comm, std::size_t rank) const¶ Create empty tensor layout.
Parameters: - comm –
- rank –
-
std::shared_ptr<GenericLinearOperator>
dolfin::PETScFactory::
create_linear_operator
(MPI_Comm comm) const¶ Create empty linear operator.
Parameters: comm –
-
std::shared_ptr<GenericLinearSolver>
dolfin::PETScFactory::
create_lu_solver
(MPI_Comm comm, std::string method) const¶ Create LU solver.
Parameters: - comm –
- method –
-
std::shared_ptr<GenericMatrix>
dolfin::PETScFactory::
create_matrix
(MPI_Comm comm) const¶ Create empty matrix.
Parameters: comm –
-
std::shared_ptr<GenericVector>
dolfin::PETScFactory::
create_vector
(MPI_Comm comm) const¶ Create empty vector.
Parameters: comm –
-
PETScFactory
dolfin::PETScFactory::
factory
¶
-
PETScFactory &
dolfin::PETScFactory::
instance
()¶ Return singleton instance.
-
std::map<std::string, std::string>
dolfin::PETScFactory::
krylov_solver_methods
() const¶ Return a list of available Krylov solver methods.
-
std::map<std::string, std::string>
dolfin::PETScFactory::
krylov_solver_preconditioners
() const¶ Return a list of available preconditioners.
-
std::map<std::string, std::string>
dolfin::PETScFactory::
lu_solver_methods
() const¶ Return a list of available LU solver methods.
-
dolfin::PETScFactory::
~PETScFactory
()¶ Destructor.
-
PETScKrylovSolver¶
C++ documentation for PETScKrylovSolver
from dolfin/la/PETScKrylovSolver.h
:
-
class
dolfin::
PETScKrylovSolver
: public dolfin::GenericLinearSolver¶ This class implements Krylov methods for linear systems of the form Ax = b. It is a wrapper for the Krylov solvers of PETSc.
Friends:
PETScSNESSolver
,PETScTAOSolver
.-
dolfin::PETScKrylovSolver::
PETScKrylovSolver
(KSP ksp)¶ Create solver wrapper of a PETSc KSP object.
Parameters: ksp –
Create Krylov solver for a particular method and
PETScPreconditioner
(shared_ptr version)Parameters: - comm –
- method –
- preconditioner –
-
dolfin::PETScKrylovSolver::
PETScKrylovSolver
(MPI_Comm comm, std::string method = "default", std::string preconditioner = "default")¶ Create Krylov solver for a particular method and named preconditioner
Parameters: - comm –
- method –
- preconditioner –
Create Krylov solver for a particular method and
PETScPreconditioner
(shared_ptr version)Parameters: - method –
- preconditioner –
-
dolfin::PETScKrylovSolver::
PETScKrylovSolver
(std::string method = "default", std::string preconditioner = "default")¶ Create Krylov solver for a particular method and named preconditioner
Parameters: - method –
- preconditioner –
-
void
dolfin::PETScKrylovSolver::
check_dimensions
(const PETScBaseMatrix &A, const GenericVector &x, const GenericVector &b) const¶ Parameters: - A –
- x –
- b –
-
norm_type
dolfin::PETScKrylovSolver::
get_norm_type
() const¶ Get norm type used in convergence testing.
-
PETScKrylovSolver::norm_type
dolfin::PETScKrylovSolver::
get_norm_type
(std::string norm)¶ Parameters: norm –
-
std::string
dolfin::PETScKrylovSolver::
get_options_prefix
() const¶ Returns the prefix used by PETSc when searching the PETSc options database
-
KSP
dolfin::PETScKrylovSolver::
ksp
() const¶ Return PETSc KSP pointer.
-
std::map<std::string, std::string>
dolfin::PETScKrylovSolver::
methods
()¶ Return a list of available solver methods.
-
void
dolfin::PETScKrylovSolver::
monitor
(bool monitor_convergence)¶ Monitor residual at each iteration.
Parameters: monitor_convergence –
-
enum
dolfin::PETScKrylovSolver::
norm_type
¶ Norm types used in convergence testing. Not all solvers types support all norm types (see http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/KSP/KSPSetNormType.html ). Note that ‘default’ is a reserved keyword, so we use ‘default_norm’
-
enumerator
dolfin::PETScKrylovSolver::norm_type::
none
¶
-
enumerator
dolfin::PETScKrylovSolver::norm_type::
default_norm
¶
-
enumerator
dolfin::PETScKrylovSolver::norm_type::
preconditioned
¶
-
enumerator
dolfin::PETScKrylovSolver::norm_type::
unpreconditioned
¶
-
enumerator
dolfin::PETScKrylovSolver::norm_type::
natural
¶
-
enumerator
-
std::string
dolfin::PETScKrylovSolver::
parameter_type
() const¶ Return parameter type: “krylov_solver” or “lu_solver”.
-
bool
dolfin::PETScKrylovSolver::
preconditioner_set
¶
-
std::map<std::string, std::string>
dolfin::PETScKrylovSolver::
preconditioners
()¶ Return a list of available named preconditioners.
-
void
dolfin::PETScKrylovSolver::
set_dm_active
(bool val)¶ Activate/deactivate DM.
Parameters: val –
-
void
dolfin::PETScKrylovSolver::
set_nonzero_guess
(bool nonzero_guess)¶ Use nonzero initial guess for solution function (nonzero_guess=true, the solution vector x will not be zeroed before the solver starts)
Parameters: nonzero_guess –
-
void
dolfin::PETScKrylovSolver::
set_norm_type
(norm_type type)¶ Set
norm type used in convergence testing - not all solvers types support all norm typesParameters: type –
-
void
dolfin::PETScKrylovSolver::
set_operator
(const PETScBaseMatrix &A)¶ Set
operator (PETScMatrix
). This is memory-safe as PETSc will increase the reference count to the underlying PETSc object.Parameters: A –
Set
operator (matrix)Parameters: A –
-
void
dolfin::PETScKrylovSolver::
set_operators
(const PETScBaseMatrix &A, const PETScBaseMatrix &P)¶ Set
operator and preconditioner matrix (PETScMatrix
). This is memory-safe as PETSc will increase the reference count to the underlying PETSc objects.Parameters: - A –
- P –
Set
operator (matrix) and preconditioner matrix.Parameters: - A –
- P –
-
void
dolfin::PETScKrylovSolver::
set_options_prefix
(std::string options_prefix)¶ Sets the prefix used by PETSc when searching the PETSc options database
Parameters: options_prefix –
-
void
dolfin::PETScKrylovSolver::
set_reuse_preconditioner
(bool reuse_pc)¶ Reuse preconditioner if true, even if matrix operator changes (by default preconditioner will be re-built if the matrix changes)
Parameters: reuse_pc –
-
void
dolfin::PETScKrylovSolver::
set_tolerances
(double relative, double absolute, double diverged, int max_iter)¶ Set
tolerances (relative residual, alsolute residial, maximum number of iterations)Parameters: - relative –
- absolute –
- diverged –
- max_iter –
-
std::size_t
dolfin::PETScKrylovSolver::
solve
(GenericVector &x, const GenericVector &b)¶ Solve linear system Ax = b and return number of iterations.
Parameters: - x –
- b –
-
std::size_t
dolfin::PETScKrylovSolver::
solve
(GenericVector &x, const GenericVector &b, bool transpose)¶ Solve linear system Ax = b and return number of iterations (A^t x = b if transpose is true)
Parameters: - x –
- b –
- transpose –
-
std::size_t
dolfin::PETScKrylovSolver::
solve
(PETScVector &x, const PETScVector &b, bool transpose = false)¶ Solve linear system Ax = b and return number of iterations (A^t x = b if transpose is true)
Parameters: - x –
- b –
- transpose –
-
std::size_t
dolfin::PETScKrylovSolver::
solve
(const GenericLinearOperator &A, GenericVector &x, const GenericVector &b)¶ Solve linear system Ax = b and return number of iterations.
Parameters: - A –
- x –
- b –
-
std::string
dolfin::PETScKrylovSolver::
str
(bool verbose) const¶ Return informal string representation (pretty-print)
Parameters: verbose –
-
void
dolfin::PETScKrylovSolver::
write_report
(int num_iterations, KSPConvergedReason reason)¶ Parameters: - num_iterations –
- reason –
-
dolfin::PETScKrylovSolver::
~PETScKrylovSolver
()¶ Destructor.
-
PETScLUSolver¶
C++ documentation for PETScLUSolver
from dolfin/la/PETScLUSolver.h
:
-
class
dolfin::
PETScLUSolver
: public dolfin::GenericLinearSolver¶ This class implements the direct solution (LU factorization) for linear systems of the form Ax = b. It is a wrapper for the LU solver of PETSc.
Friends:
PETScSNESSolver
,PETScTAOSolver
.Constructor.
Parameters: - comm –
- A –
- method –
-
dolfin::PETScLUSolver::
PETScLUSolver
(MPI_Comm comm, std::string method = "default")¶ Constructor.
Parameters: - comm –
- method –
Constructor.
Parameters: - A –
- method –
-
dolfin::PETScLUSolver::
PETScLUSolver
(std::string method = "default")¶ Constructor.
Parameters: method –
-
std::string
dolfin::PETScLUSolver::
get_options_prefix
() const¶ Returns the prefix used by PETSc when searching the options database
-
KSP
dolfin::PETScLUSolver::
ksp
() const¶ Return PETSc KSP pointer.
-
std::map<std::string, const MatSolverPackage>
dolfin::PETScLUSolver::
lumethods
¶
-
std::map<std::string, std::string>
dolfin::PETScLUSolver::
methods
()¶ Return a list of available solver methods.
-
std::string
dolfin::PETScLUSolver::
parameter_type
() const¶ Return parameter type: “krylov_solver” or “lu_solver”.
-
const MatSolverPackage
dolfin::PETScLUSolver::
select_solver
(MPI_Comm comm, std::string method)¶ Parameters: - comm –
- method –
-
void
dolfin::PETScLUSolver::
set_operator
(const PETScMatrix &A)¶ Set
operator (matrix)Parameters: A –
Set
operator (matrix)Parameters: A –
-
void
dolfin::PETScLUSolver::
set_options_prefix
(std::string options_prefix)¶ Sets the prefix used by PETSc when searching the options database
Parameters: options_prefix –
-
std::size_t
dolfin::PETScLUSolver::
solve
(GenericVector &x, const GenericVector &b)¶ Solve linear system Ax = b.
Parameters: - x –
- b –
-
std::size_t
dolfin::PETScLUSolver::
solve
(GenericVector &x, const GenericVector &b, bool transpose)¶ Solve linear system Ax = b (A^t x = b if transpose is true)
Parameters: - x –
- b –
- transpose –
-
std::size_t
dolfin::PETScLUSolver::
solve
(const GenericLinearOperator &A, GenericVector &x, const GenericVector &b)¶ Solve linear system Ax = b.
Parameters: - A –
- x –
- b –
-
std::size_t
dolfin::PETScLUSolver::
solve
(const PETScMatrix &A, PETScVector &x, const PETScVector &b)¶ Solve linear system Ax = b.
Parameters: - A –
- x –
- b –
-
std::string
dolfin::PETScLUSolver::
str
(bool verbose) const¶ Return informal string representation (pretty-print)
Parameters: verbose –
-
dolfin::PETScLUSolver::
~PETScLUSolver
()¶ Destructor.
PETScLinearOperator¶
C++ documentation for PETScLinearOperator
from dolfin/la/PETScLinearOperator.h
:
-
class
dolfin::
PETScLinearOperator
: public dolfin::GenericLinearOperator, dolfin::PETScBaseMatrix¶ PETSc version of the
GenericLinearOperator
. Matrix-free interface for the solution of linear systems defined in terms of the action (matrix-vector product) of a linear operator.-
dolfin::PETScLinearOperator::
PETScLinearOperator
(MPI_Comm comm)¶ Constructor.
Parameters: comm –
-
void
dolfin::PETScLinearOperator::
init_layout
(const GenericVector &x, const GenericVector &y, GenericLinearOperator *wrapper)¶ Initialize linear operator to match parallel layout of vectors x and y for product y = Ax. Needs to be implemented by backend.
Parameters: - x –
- y –
- wrapper –
-
void
dolfin::PETScLinearOperator::
mult
(const GenericVector &x, GenericVector &y) const¶ Compute matrix-vector product y = Ax.
Parameters: - x –
- y –
-
std::size_t
dolfin::PETScLinearOperator::
size
(std::size_t dim) const¶ Return size of given dimension.
Parameters: dim –
-
std::string
dolfin::PETScLinearOperator::
str
(bool verbose) const¶ Return informal string representation (pretty-print)
Parameters: verbose –
-
GenericLinearOperator *
dolfin::PETScLinearOperator::
wrapper
()¶ Return pointer to wrapper (const version)
-
const GenericLinearOperator *
dolfin::PETScLinearOperator::
wrapper
() const¶ Return pointer to wrapper (const version)
-
PETScMatrix¶
C++ documentation for PETScMatrix
from dolfin/la/PETScMatrix.h
:
-
class
dolfin::
PETScMatrix
: public dolfin::GenericMatrix, dolfin::PETScBaseMatrix¶ This class provides a simple matrix class based on PETSc. It is a wrapper for a PETSc matrix pointer (Mat) implementing the
GenericMatrix
interface. The interface is intentionally simple. For advanced usage, access the PETSc Mat pointer using the functionmat
and use the standard PETSc interface.-
dolfin::PETScMatrix::
PETScMatrix
()¶ Create empty matrix (on MPI_COMM_WORLD)
-
dolfin::PETScMatrix::
PETScMatrix
(MPI_Comm comm)¶ Create empty matrix.
Parameters: comm –
-
dolfin::PETScMatrix::
PETScMatrix
(Mat A)¶ Create a wrapper around a PETSc Mat pointer. The Mat object should have been created, e.g. via PETSc MatCreate.
Parameters: A –
-
dolfin::PETScMatrix::
PETScMatrix
(const PETScMatrix &A)¶ Copy constructor.
Parameters: A –
-
void
dolfin::PETScMatrix::
add
(const double *block, std::size_t m, const dolfin::la_index *rows, std::size_t n, const dolfin::la_index *cols)¶ Add block of values using global indices.
Parameters: - block –
- m –
- rows –
- n –
- cols –
-
void
dolfin::PETScMatrix::
add_local
(const double *block, std::size_t m, const dolfin::la_index *rows, std::size_t n, const dolfin::la_index *cols)¶ Add block of values using local indices.
Parameters: - block –
- m –
- rows –
- n –
- cols –
-
void
dolfin::PETScMatrix::
apply
(std::string mode)¶ Finalize assembly of tensor. The following values are recognized for the mode parameter: add - corresponds to PETSc MatAssemblyBegin+End(MAT_FINAL_ASSEMBLY) insert - corresponds to PETSc MatAssemblyBegin+End(MAT_FINAL_ASSEMBLY) flush - corresponds to PETSc MatAssemblyBegin+End(MAT_FLUSH_ASSEMBLY)
Parameters: mode –
-
void
dolfin::PETScMatrix::
axpy
(double a, const GenericMatrix &A, bool same_nonzero_pattern)¶ Add multiple of given matrix (AXPY operation)
Parameters: - a –
- A –
- same_nonzero_pattern –
-
void
dolfin::PETScMatrix::
binary_dump
(std::string file_name) const¶ Dump matrix to PETSc binary format.
Parameters: file_name –
-
std::shared_ptr<GenericMatrix>
dolfin::PETScMatrix::
copy
() const¶ Return copy of matrix.
-
MatNullSpace
dolfin::PETScMatrix::
create_petsc_nullspace
(const VectorSpaceBasis &nullspace) const¶ Parameters: nullspace –
-
bool
dolfin::PETScMatrix::
empty
() const¶ Return true if empty.
-
GenericLinearAlgebraFactory &
dolfin::PETScMatrix::
factory
() const¶ Return linear algebra backend factory.
-
void
dolfin::PETScMatrix::
get
(double *block, std::size_t m, const dolfin::la_index *rows, std::size_t n, const dolfin::la_index *cols) const¶ Get block of values.
Parameters: - block –
- m –
- rows –
- n –
- cols –
-
void
dolfin::PETScMatrix::
get_diagonal
(GenericVector &x) const¶ Get diagonal of a matrix.
Parameters: x –
-
std::string
dolfin::PETScMatrix::
get_options_prefix
() const¶ Returns the prefix used by PETSc when searching the options database
-
void
dolfin::PETScMatrix::
getrow
(std::size_t row, std::vector<std::size_t> &columns, std::vector<double> &values) const¶ Get non-zero values of given row.
Parameters: - row –
- columns –
- values –
-
void
dolfin::PETScMatrix::
ident
(std::size_t m, const dolfin::la_index *rows)¶ Set
given rows (global row indices) to identity matrix.Parameters: - m –
- rows –
-
void
dolfin::PETScMatrix::
ident_local
(std::size_t m, const dolfin::la_index *rows)¶ Set
given rows (local row indices) to identity matrix.Parameters: - m –
- rows –
-
void
dolfin::PETScMatrix::
init
(const TensorLayout &tensor_layout)¶ Initialize zero tensor using tensor layout.
Parameters: tensor_layout –
-
void
dolfin::PETScMatrix::
init_vector
(GenericVector &z, std::size_t dim) const¶ Initialize vector z to be compatible with the matrix-vector product y = Ax. In the parallel case, both size and layout are important.
Parameters: - z – (
GenericVector
&)Vector
to initialise - dim – (std::size_t) The dimension (axis): dim = 0 –> z = y, dim = 1 –> z = x
- z – (
-
bool
dolfin::PETScMatrix::
is_symmetric
(double tol) const¶ Test if matrix is symmetric.
Parameters: tol –
-
std::pair<std::int64_t, std::int64_t>
dolfin::PETScMatrix::
local_range
(std::size_t dim) const¶ Return local ownership range.
Parameters: dim –
-
void
dolfin::PETScMatrix::
mult
(const GenericVector &x, GenericVector &y) const¶ Compute matrix-vector product y = Ax.
Parameters: - x –
- y –
-
std::size_t
dolfin::PETScMatrix::
nnz
() const¶ Return number of non-zero entries in matrix (collective)
-
double
dolfin::PETScMatrix::
norm
(std::string norm_type) const¶ Return norm of matrix.
Parameters: norm_type –
-
const std::map<std::string, NormType>
dolfin::PETScMatrix::
norm_types
¶
-
const PETScMatrix &
dolfin::PETScMatrix::
operator*=
(double a)¶ Multiply matrix by given number.
Parameters: a –
-
const PETScMatrix &
dolfin::PETScMatrix::
operator/=
(double a)¶ Divide matrix by given number.
Parameters: a –
-
const GenericMatrix &
dolfin::PETScMatrix::
operator=
(const GenericMatrix &A)¶ Assignment operator.
Parameters: A –
-
const PETScMatrix &
dolfin::PETScMatrix::
operator=
(const PETScMatrix &A)¶ Assignment operator.
Parameters: A –
-
void
dolfin::PETScMatrix::
set
(const double *block, std::size_t m, const dolfin::la_index *rows, std::size_t n, const dolfin::la_index *cols)¶ Set
block of values using global indices.Parameters: - block –
- m –
- rows –
- n –
- cols –
-
void
dolfin::PETScMatrix::
set_diagonal
(const GenericVector &x)¶ Set
diagonal of a matrix.Parameters: x –
-
void
dolfin::PETScMatrix::
set_from_options
()¶ Call PETSc function MatSetFromOptions on the PETSc Mat object.
-
void
dolfin::PETScMatrix::
set_local
(const double *block, std::size_t m, const dolfin::la_index *rows, std::size_t n, const dolfin::la_index *cols)¶ Set
block of values using local indices.Parameters: - block –
- m –
- rows –
- n –
- cols –
-
void
dolfin::PETScMatrix::
set_near_nullspace
(const VectorSpaceBasis &nullspace)¶ Attach near nullspace to matrix (used by preconditioners, such as smoothed aggregation algerbraic multigrid)
Parameters: nullspace –
-
void
dolfin::PETScMatrix::
set_nullspace
(const VectorSpaceBasis &nullspace)¶ Attach nullspace to matrix (typically used by Krylov solvers when solving singular systems)
Parameters: nullspace –
-
void
dolfin::PETScMatrix::
set_options_prefix
(std::string options_prefix)¶ Sets the prefix used by PETSc when searching the options database
Parameters: options_prefix –
-
void
dolfin::PETScMatrix::
setrow
(std::size_t row, const std::vector<std::size_t> &columns, const std::vector<double> &values)¶ Set
values for given row.Parameters: - row –
- columns –
- values –
-
std::size_t
dolfin::PETScMatrix::
size
(std::size_t dim) const¶ Return size of given dimension.
Parameters: dim –
-
std::string
dolfin::PETScMatrix::
str
(bool verbose) const¶ Return informal string representation (pretty-print)
Parameters: verbose –
-
void
dolfin::PETScMatrix::
transpmult
(const GenericVector &x, GenericVector &y) const¶ Matrix-vector product, y = A^T x. The y vector must either be zero-sized or have correct size and parallel layout.
Parameters: - x –
- y –
-
void
dolfin::PETScMatrix::
zero
(std::size_t m, const dolfin::la_index *rows)¶ Set
given rows (global row indices) to zero.Parameters: - m –
- rows –
-
void
dolfin::PETScMatrix::
zero_local
(std::size_t m, const dolfin::la_index *rows)¶ Set
given rows (local row indices) to zero.Parameters: - m –
- rows –
-
dolfin::PETScMatrix::
~PETScMatrix
()¶ Destructor.
-
PETScObject¶
C++ documentation for PETScObject
from dolfin/la/PETScObject.h
:
-
class
dolfin::
PETScObject
¶ This class calls
SubSystemsManager
to initialise PETSc. All PETSc objects must be derived from this class.-
dolfin::PETScObject::
PETScObject
()¶ Constructor. Ensures that PETSc has been initialised.
-
void
dolfin::PETScObject::
petsc_error
(int error_code, std::string filename, std::string petsc_function)¶ Print error message for PETSc calls that return an error.
Parameters: - error_code –
- filename –
- petsc_function –
-
dolfin::PETScObject::
~PETScObject
()¶ Destructor.
-
PETScOptions¶
C++ documentation for PETScOptions
from dolfin/la/PETScOptions.h
:
-
class
dolfin::
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.
PETScOptions::set("mat_mumps_icntl_14", 40);
Note: the non-templated functions are to simplify SWIG wapping into Python.
-
void
dolfin::PETScOptions::
clear
()¶ Clear PETSc global options database.
-
void
dolfin::PETScOptions::
clear
(std::string option)¶ Clear a PETSc option.
Parameters: option –
-
void
dolfin::PETScOptions::
set
(std::string option)¶ Set
PETSc option that takes no value.Parameters: option –
-
void
dolfin::PETScOptions::
set
(std::string option, bool value)¶ Set
PETSc boolean option.Parameters: - option –
- value –
-
void
dolfin::PETScOptions::
set
(std::string option, const T value)¶ Genetic function for setting PETSc option.
Parameters: - option –
- value –
-
void
dolfin::PETScOptions::
set
(std::string option, double value)¶ Set
PETSc double option.Parameters: - option –
- value –
-
void
PETScPreconditioner¶
C++ documentation for PETScPreconditioner
from dolfin/la/PETScPreconditioner.h
:
-
class
dolfin::
PETScPreconditioner
¶ This class is a wrapper for configuring PETSc preconditioners. It does not own a preconditioner. It can take a
PETScKrylovSolver
and set the preconditioner type and parameters.Friends:
PETScSNESSolver
,PETScTAOSolver
.-
dolfin::PETScPreconditioner::
PETScPreconditioner
(std::string type = "default")¶ Create a particular preconditioner object.
Parameters: type –
-
std::size_t
dolfin::PETScPreconditioner::
gdim
¶
-
std::map<std::string, std::string>
dolfin::PETScPreconditioner::
preconditioners
()¶ Return a list of available preconditioners.
-
void
dolfin::PETScPreconditioner::
set
(PETScKrylovSolver &solver)¶ Set
the preconditioner type and parameters.Parameters: solver –
-
void
dolfin::PETScPreconditioner::
set_coordinates
(const std::vector<double> &x, std::size_t dim)¶ Set
the coordinates of the operator (matrix) rows and geometric dimension d. This is can be used by required for certain preconditioners, e.g. ML. The input for this function can be generated using GenericDofMap::tabulate_all_dofs.Parameters: - x –
- dim –
-
void
dolfin::PETScPreconditioner::
set_fieldsplit
(PETScKrylovSolver &solver, const std::vector<std::vector<dolfin::la_index>> &fields, const std::vector<std::string> &split_names)¶ Assign indices from fields as separate PETSc index sets, with given names
Parameters: - solver – (
PETScKrylovSolver
&) - fields – (std::vector<std::vector<dolfin::la_index>>&)
- split_names – (std::vector<std::string>&)
- solver – (
-
void
dolfin::PETScPreconditioner::
set_type
(PETScKrylovSolver &solver, std::string type)¶ Select type by name.
Parameters: - solver –
- type –
-
std::string
dolfin::PETScPreconditioner::
str
(bool verbose) const¶ Return informal string representation (pretty-print)
Parameters: verbose –
-
dolfin::PETScPreconditioner::
~PETScPreconditioner
()¶ Destructor.
-
PETScVector¶
C++ documentation for PETScVector
from dolfin/la/PETScVector.h
:
-
class
dolfin::
PETScVector
: public dolfin::GenericVector¶ A simple vector class based on PETSc. It is a simple wrapper for a PETSc vector pointer (Vec) implementing the
GenericVector
interface. The interface is intentionally simple. For advanced usage, access the PETSc Vec pointer using the functionvec
and use the standard PETSc interface.-
dolfin::PETScVector::
PETScVector
()¶ Create empty vector (on MPI_COMM_WORLD)
-
dolfin::PETScVector::
PETScVector
(MPI_Comm comm)¶ Create empty vector on an
MPI
communicator.Parameters: comm –
-
dolfin::PETScVector::
PETScVector
(MPI_Comm comm, std::size_t N)¶ Create vector of size N.
Parameters: - comm –
- N –
-
dolfin::PETScVector::
PETScVector
(Vec x)¶ Create vector wrapper of PETSc Vec pointer. The reference counter of the Vec will be increased, and decreased upon destruction of this object.
Parameters: x –
-
dolfin::PETScVector::
PETScVector
(const PETScVector &x)¶ Copy constructor.
Parameters: x –
-
dolfin::PETScVector::
PETScVector
(const SparsityPattern &sparsity_pattern)¶ Create vector.
Parameters: sparsity_pattern –
-
void
dolfin::PETScVector::
abs
()¶ Replace all entries in the vector by their absolute values.
-
void
dolfin::PETScVector::
add
(const double *block, std::size_t m, const dolfin::la_index *rows)¶ Add block of values using global indices.
Parameters: - block –
- m –
- rows –
-
void
dolfin::PETScVector::
add_local
(const Array<double> &values)¶ Add values to each entry on local process.
Parameters: values –
-
void
dolfin::PETScVector::
add_local
(const double *block, std::size_t m, const dolfin::la_index *rows)¶ Add block of values using local indices.
Parameters: - block –
- m –
- rows –
-
void
dolfin::PETScVector::
apply
(std::string mode)¶ Finalize assembly of tensor.
Parameters: mode –
-
void
dolfin::PETScVector::
axpy
(double a, const GenericVector &x)¶ Add multiple of given vector (AXPY operation)
Parameters: - a –
- x –
-
std::shared_ptr<GenericVector>
dolfin::PETScVector::
copy
() const¶ Return copy of vector.
-
bool
dolfin::PETScVector::
empty
() const¶ Return true if vector is empty.
-
GenericLinearAlgebraFactory &
dolfin::PETScVector::
factory
() const¶ Return linear algebra backend factory.
-
void
dolfin::PETScVector::
gather
(GenericVector &y, const std::vector<dolfin::la_index> &indices) const¶ Gather entries (given by global indices) into local (MPI_COMM_SELF) vector x. Provided x must be empty or of correct dimension (same as provided indices). This operation is collective
Parameters: - y –
- indices –
-
void
dolfin::PETScVector::
gather
(std::vector<double> &x, const std::vector<dolfin::la_index> &indices) const¶ Gather entries (given by global indices) into x. This operation is collective
Parameters: - x –
- indices –
-
void
dolfin::PETScVector::
gather_on_zero
(std::vector<double> &x) const¶ Gather all entries into x on process 0. This operation is collective
Parameters: x –
-
void
dolfin::PETScVector::
get
(double *block, std::size_t m, const dolfin::la_index *rows) const¶ Get block of values using global indices (all values must be owned by local process, ghosts cannot be accessed)
Parameters: - block –
- m –
- rows –
-
void
dolfin::PETScVector::
get_local
(double *block, std::size_t m, const dolfin::la_index *rows) const¶ Get block of values using local indices.
Parameters: - block –
- m –
- rows –
-
void
dolfin::PETScVector::
get_local
(std::vector<double> &values) const¶ Get all values on local process.
Parameters: values –
-
std::string
dolfin::PETScVector::
get_options_prefix
() const¶ Returns the prefix used by PETSc when searching the options database
-
void
dolfin::PETScVector::
init
(std::pair<std::size_t, std::size_t> range)¶ Initialize vector with given ownership range.
Parameters: range –
-
void
dolfin::PETScVector::
init
(std::pair<std::size_t, std::size_t> range, const std::vector<std::size_t> &local_to_global_map, const std::vector<la_index> &ghost_indices)¶ Initialize vector with given ownership range and with ghost values
Parameters: - range –
- local_to_global_map –
- ghost_indices –
-
void
dolfin::PETScVector::
init
(std::size_t N)¶ Initialize vector to global size N.
Parameters: N –
-
double
dolfin::PETScVector::
inner
(const GenericVector &v) const¶ Return inner product with given vector.
Parameters: v –
-
std::pair<std::int64_t, std::int64_t>
dolfin::PETScVector::
local_range
() const¶ Return ownership range of a vector.
-
std::size_t
dolfin::PETScVector::
local_size
() const¶ Return local size of vector.
-
double
dolfin::PETScVector::
max
() const¶ Return maximum value of vector.
-
double
dolfin::PETScVector::
min
() const¶ Return minimum value of vector.
-
double
dolfin::PETScVector::
norm
(std::string norm_type) const¶ Return norm of vector.
Parameters: norm_type –
-
const std::map<std::string, NormType>
dolfin::PETScVector::
norm_types
¶
-
const PETScVector &
dolfin::PETScVector::
operator*=
(const GenericVector &x)¶ Multiply vector by another vector pointwise.
Parameters: x –
-
const PETScVector &
dolfin::PETScVector::
operator*=
(double a)¶ Multiply vector by given number.
Parameters: a –
-
const PETScVector &
dolfin::PETScVector::
operator+=
(const GenericVector &x)¶ Add given vector.
Parameters: x –
-
const PETScVector &
dolfin::PETScVector::
operator+=
(double a)¶ Add number to all components of a vector.
Parameters: a –
-
const PETScVector &
dolfin::PETScVector::
operator-=
(const GenericVector &x)¶ Subtract given vector.
Parameters: x –
-
const PETScVector &
dolfin::PETScVector::
operator-=
(double a)¶ Subtract number from all components of a vector.
Parameters: a –
-
const PETScVector &
dolfin::PETScVector::
operator/=
(double a)¶ Divide vector by given number.
Parameters: a –
-
const GenericVector &
dolfin::PETScVector::
operator=
(const GenericVector &x)¶ Assignment operator.
Parameters: x –
-
const PETScVector &
dolfin::PETScVector::
operator=
(const PETScVector &x)¶ Assignment operator.
Parameters: x –
-
const PETScVector &
dolfin::PETScVector::
operator=
(double a)¶ Assignment operator.
Parameters: a –
-
bool
dolfin::PETScVector::
owns_index
(std::size_t i) const¶ Determine whether global vector index is owned by this process.
Parameters: i –
-
void
dolfin::PETScVector::
reset
(Vec vec)¶ Switch underlying PETSc object. Intended for internal library usage.
Parameters: vec –
-
void
dolfin::PETScVector::
set
(const double *block, std::size_t m, const dolfin::la_index *rows)¶ Set
block of values using global indices.Parameters: - block –
- m –
- rows –
-
void
dolfin::PETScVector::
set_from_options
()¶ Call PETSc function VecSetFromOptions on the underlying Vec object
-
void
dolfin::PETScVector::
set_local
(const double *block, std::size_t m, const dolfin::la_index *rows)¶ Set
block of values using local indices.Parameters: - block –
- m –
- rows –
-
void
dolfin::PETScVector::
set_local
(const std::vector<double> &values)¶ Set
all values on local process.Parameters: values –
-
void
dolfin::PETScVector::
set_options_prefix
(std::string options_prefix)¶ Sets the prefix used by PETSc when searching the options database
Parameters: options_prefix –
-
std::size_t
dolfin::PETScVector::
size
() const¶ Return size of vector.
-
std::string
dolfin::PETScVector::
str
(bool verbose) const¶ Return informal string representation (pretty-print)
Parameters: verbose –
-
double
dolfin::PETScVector::
sum
() const¶ Return sum of values of vector.
-
double
dolfin::PETScVector::
sum
(const Array<std::size_t> &rows) const¶ Return sum of selected rows in vector.
Parameters: rows –
-
void
dolfin::PETScVector::
update_ghost_values
()¶ Update values shared from remote processes.
-
Vec
dolfin::PETScVector::
vec
() const¶ Return pointer to PETSc Vec object.
-
dolfin::PETScVector::
~PETScVector
()¶ Destructor.
-
Scalar¶
C++ documentation for Scalar
from dolfin/la/Scalar.h
:
-
class
dolfin::
Scalar
: public dolfin::GenericTensor¶ This class represents a real-valued scalar quantity and implements the
GenericTensor
interface for scalars.-
dolfin::Scalar::
Scalar
()¶ Create zero scalar.
-
dolfin::Scalar::
Scalar
(MPI_Comm comm)¶ Create zero scalar.
Parameters: comm –
-
void
dolfin::Scalar::
add
(const double *block, const dolfin::la_index *num_rows, const dolfin::la_index *const *rows)¶ Add block of values using global indices.
Parameters: - block –
- num_rows –
- rows –
-
void
dolfin::Scalar::
add
(const double *block, const std::vector<ArrayView<const dolfin::la_index>> &rows)¶ Add block of values using global indices.
Parameters: - block –
- rows –
-
void
dolfin::Scalar::
add_local
(const double *block, const dolfin::la_index *num_rows, const dolfin::la_index *const *rows)¶ Add block of values using local indices.
Parameters: - block –
- num_rows –
- rows –
-
void
dolfin::Scalar::
add_local
(const double *block, const std::vector<ArrayView<const dolfin::la_index>> &rows)¶ Add block of values using local indices.
Parameters: - block –
- rows –
-
void
dolfin::Scalar::
add_local_value
(double value)¶ Add to local increment (added for testing, remove if we add a better way from python)
Parameters: value –
-
void
dolfin::Scalar::
apply
(std::string mode)¶ Finalize assembly of tensor.
Parameters: mode –
-
std::shared_ptr<Scalar>
dolfin::Scalar::
copy
() const¶ Return copy of scalar.
-
bool
dolfin::Scalar::
empty
() const¶ Return true if empty.
-
GenericLinearAlgebraFactory &
dolfin::Scalar::
factory
() const¶ Return a factory for the default linear algebra backend.
-
void
dolfin::Scalar::
get
(double *block, const dolfin::la_index *num_rows, const dolfin::la_index *const *rows) const¶ Get block of values.
Parameters: - block –
- num_rows –
- rows –
-
double
dolfin::Scalar::
get_scalar_value
() const¶ Get final value (assumes prior
apply()
, not part ofGenericTensor
interface)
-
void
dolfin::Scalar::
init
(const TensorLayout &tensor_layout)¶ Initialize zero tensor using sparsity pattern.
Parameters: tensor_layout –
-
std::pair<std::int64_t, std::int64_t>
dolfin::Scalar::
local_range
(std::size_t dim) const¶ Return local ownership range.
Parameters: dim –
-
std::size_t
dolfin::Scalar::
rank
() const¶ Return tensor rank (number of dimensions)
-
void
dolfin::Scalar::
set
(const double *block, const dolfin::la_index *num_rows, const dolfin::la_index *const *rows)¶ Set
block of values using global indices.Parameters: - block –
- num_rows –
- rows –
-
void
dolfin::Scalar::
set_local
(const double *block, const dolfin::la_index *num_rows, const dolfin::la_index *const *rows)¶ Set
block of values using local indices.Parameters: - block –
- num_rows –
- rows –
-
std::size_t
dolfin::Scalar::
size
(std::size_t dim) const¶ Return size of given dimension.
Parameters: dim –
-
std::string
dolfin::Scalar::
str
(bool verbose) const¶ Return informal string representation (pretty-print)
Parameters: verbose –
-
dolfin::Scalar::
~Scalar
()¶ Destructor.
-
SparsityPattern¶
C++ documentation for SparsityPattern
from dolfin/la/SparsityPattern.h
:
-
class
dolfin::
SparsityPattern
¶ This class implements a sparsity pattern data structure. It is used by most linear algebra backends.
-
dolfin::SparsityPattern::
SparsityPattern
(MPI_Comm comm, std::size_t primary_dim)¶ Create empty sparsity pattern.
Parameters: - comm –
- primary_dim –
Create sparsity pattern for a generic tensor.
Parameters: - comm –
- index_maps –
- primary_dim –
-
enum
dolfin::SparsityPattern::
Type
¶ Whether
SparsityPattern
is sorted.-
enumerator
dolfin::SparsityPattern::Type::
sorted
¶
-
enumerator
dolfin::SparsityPattern::Type::
unsorted
¶
-
enumerator
-
void
dolfin::SparsityPattern::
apply
()¶ Finalize sparsity pattern.
-
std::vector<std::vector<std::size_t>>
dolfin::SparsityPattern::
diagonal_pattern
(Type type) const¶ Return underlying sparsity pattern (diagonal). Options are ‘sorted’ and ‘unsorted’.
Parameters: type –
-
void
dolfin::SparsityPattern::
info_statistics
() const¶
Initialize sparsity pattern for a generic tensor.
Parameters: index_maps –
-
void
dolfin::SparsityPattern::
insert_entries
(const std::vector<ArrayView<const dolfin::la_index>> &entries, const std::function<dolfin::la_index(const dolfin::la_index, const IndexMap&)> &primary_dim_map, const std::function<dolfin::la_index(const dolfin::la_index, const IndexMap&)> &primary_codim_map)¶ Parameters: - entries –
- primary_dim_map –
- primary_codim_map –
-
void
dolfin::SparsityPattern::
insert_full_rows_local
(const std::vector<std::size_t> &rows)¶ Insert full rows (or columns, according to primary dimension) using local (process-wise) indices. This must be called before any other sparse insertion occurs to avoid quadratic complexity of dense rows insertion
Parameters: rows –
-
void
dolfin::SparsityPattern::
insert_global
(const std::vector<ArrayView<const dolfin::la_index>> &entries)¶ Insert non-zero entries using global indices.
Parameters: entries –
-
void
dolfin::SparsityPattern::
insert_global
(dolfin::la_index i, dolfin::la_index j)¶ Insert a global entry - will be fixed by
apply()
Parameters: - i –
- j –
-
void
dolfin::SparsityPattern::
insert_local
(const std::vector<ArrayView<const dolfin::la_index>> &entries)¶ Insert non-zero entries using local (process-wise) indices.
Parameters: entries –
-
void
dolfin::SparsityPattern::
insert_local_global
(const std::vector<ArrayView<const dolfin::la_index>> &entries)¶ Insert non-zero entries using local (process-wise) indices for the primary dimension and global indices for the co-dimension
Parameters: entries –
-
std::pair<std::size_t, std::size_t>
dolfin::SparsityPattern::
local_range
(std::size_t dim) const¶ Return local range for dimension dim.
Parameters: dim –
-
std::vector<std::size_t>
dolfin::SparsityPattern::
non_local
¶
-
void
dolfin::SparsityPattern::
num_local_nonzeros
(std::vector<std::size_t> &num_nonzeros) const¶ Fill vector with number of nonzeros in local_range for dimension 0
Parameters: num_nonzeros –
-
std::size_t
dolfin::SparsityPattern::
num_nonzeros
() const¶ Return number of local nonzeros.
-
void
dolfin::SparsityPattern::
num_nonzeros_diagonal
(std::vector<std::size_t> &num_nonzeros) const¶ Fill array with number of nonzeros for diagonal block in local_range for dimension 0. For matrices, fill array with number of nonzeros per local row for diagonal block
Parameters: num_nonzeros –
-
void
dolfin::SparsityPattern::
num_nonzeros_off_diagonal
(std::vector<std::size_t> &num_nonzeros) const¶ Fill array with number of nonzeros for off-diagonal block in local_range for dimension 0. For matrices, fill array with number of nonzeros per local row for off-diagonal block. If there is no off-diagonal pattern, the vector is resized to zero-length
Parameters: num_nonzeros –
-
std::vector<std::vector<std::size_t>>
dolfin::SparsityPattern::
off_diagonal_pattern
(Type type) const¶ Return underlying sparsity pattern (off-diagonal). Options are ‘sorted’ and ‘unsorted’. Empty vector is returned if there is no off-diagonal contribution.
Parameters: type –
-
std::size_t
dolfin::SparsityPattern::
primary_dim
() const¶ Return primary dimension (e.g., 0=row partition, 1=column partition)
-
std::size_t
dolfin::SparsityPattern::
rank
() const¶ Return rank.
-
std::string
dolfin::SparsityPattern::
str
(bool verbose) const¶ Return informal string representation (pretty-print)
Parameters: verbose –
-
TensorLayout¶
C++ documentation for TensorLayout
from dolfin/la/TensorLayout.h
:
-
class
dolfin::
TensorLayout
¶ This class described the size and possibly the sparsity of a (sparse) tensor. It is used by the linear algebra backends to initialise tensors.
-
enum
dolfin::TensorLayout::
Ghosts
¶ Ghosted or unghosted layout.
-
enumerator
dolfin::TensorLayout::Ghosts::
GHOSTED
= true¶
-
enumerator
dolfin::TensorLayout::Ghosts::
UNGHOSTED
= false¶
-
enumerator
-
enum
dolfin::TensorLayout::
Sparsity
¶ Sparse or dense layout.
-
enumerator
dolfin::TensorLayout::Sparsity::
SPARSE
= true¶
-
enumerator
dolfin::TensorLayout::Sparsity::
DENSE
= false¶
-
enumerator
-
dolfin::TensorLayout::
TensorLayout
(MPI_Comm comm, std::size_t primary_dim, Sparsity sparsity_pattern)¶ Create empty tensor layout.
Parameters: - comm –
- primary_dim –
- sparsity_pattern –
Create a tensor layout.
Parameters: - mpi_comm –
- index_maps –
- primary_dim –
- sparsity_pattern –
- ghosted –
-
std::shared_ptr<const IndexMap>
dolfin::TensorLayout::
index_map
(std::size_t i) const¶ Return
IndexMap
for dimension.Parameters: i –
Initialize tensor layout.
Parameters: - index_maps –
- ghosted –
-
std::pair<std::size_t, std::size_t>
dolfin::TensorLayout::
local_range
(std::size_t dim) const¶ Return local range for dimension dim.
Parameters: dim –
-
const std::size_t
dolfin::TensorLayout::
primary_dim
¶ Primary storage dim (e.g., 0=row major, 1=column major)
-
std::size_t
dolfin::TensorLayout::
rank
() const¶ Return rank.
-
std::size_t
dolfin::TensorLayout::
size
(std::size_t i) const¶ Return global size for dimension i (size of tensor, includes non-zeroes)
Parameters: i –
-
std::shared_ptr<SparsityPattern>
dolfin::TensorLayout::
sparsity_pattern
()¶ Return sparsity pattern (possibly null)
-
std::shared_ptr<const SparsityPattern>
dolfin::TensorLayout::
sparsity_pattern
() const¶ Return sparsity pattern (possibly null), const version.
-
std::string
dolfin::TensorLayout::
str
(bool verbose) const¶ Return informal string representation (pretty-print)
Parameters: verbose –
-
enum
TpetraFactory¶
C++ documentation for TpetraFactory
from dolfin/la/TpetraFactory.h
:
-
class
dolfin::
TpetraFactory
¶ Tpetra linear algebra factory.
-
dolfin::TpetraFactory::
TpetraFactory
()¶ Private constructor.
-
std::shared_ptr<GenericLinearSolver>
dolfin::TpetraFactory::
create_krylov_solver
(MPI_Comm comm, std::string method, std::string preconditioner) const¶ Create Krylov solver.
Parameters: - comm –
- method –
- preconditioner –
-
std::shared_ptr<TensorLayout>
dolfin::TpetraFactory::
create_layout
(MPI_Comm comm, std::size_t rank) const¶ Create empty tensor layout.
Parameters: - comm –
- rank –
-
std::shared_ptr<GenericLinearOperator>
dolfin::TpetraFactory::
create_linear_operator
(MPI_Comm comm) const¶ Create empty linear operator.
Parameters: comm –
-
std::shared_ptr<GenericLinearSolver>
dolfin::TpetraFactory::
create_lu_solver
(MPI_Comm comm, std::string method) const¶ Create LU solver.
Parameters: - comm –
- method –
-
std::shared_ptr<GenericMatrix>
dolfin::TpetraFactory::
create_matrix
(MPI_Comm comm) const¶ Create empty matrix.
Parameters: comm –
-
std::shared_ptr<GenericVector>
dolfin::TpetraFactory::
create_vector
(MPI_Comm comm) const¶ Create empty vector.
Parameters: comm –
-
TpetraFactory
dolfin::TpetraFactory::
factory
¶
-
TpetraFactory &
dolfin::TpetraFactory::
instance
()¶ Return singleton instance.
-
std::map<std::string, std::string>
dolfin::TpetraFactory::
krylov_solver_methods
() const¶ Return a list of available Krylov solver methods.
-
std::map<std::string, std::string>
dolfin::TpetraFactory::
krylov_solver_preconditioners
() const¶ Return a list of available preconditioners.
-
std::map<std::string, std::string>
dolfin::TpetraFactory::
lu_solver_methods
() const¶ Return a list of available LU solver methods.
-
dolfin::TpetraFactory::
~TpetraFactory
()¶ Destructor.
-
TpetraMatrix¶
C++ documentation for TpetraMatrix
from dolfin/la/TpetraMatrix.h
:
-
class
dolfin::
TpetraMatrix
: public dolfin::GenericMatrix¶ This class provides a simple matrix class based on Tpetra. It is a wrapper for a Tpetra matrix pointer (Teuchos::RCP<matrix_type>) implementing the
GenericMatrix
interface. The interface is intentionally simple. For advanced usage, access the Tpetra::RCP<matrix_type> pointer using the functionmat
and use the standard Tpetra interface.-
dolfin::TpetraMatrix::
TpetraMatrix
()¶ Create empty matrix.
-
dolfin::TpetraMatrix::
TpetraMatrix
(Teuchos::RCP<matrix_type> A)¶ Create a wrapper around a Teuchos::RCP<matrix_type> pointer.
Parameters: A –
-
dolfin::TpetraMatrix::
TpetraMatrix
(const TpetraMatrix &A)¶ Copy constructor.
Parameters: A –
-
void
dolfin::TpetraMatrix::
add
(const double *block, std::size_t m, const dolfin::la_index *rows, std::size_t n, const dolfin::la_index *cols)¶ Add block of values using global indices.
Parameters: - block –
- m –
- rows –
- n –
- cols –
-
void
dolfin::TpetraMatrix::
add_local
(const double *block, std::size_t m, const dolfin::la_index *rows, std::size_t n, const dolfin::la_index *cols)¶ Add block of values using local indices.
Parameters: - block –
- m –
- rows –
- n –
- cols –
-
void
dolfin::TpetraMatrix::
apply
(std::string mode)¶ Finalize assembly of tensor. The mode parameter is ignored.
Parameters: mode –
-
void
dolfin::TpetraMatrix::
axpy
(double a, const GenericMatrix &A, bool same_nonzero_pattern)¶ Add multiple of given matrix (AXPY operation)
Parameters: - a –
- A –
- same_nonzero_pattern –
-
std::shared_ptr<GenericMatrix>
dolfin::TpetraMatrix::
copy
() const¶ Return copy of matrix.
-
bool
dolfin::TpetraMatrix::
empty
() const¶ Return true if empty.
-
GenericLinearAlgebraFactory &
dolfin::TpetraMatrix::
factory
() const¶ Return linear algebra backend factory.
-
void
dolfin::TpetraMatrix::
get
(double *block, std::size_t m, const dolfin::la_index *rows, std::size_t n, const dolfin::la_index *cols) const¶ Get block of values.
Parameters: - block –
- m –
- rows –
- n –
- cols –
-
void
dolfin::TpetraMatrix::
get_diagonal
(GenericVector &x) const¶ Get diagonal of a matrix.
Parameters: x –
-
void
dolfin::TpetraMatrix::
getrow
(std::size_t row, std::vector<std::size_t> &columns, std::vector<double> &values) const¶ Get non-zero values of given row.
Parameters: - row –
- columns –
- values –
-
type
dolfin::TpetraMatrix::
graph_type
¶ Graph type (local index, global index)
-
void
dolfin::TpetraMatrix::
graphdump
(const Teuchos::RCP<const graph_type> graph)¶ Print out a graph, for debugging.
Parameters: graph –
-
void
dolfin::TpetraMatrix::
ident
(std::size_t m, const dolfin::la_index *rows)¶ Set
given rows (global row indices) to identity matrix.Parameters: - m –
- rows –
-
void
dolfin::TpetraMatrix::
ident_local
(std::size_t m, const dolfin::la_index *rows)¶ Set
given rows (local row indices) to identity matrix.Parameters: - m –
- rows –
-
void
dolfin::TpetraMatrix::
init
(const TensorLayout &tensor_layout)¶ Initialize zero tensor using tensor layout.
Parameters: tensor_layout –
-
void
dolfin::TpetraMatrix::
init_vector
(GenericVector &z, std::size_t dim) const¶ Initialize vector z to be compatible with the matrix-vector product y = Ax. In the parallel case, both size and layout are important.
Parameters: - z – (
GenericVector
&)Vector
to initialise - dim – (std::size_t) The dimension (axis): dim = 0 –> z = y, dim = 1 –> z = x
- z – (
-
bool
dolfin::TpetraMatrix::
is_symmetric
(double tol) const¶ Test if matrix is symmetric.
Parameters: tol –
-
std::pair<std::int64_t, std::int64_t>
dolfin::TpetraMatrix::
local_range
(std::size_t dim) const¶ Return local ownership range.
Parameters: dim –
-
type
dolfin::TpetraMatrix::
map_type
¶ Map type (local index, global index)
-
Teuchos::RCP<matrix_type>
dolfin::TpetraMatrix::
mat
()¶ Return Teuchos reference counted pointer to raw matrix.
-
Teuchos::RCP<const matrix_type>
dolfin::TpetraMatrix::
mat
() const¶ Return Teuchos reference counted pointer to raw matrix (const)
-
void
dolfin::TpetraMatrix::
mult
(const GenericVector &x, GenericVector &y) const¶ Compute matrix-vector product y = Ax.
Parameters: - x –
- y –
-
std::size_t
dolfin::TpetraMatrix::
nnz
() const¶ Return number of non-zero entries in matrix (collective)
-
double
dolfin::TpetraMatrix::
norm
(std::string norm_type) const¶ Return norm of matrix.
Parameters: norm_type –
-
const TpetraMatrix &
dolfin::TpetraMatrix::
operator*=
(double a)¶ Multiply matrix by given number.
Parameters: a –
-
const TpetraMatrix &
dolfin::TpetraMatrix::
operator/=
(double a)¶ Divide matrix by given number.
Parameters: a –
-
const GenericMatrix &
dolfin::TpetraMatrix::
operator=
(const GenericMatrix &A)¶ Assignment operator.
Parameters: A –
-
const TpetraMatrix &
dolfin::TpetraMatrix::
operator=
(const TpetraMatrix &A)¶ Assignment operator.
Parameters: A –
-
void
dolfin::TpetraMatrix::
set
(const double *block, std::size_t m, const dolfin::la_index *rows, std::size_t n, const dolfin::la_index *cols)¶ Set
block of values using global indices.Parameters: - block –
- m –
- rows –
- n –
- cols –
-
void
dolfin::TpetraMatrix::
set_diagonal
(const GenericVector &x)¶ Set
diagonal of a matrix.Parameters: x –
-
void
dolfin::TpetraMatrix::
set_local
(const double *block, std::size_t m, const dolfin::la_index *rows, std::size_t n, const dolfin::la_index *cols)¶ Set
block of values using local indices.Parameters: - block –
- m –
- rows –
- n –
- cols –
-
void
dolfin::TpetraMatrix::
setrow
(std::size_t row, const std::vector<std::size_t> &columns, const std::vector<double> &values)¶ Set
values for given row.Parameters: - row –
- columns –
- values –
-
std::size_t
dolfin::TpetraMatrix::
size
(std::size_t dim) const¶ Return size of given dimension.
Parameters: dim –
-
std::string
dolfin::TpetraMatrix::
str
(bool verbose) const¶ Return informal string representation (pretty-print)
Parameters: verbose –
-
void
dolfin::TpetraMatrix::
transpmult
(const GenericVector &x, GenericVector &y) const¶ Matrix-vector product, y = A^T x. The y vector must either be zero-sized or have correct size and parallel layout.
Parameters: - x –
- y –
-
void
dolfin::TpetraMatrix::
zero
(std::size_t m, const dolfin::la_index *rows)¶ Set
given rows (global row indices) to zero.Parameters: - m –
- rows –
-
void
dolfin::TpetraMatrix::
zero_local
(std::size_t m, const dolfin::la_index *rows)¶ Set
given rows (local row indices) to zero.Parameters: - m –
- rows –
-
dolfin::TpetraMatrix::
~TpetraMatrix
()¶ Destructor.
-
TpetraVector¶
C++ documentation for TpetraVector
from dolfin/la/TpetraVector.h
:
-
class
dolfin::
TpetraVector
: public dolfin::GenericVector¶ This class provides a simple vector class based on Tpetra. It is a wrapper for Teuchos::RCP<Tpetra::MultiVector> implementing the
GenericVector
interface. The interface is intentionally simple. For advanced usage, access the Teuchos::RCP<Tpetra::MultiVector> using the functionvec
and use the standard Tpetra interface.Friends:
TpetraMatrix
.-
dolfin::TpetraVector::
TpetraVector
(MPI_Comm comm, std::size_t N)¶ Create vector of size N.
Parameters: - comm –
- N –
-
dolfin::TpetraVector::
TpetraVector
(MPI_Comm comm = MPI_COMM_WORLD)¶ Create empty vector.
Parameters: comm –
-
dolfin::TpetraVector::
TpetraVector
(const TpetraVector &x)¶ Copy constructor.
Parameters: x –
-
void
dolfin::TpetraVector::
abs
()¶ Replace all entries in the vector by their absolute values.
-
void
dolfin::TpetraVector::
add
(const double *block, std::size_t m, const dolfin::la_index *rows)¶ Add block of values using global indices.
Parameters: - block –
- m –
- rows –
-
void
dolfin::TpetraVector::
add_local
(const Array<double> &values)¶ Add values to each entry on local process.
Parameters: values –
-
void
dolfin::TpetraVector::
add_local
(const double *block, std::size_t m, const dolfin::la_index *rows)¶ Add block of values using local indices.
Parameters: - block –
- m –
- rows –
-
void
dolfin::TpetraVector::
apply
(std::string mode)¶ Finalize assembly of tensor.
Parameters: mode –
-
void
dolfin::TpetraVector::
axpy
(double a, const GenericVector &x)¶ Add multiple of given vector (AXPY operation)
Parameters: - a –
- x –
-
std::shared_ptr<GenericVector>
dolfin::TpetraVector::
copy
() const¶ Return copy of vector.
-
bool
dolfin::TpetraVector::
empty
() const¶ Return true if vector is empty.
-
GenericLinearAlgebraFactory &
dolfin::TpetraVector::
factory
() const¶ Return linear algebra backend factory.
-
void
dolfin::TpetraVector::
gather
(GenericVector &y, const std::vector<dolfin::la_index> &indices) const¶ Gather entries (given by global indices) into local (MPI_COMM_SELF) vector x. Provided x must be empty or of correct dimension (same as provided indices). This operation is collective
Parameters: - y –
- indices –
-
void
dolfin::TpetraVector::
gather
(std::vector<double> &x, const std::vector<dolfin::la_index> &indices) const¶ Gather entries (given by global indices) into x. This operation is collective
Parameters: - x –
- indices –
-
void
dolfin::TpetraVector::
gather_on_zero
(std::vector<double> &x) const¶ Gather all entries into x on process 0. This operation is collective
Parameters: x –
-
void
dolfin::TpetraVector::
get
(double *block, std::size_t m, const dolfin::la_index *rows) const¶ Get block of values using global indices (all values must be owned by local process, ghosts cannot be accessed)
Parameters: - block –
- m –
- rows –
-
void
dolfin::TpetraVector::
get_local
(double *block, std::size_t m, const dolfin::la_index *rows) const¶ Get block of values using local indices.
Parameters: - block –
- m –
- rows –
-
void
dolfin::TpetraVector::
get_local
(std::vector<double> &values) const¶ Get all values on local process.
Parameters: values –
-
void
dolfin::TpetraVector::
init
(std::pair<std::size_t, std::size_t> range)¶ Initialize vector with given ownership range.
Parameters: range –
-
void
dolfin::TpetraVector::
init
(std::pair<std::size_t, std::size_t> range, const std::vector<std::size_t> &local_to_global_map, const std::vector<la_index> &ghost_indices)¶ Initialize vector with given ownership range and with ghost values
Parameters: - range –
- local_to_global_map –
- ghost_indices –
-
void
dolfin::TpetraVector::
init
(std::size_t N)¶ Initialize vector to global size N.
Parameters: N –
-
double
dolfin::TpetraVector::
inner
(const GenericVector &v) const¶ Return inner product with given vector.
Parameters: v –
-
std::pair<std::int64_t, std::int64_t>
dolfin::TpetraVector::
local_range
() const¶ Return ownership range of a vector.
-
std::size_t
dolfin::TpetraVector::
local_size
() const¶ Return local size of vector.
-
type
dolfin::TpetraVector::
map_type
¶ TpetraVector
map type (local index, global index)
-
void
dolfin::TpetraVector::
mapdump
(Teuchos::RCP<const map_type> xmap, const std::string desc)¶ output map for debugging
Parameters: - xmap –
- desc –
-
void
dolfin::TpetraVector::
mapdump
(const std::string desc)¶ Dump x.map and ghost_map for debugging.
Parameters: desc –
-
double
dolfin::TpetraVector::
max
() const¶ Return maximum value of vector.
-
double
dolfin::TpetraVector::
min
() const¶ Return minimum value of vector.
-
type
dolfin::TpetraVector::
node_type
¶ Node type.
-
double
dolfin::TpetraVector::
norm
(std::string norm_type) const¶ Return norm of vector.
Parameters: norm_type –
-
const TpetraVector &
dolfin::TpetraVector::
operator*=
(const GenericVector &x)¶ Multiply vector by another vector pointwise.
Parameters: x –
-
const TpetraVector &
dolfin::TpetraVector::
operator*=
(double a)¶ Multiply vector by given number.
Parameters: a –
-
const TpetraVector &
dolfin::TpetraVector::
operator+=
(const GenericVector &x)¶ Add given vector.
Parameters: x –
-
const TpetraVector &
dolfin::TpetraVector::
operator+=
(double a)¶ Add number to all components of a vector.
Parameters: a –
-
const TpetraVector &
dolfin::TpetraVector::
operator-=
(const GenericVector &x)¶ Subtract given vector.
Parameters: x –
-
const TpetraVector &
dolfin::TpetraVector::
operator-=
(double a)¶ Subtract number from all components of a vector.
Parameters: a –
-
const TpetraVector &
dolfin::TpetraVector::
operator/=
(double a)¶ Divide vector by given number.
Parameters: a –
-
const GenericVector &
dolfin::TpetraVector::
operator=
(const GenericVector &x)¶ Assignment operator.
Parameters: x –
-
const TpetraVector &
dolfin::TpetraVector::
operator=
(const TpetraVector &x)¶ Assignment operator.
Parameters: x –
-
const TpetraVector &
dolfin::TpetraVector::
operator=
(double a)¶ Assignment operator.
Parameters: a –
-
bool
dolfin::TpetraVector::
owns_index
(std::size_t i) const¶ Determine whether global vector index is owned by this process.
Parameters: i –
-
void
dolfin::TpetraVector::
set
(const double *block, std::size_t m, const dolfin::la_index *rows)¶ Set
block of values using global indices.Parameters: - block –
- m –
- rows –
-
void
dolfin::TpetraVector::
set_local
(const double *block, std::size_t m, const dolfin::la_index *rows)¶ Set
block of values using local indices.Parameters: - block –
- m –
- rows –
-
void
dolfin::TpetraVector::
set_local
(const std::vector<double> &values)¶ Set
all values on local process.Parameters: values –
-
std::size_t
dolfin::TpetraVector::
size
() const¶ Return size of vector.
-
std::string
dolfin::TpetraVector::
str
(bool verbose) const¶ Return informal string representation (pretty-print)
Parameters: verbose –
-
double
dolfin::TpetraVector::
sum
() const¶ Return sum of values of vector.
-
double
dolfin::TpetraVector::
sum
(const Array<std::size_t> &rows) const¶ Return sum of selected rows in vector.
Parameters: rows –
-
void
dolfin::TpetraVector::
update_ghost_values
()¶ Update ghost values in vector.
-
Teuchos::RCP<vector_type>
dolfin::TpetraVector::
vec
() const¶ Return pointer to Tpetra vector object.
-
type
dolfin::TpetraVector::
vector_type
¶ TpetraVector
vector type (scalar, local index, global index, node)
-
dolfin::TpetraVector::
~TpetraVector
()¶ Create vector wrapper of Tpetra Vec pointer. Destructor
-
TrilinosParameters¶
C++ documentation for TrilinosParameters
from dolfin/la/TrilinosParameters.h
:
-
class
dolfin::
TrilinosParameters
¶ Method for translating DOLFIN
Parameters
to Teuchos::ParameterList needed by Trilinos objects-
void
dolfin::TrilinosParameters::
insert_parameters
(const Parameters ¶ms, Teuchos::RCP<Teuchos::ParameterList> parameter_list)¶ Copy over parameters from a dolfin
Parameters
object to a Teuchos::ParameterListParameters: - params – (
Parameters
) dolfin parameter set [direction=in] - parameter_list – (Teuchos::RCP<Teuchos::ParameterList>) Trilinos Teuchos parameter set [direction=inout]
- params – (
-
void
TrilinosPreconditioner¶
C++ documentation for TrilinosPreconditioner
from dolfin/la/TrilinosPreconditioner.h
:
-
class
dolfin::
TrilinosPreconditioner
¶ This class provides a common base for Trilinos preconditioners.
-
dolfin::TrilinosPreconditioner::
TrilinosPreconditioner
()¶ Constructor.
Initialise this preconditioner with the operator P.
Parameters: P –
-
void
dolfin::TrilinosPreconditioner::
set
(BelosKrylovSolver &solver) = 0¶ Set
this preconditioner on a solver.Parameters: solver –
-
dolfin::TrilinosPreconditioner::
~TrilinosPreconditioner
()¶ Destructor.
-
Vector¶
C++ documentation for Vector
from dolfin/la/Vector.h
:
-
class
dolfin::
Vector
: public dolfin::GenericVector¶ This class provides the default DOLFIN vector class, based on the default DOLFIN linear algebra backend.
-
dolfin::Vector::
Vector
()¶ Create empty vector.
-
dolfin::Vector::
Vector
(MPI_Comm comm)¶ Create empty vector.
Parameters: comm –
-
dolfin::Vector::
Vector
(MPI_Comm comm, std::size_t N)¶ Create vector of size N.
Parameters: - comm –
- N –
-
dolfin::Vector::
Vector
(const GenericVector &x)¶ Create a
Vector()
from aGenericVector
.Parameters: x –
-
void
dolfin::Vector::
abs
()¶ Replace all entries in the vector by their absolute values.
-
void
dolfin::Vector::
add
(const double *block, std::size_t m, const dolfin::la_index *rows)¶ Add block of values using global indices.
Parameters: - block –
- m –
- rows –
-
void
dolfin::Vector::
add_local
(const Array<double> &values)¶ Add values to each entry on local process.
Parameters: values –
-
void
dolfin::Vector::
add_local
(const double *block, std::size_t m, const dolfin::la_index *rows)¶ Add block of values using local indices.
Parameters: - block –
- m –
- rows –
-
void
dolfin::Vector::
apply
(std::string mode)¶ Finalize assembly of tensor.
Parameters: mode –
-
void
dolfin::Vector::
axpy
(double a, const GenericVector &x)¶ Add multiple of given vector (AXPY operation)
Parameters: - a –
- x –
-
std::shared_ptr<GenericVector>
dolfin::Vector::
copy
() const¶ Return copy of vector.
-
bool
dolfin::Vector::
empty
() const¶ Return true if vector is empty.
-
GenericLinearAlgebraFactory &
dolfin::Vector::
factory
() const¶ Return linear algebra backend factory.
-
void
dolfin::Vector::
gather
(GenericVector &x, const std::vector<dolfin::la_index> &indices) const¶ Gather entries (given by global indices) into local vector x
Parameters: - x –
- indices –
-
void
dolfin::Vector::
gather
(std::vector<double> &x, const std::vector<dolfin::la_index> &indices) const¶ Gather entries (given by global indices) into x.
Parameters: - x –
- indices –
-
void
dolfin::Vector::
gather_on_zero
(std::vector<double> &x) const¶ Gather all entries into x on process 0.
Parameters: x –
-
void
dolfin::Vector::
get
(double *block, std::size_t m, const dolfin::la_index *rows) const¶ Get block of values using global indices (values must all live on the local process, ghosts are no accessible)
Parameters: - block –
- m –
- rows –
-
void
dolfin::Vector::
get_local
(double *block, std::size_t m, const dolfin::la_index *rows) const¶ Get block of values using local indices (values must all live on the local process)
Parameters: - block –
- m –
- rows –
-
void
dolfin::Vector::
get_local
(std::vector<double> &values) const¶ Get all values on local process.
Parameters: values –
-
void
dolfin::Vector::
init
(std::pair<std::size_t, std::size_t> range)¶ Initialize vector with given ownership range.
Parameters: range –
-
void
dolfin::Vector::
init
(std::pair<std::size_t, std::size_t> range, const std::vector<std::size_t> &local_to_global_map, const std::vector<la_index> &ghost_indices)¶ Initialize vector with given ownership range and with ghost values
Parameters: - range –
- local_to_global_map –
- ghost_indices –
-
void
dolfin::Vector::
init
(std::size_t N)¶ Initialize vector to size N.
Parameters: N –
-
double
dolfin::Vector::
inner
(const GenericVector &x) const¶ Return inner product with given vector.
Parameters: x –
-
GenericVector *
dolfin::Vector::
instance
()¶ Return concrete instance / unwrap (non-const version)
-
const GenericVector *
dolfin::Vector::
instance
() const¶ Return concrete instance / unwrap (const version)
-
std::pair<std::int64_t, std::int64_t>
dolfin::Vector::
local_range
() const¶ Return local ownership range of a vector.
-
std::size_t
dolfin::Vector::
local_size
() const¶ Return local size of vector.
-
double
dolfin::Vector::
max
() const¶ Return maximum value of vector.
-
double
dolfin::Vector::
min
() const¶ Return minimum value of vector.
-
double
dolfin::Vector::
norm
(std::string norm_type) const¶ Return norm of vector.
Parameters: norm_type –
-
const Vector &
dolfin::Vector::
operator*=
(const GenericVector &x)¶ Multiply vector by another vector pointwise.
Parameters: x –
-
const Vector &
dolfin::Vector::
operator*=
(double a)¶ Multiply vector by given number.
Parameters: a –
-
const Vector &
dolfin::Vector::
operator+=
(const GenericVector &x)¶ Add given vector.
Parameters: x –
-
const GenericVector &
dolfin::Vector::
operator+=
(double a)¶ Add number to all components of a vector.
Parameters: a –
-
const Vector &
dolfin::Vector::
operator-=
(const GenericVector &x)¶ Subtract given vector.
Parameters: x –
-
const GenericVector &
dolfin::Vector::
operator-=
(double a)¶ Subtract number from all components of a vector.
Parameters: a –
-
const Vector &
dolfin::Vector::
operator/=
(double a)¶ Divide vector by given number.
Parameters: a –
-
const GenericVector &
dolfin::Vector::
operator=
(const GenericVector &x)¶ Assignment operator.
Parameters: x –
-
const Vector &
dolfin::Vector::
operator=
(const Vector &x)¶ Assignment operator.
Parameters: x –
-
const Vector &
dolfin::Vector::
operator=
(double a)¶ Assignment operator.
Parameters: a –
-
bool
dolfin::Vector::
owns_index
(std::size_t i) const¶ Determine whether global vector index is owned by this process.
Parameters: i –
-
void
dolfin::Vector::
set
(const double *block, std::size_t m, const dolfin::la_index *rows)¶ Set
block of values using global indices.Parameters: - block –
- m –
- rows –
-
void
dolfin::Vector::
set_local
(const double *block, std::size_t m, const dolfin::la_index *rows)¶ Set
block of values using local indices.Parameters: - block –
- m –
- rows –
-
void
dolfin::Vector::
set_local
(const std::vector<double> &values)¶ Set
all values on local process.Parameters: values –
Return concrete shared ptr instance / unwrap (non-const version)
Return concrete shared ptr instance / unwrap (const version)
-
std::size_t
dolfin::Vector::
size
() const¶ Return size of vector.
-
std::string
dolfin::Vector::
str
(bool verbose) const¶ Return informal string representation (pretty-print)
Parameters: verbose –
-
double
dolfin::Vector::
sum
() const¶ Return sum of values of vector.
-
double
dolfin::Vector::
sum
(const Array<std::size_t> &rows) const¶ Return sum of selected rows in vector. Repeated entries are only summed once.
Parameters: rows –
-
std::shared_ptr<GenericVector>
dolfin::Vector::
vector
¶
-
VectorSpaceBasis¶
C++ documentation for VectorSpaceBasis
from dolfin/la/VectorSpaceBasis.h
:
-
class
dolfin::
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.
Constructor.
Parameters: basis –
-
std::size_t
dolfin::VectorSpaceBasis::
dim
() const¶ Number of vectors in the basis.
-
bool
dolfin::VectorSpaceBasis::
is_orthogonal
(double tol = 1.0e-10) const¶ Test if basis is orthogonal.
Parameters: tol –
-
bool
dolfin::VectorSpaceBasis::
is_orthonormal
(double tol = 1.0e-10) const¶ Test if basis is orthonormal.
Parameters: tol –
-
std::shared_ptr<const GenericVector>
dolfin::VectorSpaceBasis::
operator[]
(std::size_t i) const¶ Get a particular basis vector.
Parameters: i –
-
void
dolfin::VectorSpaceBasis::
orthogonalize
(GenericVector &x) const¶ Orthogonalize x with respect to basis.
Parameters: x –
-
void
dolfin::VectorSpaceBasis::
orthonormalize
(double tol = 1.0e-10)¶ Apply the Gram-Schmidt process to orthonormalize the basis. Throws an error if a (near) linear dependency is detected. Error is thrown if <x_i, x_i> < tol.
Parameters: tol –
-
dolfin::VectorSpaceBasis::
~VectorSpaceBasis
()¶ Destructor.