DOLFINx
0.1.0
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 <PETScVector.h>
Public Member Functions | |
PETScVector (const common::IndexMap &map, int bs) | |
Create vector. More... | |
PETScVector (const PETScVector &x)=delete | |
PETScVector (PETScVector &&x) | |
Move constructor. | |
PETScVector (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 the PETScVector. More... | |
virtual | ~PETScVector () |
Destructor. | |
PETScVector & | operator= (const PETScVector &x)=delete |
PETScVector & | operator= (PETScVector &&x) |
Move Assignment operator. | |
PETScVector | copy () const |
Create a copy of the vector. More... | |
std::int64_t | size () const |
Return global size of vector. | |
std::int32_t | local_size () const |
Return local size of vector (belonging to this process) | |
std::array< std::int64_t, 2 > | local_range () const |
Return ownership range for calling rank. | |
MPI_Comm | mpi_comm () const |
Return MPI communicator. | |
PetscReal | norm (la::Norm type) const |
Compute norm of vector. More... | |
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 vec() and use the full PETSc interface.
PETScVector::PETScVector | ( | const common::IndexMap & | map, |
int | bs | ||
) |
Create vector.
Collective
[in] | map | Index map describing the parallel layout |
[in] | bs | the block size |
PETScVector::PETScVector | ( | 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 the PETScVector.
Collective
[in] | x | The PETSc Vec |
[in] | inc_ref_count | True if the reference count of x should be incremented |
PETScVector PETScVector::copy | ( | ) | const |
Create a copy of the vector.
Collective
PetscReal PETScVector::norm | ( | la::Norm | type | ) | const |
Compute norm of vector.
Collective
[in] | type | The norm type |