Actual source code: ex20.c
petsc-3.11.4 2019-09-28
1: static char help[] = "Tests DMDACreate3d() memory usage\n\n";
3: #include <petscdmda.h>
6: int main(int argc,char **argv)
7: {
8: DM dm;
9: Vec X,Y;
11: PetscInt dof = 10;
13: PetscInitialize(&argc,&argv,(char*)0,help);if (ierr) return ierr;
14: PetscOptionsGetInt(NULL,NULL,"-dof",&dof,NULL);
15: DMDACreate3d(PETSC_COMM_WORLD,DM_BOUNDARY_NONE,DM_BOUNDARY_NONE,DM_BOUNDARY_NONE,DMDA_STENCIL_STAR,-128,-128,-128,PETSC_DECIDE,PETSC_DECIDE,PETSC_DECIDE,dof,1,NULL,NULL,NULL,&dm);
16: DMSetFromOptions(dm);
17: DMSetUp(dm);
18: PetscMemoryTrace("DMDACreate3d ");
20: DMCreateGlobalVector(dm,&X);
21: PetscMemoryTrace("DMCreateGlobalVector");
22: DMCreateGlobalVector(dm,&Y);
23: PetscMemoryTrace("DMCreateGlobalVector");
25: VecDestroy(&X);
26: VecDestroy(&Y);
27: DMDestroy(&dm);
28: PetscFinalize();
29: return ierr;
30: }