xref: /petsc/src/dm/tests/ex52.c (revision 40badf4fbc550ac1f60bd080eaff6de6d55b946d)
1 
2 static char help[] = "Tests periodic boundary conditions for DMDA1d with periodic boundary conditions.\n\n";
3 
4 #include <petscdmda.h>
5 
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};
12 
13   ierr = PetscInitialize(&argc,&argv,(char*)0,help);if (ierr) return ierr;
14   CHKERRQ(DMDACreate1d(PETSC_COMM_WORLD,DM_BOUNDARY_PERIODIC,7,2,1,NULL,&da));
15   CHKERRQ(DMSetFromOptions(da));
16   CHKERRQ(DMDASetBlockFills(da,dfill,ofill));
17   CHKERRQ(DMSetUp(da));
18   CHKERRQ(DMCreateMatrix(da,&A));
19   CHKERRQ(MatView(A,PETSC_VIEWER_STDOUT_WORLD));
20   CHKERRQ(PetscViewerPushFormat(PETSC_VIEWER_STDOUT_WORLD,PETSC_VIEWER_ASCII_INFO));
21   CHKERRQ(MatView(A,PETSC_VIEWER_STDOUT_WORLD));
22   CHKERRQ(MatDestroy(&A));
23   CHKERRQ(DMDestroy(&da));
24   ierr = PetscFinalize();
25   return ierr;
26 }
27 
28 /*TEST
29 
30    test:
31 
32    test:
33       suffix: 2
34       nsize: 2
35 
36 TEST*/
37