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

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