Actual source code: ex45.c
1: /* -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.
3: Detected bug in DMCreateMatrix() for skinny domains with periodic boundary conditions in overestimating nonzero preallocation
5: Creation Date : 08-12-2016
7: Last Modified : Thu 08 Dec 2016 10:46:02 AM CET
9: Created By : Davide Monsorno
11: _._._._._._._._._._._._._._._._._._._._._.*/
13: #include <petscdmda.h>
15: int main(int argc, char *argv[])
16: {
17: PetscInt nx = 2;
18: PetscInt ny = 2;
19: PetscInt nz = 128;
20: DM da;
21: Mat A;
24: PetscInitialize(&argc, &argv, NULL, NULL);
25: DMDACreate3d(PETSC_COMM_WORLD, DM_BOUNDARY_PERIODIC, DM_BOUNDARY_PERIODIC, DM_BOUNDARY_GHOSTED, DMDA_STENCIL_BOX, nx, ny, nz, PETSC_DECIDE, PETSC_DECIDE, PETSC_DECIDE, 1, 2, NULL, NULL, NULL, &da);
26: DMSetFromOptions(da);
27: DMSetUp(da);
28: DMView(da, PETSC_VIEWER_STDOUT_WORLD);
29: DMCreateMatrix(da, &A);
31: MatDestroy(&A);
32: DMDestroy(&da);
33: PetscFinalize();
34: return 0;
35: }
37: /*TEST
39: test:
40: nsize: 5
42: TEST*/