Actual source code: ex31.c
petsc-3.7.7 2017-09-25
1: static char help[] = "Tests MAIJ matrix for large DOF\n\n";
3: #include <petscdm.h>
4: #include <petscdmda.h>
8: int main(int argc,char *argv[])
9: {
10: Mat M;
11: Vec x,y;
13: DM da,daf;
15: PetscInitialize(&argc,&argv,0,help);
16: DMDACreate2d(PETSC_COMM_WORLD, DM_BOUNDARY_NONE, DM_BOUNDARY_NONE,DMDA_STENCIL_STAR,4,5,PETSC_DECIDE,PETSC_DECIDE,41,1,0,0,&da);
17: DMRefine(da,PETSC_COMM_WORLD,&daf);
18: DMCreateInterpolation(da,daf,&M,NULL);
19: DMCreateGlobalVector(da,&x);
20: DMCreateGlobalVector(daf,&y);
22: MatMult(M,x,y);
23: MatMultTranspose(M,y,x);
24: DMDestroy(&da);
25: DMDestroy(&daf);
26: VecDestroy(&x);
27: VecDestroy(&y);
28: MatDestroy(&M);
29: PetscFinalize();
30: return 0;
31: }