Actual source code: ex252.c

  1: static char help[] = "Test MatZeroEntries() on unassembled matrices \n\n";

  3: #include <petscmat.h>

  5: int main(int argc, char **args)
  6: {
  7:   Mat      A;
  8:   PetscInt N = 32;
  9:   MPI_Comm comm;

 11:   PetscFunctionBeginUser;
 12:   PetscCall(PetscInitialize(&argc, &args, NULL, help));
 13:   comm = PETSC_COMM_WORLD;
 14:   PetscCall(PetscOptionsGetInt(NULL, NULL, "-N", &N, NULL));
 15:   PetscCall(MatCreate(comm, &A));
 16:   PetscCall(MatSetSizes(A, PETSC_DECIDE, PETSC_DECIDE, N, N));
 17:   PetscCall(MatSetFromOptions(A));
 18:   PetscCall(MatSeqAIJSetPreallocation(A, 3, NULL));
 19:   PetscCall(MatMPIAIJSetPreallocation(A, 3, NULL, 2, NULL));
 20:   PetscCall(MatZeroEntries(A));
 21:   PetscCall(MatDestroy(&A));
 22:   PetscCall(PetscFinalize());
 23:   return 0;
 24: }

 26: /*TEST
 27:    test:
 28:       requires: kokkos_kernels
 29:       nsize: {{1 2}}
 30:       output_file: output/ex252_1.out
 31:       args: -mat_type aijkokkos
 32: TEST*/