ryujin 2.1.1 revision ee5cbcbf2346c1299c942d0e1f13b46449973c18
Loading...
Searching...
No Matches
List of all members
ryujin::SparsityPatternView< warp_size, MemorySpace > Class Template Reference

#include <source/sparsity_pattern.h>

Public Member Functions

Constructor and initialization
 SparsityPatternView ()=default
 
 SparsityPatternView (const SparsityPattern< warp_size > &sparsity_pattern)
 
void reinit (const SparsityPattern< warp_size > &sparsity_pattern)
 
General information about the sparsity pattern
DEAL_II_HOST_DEVICE unsigned int n_internal_dofs () const
 
DEAL_II_HOST_DEVICE unsigned int n_locally_owned_dofs () const
 
DEAL_II_HOST_DEVICE unsigned int n_rows () const
 
DEAL_II_HOST_DEVICE unsigned int n_nonzero_elements () const
 
Properties of a row
DEAL_II_HOST_DEVICE unsigned int stride_of_row (const unsigned int row) const
 
DEAL_II_HOST_DEVICE const unsigned int * columns (const unsigned int row) const
 
DEAL_II_HOST_DEVICE unsigned int row_length (const unsigned int row) const
 
DEAL_II_HOST_DEVICE unsigned int column_index (const unsigned int row, const unsigned int column) const
 
Offset calculation
template<unsigned int n_components = 1>
DEAL_II_HOST_DEVICE unsigned int offset (const unsigned int row, const unsigned int column_index, const unsigned int component=0) const
 
template<unsigned int n_components = 1>
DEAL_II_HOST_DEVICE unsigned int offset_internal (const unsigned int row, const unsigned int column_index) const
 
template<unsigned int n_components = 1>
DEAL_II_HOST_DEVICE unsigned int transposed_offset (const unsigned int row, const unsigned int column_index, const unsigned int component=0) const
 
template<unsigned int n_components = 1>
DEAL_II_HOST_DEVICE const unsigned int * transposed_offset_internal (const unsigned int row, const unsigned int column_index) const
 
template<unsigned int n_components = 1>
DEAL_II_HOST_DEVICE unsigned int ghost_offset () const
 

Detailed Description

template<int warp_size, typename MemorySpace>
class ryujin::SparsityPatternView< warp_size, MemorySpace >

This class models a "view" of the sparsity pattern that lives in the host or device memory space. It provides a number of methods for iterating over the sparsity pattern and offset computation.

Note
This class is designed to be captured by value in computation loops with access to either the host or device memory space. As such we do not store a reference to the underlying SparsityPattern but rather raw pointers into the corresponding memory. The view is only valid as long as the underlying SparsityPattern object is not modified.

Definition at line 216 of file sparsity_pattern.h.

Constructor & Destructor Documentation

◆ SparsityPatternView() [1/2]

template<int warp_size, typename MemorySpace >
ryujin::SparsityPatternView< warp_size, MemorySpace >::SparsityPatternView ( )
default

◆ SparsityPatternView() [2/2]

template<int warp_size, typename MemorySpace >
ryujin::SparsityPatternView< warp_size, MemorySpace >::SparsityPatternView ( const SparsityPattern< warp_size > &  sparsity_pattern)

Member Function Documentation

◆ reinit()

template<int warp_size, typename MemorySpace >
void ryujin::SparsityPatternView< warp_size, MemorySpace >::reinit ( const SparsityPattern< warp_size > &  sparsity_pattern)

◆ n_internal_dofs()

template<int warp_size, typename MemorySpace >
DEAL_II_HOST_DEVICE unsigned int ryujin::SparsityPatternView< warp_size, MemorySpace >::n_internal_dofs ( ) const

The number of locally internal rows of the sparsity pattern that are stored in optimized "array-of-struct-of-array" format.

◆ n_locally_owned_dofs()

template<int warp_size, typename MemorySpace >
DEAL_II_HOST_DEVICE unsigned int ryujin::SparsityPatternView< warp_size, MemorySpace >::n_locally_owned_dofs ( ) const

The number of locally owned rows of the sparsity pattern.

◆ n_rows()

template<int warp_size, typename MemorySpace >
DEAL_II_HOST_DEVICE unsigned int ryujin::SparsityPatternView< warp_size, MemorySpace >::n_rows ( ) const

The total number of rows of the given sparsity pattern. This number comprises all locally owned rows and the ghost row range and is equal to n_locally_relevant.

