Actual source code: ex31.c

petsc-3.13.6 2020-09-29
Report Typos and Errors
  1: static char help[] = "Tests MAIJ matrix for large DOF\n\n";

  3:  #include <petscdm.h>
  4:  #include <petscdmda.h>

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

 13:   PetscInitialize(&argc,&argv,0,help);if (ierr) return ierr;
 14:   DMDACreate2d(PETSC_COMM_WORLD, DM_BOUNDARY_NONE, DM_BOUNDARY_NONE,DMDA_STENCIL_STAR,4,5,PETSC_DECIDE,PETSC_DECIDE,41,1,0,0,&da);
 15:   DMSetFromOptions(da);
 16:   DMSetUp(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 ierr;
 31: }


 34: /*TEST

 36:    test:
 37:       nsize: 2

 39: TEST*/