Block-Structured AMR Software Framework
Loading...
Searching...
No Matches
amrex::CSR< T, V > Struct Template Reference

Owning CSR container backed by AMReX resizable vectors. More...

#include <AMReX_CSR.H>

Public Member Functions

Long nrows () const
 Number of logical rows represented by the CSR offset array.
 
void resize (Long num_rows, Long num_non_zeros)
 Resize the storage to accommodate num_rows and num_non_zeros entries.
 
CsrView< T > view ()
 Mutable view of the underlying buffers.
 
CsrView< T const > view () const
 Const view of the underlying buffers.
 
CsrView< T const > const_view () const
 Convenience alias for view() const.
 
void sort ()
 Sort each row by column index. Uses GPU acceleration when possible.
 
void sort_on_host ()
 Host-only fallback that sorts column indices row by row.
 

Public Attributes

V< T > mat
 
V< Longcol_index
 
V< Longrow_offset
 
Long nnz = 0
 

Detailed Description

template<typename T, template< typename > class V>
struct amrex::CSR< T, V >

Owning CSR container backed by AMReX resizable vectors.

Template Parameters
TValue type stored in the matrix.
VVector-like container template (e.g., PODVector, Gpu::DeviceVector).

Member Function Documentation

◆ const_view()

template<typename T , template< typename > class V>
CsrView< T const > amrex::CSR< T, V >::const_view ( ) const
inline

Convenience alias for view() const.

◆ nrows()

template<typename T , template< typename > class V>
Long amrex::CSR< T, V >::nrows ( ) const
inline

Number of logical rows represented by the CSR offset array.

◆ resize()

template<typename T , template< typename > class V>
void amrex::CSR< T, V >::resize ( Long  num_rows,
Long  num_non_zeros 
)
inline

Resize the storage to accommodate num_rows and num_non_zeros entries.

Existing data are discarded; value/column arrays are resized to the specified nonzero count and row offsets to num_rows+1.

Parameters
num_rowsRow count.
num_non_zerosNumber of nonzeros.

◆ sort()

template<typename T , template< typename > class V>
void amrex::CSR< T, V >::sort ( )

Sort each row by column index. Uses GPU acceleration when possible.

◆ sort_on_host()

template<typename T , template< typename > class V>
void amrex::CSR< T, V >::sort_on_host ( )

Host-only fallback that sorts column indices row by row.

◆ view() [1/2]

template<typename T , template< typename > class V>
CsrView< T > amrex::CSR< T, V >::view ( )
inline

Mutable view of the underlying buffers.

◆ view() [2/2]

template<typename T , template< typename > class V>
CsrView< T const > amrex::CSR< T, V >::view ( ) const
inline

Const view of the underlying buffers.

Member Data Documentation

◆ col_index

template<typename T , template< typename > class V>
V<Long> amrex::CSR< T, V >::col_index

◆ mat

template<typename T , template< typename > class V>
V<T> amrex::CSR< T, V >::mat

◆ nnz

template<typename T , template< typename > class V>
Long amrex::CSR< T, V >::nnz = 0

◆ row_offset

template<typename T , template< typename > class V>
V<Long> amrex::CSR< T, V >::row_offset

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