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

Sparse Matrix implementation, that map over Eigen. More...

Detailed Description

template<typename T, typename id_t>
class SparseMatrix< T, id_t, PETSC_BASE >

Sparse Matrix implementation, that map over Eigen.

Template Parameters
TType of the sparse Matrix store on each row,colums
id_ttype of id
implimplementation

Definition at line 96 of file SparseMatrix_petsc.hpp.

#include <SparseMatrix_petsc.hpp>

Public Types

typedef boost::mpl::int_
< PETSC_BASE > 
triplet_impl
 Triplet implementation id.
 
typedef triplet< T, PETSC_BASE > triplet_type
 Triplet type.
 

Public Member Functions

 SparseMatrix (size_t N1, size_t N2, size_t n_row_local)
 Create an empty Matrix. More...
 
 SparseMatrix ()
 Create an empty Matrix. More...
 
openfpm::vector< triplet_type > & getMatrixTriplets ()
 Get the Matrix triplets buffer. More...
 
const Mat & getMat () const
 Get the Patsc Matrix object. More...
 
Mat & getMat ()
 Get the Petsc Matrix object. More...
 
void resize (size_t row, size_t col, size_t l_row, size_t l_col)
 Resize the Sparse Matrix. More...
 
operator() (id_t i, id_t j)
 Get the row i and the colum j of the Matrix. More...
 
getValue (size_t r, size_t c)
 Get the value from triplet. More...
 

Private Member Functions

void fill_petsc ()
 Fill the petsc Matrix. More...
 

Private Attributes

size_t g_row
 Number of matrix row (global)
 
size_t g_col
 Number of matrix colums (global)
 
size_t l_row
 Number of matrix row (local)
 
size_t l_col
 Number of matrix colums (local)
 
size_t start_row
 starting row for this processor
 
bool m_created = false
 indicate if the matrix has been created
 
Mat mat
 PETSC Matrix.
 
openfpm::vector< triplet_typetrpl
 Triplets of the matrix.
 
openfpm::vector< PetscScalar > vals
 temporary list of values
 
openfpm::vector< PetscInt > cols
 temporary list of colums
 
openfpm::vector< PetscInt > d_nnz
 PETSC d_nnz.
 
openfpm::vector< PetscInt > o_nnz
 PETSC o_nnz.
 

Constructor & Destructor Documentation

template<typename T , typename id_t >
SparseMatrix< T, id_t, PETSC_BASE >::SparseMatrix ( size_t  N1,
size_t  N2,
size_t  n_row_local 
)
inline

Create an empty Matrix.

Parameters
N1number of row
N2number of colums
N1_locnumber of local row

Definition at line 213 of file SparseMatrix_petsc.hpp.

template<typename T , typename id_t >
SparseMatrix< T, id_t, PETSC_BASE >::SparseMatrix ( )
inline

Create an empty Matrix.

Definition at line 236 of file SparseMatrix_petsc.hpp.

Member Function Documentation

template<typename T , typename id_t >
void SparseMatrix< T, id_t, PETSC_BASE >::fill_petsc ( )
inlineprivate

Fill the petsc Matrix.

Definition at line 144 of file SparseMatrix_petsc.hpp.

template<typename T , typename id_t >
const Mat& SparseMatrix< T, id_t, PETSC_BASE >::getMat ( ) const
inline

Get the Patsc Matrix object.

Returns
the Eigen Matrix

Definition at line 269 of file SparseMatrix_petsc.hpp.

template<typename T , typename id_t >
Mat& SparseMatrix< T, id_t, PETSC_BASE >::getMat ( )
inline

Get the Petsc Matrix object.

Returns
the Petsc Matrix

Definition at line 282 of file SparseMatrix_petsc.hpp.

template<typename T , typename id_t >
openfpm::vector<triplet_type>& SparseMatrix< T, id_t, PETSC_BASE >::getMatrixTriplets ( )
inline

Get the Matrix triplets buffer.

It return a buffer that can be filled with triplets

Returns
Petsc Matrix

Definition at line 257 of file SparseMatrix_petsc.hpp.

template<typename T , typename id_t >
T SparseMatrix< T, id_t, PETSC_BASE >::getValue ( size_t  r,
size_t  c 
)
inline

Get the value from triplet.

Warning
It is extremly slow because it do a full search across the triplets elements
Parameters
rrow
ccolum

Definition at line 345 of file SparseMatrix_petsc.hpp.

template<typename T , typename id_t >
T SparseMatrix< T, id_t, PETSC_BASE >::operator() ( id_t  i,
id_t  j 
)
inline

Get the row i and the colum j of the Matrix.

Warning
it is slow, consider to get blocks of the matrix
Returns
the value of the matrix at row i colum j

Definition at line 328 of file SparseMatrix_petsc.hpp.

template<typename T , typename id_t >
void SparseMatrix< T, id_t, PETSC_BASE >::resize ( size_t  row,
size_t  col,
size_t  l_row,
size_t  l_col 
)
inline

Resize the Sparse Matrix.

Parameters
rownumber for row
colnumber of colums
localnumber of row
localnumber of colums

Definition at line 298 of file SparseMatrix_petsc.hpp.


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