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