◆ n_nonzero_elements()

template<int warp_size, typename MemorySpace >
DEAL_II_HOST_DEVICE unsigned int ryujin::SparsityPatternView< warp_size, MemorySpace >::n_nonzero_elements ( ) const

The total number of nonzero elements of the given sparsity pattern.

◆ stride_of_row()

template<int warp_size, typename MemorySpace >
DEAL_II_HOST_DEVICE unsigned int ryujin::SparsityPatternView< warp_size, MemorySpace >::stride_of_row ( const unsigned int  row) const

Return the "stride size" of a given row index, i.e., the distance in memory between two consecutive column entries of the row. The function returns warp_size for all indices in the range [0, n_internal_dofs) and 1 otherwise.

◆ columns()

template<int warp_size, typename MemorySpace >
DEAL_II_HOST_DEVICE const unsigned int * ryujin::SparsityPatternView< warp_size, MemorySpace >::columns ( const unsigned int  row) const

Return a pointer to the array of column indices for the given row, i.e., for a given row index i:

const unsigned int *js = sparsity_pattern.columns(i);

is a pointer to the column index j (or column indices *js when SIMD vectorized).

◆ row_length()

template<int warp_size, typename MemorySpace >
DEAL_II_HOST_DEVICE unsigned int ryujin::SparsityPatternView< warp_size, MemorySpace >::row_length ( const unsigned int  row) const

Return the row length of a given row index.

◆ column_index()

template<int warp_size, typename MemorySpace >
DEAL_II_HOST_DEVICE unsigned int ryujin::SparsityPatternView< warp_size, MemorySpace >::column_index ( const unsigned int  row,
const unsigned int  column 
) const

Given a row index row and a column index column return the corresponding column index, i.e., the position of the column in the stencil of nonzero row entries.

◆ offset()

template<int warp_size, typename MemorySpace >
template<unsigned int n_components = 1>
DEAL_II_HOST_DEVICE unsigned int ryujin::SparsityPatternView< warp_size, MemorySpace >::offset ( const unsigned int  row,
const unsigned int  column_index,
const unsigned int  component = 0 
) const

Given a row index, an index for the column (within [0, row_length(row)), and a component index return the position of the matrix entry in the data array.

◆ offset_internal()

template<int warp_size, typename MemorySpace >
template<unsigned int n_components = 1>
DEAL_II_HOST_DEVICE unsigned int ryujin::SparsityPatternView< warp_size, MemorySpace >::offset_internal ( const unsigned int  row,
const unsigned int  column_index 
) const

Specialized version of the function above that computes the offset only for the internal part and pointing to component 0. This variant avoids a number of index computations and an if statement.

Note
The stride between two components of the returned offset is warp_size. Furthermore, the matrix entries of the rows row, row + 1, ..., row + k of the same warp are stored consecutively starting at the returned offset.
Precondition
row must be within the internal index range.

◆ transposed_offset()

template<int warp_size, typename MemorySpace >
template<unsigned int n_components = 1>
DEAL_II_HOST_DEVICE unsigned int ryujin::SparsityPatternView< warp_size, MemorySpace >::transposed_offset ( const unsigned int  row,
const unsigned int  column_index,
const unsigned int  component = 0 
) const

Given a row index, an index for the column (within [0, row_length(row)), and a component index return the position of the transposed matrix entry in the data array.

◆ transposed_offset_internal()

template<int warp_size, typename MemorySpace >
template<unsigned int n_components = 1>
DEAL_II_HOST_DEVICE const unsigned int * ryujin::SparsityPatternView< warp_size, MemorySpace >::transposed_offset_internal ( const unsigned int  row,
const unsigned int  column_index 
) const

Specialized version of the function above that computes the offset only for the internal part and pointing to component 0. This variant avoids a number of index computations and an if statement.

Precondition
row must be within the internal index range.

◆ ghost_offset()

template<int warp_size, typename MemorySpace >
template<unsigned int n_components = 1>
DEAL_II_HOST_DEVICE unsigned int ryujin::SparsityPatternView< warp_size, MemorySpace >::ghost_offset ( ) const

Return an offset pointing to the first element of the ghost range, i.e., the value corresponding to offset(sparsity_->n_locally_owned_dofs(), 0, 0).

Note
If the sparsity pattern does not contain a ghost range, then the offset points one element past the data array of the sparse matrix.

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