1 static char help[] = "Tests MatLoad() with blocksize set in in program\n\n"; 2 3 #include <petscmat.h> 4 5 int main(int argc, char **args) { 6 Mat A; 7 PetscViewer fd; 8 char file[PETSC_MAX_PATH_LEN]; 9 PetscBool flg; 10 11 PetscFunctionBeginUser; 12 PetscCall(PetscInitialize(&argc, &args, (char *)0, help)); 13 /* Determine files from which we read the matrix */ 14 PetscCall(PetscOptionsGetString(NULL, NULL, "-f", file, sizeof(file), &flg)); 15 PetscCheck(flg, PETSC_COMM_WORLD, PETSC_ERR_USER, "Must indicate binary file with the -f"); 16 17 /* Load matrices */ 18 PetscCall(PetscViewerBinaryOpen(PETSC_COMM_WORLD, file, FILE_MODE_READ, &fd)); 19 PetscCall(MatCreate(PETSC_COMM_WORLD, &A)); 20 PetscCall(MatSetType(A, MATSBAIJ)); 21 PetscCall(MatSetFromOptions(A)); 22 PetscCall(MatSetBlockSize(A, 2)); 23 PetscCall(MatLoad(A, fd)); 24 PetscCall(PetscViewerDestroy(&fd)); 25 PetscCall(MatDestroy(&A)); 26 PetscCall(PetscFinalize()); 27 return 0; 28 } 29 30 /*TEST 31 32 test: 33 args: -mat_type aij -f ${wPETSC_DIR}/share/petsc/datafiles/matrices/ns-real-int32-float64 -malloc_dump 34 output_file: output/ex180_1.out 35 requires: !complex double !defined(PETSC_USE_64BIT_INDICES) 36 37 test: 38 suffix: 2 39 nsize: 2 40 args: -mat_type aij -f ${wPETSC_DIR}/share/petsc/datafiles/matrices/ns-real-int32-float64 -malloc_dump 41 output_file: output/ex180_1.out 42 requires: !complex double !defined(PETSC_USE_64BIT_INDICES) 43 44 test: 45 suffix: 3 46 args: -mat_type baij -f ${wPETSC_DIR}/share/petsc/datafiles/matrices/ns-real-int32-float64 -malloc_dump 47 output_file: output/ex180_1.out 48 requires: !complex double !defined(PETSC_USE_64BIT_INDICES) 49 50 test: 51 suffix: 4more 52 nsize: 2 53 args: -mat_type baij -f ${wPETSC_DIR}/share/petsc/datafiles/matrices/ns-real-int32-float64 -malloc_dump 54 output_file: output/ex180_1.out 55 requires: !complex double !defined(PETSC_USE_64BIT_INDICES) 56 57 test: 58 suffix: 5 59 args: -mat_type sbaij -f ${wPETSC_DIR}/share/petsc/datafiles/matrices/ns-real-int32-float64 -malloc_dump 60 output_file: output/ex180_1.out 61 requires: !complex double !defined(PETSC_USE_64BIT_INDICES) 62 63 test: 64 suffix: 6 65 nsize: 2 66 args: -mat_type sbaij -f ${wPETSC_DIR}/share/petsc/datafiles/matrices/ns-real-int32-float64 -malloc_dump 67 output_file: output/ex180_1.out 68 requires: !complex double !defined(PETSC_USE_64BIT_INDICES) 69 70 test: 71 suffix: 7 72 args: -mat_type sbaij -matload_block_size 4 -f ${wPETSC_DIR}/share/petsc/datafiles/matrices/ns-real-int32-float64 -malloc_dump 73 output_file: output/ex180_1.out 74 requires: !complex double !defined(PETSC_USE_64BIT_INDICES) 75 76 test: 77 suffix: 8 78 nsize: 2 79 args: -mat_type sbaij -matload_block_size 4 -f ${wPETSC_DIR}/share/petsc/datafiles/matrices/ns-real-int32-float64 -malloc_dump 80 output_file: output/ex180_1.out 81 requires: !complex double !defined(PETSC_USE_64BIT_INDICES) 82 83 test: 84 suffix: 9 85 args: -mat_type baij -matload_block_size 4 -f ${wPETSC_DIR}/share/petsc/datafiles/matrices/ns-real-int32-float64 -malloc_dump 86 output_file: output/ex180_1.out 87 requires: !complex double !defined(PETSC_USE_64BIT_INDICES) 88 89 test: 90 suffix: 10 91 nsize: 2 92 args: -mat_type baij -matload_block_size 4 -f ${wPETSC_DIR}/share/petsc/datafiles/matrices/ns-real-int32-float64 -malloc_dump 93 output_file: output/ex180_1.out 94 requires: !complex double !defined(PETSC_USE_64BIT_INDICES) 95 96 TEST*/ 97