Actual source code: ex52.c
petsc-3.13.6 2020-09-29
2: static char help[] = "Tests periodic boundary conditions for DMDA1d with periodic boundary conditions.\n\n";
4: #include <petscdmda.h>
6: int main(int argc,char **argv)
7: {
8: PetscErrorCode ierr;
9: DM da;
10: Mat A;
11: const PetscInt dfill[4] = {0,1,0,1},ofill[4] = {0,1,1,0};
13: PetscInitialize(&argc,&argv,(char*)0,help);if (ierr) return ierr;
14: DMDACreate1d(PETSC_COMM_WORLD,DM_BOUNDARY_PERIODIC,7,2,1,NULL,&da);
15: DMSetFromOptions(da);
16: DMDASetBlockFills(da,dfill,ofill);
17: DMSetUp(da);
18: DMCreateMatrix(da,&A);
19: MatView(A,PETSC_VIEWER_STDOUT_WORLD);
20: PetscViewerPushFormat(PETSC_VIEWER_STDOUT_WORLD,PETSC_VIEWER_ASCII_INFO);
21: MatView(A,PETSC_VIEWER_STDOUT_WORLD);
22: MatDestroy(&A);
23: DMDestroy(&da);
24: PetscFinalize();
25: return ierr;
26: }
29: /*TEST
31: test:
33: test:
34: suffix: 2
35: nsize: 2
37: TEST*/