Actual source code: ex255.c
1: static char help[] = "Tests MatConvert from AIJ to MATIS with a block size greater than 1.\n";
3: #include <petscmat.h>
4: int main(int argc, char **args)
5: {
6: Mat A, B;
7: char file[PETSC_MAX_PATH_LEN];
8: PetscViewer fd;
9: PetscBool flg, equal;
12: PetscInitialize(&argc, &args, (char *)0, help);
14: /* Load an AIJ matrix */
15: PetscOptionsGetString(NULL, NULL, "-f", file, sizeof(file), &flg);
17: PetscViewerBinaryOpen(PETSC_COMM_WORLD, file, FILE_MODE_READ, &fd);
18: MatCreate(PETSC_COMM_WORLD, &A);
19: MatSetFromOptions(A);
20: MatLoad(A, fd);
22: /* Convert it to MATIS */
23: MatConvert(A, MATIS, MAT_INITIAL_MATRIX, &B);
25: /* Check they are equal */
26: MatEqual(A, B, &equal);
29: MatDestroy(&A);
30: MatDestroy(&B);
31: PetscViewerDestroy(&fd);
32: PetscFinalize();
33: }
35: /*TEST
36: test:
37: requires: datafilespath !complex double !defined(PETSC_USE_64BIT_INDICES)
38: args: -mat_type aij -matload_block_size {{1 2}} -f ${DATAFILESPATH}/matrices/smallbs2
39: output_file: output/empty.out
41: TEST*/