14#ifdef MOOSE_KOKKOS_SCOPE
18#include "libmesh/petsc_matrix.h"
50#ifdef MOOSE_KOKKOS_SCOPE
70 std::vector<PetscInt> & coo_i,
71 std::vector<PetscInt> & coo_j);
81 KOKKOS_FUNCTION
void zero(PetscInt i)
92 KOKKOS_FUNCTION PetscScalar &
operator()(PetscInt i, PetscInt j)
const
94 auto idx =
find(i, j);
96 KOKKOS_ASSERT(idx != -1);
113#ifdef MOOSE_KOKKOS_SCOPE
120 KOKKOS_FUNCTION PetscInt
find(PetscInt i, PetscInt j)
const;
149#ifdef MOOSE_KOKKOS_SCOPE
150KOKKOS_FUNCTION
inline PetscInt
153 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.
Mat mat()
Get PETSc matrix handle.
void create(libMesh::SparseMatrix< PetscScalar > &matrix, const System &system, std::vector< PetscInt > &coo_i, std::vector< PetscInt > &coo_j)
Create the matrix from a libMesh PetscMatrix.
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.
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.