Actual source code: ex6.c
1: /*
2: Demonstrates the use of the "extra", polymorphic versions of many functions
3: */
4: #include petscmat.h
6: int main(int argc,char **args)
7: {
9: Vec x;
10: Mat mat,matb,matsb;
12: #if defined(__cplusplus)
13: PetscInitialize(&argc,&args);
14: #else
15: PetscInitialize(&argc,&args,0,0);
16: #endif
18: #if defined(__cplusplus)
19: VecCreate(&x);
20: #else
21: VecCreate(PETSC_COMM_SELF,&x);
22: #endif
23: VecSetSizes(x,6,0);
24: VecSetFromOptions(x);
26: #if defined(__cplusplus)
27: mat = MatCreateSeqAIJ(6,6);
28: matb = MatCreateSeqBAIJ(2,6,6,5);
29: matsb = MatCreateSeqSBAIJ(2,6,6,5);
30: #else
31: MatCreateSeqAIJ(PETSC_COMM_SELF,6,6,0,0,&mat);
32: MatCreateSeqBAIJ(PETSC_COMM_SELF,2,6,6,5,0,&mat);
33: MatCreateSeqSBAIJ(PETSC_COMM_SELF,2,6,6,5,0,&mat);
34: #endif
36: MatDestroy(mat);
37: MatDestroy(matb);
38: MatDestroy(matsb);
39: VecDestroy(x);
40: PetscFinalize();
41: return 0;
42: }