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

#include <CSRMatrix.hpp>

Public Member Functions

 CSRMatrix (const Field< ValueType > &values, const Field< IndexType > &colIdxs, const Field< IndexType > &rowPtrs)
 Constructor for CSRMatrix.
 
 ~CSRMatrix ()=default
 Default destructor.
 
const Executorexec () const
 Get the executor associated with this matrix.
 
IndexType nRows () const
 Get the number of rows in the matrix.
 
IndexType nNonZeros () const
 Get the number of non-zero values in the matrix.
 
std::span< ValueType > values ()
 Get a span to the values array.
 
std::span< IndexType > colIdxs ()
 Get a span to the column indices array.
 
std::span< IndexType > rowPtrs ()
 Get a span to the row pointers array.
 
const std::span< const ValueType > values () const
 Get a const span to the values array.
 
const std::span< const IndexType > colIdxs () const
 Get a const span to the column indices array.
 
const std::span< const IndexType > rowPtrs () const
 Get a const span to the row pointers array.
 
CSRMatrix< ValueType, IndexType > copyToExecutor (Executor dstExec) const
 Copy the matrix to another executor.
 
CSRMatrix< ValueType, IndexType > copyToHost () const
 Copy the matrix to the host.
 
CSRMatrixSpan< ValueType, IndexType > span ()
 Get a span representation of the matrix.
 
const CSRMatrixSpan< const ValueType, const IndexType > span () const
 Get a const span representation of the matrix.
 

Detailed Description

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

Definition at line 90 of file CSRMatrix.hpp.

Constructor & Destructor Documentation

◆ CSRMatrix()

template<typename ValueType , typename IndexType >
NeoFOAM::la::CSRMatrix< ValueType, IndexType >::CSRMatrix ( const Field< ValueType > &  values,
const Field< IndexType > &  colIdxs,
const Field< IndexType > &  rowPtrs 
)
inline

Constructor for CSRMatrix.

Parameters
valuesThe non-zero values of the matrix.
colIdxsThe column indices for each non-zero value.
rowPtrsThe starting index in values/colIdxs for each row.

Definition at line 101 of file CSRMatrix.hpp.

◆ ~CSRMatrix()

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

Default destructor.

Member Function Documentation

◆ colIdxs() [1/2]

template<typename ValueType , typename IndexType >
std::span< IndexType > NeoFOAM::la::CSRMatrix< ValueType, IndexType >::colIdxs ( )
inline

Get a span to the column indices array.

Returns
Span containing the column indices.

Definition at line 145 of file CSRMatrix.hpp.

◆ colIdxs() [2/2]

template<typename ValueType , typename IndexType >
const std::span< const IndexType > NeoFOAM::la::CSRMatrix< ValueType, IndexType >::colIdxs ( ) const
inline

Get a const span to the column indices array.

Returns
Const span containing the column indices.

Definition at line 163 of file CSRMatrix.hpp.

◆ copyToExecutor()

template<typename ValueType , typename IndexType >
CSRMatrix< ValueType, IndexType > NeoFOAM::la::CSRMatrix< ValueType, IndexType >::copyToExecutor ( Executor  dstExec) const
inline

Copy the matrix to another executor.

Parameters
dstExecThe destination executor.
Returns
A copy of the matrix on the destination executor.

Definition at line 176 of file CSRMatrix.hpp.

◆ copyToHost()

template<typename ValueType , typename IndexType >
CSRMatrix< ValueType, IndexType > NeoFOAM::la::CSRMatrix< ValueType, IndexType >::copyToHost ( ) const
inline

Copy the matrix to the host.

Returns
A copy of the matrix on the host.

Definition at line 192 of file CSRMatrix.hpp.

◆ exec()

template<typename ValueType , typename IndexType >
const Executor & NeoFOAM::la::CSRMatrix< ValueType, IndexType >::exec ( ) const
inline

Get the executor associated with this matrix.

Returns
Reference to the executor.

Definition at line 121 of file CSRMatrix.hpp.

◆ nNonZeros()

template<typename ValueType , typename IndexType >
IndexType NeoFOAM::la::CSRMatrix< ValueType, IndexType >::nNonZeros ( ) const
inline

Get the number of non-zero values in the matrix.

Returns
Number of non-zero values.

Definition at line 133 of file CSRMatrix.hpp.

◆ nRows()

template<typename ValueType , typename IndexType >
IndexType NeoFOAM::la::CSRMatrix< ValueType, IndexType >::nRows ( ) const
inline

Get the number of rows in the matrix.

Returns
Number of rows.

Definition at line 127 of file CSRMatrix.hpp.

◆ rowPtrs() [1/2]

template<typename ValueType , typename IndexType >
std::span< IndexType > NeoFOAM::la::CSRMatrix< ValueType, IndexType >::rowPtrs ( )
inline

Get a span to the row pointers array.

Returns
Span containing the row pointers.

Definition at line 151 of file CSRMatrix.hpp.

◆ rowPtrs() [2/2]

template<typename ValueType , typename IndexType >
const std::span< const IndexType > NeoFOAM::la::CSRMatrix< ValueType, IndexType >::rowPtrs ( ) const
inline

Get a const span to the row pointers array.

Returns
Const span containing the row pointers.

Definition at line 169 of file CSRMatrix.hpp.

◆ span() [1/2]

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

Get a span representation of the matrix.

Returns
CSRMatrixSpan for easy access to matrix elements.

Definition at line 201 of file CSRMatrix.hpp.

◆ span() [2/2]

template<typename ValueType , typename IndexType >
const CSRMatrixSpan< const ValueType, const IndexType > NeoFOAM::la::CSRMatrix< ValueType, IndexType >::span ( ) const
inline

Get a const span representation of the matrix.

Returns
Const CSRMatrixSpan for read-only access to matrix elements.

Definition at line 210 of file CSRMatrix.hpp.

◆ values() [1/2]

template<typename ValueType , typename IndexType >
std::span< ValueType > NeoFOAM::la::CSRMatrix< ValueType, IndexType >::values ( )
inline

Get a span to the values array.

Returns
Span containing the matrix values.

Definition at line 139 of file CSRMatrix.hpp.

◆ values() [2/2]

template<typename ValueType , typename IndexType >
const std::span< const ValueType > NeoFOAM::la::CSRMatrix< ValueType, IndexType >::values ( ) const
inline

Get a const span to the values array.

Returns
Const span containing the matrix values.

Definition at line 157 of file CSRMatrix.hpp.


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