Actual source code: ex52.c


  2: static char help[] = "Tests periodic boundary conditions for DMDA1d with periodic boundary conditions.\n\n";

  4: #include <petscdmda.h>

  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};

 12:   PetscInitialize(&argc,&argv,(char*)0,help);
 13:   DMDACreate1d(PETSC_COMM_WORLD,DM_BOUNDARY_PERIODIC,7,2,1,NULL,&da);
 14:   DMSetFromOptions(da);
 15:   DMDASetBlockFills(da,dfill,ofill);
 16:   DMSetUp(da);
 17:   DMCreateMatrix(da,&A);
 18:   MatView(A,PETSC_VIEWER_STDOUT_WORLD);
 19:   PetscViewerPushFormat(PETSC_VIEWER_STDOUT_WORLD,PETSC_VIEWER_ASCII_INFO);
 20:   MatView(A,PETSC_VIEWER_STDOUT_WORLD);
 21:   MatDestroy(&A);
 22:   DMDestroy(&da);
 23:   PetscFinalize();
 24:   return 0;
 25: }

 27: /*TEST

 29:    test:

 31:    test:
 32:       suffix: 2
 33:       nsize: 2

 35: TEST*/