NeoFOAM
WIP Prototype of a modern OpenFOAM core
Loading...
Searching...
No Matches
Public Member Functions | List of all members
NeoFOAM::la::CSRMatrixSpan< ValueType, IndexType > Class Template Reference

A helper class to allow easy read/write on all executors. More...

#include <CSRMatrix.hpp>

Public Member Functions

 CSRMatrixSpan (const std::span< ValueType > &values, const std::span< IndexType > &colIdxs, const std::span< IndexType > &rowPtrs)
 Constructor for CSRMatrixSpan.
 
 ~CSRMatrixSpan ()=default
 Default destructor.
 
KOKKOS_INLINE_FUNCTION ValueType & entry (const IndexType i, const IndexType j) const
 Retrieve a reference to the matrix element at position (i,j).
 
KOKKOS_INLINE_FUNCTION ValueType & entry (const IndexType offset) const
 Direct access to a value given the offset.
 
std::tuple< std::span< ValueType >, std::span< IndexType >, std::span< IndexType > > span ()
 Returns a structured binding of all containers.
 

Detailed Description

template<typename ValueType, typename IndexType>
class NeoFOAM::la::CSRMatrixSpan< ValueType, IndexType >

A helper class to allow easy read/write on all executors.

Template Parameters
ValueTypeThe type of the underlying CSR matrix elements.
IndexTypeThe type of the indexes.

Definition at line 20 of file CSRMatrix.hpp.

Constructor & Destructor Documentation

◆ CSRMatrixSpan()

template<typename ValueType , typename IndexType >
NeoFOAM::la::CSRMatrixSpan< ValueType, IndexType >::CSRMatrixSpan ( const std::span< ValueType > &  values,
const std::span< IndexType > &  colIdxs,
const std::span< IndexType > &  rowPtrs 
)
inline

Constructor for CSRMatrixSpan.

Parameters
valuesSpan of the non-zero values of the matrix.
colIdxsSpan of the column indices for each non-zero value.
rowPtrsSpan of the starting index in values/colIdxs for each row.

Definition at line 30 of file CSRMatrix.hpp.

◆ ~CSRMatrixSpan()

template<typename ValueType , typename IndexType >
NeoFOAM::la::CSRMatrixSpan< ValueType, IndexType >::~CSRMatrixSpan ( )
default

Default destructor.

Member Function Documentation

◆ entry() [1/2]

template<typename ValueType , typename IndexType >
KOKKOS_INLINE_FUNCTION ValueType & NeoFOAM::la::CSRMatrixSpan< ValueType, IndexType >::entry ( const IndexType  i,
const IndexType  j 
) const
inline

Retrieve a reference to the matrix element at position (i,j).

Parameters
iThe row index.
jThe column index.
Returns
Reference to the matrix element if it exists.

Definition at line 49 of file CSRMatrix.hpp.

◆ entry() [2/2]

template<typename ValueType , typename IndexType >
KOKKOS_INLINE_FUNCTION ValueType & NeoFOAM::la::CSRMatrixSpan< ValueType, IndexType >::entry ( const IndexType  offset) const
inline

Direct access to a value given the offset.

Parameters
offsetThe offset, from 0, to the value.
Returns
Reference to the matrix element if it exists.

Definition at line 71 of file CSRMatrix.hpp.

◆ span()

template<typename ValueType , typename IndexType >
std::tuple< std::span< ValueType >, std::span< IndexType >, std::span< IndexType > > NeoFOAM::la::CSRMatrixSpan< ValueType, IndexType >::span ( )
inline

Returns a structured binding of all containers.

Returns
std::tuple<std::span<ValueType>, std::span<IndexType>, std::span<IndexType>>

Definition at line 77 of file CSRMatrix.hpp.


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