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(type=”global”, use_gpu=false)

    Create empty vector

  • PETScVector(N, type=”global”, use_gpu=false)

    Create vector of size N

  • PETScVector(sparsity_pattern)

    Create vector

  • PETScVector(x)

    Copy constructor

  • PETScVector(x)

    Create vector from given 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

reset()

Reset data and PETSc vector object

resize()

Overloaded versions

  • resize(N)

    Resize vector to global size N

  • resize(range)

    Resize vector with given ownership range

  • resize(range, ghost_indices)

    Resize 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

vec()