|
DOLFINx 0.7.1
DOLFINx C++ interface
|
A simple wrapper for a PETSc vector pointer (Vec). Its main purpose is to assist with memory/lifetime management of PETSc Vec objects. More...
#include <petsc.h>
Public Member Functions | |
| Vector (const common::IndexMap &map, int bs) | |
| Create a vector. | |
| Vector (const Vector &x)=delete | |
| Vector (Vector &&x) | |
| Move constructor. | |
| Vector (Vec x, bool inc_ref_count) | |
| Create holder of a PETSc Vec object/pointer. The Vec x object should already be created. If inc_ref_count is true, the reference counter of the Vec object will be increased. The Vec reference count will always be decreased upon destruction of the PETScVector. | |
| virtual | ~Vector () |
| Destructor. | |
| Vector & | operator= (const Vector &x)=delete |
| Vector & | operator= (Vector &&x) |
| Move Assignment operator. | |
| Vector | copy () const |
| Create a copy of the vector. | |
| std::int64_t | size () const |
| Return global size of the vector. | |
| std::int32_t | local_size () const |
| Return local size of vector (belonging to the call rank) | |
| std::array< std::int64_t, 2 > | local_range () const |
| Return ownership range for calling rank. | |
| MPI_Comm | comm () const |
| Return MPI communicator. | |
| 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. | |
| void | set_from_options () |
| Call PETSc function VecSetFromOptions on the underlying Vec object. | |
| Vec | vec () const |
| Return pointer to PETSc Vec object. | |
A simple wrapper for a PETSc vector pointer (Vec). Its main purpose is to assist with memory/lifetime management of PETSc Vec objects.
Access the underlying PETSc Vec pointer using the function Vector::vec() and use the full PETSc interface.
| Vector | ( | const common::IndexMap & | map, |
| int | bs | ||
| ) |
Create a vector.
| [in] | map | Index map describing the parallel layout |
| [in] | bs | the block size |
| Vector | ( | Vec | x, |
| bool | inc_ref_count | ||
| ) |
Create holder of a PETSc Vec object/pointer. The Vec x object should already be created. If inc_ref_count is true, the reference counter of the Vec object will be increased. The Vec reference count will always be decreased upon destruction of the PETScVector.
| [in] | x | The PETSc Vec |
| [in] | inc_ref_count | True if the reference count of x should be incremented |
| petsc::Vector copy | ( | ) | const |
Create a copy of the vector.