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 { 7 Mat A; 8 PetscInt N = 32; 9 MPI_Comm comm; 10 PetscErrorCode ierr; 11 12 ierr = PetscInitialize(&argc, &args, (char*) 0, help);if (ierr) return ierr; 13 comm = PETSC_COMM_WORLD; 14 ierr = PetscOptionsGetInt(NULL,NULL, "-N", &N, NULL);CHKERRQ(ierr); 15 ierr = MatCreate(comm, &A);CHKERRQ(ierr); 16 ierr = MatSetSizes(A, PETSC_DECIDE, PETSC_DECIDE, N, N);CHKERRQ(ierr); 17 ierr = MatSetFromOptions(A);CHKERRQ(ierr); 18 ierr = MatSeqAIJSetPreallocation(A, 3, NULL);CHKERRQ(ierr); 19 ierr = MatMPIAIJSetPreallocation(A, 3, NULL, 2, NULL);CHKERRQ(ierr); 20 ierr = MatZeroEntries(A);CHKERRQ(ierr); 21 ierr = MatDestroy(&A);CHKERRQ(ierr); 22 ierr = PetscFinalize(); 23 return ierr; 24 } 25 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*/ 33 34