Actual source code: ex199.c


  2: static char help[] = "Tests the different MatColoring implementations.\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;

 17:   PetscInitialize(&argc, &args, (char *)0, help);
 18:   MPI_Comm_size(PETSC_COMM_WORLD, &size);

 20:   PetscOptionsGetString(NULL, NULL, "-f", file, sizeof(file), &flg);
 22:   PetscViewerBinaryOpen(PETSC_COMM_WORLD, file, FILE_MODE_READ, &viewer);
 23:   MatCreate(PETSC_COMM_WORLD, &C);
 24:   MatLoad(C, viewer);
 25:   PetscViewerDestroy(&viewer);

 27:   MatColoringCreate(C, &ctx);
 28:   MatColoringSetFromOptions(ctx);
 29:   MatColoringApply(ctx, &coloring);
 30:   MatColoringTest(ctx, coloring);
 31:   if (size == 1) {
 32:     /* jp, power and greedy have bug -- need to be fixed */
 33:     MatISColoringTest(C, coloring);
 34:   }

 36:   /* Free data structures */
 37:   ISColoringDestroy(&coloring);
 38:   MatColoringDestroy(&ctx);
 39:   MatDestroy(&C);
 40:   PetscFinalize();
 41:   return 0;
 42: }

 44: /*TEST

 46:    test:
 47:       nsize: {{3}}
 48:       requires: datafilespath !complex double !defined(PETSC_USE_64BIT_INDICES)
 49:       args: -f ${DATAFILESPATH}/matrices/arco1 -mat_coloring_type {{ jp power natural greedy}} -mat_coloring_distance {{ 1 2}}

 51:    test:
 52:       suffix: 2
 53:       nsize: {{1 2}}
 54:       requires: datafilespath !complex double !defined(PETSC_USE_64BIT_INDICES)
 55:       args: -f ${DATAFILESPATH}/matrices/arco1 -mat_coloring_type {{  sl lf id }} -mat_coloring_distance 2
 56:       output_file: output/ex199_1.out

 58: TEST*/