Actual source code: ex232.c
2: /* tests MatSeqSBAIJSetPreallocationCSR() and MatMPISBAIJSetPreallocationCSR() */
4: #include <petsc.h>
6: int main(int argc, char **args)
7: {
8: PetscInt ia[3] = { 0, 2, 4};
9: PetscInt ja[4] = { 0, 1, 0, 1};
10: PetscScalar c[16] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 };
11: Mat ssbaij;
12: Mat msbaij;
14: PetscInitialize(&argc,&args,(char*)0,(char*)0);
16: MatCreate(PETSC_COMM_SELF, &ssbaij);
17: MatCreate(PETSC_COMM_SELF, &msbaij);
18: MatSetType(ssbaij, MATSEQSBAIJ);
19: MatSetType(msbaij, MATMPISBAIJ);
20: MatSetBlockSize(ssbaij, 2);
21: MatSetSizes(ssbaij, 4, 4, 4, 4);
22: MatSetBlockSize(msbaij, 2);
23: MatSetSizes(msbaij, 4, 4, 4, 4);
24: MatSeqSBAIJSetPreallocationCSR(ssbaij, 2, ia, ja, c);
25: MatMPISBAIJSetPreallocationCSR(msbaij, 2, ia, ja, c);
26: MatView(ssbaij, PETSC_VIEWER_STDOUT_(PETSC_COMM_SELF));
27: MatView(msbaij, PETSC_VIEWER_STDOUT_(PETSC_COMM_SELF));
28: MatDestroy(&ssbaij);
29: MatDestroy(&msbaij);
30: PetscFinalize();
31: return 0;
32: }
34: /*TEST
36: test:
37: filter: sed "s?\.??g"
39: TEST*/