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