Actual source code: ex190.c
1: static char help[] = "Tests MatLoad() with uneven dimensions set in program\n\n";
3: #include <petscmat.h>
5: int main(int argc, char **args)
6: {
7: Mat A;
8: PetscViewer fd;
9: char file[PETSC_MAX_PATH_LEN];
10: PetscBool flg;
11: PetscMPIInt rank;
14: PetscInitialize(&argc, &args, (char *)0, help);
15: MPI_Comm_rank(PETSC_COMM_WORLD, &rank);
17: /* Determine files from which we read the matrix */
18: PetscOptionsGetString(NULL, NULL, "-f", file, sizeof(file), &flg);
21: /* Load matrices */
22: PetscViewerBinaryOpen(PETSC_COMM_WORLD, file, FILE_MODE_READ, &fd);
23: MatCreate(PETSC_COMM_WORLD, &A);
24: MatSetFromOptions(A);
25: MatSetBlockSize(A, 2);
26: if (rank == 0) {
27: MatSetSizes(A, 4, PETSC_DETERMINE, PETSC_DETERMINE, PETSC_DETERMINE);
28: } else {
29: MatSetSizes(A, 8, PETSC_DETERMINE, PETSC_DETERMINE, PETSC_DETERMINE);
30: }
31: MatLoad(A, fd);
32: PetscViewerDestroy(&fd);
33: MatDestroy(&A);
34: PetscFinalize();
35: return 0;
36: }
38: /*TEST
40: test:
41: nsize: 2
42: args: -mat_type aij -mat_view -f ${wPETSC_DIR}/share/petsc/datafiles/matrices/ns-real-int32-float64
43: requires: double !complex !defined(PETSC_USE_64BIT_INDICES)
45: test:
46: suffix: 2
47: nsize: 2
48: args: -mat_type baij -mat_view -f ${wPETSC_DIR}/share/petsc/datafiles/matrices/ns-real-int32-float64
49: requires: double !complex !defined(PETSC_USE_64BIT_INDICES)
51: test:
52: suffix: 3
53: nsize: 2
54: args: -mat_type sbaij -mat_view -f ${wPETSC_DIR}/share/petsc/datafiles/matrices/ns-real-int32-float64
55: requires: double !complex !defined(PETSC_USE_64BIT_INDICES)
57: TEST*/