For drawing predefined PETSc objects such as matrices and vectors, one must
first create a viewer using the
command
ierr = ViewerDrawOpenX(MPI_Comm comm,char *display,char *title,int x,int y,int w, int h,Viewer *viewer);This viewer may be passed to any of the XXXView() routines. To draw into the viewer, one must obtain the Draw object with the command
ierr = ViewerDrawGetDraw(Viewer viewer,Draw *draw);Then one can call any of the DrawXXX commands on the draw object. If one obtains the draw object in this manner, one does not call the DrawOpenX() command discussed below.
Predefined viewers, VIEWER_DRAW_WORLD and VIEWER_DRAW_SELF, may be used at any time. Their initial use will cause the appropriate window to be created.
By default, PETSc drawing tools employ a private colormap, which remedies the problem of poor color choices for contour plots due to an external program's mangling of the colormap (e.g, Netscape tends to do this). Unfortunately, this causes flashing of colors as the mouse is moved between the PETSc windows and other windows. Alternatively, a shared colormap can be used via the option -draw_x_shared_colormap.