1 static char help[] = "Tests periodic boundary conditions for DMDA1d with periodic boundary conditions.\n\n";
2
3 #include <petscdmda.h>
4
main(int argc,char ** argv)5 int main(int argc, char **argv)
6 {
7 DM da;
8 Mat A;
9 const PetscInt dfill[4] = {0, 1, 0, 1}, ofill[4] = {0, 1, 1, 0};
10
11 PetscFunctionBeginUser;
12 PetscCall(PetscInitialize(&argc, &argv, NULL, help));
13 PetscCall(DMDACreate1d(PETSC_COMM_WORLD, DM_BOUNDARY_PERIODIC, 7, 2, 1, NULL, &da));
14 PetscCall(DMSetFromOptions(da));
15 PetscCall(DMDASetBlockFills(da, dfill, ofill));
16 PetscCall(DMSetUp(da));
17 PetscCall(DMCreateMatrix(da, &A));
18 PetscCall(MatView(A, PETSC_VIEWER_STDOUT_WORLD));
19 PetscCall(PetscViewerPushFormat(PETSC_VIEWER_STDOUT_WORLD, PETSC_VIEWER_ASCII_INFO));
20 PetscCall(MatView(A, PETSC_VIEWER_STDOUT_WORLD));
21 PetscCall(MatDestroy(&A));
22 PetscCall(DMDestroy(&da));
23 PetscCall(PetscFinalize());
24 return 0;
25 }
26
27 /*TEST
28
29 test:
30
31 test:
32 suffix: 2
33 nsize: 2
34
35 TEST*/
36