EigenVector

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

Bases: dolfin.cpp.la.GenericVector

This class provides a simple vector class based on Eigen. It is a simple wrapper for a Eigen vector implementing the GenericVector interface. The interface is intentionally simple. For advanced usage, access the underlying Eigen vector and use the standard Eigen interface which is documented at http://eigen.tuxfamily.org

Construct vector from an Eigen shared_ptr.

Parameters:Eigen::VectorXd > x (std::shared_ptr<) –
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

data(deepcopy=True)

Return an array to underlaying data

This method is only available for the Eigen linear algebra backend.

Arguments
deepcopy
Return a copy of the data. If set to False a reference to the Matrix need to be kept, otherwise the data will be destroyed together with the destruction of the Matrix
gather()

Gather entries into local vector x.

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

void

get_local()

Get block of values using local indices.

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

void

init()

Resize vector with given ownership range and with ghost values.

Parameters:
  • std::size_t, std::size_t > range (std::pair<) –
  • std::vector< std::size_t > & local_to_global_map (const) –
  • std::vector< la_index > & ghost_indices (const) –
Return type:

void

resize()

Resize vector to size N.

Parameters:N (std::size_t) –
Return type:void
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

sum()

Return sum of values of vector.

Return type:double
thisown

The membership flag

vec()

Return reference to Eigen vector (const version)

Return type:std::shared_ptr< const Eigen::VectorXd >