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