The Kokkos wrapper class for PETSc matrix.
More...
#include <KokkosMatrix.h>
|
| | Matrix ()=default |
| | Default constructor.
|
| |
| | ~Matrix () |
| | Destructor.
|
| |
| Mat | mat () |
| | Get PETSc matrix handle.
|
| |
| void | destroy () |
| | Free all data and reset.
|
| |
| bool | isAlloc () const |
| | Get whether the matrix was allocated.
|
| |
| void | create (libMesh::SparseMatrix< PetscScalar > &matrix, const System &system) |
| | Create the matrix from a libMesh PetscMatrix.
|
| |
| void | close () |
| | Assemble the underlying PETSc matrix.
|
| |
| KOKKOS_FUNCTION void | zero (PetscInt i) |
| | Zero a row.
|
| |
| KOKKOS_FUNCTION PetscScalar & | operator() (PetscInt i, PetscInt j) const |
| | Get an entry with given row and column indices.
|
| |
| auto & | operator= (PetscScalar scalar) |
| | Assign a scalar value uniformly.
|
| |
|
| KOKKOS_FUNCTION PetscInt | find (PetscInt i, PetscInt j) const |
| | Get the index of given row and column indices.
|
| |
The Kokkos wrapper class for PETSc matrix.
Definition at line 28 of file KokkosMatrix.h.
◆ Matrix()
| Moose::Kokkos::Matrix::Matrix |
( |
| ) |
|
|
default |
◆ ~Matrix()
| Moose::Kokkos::Matrix::~Matrix |
( |
| ) |
|
|
inline |
Destructor.
Definition at line 38 of file KokkosMatrix.h.
void destroy()
Free all data and reset.
◆ close()
| void Moose::Kokkos::Matrix::close |
( |
| ) |
|
Assemble the underlying PETSc matrix.
◆ create()
Create the matrix from a libMesh PetscMatrix.
- Parameters
-
◆ destroy()
| void Moose::Kokkos::Matrix::destroy |
( |
| ) |
|
Free all data and reset.
Referenced by ~Matrix().
◆ find()
| KOKKOS_FUNCTION PetscInt Moose::Kokkos::Matrix::find |
( |
PetscInt |
i, |
|
|
PetscInt |
j |
|
) |
| const |
|
inlineprivate |
Get the index of given row and column indices.
- Parameters
-
| i | The row index local to this process |
| j | The global column index |
- Returns
- The index into the nonzero vector, and -1 if not found
Definition at line 140 of file KokkosMatrix.h.
141{
142 KOKKOS_ASSERT(i <
_nr);
143
147
148 if (target == end)
149 return -1;
150 else
152}
KOKKOS_FUNCTION T * data() const
Get the data pointer.
Array< PetscInt > _row_ptr
PetscCount _nr
Number of rows local to this process.
Array< PetscInt > _col_idx
CSR vectors on device.
KOKKOS_INLINE_FUNCTION const T * find(const T &target, const T *const begin, const T *const end)
Find a value in an array.
Referenced by operator()().
◆ isAlloc()
| bool Moose::Kokkos::Matrix::isAlloc |
( |
| ) |
const |
|
inline |
Get whether the matrix was allocated.
- Returns
- Whether the matrix was allocated
Definition at line 53 of file KokkosMatrix.h.
bool _is_alloc
Flag whether the matrix was allocated.
◆ mat()
| Mat Moose::Kokkos::Matrix::mat |
( |
| ) |
|
|
inline |
◆ operator()()
| KOKKOS_FUNCTION PetscScalar & Moose::Kokkos::Matrix::operator() |
( |
PetscInt |
i, |
|
|
PetscInt |
j |
|
) |
| const |
|
inline |
Get an entry with given row and column indices.
- Parameters
-
| i | The row index local to this process |
| j | The global column index |
- Returns
- The reference of the element
Definition at line 80 of file KokkosMatrix.h.
81 {
83
84 KOKKOS_ASSERT(idx != -1);
85
87 }
Array< PetscScalar > _val
KOKKOS_FUNCTION PetscInt find(PetscInt i, PetscInt j) const
Get the index of given row and column indices.
◆ operator=()
| auto & Moose::Kokkos::Matrix::operator= |
( |
PetscScalar |
scalar | ) |
|
|
inline |
Assign a scalar value uniformly.
- Parameters
-
| scalar | The scalar value to be assigned |
Definition at line 92 of file KokkosMatrix.h.
93 {
95
96 return *this;
97 }
◆ zero()
| KOKKOS_FUNCTION void Moose::Kokkos::Matrix::zero |
( |
PetscInt |
i | ) |
|
|
inline |
Zero a row.
- Parameters
-
| i | The row index local to this process to be zeroed |
Definition at line 69 of file KokkosMatrix.h.
◆ _col_idx
| Array<PetscInt> Moose::Kokkos::Matrix::_col_idx |
|
private |
◆ _is_alloc
| bool Moose::Kokkos::Matrix::_is_alloc = false |
|
private |
◆ _is_host
| bool Moose::Kokkos::Matrix::_is_host = false |
|
private |
Flag whether the PETSc matrix is a host matrix.
Definition at line 131 of file KokkosMatrix.h.
◆ _matrix
| Mat Moose::Kokkos::Matrix::_matrix = PETSC_NULLPTR |
|
private |
◆ _nr
| PetscCount Moose::Kokkos::Matrix::_nr = 0 |
|
private |
◆ _row_idx
| Array<PetscInt> Moose::Kokkos::Matrix::_row_idx |
|
private |
◆ _row_ptr
| Array<PetscInt> Moose::Kokkos::Matrix::_row_ptr |
|
private |
◆ _val
| Array<PetscScalar> Moose::Kokkos::Matrix::_val |
|
private |
The documentation for this class was generated from the following file: