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