Actual source code: ex26.c
petsc-dev 2014-02-02
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: DMSetMatType(da,MATAIJ);
25: DMCreateMatrix(da,&J);
26: DMCreateColoring(da,IS_COLORING_GHOSTED,&iscoloring);
27: MatFDColoringCreate(J,iscoloring,&matfdcoloring);
28: MatFDColoringSetUp(J,iscoloring,matfdcoloring);
29: ISColoringDestroy(&iscoloring);
31: /* free spaces */
32: MatDestroy(&J);
33: MatFDColoringDestroy(&matfdcoloring);
34: DMDestroy(&da);
35: PetscFinalize();
36: return(0);
37: }