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

add_local()

Overloaded versions

  • add_local(block, m, rows)

    Add block of values using local indices

  • add_local(values)

    Add values to each entry on local process

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 using local indices

  • 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, local_to_global_map, ghost_indices)

    Initialize vector with given ownership range and with ghost values

set_local()

Overloaded versions

  • set_local(block, m, rows)

    Set block of values using local indices

  • set_local(values)

    Set all values on local process

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