xref: /petsc/src/dm/tests/ex31.c (revision 58d68138c660dfb4e9f5b03334792cd4f2ffd7cc)
1 static char help[] = "Tests MAIJ matrix for large DOF\n\n";
2 
3 #include <petscdm.h>
4 #include <petscdmda.h>
5 
6 int main(int argc, char *argv[]) {
7   Mat M;
8   Vec x, y;
9   DM  da, daf;
10 
11   PetscFunctionBeginUser;
12   PetscCall(PetscInitialize(&argc, &argv, 0, help));
13   PetscCall(DMDACreate2d(PETSC_COMM_WORLD, DM_BOUNDARY_NONE, DM_BOUNDARY_NONE, DMDA_STENCIL_STAR, 4, 5, PETSC_DECIDE, PETSC_DECIDE, 41, 1, 0, 0, &da));
14   PetscCall(DMSetFromOptions(da));
15   PetscCall(DMSetUp(da));
16   PetscCall(DMRefine(da, PETSC_COMM_WORLD, &daf));
17   PetscCall(DMCreateInterpolation(da, daf, &M, NULL));
18   PetscCall(DMCreateGlobalVector(da, &x));
19   PetscCall(DMCreateGlobalVector(daf, &y));
20 
21   PetscCall(MatMult(M, x, y));
22   PetscCall(MatMultTranspose(M, y, x));
23   PetscCall(DMDestroy(&da));
24   PetscCall(DMDestroy(&daf));
25   PetscCall(VecDestroy(&x));
26   PetscCall(VecDestroy(&y));
27   PetscCall(MatDestroy(&M));
28   PetscCall(PetscFinalize());
29   return 0;
30 }
31 
32 /*TEST
33 
34    test:
35       nsize: 2
36 
37 TEST*/
38