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;

 12:   PetscInitialize(&argc, &args, (char *)0, help);
 13:   comm = PETSC_COMM_WORLD;
 14:   PetscOptionsGetInt(NULL, NULL, "-N", &N, NULL);
 15:   MatCreate(comm, &A);
 16:   MatSetSizes(A, PETSC_DECIDE, PETSC_DECIDE, N, N);
 17:   MatSetFromOptions(A);
 18:   MatSeqAIJSetPreallocation(A, 3, NULL);
 19:   MatMPIAIJSetPreallocation(A, 3, NULL, 2, NULL);
 20:   MatZeroEntries(A);
 21:   MatDestroy(&A);
 22:   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*/