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 PetscCall(PetscInitialize(&argc,&argv,(char*)0,help)); 16 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 17 Create distributed array (DMDA) to manage parallel grid and vectors 18 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ 19 PetscCall(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 PetscCall(DMSetFromOptions(da)); 21 PetscCall(DMSetUp(da)); 22 PetscCall(DMSetMatType(da,MATAIJ)); 23 PetscCall(DMCreateMatrix(da,&J)); 24 PetscCall(DMCreateColoring(da,IS_COLORING_LOCAL,&iscoloring)); 25 PetscCall(MatFDColoringCreate(J,iscoloring,&matfdcoloring)); 26 PetscCall(MatFDColoringSetUp(J,iscoloring,matfdcoloring)); 27 PetscCall(ISColoringDestroy(&iscoloring)); 28 29 /* free spaces */ 30 PetscCall(MatDestroy(&J)); 31 PetscCall(MatFDColoringDestroy(&matfdcoloring)); 32 PetscCall(DMDestroy(&da)); 33 PetscCall(PetscFinalize()); 34 return 0; 35 } 36