Actual source code: ex180.c

  1: static char help[] = "Tests MatLoad() with blocksize set in 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;

 12:   PetscInitialize(&argc,&args,(char*)0,help);
 13:   /* Determine files from which we read the matrix */
 14:   PetscOptionsGetString(NULL,NULL,"-f",file,sizeof(file),&flg);

 17:   /* Load matrices */
 18:   PetscViewerBinaryOpen(PETSC_COMM_WORLD,file,FILE_MODE_READ,&fd);
 19:   MatCreate(PETSC_COMM_WORLD,&A);
 20:   MatSetType(A,MATSBAIJ);
 21:   MatSetFromOptions(A);
 22:   MatSetBlockSize(A,2);
 23:   MatLoad(A,fd);
 24:   PetscViewerDestroy(&fd);
 25:   MatDestroy(&A);
 26:   PetscFinalize();
 27:   return 0;
 28: }

 30: /*TEST

 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)

 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)

 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)

 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)

 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)

 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)

 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)

 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)

 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)

 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)

 96: TEST*/