DOLFIN-X
DOLFIN-X C++ interface
Public Member Functions | List of all members
dolfinx::la::PETScVector Class Reference

It is a simple wrapper for a PETSc vector pointer (Vec). Its main purpose is to assist memory management of PETSc Vec objects. More...

#include <PETScVector.h>

Public Member Functions

 PETScVector (const common::IndexMap &map)
 Create vector.
 
 PETScVector (MPI_Comm comm, std::array< std::int64_t, 2 > range, const Eigen::Array< std::int64_t, Eigen::Dynamic, 1 > &ghost_indices, int block_size)
 Create vector.
 
 PETScVector (const PETScVector &x)=delete
 
 PETScVector (PETScVector &&x) noexcept
 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.
 
virtual ~PETScVector ()
 Destructor.
 
PETScVectoroperator= (const PETScVector &x)=delete
 
PETScVectoroperator= (PETScVector &&x)
 Move Assignment operator.
 
PETScVector copy () const
 Copy vector.
 
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 process.
 
void apply_ghosts ()
 Update owned entries owned by this process and which are ghosts on other processes, i.e., have been added to by a remote process. This is more efficient that apply() when processes only add/set their owned entries and the pre-defined ghosts.
 
void update_ghosts ()
 Update ghost values (gathers ghost values from the owning processes)
 
MPI_Comm mpi_comm () const
 Return MPI communicator.
 
PetscReal norm (la::Norm norm_type) const
 Return norm of vector.
 
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.
 

Detailed Description

It is a simple wrapper for a PETSc vector pointer (Vec). Its main purpose is to assist memory management of PETSc Vec objects.

For advanced usage, access the PETSc Vec pointer using the function vec() and use the standard PETSc interface.


The documentation for this class was generated from the following files: