xref: /petsc/src/dm/tests/ex52.c (revision b122ec5aa1bd4469eb4e0673542fb7de3f411254)
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   DM               da;
9   Mat              A;
10   const PetscInt   dfill[4] = {0,1,0,1},ofill[4] = {0,1,1,0};
11 
12   CHKERRQ(PetscInitialize(&argc,&argv,(char*)0,help));
13   CHKERRQ(DMDACreate1d(PETSC_COMM_WORLD,DM_BOUNDARY_PERIODIC,7,2,1,NULL,&da));
14   CHKERRQ(DMSetFromOptions(da));
15   CHKERRQ(DMDASetBlockFills(da,dfill,ofill));
16   CHKERRQ(DMSetUp(da));
17   CHKERRQ(DMCreateMatrix(da,&A));
18   CHKERRQ(MatView(A,PETSC_VIEWER_STDOUT_WORLD));
19   CHKERRQ(PetscViewerPushFormat(PETSC_VIEWER_STDOUT_WORLD,PETSC_VIEWER_ASCII_INFO));
20   CHKERRQ(MatView(A,PETSC_VIEWER_STDOUT_WORLD));
21   CHKERRQ(MatDestroy(&A));
22   CHKERRQ(DMDestroy(&da));
23   CHKERRQ(PetscFinalize());
24   return 0;
25 }
26 
27 /*TEST
28 
29    test:
30 
31    test:
32       suffix: 2
33       nsize: 2
34 
35 TEST*/
36