xref: /petsc/src/mat/tests/ex252.c (revision 58d68138c660dfb4e9f5b03334792cd4f2ffd7cc)
1 static char help[] = "Test MatZeroEntries() on unassembled matrices \n\n";
2 
3 #include <petscmat.h>
4 
5 int main(int argc, char **args) {
6   Mat      A;
7   PetscInt N = 32;
8   MPI_Comm comm;
9 
10   PetscFunctionBeginUser;
11   PetscCall(PetscInitialize(&argc, &args, (char *)0, help));
12   comm = PETSC_COMM_WORLD;
13   PetscCall(PetscOptionsGetInt(NULL, NULL, "-N", &N, NULL));
14   PetscCall(MatCreate(comm, &A));
15   PetscCall(MatSetSizes(A, PETSC_DECIDE, PETSC_DECIDE, N, N));
16   PetscCall(MatSetFromOptions(A));
17   PetscCall(MatSeqAIJSetPreallocation(A, 3, NULL));
18   PetscCall(MatMPIAIJSetPreallocation(A, 3, NULL, 2, NULL));
19   PetscCall(MatZeroEntries(A));
20   PetscCall(MatDestroy(&A));
21   PetscCall(PetscFinalize());
22   return 0;
23 }
24 
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*/
32