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

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

#include <AMReX_CSR.H>

Public Types

using index_type = I
 

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, I > view ()
 Mutable view of the underlying buffers.
 
CsrView< T const, I > view () const
 Const view of the underlying buffers.
 
CsrView< T const, I > 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< I > col_index
 
V< I > row_offset
 
Long nnz = 0
 

Detailed Description

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

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).
IIndex type of both the column indices and the row offsets.

Member Typedef Documentation

◆ index_type

template<typename T , template< typename > class V, typename I = Long>
using amrex::CSR< T, V, I >::index_type = I

Member Function Documentation

◆ const_view()

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

Convenience alias for view() const.

◆ nrows()

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

Number of logical rows represented by the CSR offset array.

◆ resize()

template<typename T , template< typename > class V, typename I = Long>
void amrex::CSR< T, V, I >::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, typename I >
void amrex::CSR< T, V, I >::sort ( )

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

◆ sort_on_host()

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

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

◆ view() [1/2]

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

Mutable view of the underlying buffers.

◆ view() [2/2]

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

Const view of the underlying buffers.

Member Data Documentation

◆ col_index

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

◆ mat

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

◆ nnz

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

◆ row_offset

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

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