14#ifdef MOOSE_KOKKOS_SCOPE
18#include "libmesh/petsc_matrix.h"
48#ifdef MOOSE_KOKKOS_SCOPE
69 KOKKOS_FUNCTION
void zero(PetscInt i)
80 KOKKOS_FUNCTION PetscScalar &
operator()(PetscInt i, PetscInt j)
const
82 auto idx =
find(i, j);
84 KOKKOS_ASSERT(idx != -1);
101#ifdef MOOSE_KOKKOS_SCOPE
108 KOKKOS_FUNCTION PetscInt
find(PetscInt i, PetscInt j)
const;
138#ifdef MOOSE_KOKKOS_SCOPE
139KOKKOS_FUNCTION
inline PetscInt
142 KOKKOS_ASSERT(i <
_nr);
KOKKOS_FUNCTION T * data() const
Get the data pointer.
The Kokkos wrapper class for PETSc matrix.
Array< PetscInt > _row_ptr
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.
bool _is_host
Flag whether the PETSc matrix is a host matrix.
auto & operator=(PetscScalar scalar)
Assign a scalar value uniformly.
Array< PetscScalar > _val
KOKKOS_FUNCTION PetscInt find(PetscInt i, PetscInt j) const
Get the index of given row and column indices.
void close()
Assemble the underlying PETSc matrix.
Array< PetscInt > _row_idx
Mat mat()
Get PETSc matrix handle.
bool isAlloc() const
Get whether the matrix was allocated.
PetscCount _nr
Number of rows local to this process.
Array< PetscInt > _col_idx
CSR vectors on device.
Matrix()=default
Default constructor.
void create(libMesh::SparseMatrix< PetscScalar > &matrix, const System &system)
Create the matrix from a libMesh PetscMatrix.
bool _is_alloc
Flag whether the matrix was allocated.
void destroy()
Free all data and reset.
The Kokkos base system class.
KOKKOS_INLINE_FUNCTION const T * find(const T &target, const T *const begin, const T *const end)
Find a value in an array.