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