GenericVector

class dolfin.cpp.la.GenericVector(*args, **kwargs)

Bases: dolfin.cpp.la.GenericTensor

This class defines a common interface for vectors.

abs()

Replace all entries in the vector by their absolute values.

Return type:void
add()

Add block of values using global indices.

Parameters:
  • double * block (const) –
  • std::vector< ArrayView< const dolfin::la_index >> & rows (const) –
Return type:

void

add_local()

Add block of values using local indices.

Parameters:
  • double * block (const) –
  • m (std::size_t) –
  • dolfin::la_index * rows (const) –
Return type:

void

array()

Return a numpy array representation of the local part of a Vector

axpy()

Add multiple of given vector (AXPY operation)

Parameters:
  • a (double) –
  • GenericVector & x (const) –
Return type:

void

copy()

Return copy of vector.

Return type:std::shared_ptr< GenericVector >
gather()

Gather entries (given by global indices) into local vector x

Parameters:
  • & x (GenericVector) –
  • std::vector< dolfin::la_index > & indices (const) –
Return type:

void

gather_on_zero()

Gather all entries into x on process 0.

Parameters:double > & x (std::vector<) –
Return type:void
get_local()

Get block of values using local indices (values must all live on the local process, ghost are accessible)

Parameters:
  • * block (double) –
  • m (std::size_t) –
  • dolfin::la_index * rows (const) –
Return type:

void

init()

Initialize vector with given local ownership range.

Parameters:std::size_t, std::size_t > range (std::pair<) –
Return type:void
inner()

Return inner product with given vector.

Parameters:GenericVector & x (const) –
Return type:double
local_range()

Return local ownership range.

Parameters:dim (std::size_t) –
Return type:std::pair< std::int64_t, std::int64_t >
local_size()

Return local size of vector.

Return type:std::size_t
max()

Return maximum value of vector.

Return type:double
min()

Return minimum value of vector.

Return type:double
norm()

Return norm of vector.

Parameters:norm_type (std::string) –
Return type:double
owns_index()

Determine whether global vector index is owned by this process.

Parameters:i (std::size_t) –
Return type:bool
set_local()

Set block of values using local indices.

Parameters:
  • double * block (const) –
  • m (std::size_t) –
  • dolfin::la_index * rows (const) –
Return type:

void

size()

Return size of given dimension.

Parameters:dim (std::size_t) –
Return type:std::size_t
sum()

Return sum of vector.

Return type:double
thisown

The membership flag