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;

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

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

 31: /*TEST

 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)

 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)

 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)

 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)

 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)

 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)

 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)

 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)

 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)

 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)

 97: TEST*/