PETScVector.h¶
Note
The documentation on this page was automatically extracted from the DOLFIN C++ code and may need to be edited or expanded.
-
class
PETScVector
¶ Parent class(es)
This class provides 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 function vec() and use the standard PETSc interface.
-
PETScVector
()¶ Create empty vector
-
PETScVector
(MPI_Comm comm, std::size_t N)¶ Create vector of size N
-
explicit
PETScVector
(const GenericSparsityPattern &sparsity_pattern)¶ Create vector
-
PETScVector
(const PETScVector &x)¶ Copy constructor
-
explicit
PETScVector
(Vec x)¶ Create vector wrapper of PETSc Vec pointer
-
void
zero
()¶ Set all entries to zero and keep any sparse structure
-
void
apply
(std::string mode)¶ Finalize assembly of tensor
-
MPI_Comm
mpi_comm
() const¶ Return MPI communicator
-
std::string
str
(bool verbose) const¶ Return informal string representation (pretty-print)
-
std::shared_ptr<GenericVector>
copy
() const¶ Return copy of vector
-
void
init
(MPI_Comm comm, std::size_t N)¶ Initialize vector to global size N
-
void
init
(MPI_Comm comm, std::pair<std::size_t, std::size_t> range)¶ Initialize vector with given ownership range
-
void
init
(MPI_Comm comm, 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
-
bool
empty
() const¶ Return true if vector is empty
-
std::size_t
size
() const¶ Return size of vector
-
std::size_t
local_size
() const¶ Return local size of vector
-
std::pair<std::size_t, std::size_t>
local_range
() const¶ Return ownership range of a vector
-
bool
owns_index
(std::size_t i) const¶ Determine whether global vector index is owned by this process
-
void
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)
-
void
get_local
(double *block, std::size_t m, const dolfin::la_index *rows) const¶ Get block of values using local indices
-
void
set
(const double *block, std::size_t m, const dolfin::la_index *rows)¶ Set block of values using global indices
-
void
set_local
(const double *block, std::size_t m, const dolfin::la_index *rows)¶ Set block of values using local indices
-
void
add
(const double *block, std::size_t m, const dolfin::la_index *rows)¶ Add block of values using global indices
-
void
add_local
(const double *block, std::size_t m, const dolfin::la_index *rows)¶ Add block of values using local indices
-
void
get_local
(std::vector<double> &values) const¶ Get all values on local process
-
void
set_local
(const std::vector<double> &values)¶ Set all values on local process
-
void
gather
(GenericVector &y, const std::vector<dolfin::la_index> &indices) const¶ Gather vector entries into a local vector
-
void
gather
(std::vector<double> &x, const std::vector<dolfin::la_index> &indices) const¶ Gather entries into x
-
void
gather_on_zero
(std::vector<double> &x) const¶ Gather all entries into x on process 0
-
void
axpy
(double a, const GenericVector &x)¶ Add multiple of given vector (AXPY operation)
-
void
abs
()¶ Replace all entries in the vector by their absolute values
-
double
inner
(const GenericVector &v) const¶ Return inner product with given vector
-
double
norm
(std::string norm_type) const¶ Return norm of vector
-
double
min
() const¶ Return minimum value of vector
-
double
max
() const¶ Return maximum value of vector
-
double
sum
() const¶ Return sum of values of vector
-
const PETScVector &
operator*=
(double a)¶ Multiply vector by given number
-
const PETScVector &
operator*=
(const GenericVector &x)¶ Multiply vector by another vector pointwise
-
const PETScVector &
operator/=
(double a)¶ Divide vector by given number
-
const PETScVector &
operator+=
(const GenericVector &x)¶ Add given vector
-
const PETScVector &
operator+=
(double a)¶ Add number to all components of a vector
-
const PETScVector &
operator-=
(const GenericVector &x)¶ Subtract given vector
-
const PETScVector &
operator-=
(double a)¶ Subtract number from all components of a vector
-
const GenericVector &
operator=
(const GenericVector &x)¶ Assignment operator
-
const PETScVector &
operator=
(double a)¶ Assignment operator
-
GenericLinearAlgebraFactory &
factory
() const¶ Return linear algebra backend factory
-
void
set_options_prefix
(std::string options_prefix)¶ Sets the prefix used by PETSc when searching the options database
-
std::string
get_options_prefix
() const¶ Returns the prefix used by PETSc when searching the options database
-
Vec
vec
() const¶ Return pointer to PETSc Vec object
-
const PETScVector &
operator=
(const PETScVector &x)¶ Assignment operator
-