Actual source code: ex199.c
2: static char help[] = "Tests the different MatColoring implementatons.\n\n";
4: #include <petscmat.h>
6: int main(int argc,char **args)
7: {
8: Mat C;
9: PetscViewer viewer;
10: char file[128];
11: PetscBool flg;
12: MatColoring ctx;
13: ISColoring coloring;
14: PetscMPIInt size;
16: PetscInitialize(&argc,&args,(char*)0,help);
17: MPI_Comm_size(PETSC_COMM_WORLD,&size);
19: PetscOptionsGetString(NULL,NULL,"-f",file,sizeof(file),&flg);
21: PetscViewerBinaryOpen(PETSC_COMM_WORLD,file,FILE_MODE_READ,&viewer);
22: MatCreate(PETSC_COMM_WORLD,&C);
23: MatLoad(C,viewer);
24: PetscViewerDestroy(&viewer);
26: MatColoringCreate(C,&ctx);
27: MatColoringSetFromOptions(ctx);
28: MatColoringApply(ctx,&coloring);
29: MatColoringTest(ctx,coloring);
30: if (size == 1) {
31: /* jp, power and greedy have bug -- need to be fixed */
32: MatISColoringTest(C,coloring);
33: }
35: /* Free data structures */
36: ISColoringDestroy(&coloring);
37: MatColoringDestroy(&ctx);
38: MatDestroy(&C);
39: PetscFinalize();
40: return 0;
41: }
43: /*TEST
45: test:
46: nsize: {{3}}
47: requires: datafilespath !complex double !defined(PETSC_USE_64BIT_INDICES)
48: args: -f ${DATAFILESPATH}/matrices/arco1 -mat_coloring_type {{ jp power natural greedy}} -mat_coloring_distance {{ 1 2}}
50: test:
51: suffix: 2
52: nsize: {{1 2}}
53: requires: datafilespath !complex double !defined(PETSC_USE_64BIT_INDICES)
54: args: -f ${DATAFILESPATH}/matrices/arco1 -mat_coloring_type {{ sl lf id }} -mat_coloring_distance 2
55: output_file: output/ex199_1.out
57: TEST*/