RINGMesh  Version 5.0.0
A programming library for geological model meshes
RINGMesh::SparseMatrixImpl< T, RowType > Class Template Reference

This is the parent class for sparse matrices, the main difference between light and heavy type matrices depend on the contents of rows elements: Light will contain type T objects, while heavy an index to access a std::deque. More...

#include <matrix.h>

Public Types

using Row = RowImpl< RowType >
 

Public Member Functions

 SparseMatrixImpl (bool is_symmetrical=false)
 
 ~SparseMatrixImpl ()=default
 
bool exist (index_t i, index_t j) const
 
index_t get_nb_elements_in_line (index_t i) const
 gets number of elements within a row More...
 
index_t get_column_in_line (index_t i, index_t e) const
 gets the j that correspond to the given index within the row More...
 
std::tuple< bool, index_t > get_index_in_line (index_t i, index_t j) const
 gets the rows_ index corresponding to a given i-j couple More...
 
index_t ni () const
 
index_t nj () const
 
bool is_symmetrical () const
 
void build_matrix (index_t ni, index_t nj)
 
get_element_in_line (index_t i, index_t e) const
 

Protected Attributes

std::unique_ptr< Row[] > rows_ {}
 
index_t ni_ { 0 }
 
index_t nj_ { 0 }
 
bool is_symmetrical_
 

Private Member Functions

 ringmesh_disable_copy_and_move (SparseMatrixImpl)
 

Detailed Description

template<typename T, typename RowType>
class RINGMesh::SparseMatrixImpl< T, RowType >

This is the parent class for sparse matrices, the main difference between light and heavy type matrices depend on the contents of rows elements: Light will contain type T objects, while heavy an index to access a std::deque.

Definition at line 200 of file matrix.h.

Member Typedef Documentation

◆ Row

template<typename T, typename RowType>
using RINGMesh::SparseMatrixImpl< T, RowType >::Row = RowImpl< RowType >

Definition at line 205 of file matrix.h.

Constructor & Destructor Documentation

◆ SparseMatrixImpl()

template<typename T, typename RowType>
RINGMesh::SparseMatrixImpl< T, RowType >::SparseMatrixImpl ( bool  is_symmetrical = false)
inlineexplicit

Definition at line 206 of file matrix.h.

◆ ~SparseMatrixImpl()

template<typename T, typename RowType>
RINGMesh::SparseMatrixImpl< T, RowType >::~SparseMatrixImpl ( )
default

Member Function Documentation

◆ build_matrix()

template<typename T, typename RowType>
void RINGMesh::SparseMatrixImpl< T, RowType >::build_matrix ( index_t  ni,
index_t  nj 
)
inline

build the matrix, in allocate the ni number of lines and sets the matrix dimensions

Parameters
[in]ninumber of lines of the matrix
[in]njnumber of columns of the matrix

Definition at line 296 of file matrix.h.

◆ exist()

template<typename T, typename RowType>
bool RINGMesh::SparseMatrixImpl< T, RowType >::exist ( index_t  i,
index_t  j 
) const
inline

Test the existence of a given i-j element

Parameters
[in]ithe given row
[in]jthe given column
Returns
bool true if it exists, false if it does not exist

Definition at line 219 of file matrix.h.

◆ get_column_in_line()

template<typename T, typename RowType>
index_t RINGMesh::SparseMatrixImpl< T, RowType >::get_column_in_line ( index_t  i,
index_t  e 
) const
inline

gets the j that correspond to the given index within the row

Parameters
[in]irow index
[in]ethe index within the row
Returns
index_t of the corresponding j column in the matrix

Definition at line 242 of file matrix.h.

◆ get_element_in_line()

template<typename T, typename RowType>
T RINGMesh::SparseMatrixImpl< T, RowType >::get_element_in_line ( index_t  i,
index_t  e 
) const
inline

get the value of e-element (index within the row, not in the matrix) on line i. this code should never be reached.

Parameters
[in]irow index
[in]eindex within the row
Returns
value to retrieve

Definition at line 311 of file matrix.h.

◆ get_index_in_line()

template<typename T, typename RowType>
std::tuple< bool, index_t > RINGMesh::SparseMatrixImpl< T, RowType >::get_index_in_line ( index_t  i,
index_t  j 
) const
inline

gets the rows_ index corresponding to a given i-j couple

Parameters
[in]irow index
[in]jcolumn index
Returns
a tuple containing:
  • a boolean: true if success, else false if the i-j couple is empty.
  • the index the index within a row if any, else NO_ID.

Definition at line 255 of file matrix.h.

◆ get_nb_elements_in_line()

template<typename T, typename RowType>
index_t RINGMesh::SparseMatrixImpl< T, RowType >::get_nb_elements_in_line ( index_t  i) const
inline

gets number of elements within a row

Parameters
[in]irow index
Returns
index_t number of elements

Definition at line 230 of file matrix.h.

◆ is_symmetrical()

template<typename T, typename RowType>
bool RINGMesh::SparseMatrixImpl< T, RowType >::is_symmetrical ( ) const
inline

returns true if the matrix is symmetrical

Returns
bool is_symmetrical (true if yes)

Definition at line 285 of file matrix.h.

◆ ni()

template<typename T, typename RowType>
index_t RINGMesh::SparseMatrixImpl< T, RowType >::ni ( ) const
inline

returns the number of lines

Returns
index_t ni number of lines of the matrix

Definition at line 267 of file matrix.h.

◆ nj()

template<typename T, typename RowType>
index_t RINGMesh::SparseMatrixImpl< T, RowType >::nj ( ) const
inline

returns the number of columns

Returns
index_t nj number of columns of the matrix

Definition at line 276 of file matrix.h.

◆ ringmesh_disable_copy_and_move()

template<typename T, typename RowType>
RINGMesh::SparseMatrixImpl< T, RowType >::ringmesh_disable_copy_and_move ( SparseMatrixImpl< T, RowType >  )
private

Member Data Documentation

◆ is_symmetrical_

template<typename T, typename RowType>
bool RINGMesh::SparseMatrixImpl< T, RowType >::is_symmetrical_
protected

Definition at line 322 of file matrix.h.

◆ ni_

template<typename T, typename RowType>
index_t RINGMesh::SparseMatrixImpl< T, RowType >::ni_ { 0 }
protected

Definition at line 321 of file matrix.h.

◆ nj_

template<typename T, typename RowType>
index_t RINGMesh::SparseMatrixImpl< T, RowType >::nj_ { 0 }
protected

Definition at line 321 of file matrix.h.

◆ rows_

template<typename T, typename RowType>
std::unique_ptr< Row[] > RINGMesh::SparseMatrixImpl< T, RowType >::rows_ {}
protected

Definition at line 320 of file matrix.h.


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