OpenFPM_pdata  1.1.0
Project that contain the implementation of distributed structures
 All Data Structures Namespaces Functions Variables Typedefs Enumerations Friends Pages
Vector< T, PETSC_BASE > Class Template Reference

PETSC vector for linear algebra. More...

Detailed Description

template<typename T>
class Vector< T, PETSC_BASE >

PETSC vector for linear algebra.

This vector wrap the PETSC vector for solving linear systems

Definition at line 104 of file Vector_petsc.hpp.

#include <Vector_petsc.hpp>

Public Member Functions

 Vector (const Vector< T, PETSC_BASE > &v)
 Copy the vector. More...
 
 Vector (Vector< T, PETSC_BASE > &&v)
 Copy the vector. More...
 
 ~Vector ()
 Destroy the vector. More...
 
 Vector (size_t n, size_t n_row_local)
 Create a vector with n elements. More...
 
 Vector ()
 Create a vector with 0 elements. More...
 
void resize (size_t row, size_t l_row)
 Resize the Vector. More...
 
void insert (size_t i, T val)
 Return a reference to the vector element. More...
 
PetscScalar & insert (size_t i)
 Return a reference to the vector element. More...
 
const PetscScalar & insert (size_t i) const
 Return a reference to the vector element. More...
 
const PetscScalar & operator() (size_t i) const
 Return a reference to the vector element. More...
 
PetscScalar & operator() (size_t i)
 Return a reference to the vector element. More...
 
const Vec & getVec () const
 Get the PETSC Vector object. More...
 
Vec & getVec ()
 Get the PETSC Vector object. More...
 
void update ()
 Update the Vector with the PETSC object. More...
 
Vector< T, PETSC_BASE > & operator= (const Vector< T, PETSC_BASE > &v)
 Copy the vector. More...
 
Vector< T, PETSC_BASE > & operator= (Vector< T, PETSC_BASE > &&v)
 Copy the vector. More...
 
void setZero ()
 Set to zero all the entries. More...
 

Private Member Functions

void setPetsc () const
 Set the Eigen internal vector. More...
 

Private Attributes

size_t n_row
 Number of row the petsc vector has.
 
size_t n_row_local
 Number of local rows.
 
bool v_created = false
 Indicate if v has been allocated.
 
Vec v
 Mutable vector.
 
openfpm::vector< rval
< PetscScalar, PETSC_RVAL >
, HeapMemory, typename
memory_traits_inte< rval
< PetscScalar, PETSC_RVAL >
>::type, memory_traits_inte
row_val
 Mutable row value vector.
 
std::unordered_map< size_t,
size_t > 
map
 Global to local map.
 
invalid
 invalid
 

Constructor & Destructor Documentation

template<typename T >
Vector< T, PETSC_BASE >::Vector ( const Vector< T, PETSC_BASE > &  v)
inline

Copy the vector.

Parameters
vvector to copy

Definition at line 155 of file Vector_petsc.hpp.

template<typename T >
Vector< T, PETSC_BASE >::Vector ( Vector< T, PETSC_BASE > &&  v)
inline

Copy the vector.

Parameters
vvector to copy

Definition at line 165 of file Vector_petsc.hpp.

template<typename T >
Vector< T, PETSC_BASE >::~Vector ( )
inline

Destroy the vector.

Definition at line 175 of file Vector_petsc.hpp.

template<typename T >
Vector< T, PETSC_BASE >::Vector ( size_t  n,
size_t  n_row_local 
)
inline

Create a vector with n elements.

Parameters
nglobal number of elements in the vector
n_row_localnumber

Definition at line 187 of file Vector_petsc.hpp.

template<typename T >
Vector< T, PETSC_BASE >::Vector ( )
inline

Create a vector with 0 elements.

Definition at line 199 of file Vector_petsc.hpp.

Member Function Documentation

template<typename T >
const Vec& Vector< T, PETSC_BASE >::getVec ( ) const
inline

Get the PETSC Vector object.

Returns
the PETSC Vector

Definition at line 320 of file Vector_petsc.hpp.

template<typename T >
Vec& Vector< T, PETSC_BASE >::getVec ( )
inline

Get the PETSC Vector object.

Returns
the PETSC Vector

Definition at line 332 of file Vector_petsc.hpp.

template<typename T >
void Vector< T, PETSC_BASE >::insert ( size_t  i,
val 
)
inline

Return a reference to the vector element.

Parameters
ielement
valvalue

Definition at line 226 of file Vector_petsc.hpp.

template<typename T >
PetscScalar& Vector< T, PETSC_BASE >::insert ( size_t  i)
inline

Return a reference to the vector element.

Parameters
ielement
Returns
reference to the element vector

Definition at line 244 of file Vector_petsc.hpp.

template<typename T >
const PetscScalar& Vector< T, PETSC_BASE >::insert ( size_t  i) const
inline

Return a reference to the vector element.

Parameters
ielement
Returns
reference to the element vector

Definition at line 262 of file Vector_petsc.hpp.

template<typename T >
const PetscScalar& Vector< T, PETSC_BASE >::operator() ( size_t  i) const
inline

Return a reference to the vector element.

Warning
The element must exist
Parameters
ielement
Returns
reference to the element vector

Definition at line 282 of file Vector_petsc.hpp.

template<typename T >
PetscScalar& Vector< T, PETSC_BASE >::operator() ( size_t  i)
inline

Return a reference to the vector element.

Warning
The element must exist
Parameters
ielement
Returns
reference to the element vector

Definition at line 303 of file Vector_petsc.hpp.

template<typename T >
Vector<T,PETSC_BASE>& Vector< T, PETSC_BASE >::operator= ( const Vector< T, PETSC_BASE > &  v)
inline

Copy the vector.

Parameters
vvector to copy

Definition at line 381 of file Vector_petsc.hpp.

template<typename T >
Vector<T,PETSC_BASE>& Vector< T, PETSC_BASE >::operator= ( Vector< T, PETSC_BASE > &&  v)
inline

Copy the vector.

Parameters
vvector to copy

Definition at line 394 of file Vector_petsc.hpp.

template<typename T >
void Vector< T, PETSC_BASE >::resize ( size_t  row,
size_t  l_row 
)
inline

Resize the Vector.

Parameters
rownumbers of row
l_rownumber of local row

Definition at line 212 of file Vector_petsc.hpp.

template<typename T >
void Vector< T, PETSC_BASE >::setPetsc ( ) const
inlineprivate

Set the Eigen internal vector.

Definition at line 131 of file Vector_petsc.hpp.

template<typename T >
void Vector< T, PETSC_BASE >::setZero ( )
inline

Set to zero all the entries.

Definition at line 406 of file Vector_petsc.hpp.

template<typename T >
void Vector< T, PETSC_BASE >::update ( )
inline

Update the Vector with the PETSC object.

Definition at line 342 of file Vector_petsc.hpp.


The documentation for this class was generated from the following file: