Actual source code: ex26.c

petsc-3.6.1 2015-08-06
Report Typos and Errors
  2: static char help[] = "Tests error message in DMCreateColoring() with periodic boundary conditions. \n\n";


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

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

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

 32:   /* free spaces */
 33:   MatDestroy(&J);
 34:   MatFDColoringDestroy(&matfdcoloring);
 35:   DMDestroy(&da);
 36:   PetscFinalize();
 37:   return(0);
 38: }