VIEWER_DRAWX_

Creates a window viewer shared by all processors in a communicator.

Synopsis

Viewer VIEWER_DRAWX_(MPI_Comm comm)
Collective on MPI_Comm

Input Parameters

comm -the MPI communicator to share the window viewer

Notes

Unlike almost all other PETSc routines, VIEWER_DRAWX_ does not returnan error code. The window viewer is usually used in the form
      XXXView(XXX object,VIEWER_DRAWX_(comm));

See Also

VIEWER_DRAWX_WORLD, VIEWER_DRAWX_SELF, ViewerDrawOpenX(),
C@*/ Viewer VIEWER_DRAWX_(MPI_Comm comm) { int ierr,flag; Viewer viewer;

PetscFunctionBegin; if (Petsc_Viewer_Drawx_keyval == MPI_KEYVAL_INVALID) { ierr = MPI_Keyval_create(MPI_NULL_COPY_FN,MPI_NULL_DELETE_FN,&Petsc_Viewer_Drawx_keyval,0); if (ierr) {PetscError(__LINE__,"VIEWER_DRAWX_",__FILE__,__SDIR__,1,1,0); viewer = 0;} } ierr = MPI_Attr_get( comm, Petsc_Viewer_Drawx_keyval, (void **)&viewer, &flag ); if (ierr) {PetscError(__LINE__,"VIEWER_DRAWX_",__FILE__,__SDIR__,1,1,0); viewer = 0;} if (!flag) { /* viewer not yet created */ ierr = ViewerDrawOpenX(comm,0,0,PETSC_DECIDE,PETSC_DECIDE,300,300,&viewer); if (ierr) {PetscError(__LINE__,"VIEWER_DRAWX_",__FILE__,__SDIR__,1,1,0); viewer = 0;} ierr = MPI_Attr_put( comm, Petsc_Viewer_Drawx_keyval, (void *) viewer ); if (ierr) {PetscError(__LINE__,"VIEWER_DRAWX_",__FILE__,__SDIR__,1,1,0); viewer = 0;} } PetscFunctionReturn(viewer); }

/* If there is a Viewer associated with this communicator it is destroyed. */ int VIEWER_DRAWX_Destroy(MPI_Comm comm) { int ierr,flag; Viewer viewer;

PetscFunctionBegin; if (Petsc_Viewer_Drawx_keyval == MPI_KEYVAL_INVALID) { PetscFunctionReturn(0); } ierr = MPI_Attr_get( comm, Petsc_Viewer_Drawx_keyval, (void **)&viewer, &flag );CHKERRQ(ierr); if (flag) { ierr = ViewerDestroy(viewer); CHKERRQ(ierr); ierr = MPI_Attr_delete(comm,Petsc_Viewer_Drawx_keyval);CHKERRQ(ierr); } PetscFunctionReturn(0); }

Location: src/draw/impls/x/xops.c
Graphics (Draw) Index
Table of Contents