DOLFINx 0.9.0
DOLFINx C++ interface
Loading...
Searching...
No Matches
Vector Class Reference

#include <petsc.h>

Public Member Functions

 Vector (const common::IndexMap &map, int bs)
 
 Vector (const Vector &x)=delete
 
 Vector (Vector &&x)
 Move constructor.
 
 Vector (Vec x, bool inc_ref_count)
 
virtual ~Vector ()
 Destructor.
 
Vectoroperator= (const Vector &x)=delete
 
Vectoroperator= (Vector &&x)
 Move Assignment operator.
 
Vector copy () const
 
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
 
void set_from_options ()
 Call PETSc function VecSetFromOptions on the underlying Vec object.
 
Vec vec () const
 Return pointer to PETSc Vec object.
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ Vector() [1/2]

Vector ( const common::IndexMap & map,
int bs )

Create a vector

Note
Collective
Parameters
[in]mapIndex map describing the parallel layout
[in]bsthe block size

◆ Vector() [2/2]

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.

Note
Collective
Parameters
[in]xThe PETSc Vec
[in]inc_ref_countTrue if the reference count of x should be incremented

Member Function Documentation

◆ copy()

petsc::Vector copy ( ) const

Create a copy of the vector

Note
Collective

◆ get_options_prefix()

std::string get_options_prefix ( ) const

Returns the prefix used by PETSc when searching the options database


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