static char help[] = "Plots the various potentials used in the examples.\n"; #include #include #include int main(int argc,char **argv) { PetscDrawLG lg; PetscInt Mx = 100,i; PetscReal x,hx = .1/Mx,pause,xx[3],yy[3]; PetscDraw draw; const char *const legend[] = {"(1 - u^2)^2","1 - u^2","-(1 - u)log(1 - u)"}; PetscDrawAxis axis; PetscDrawViewPorts *ports; PetscFunctionBegin; PetscCall(PetscInitialize(&argc,&argv,0,help)); PetscCall(PetscViewerDrawResize(PETSC_VIEWER_DRAW_(PETSC_COMM_WORLD),1200,800)); PetscCall(PetscViewerDrawGetDrawLG(PETSC_VIEWER_DRAW_(PETSC_COMM_WORLD),0,&lg)); PetscCall(PetscDrawLGGetDraw(lg,&draw)); PetscCall(PetscDrawCheckResizedWindow(draw)); PetscCall(PetscDrawViewPortsCreateRect(draw,1,2,&ports)); PetscCall(PetscDrawLGGetAxis(lg,&axis)); PetscCall(PetscDrawLGReset(lg)); /* Plot the energies */ PetscCall(PetscDrawLGSetDimension(lg,3)); PetscCall(PetscDrawViewPortsSet(ports,1)); x = .9; for (i=0; i