Actual source code: ex20.c
petsc-3.7.3 2016-08-01
1: static char help[] = "Tests DMDACreate3d() memory usage\n\n";
3: #include <petscdmda.h>
8: int main(int argc,char **argv)
9: {
10: DM dm;
11: Vec X,Y;
13: PetscInt dof = 10;
15: PetscInitialize(&argc,&argv,(char*)0,help);
16: PetscOptionsGetInt(NULL,NULL,"-dof",&dof,NULL);
17: 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);
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 0;
30: }