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 PetscErrorCode ierr; 11 PetscBool flg; 12 13 ierr = PetscInitialize(&argc,&args,(char*)0,help);if (ierr) return ierr; 14 /* Determine files from which we read the matrix */ 15 ierr = PetscOptionsGetString(NULL,NULL,"-f",file,sizeof(file),&flg);CHKERRQ(ierr); 16 if (!flg) SETERRQ(PETSC_COMM_WORLD,PETSC_ERR_USER,"Must indicate binary file with the -f"); 17 18 /* Load matrices */ 19 ierr = PetscViewerBinaryOpen(PETSC_COMM_WORLD,file,FILE_MODE_READ,&fd);CHKERRQ(ierr); 20 ierr = MatCreate(PETSC_COMM_WORLD,&A);CHKERRQ(ierr); 21 ierr = MatSetType(A,MATSBAIJ);CHKERRQ(ierr); 22 ierr = MatSetFromOptions(A);CHKERRQ(ierr); 23 ierr = MatSetBlockSize(A,2);CHKERRQ(ierr); 24 ierr = MatLoad(A,fd);CHKERRQ(ierr); 25 ierr = PetscViewerDestroy(&fd);CHKERRQ(ierr); 26 ierr = MatDestroy(&A);CHKERRQ(ierr); 27 ierr = PetscFinalize(); 28 return ierr; 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