Actual source code: ex26.c

petsc-3.3-p6 2013-02-11
  2: static char help[] = "Tests error message in DMCreateColoring() with periodic boundary conditions. \n\n";


  5: #include <petscdmda.h>
  6: #include <petscmat.h>

 10: int main(int argc,char **argv)
 11: {
 12:   Mat            J;
 14:   DM             da;
 15:   MatFDColoring  matfdcoloring = 0;
 16:   ISColoring     iscoloring;

 18:   PetscInitialize(&argc,&argv,(char *)0,help);
 19:   /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 20:      Create distributed array (DMDA) to manage parallel grid and vectors
 21:   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 22:   DMDACreate2d(PETSC_COMM_WORLD,DMDA_BOUNDARY_PERIODIC, DMDA_BOUNDARY_NONE,DMDA_STENCIL_BOX,-5,-5,
 23:                     PETSC_DECIDE,PETSC_DECIDE,1,2,0,0,&da);
 24:   DMCreateMatrix(da,MATAIJ,&J);
 25:   DMCreateColoring(da,IS_COLORING_GHOSTED,MATAIJ,&iscoloring);
 26:   MatFDColoringCreate(J,iscoloring,&matfdcoloring);
 27:   ISColoringDestroy(&iscoloring);

 29:   /* free spaces */
 30:   MatDestroy(&J);
 31:   MatFDColoringDestroy(&matfdcoloring);
 32:   DMDestroy(&da);
 33:   PetscFinalize();
 34:   return(0);
 35: }