Actual source code: ex31.c

  1: static char help[] = "Tests MAIJ matrix for large DOF\n\n";

  3: #include <petscdmda.h>

  7: int main(int argc,char *argv[])
  8: {
  9:   Mat            M;
 10:   Vec            x,y;
 12:   DM             da,daf;

 14:   PetscInitialize(&argc,&argv,0,help);
 15:   DMDACreate2d(PETSC_COMM_WORLD, DMDA_BOUNDARY_NONE, DMDA_BOUNDARY_NONE,DMDA_STENCIL_STAR,4,5,PETSC_DECIDE,PETSC_DECIDE,41,1,0,0,&da);
 16:   DMRefine(da,PETSC_COMM_WORLD,&daf);
 17:   DMGetInterpolation(da,daf,&M,PETSC_NULL);
 18:   DMCreateGlobalVector(da,&x);
 19:   DMCreateGlobalVector(daf,&y);

 21:   MatMult(M,x,y);
 22:   MatMultTranspose(M,y,x);
 23:   DMDestroy(&da);
 24:   DMDestroy(&daf);
 25:   VecDestroy(&x);
 26:   VecDestroy(&y);
 27:   MatDestroy(&M);
 28:   PetscFinalize();
 29:   return 0;
 30: }