1 2 static char help[] = "Tests error message in DMCreateColoring() with periodic boundary conditions. \n\n"; 3 4 #include <petscdm.h> 5 #include <petscdmda.h> 6 #include <petscmat.h> 7 8 int main(int argc,char **argv) 9 { 10 Mat J; 11 DM da; 12 MatFDColoring matfdcoloring = 0; 13 ISColoring iscoloring; 14 15 CHKERRQ(PetscInitialize(&argc,&argv,(char*)0,help)); 16 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 17 Create distributed array (DMDA) to manage parallel grid and vectors 18 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ 19 CHKERRQ(DMDACreate2d(PETSC_COMM_WORLD,DM_BOUNDARY_PERIODIC, DM_BOUNDARY_NONE,DMDA_STENCIL_BOX,-5,-5,PETSC_DECIDE,PETSC_DECIDE,1,2,0,0,&da)); 20 CHKERRQ(DMSetFromOptions(da)); 21 CHKERRQ(DMSetUp(da)); 22 CHKERRQ(DMSetMatType(da,MATAIJ)); 23 CHKERRQ(DMCreateMatrix(da,&J)); 24 CHKERRQ(DMCreateColoring(da,IS_COLORING_LOCAL,&iscoloring)); 25 CHKERRQ(MatFDColoringCreate(J,iscoloring,&matfdcoloring)); 26 CHKERRQ(MatFDColoringSetUp(J,iscoloring,matfdcoloring)); 27 CHKERRQ(ISColoringDestroy(&iscoloring)); 28 29 /* free spaces */ 30 CHKERRQ(MatDestroy(&J)); 31 CHKERRQ(MatFDColoringDestroy(&matfdcoloring)); 32 CHKERRQ(DMDestroy(&da)); 33 CHKERRQ(PetscFinalize()); 34 return 0; 35 } 36