PETScVector

class dolfin.cpp.la.PETScVector(*args)

Bases: dolfin.cpp.la.GenericVector, dolfin.cpp.la.PETScObject

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.

Overloaded versions

  • PETScVector()

    Create empty vector

  • PETScVector(comm, N, use_gpu=false)

    Create vector of size N

  • PETScVector(sparsity_pattern)

    Create vector

  • PETScVector(x)

    Copy constructor

  • PETScVector(x)

    Create vector wrapper of PETSc Vec pointer

gather()

Overloaded versions

  • gather(y, indices)

    Gather vector entries into a local vector

  • gather(x, indices)

    Gather entries into x

get_local()

Overloaded versions

  • get_local(block, m, rows)

    Get block of values (values must all live on the local process)

  • get_local(values)

    Get all values on local process

init()

Overloaded versions

  • init(comm, N)

    Initialize vector to global size N

  • init(comm, range)

    Initialize vector with given ownership range

  • init(comm, range, ghost_indices)

    Initialize vector with given ownership range and with ghost values

sum()

Overloaded versions

  • sum()

    Return sum of values of vector

  • sum(rows)

    Return sum of selected rows in vector

thisown

The membership flag

update_ghost_values()
vec()

Return petsc4py representation of PETSc Vec