xref: /petsc/src/dm/impls/plex/tests/ex2.c (revision 609caa7c8c030312b00807b4f015fd827bb80932)
1 static char help[] = "Benchmark DMPlexInterpolate.\n\n";
2 
3 #include <petscdmplex.h>
4 
main(int argc,char ** argv)5 int main(int argc, char **argv)
6 {
7   DM            dm, dm2;
8   PetscLogStage stage;
9 
10   PetscFunctionBeginUser;
11   PetscCall(PetscInitialize(&argc, &argv, NULL, help));
12   PetscCall(PetscLogStageRegister("Interpolate", &stage));
13 
14   PetscCall(DMCreate(PETSC_COMM_WORLD, &dm));
15   PetscCall(DMSetType(dm, DMPLEX));
16   PetscCall(DMSetFromOptions(dm));
17   PetscCall(DMViewFromOptions(dm, NULL, "-init_dm_view"));
18 
19   PetscCall(DMPlexUninterpolate(dm, &dm2));
20   PetscCall(DMDestroy(&dm));
21   dm = dm2;
22   PetscCall(DMViewFromOptions(dm, NULL, "-unint_dm_view"));
23 
24   PetscCall(PetscLogStagePush(stage));
25   PetscCall(DMPlexInterpolate(dm, &dm2));
26   PetscCall(PetscLogStagePop());
27 
28   PetscCall(DMViewFromOptions(dm2, NULL, "-interp_dm_view"));
29 
30   PetscCall(DMDestroy(&dm2));
31   PetscCall(DMDestroy(&dm));
32   PetscCall(PetscFinalize());
33   return 0;
34 }
35 
36 /*TEST
37 
38   test:
39     suffix: 0
40     args: -dm_plex_simplex 0
41     output_file: output/empty.out
42 
43 TEST*/
44