15c6c1daeSBarry Smith 207475bc1SBarry Smith #include <petsc-private/viewerimpl.h> /*I "petscsys.h" */ 3*e04113cfSBarry Smith #include <petscviewersaws.h> 45c6c1daeSBarry Smith 55c6c1daeSBarry Smith #undef __FUNCT__ 6*e04113cfSBarry Smith #define __FUNCT__ "PetscViewerSAWsOpen" 75c6c1daeSBarry Smith /*@C 8*e04113cfSBarry Smith PetscViewerSAWsOpen - Opens an SAWs memory snooper PetscViewer. 95c6c1daeSBarry Smith 105c6c1daeSBarry Smith Collective on MPI_Comm 115c6c1daeSBarry Smith 125c6c1daeSBarry Smith Input Parameters: 13ec957eceSBarry Smith . comm - the MPI communicator 145c6c1daeSBarry Smith 155c6c1daeSBarry Smith Output Parameter: 165c6c1daeSBarry Smith . lab - the PetscViewer 175c6c1daeSBarry Smith 185c6c1daeSBarry Smith Options Database Keys: 19*e04113cfSBarry Smith + -ams_port <port number> - port number where you are running SAWs client 20f05ece33SBarry Smith . -xxx_view ams - publish the object xxx 21*e04113cfSBarry Smith - -xxx_saws_block - blocks the program at the end of a critical point (for KSP and SNES it is the end of a solve) until 22f05ece33SBarry Smith the user unblocks the the problem with an external tool that access the object with the AMS 235c6c1daeSBarry Smith 245c6c1daeSBarry Smith Level: advanced 255c6c1daeSBarry Smith 265c6c1daeSBarry Smith Fortran Note: 275c6c1daeSBarry Smith This routine is not supported in Fortran. 285c6c1daeSBarry Smith 295c6c1daeSBarry Smith 305c6c1daeSBarry Smith Notes: 31*e04113cfSBarry Smith Unlike other viewers that only access the object being viewed on the call to XXXView(object,viewer) the SAWs viewer allows 32*e04113cfSBarry Smith one to view the object asynchronously as the program continues to run. One can remove SAWs access to the object with a call to 33*e04113cfSBarry Smith PetscObjectSAWsViewOff(). 3438dc1537SBarry Smith 35*e04113cfSBarry Smith Information about the SAWs is available via http://www.mcs.anl.gov/SAWs. 365c6c1daeSBarry Smith 375c6c1daeSBarry Smith Concepts: AMS 38f05ece33SBarry Smith Concepts: Argonne Memory Snooper 395c6c1daeSBarry Smith Concepts: Asynchronous Memory Snooper 405c6c1daeSBarry Smith 41*e04113cfSBarry Smith .seealso: PetscViewerDestroy(), PetscViewerStringSPrintf(), PETSC_VIEWER_SAWS_(), PetscObjectSAWsBlock(), 42*e04113cfSBarry Smith PetscObjectSAWsViewOff(), PetscObjectSAWsTakeAccess(), PetscObjectSAWsGrantAccess() 435c6c1daeSBarry Smith 445c6c1daeSBarry Smith @*/ 45*e04113cfSBarry Smith PetscErrorCode PetscViewerSAWsOpen(MPI_Comm comm,PetscViewer *lab) 465c6c1daeSBarry Smith { 475c6c1daeSBarry Smith PetscErrorCode ierr; 485c6c1daeSBarry Smith 495c6c1daeSBarry Smith PetscFunctionBegin; 505c6c1daeSBarry Smith ierr = PetscViewerCreate(comm,lab);CHKERRQ(ierr); 51*e04113cfSBarry Smith ierr = PetscViewerSetType(*lab,PETSCVIEWERSAWS);CHKERRQ(ierr); 525c6c1daeSBarry Smith PetscFunctionReturn(0); 535c6c1daeSBarry Smith } 54bfb97211SBarry Smith 55bfb97211SBarry Smith #undef __FUNCT__ 56*e04113cfSBarry Smith #define __FUNCT__ "PetscObjectViewSAWs" 57bfb97211SBarry Smith /*@C 58*e04113cfSBarry Smith PetscObjectViewSAWs - View the base portion of any object with an SAWs viewer 59bfb97211SBarry Smith 60bfb97211SBarry Smith Collective on PetscObject 61bfb97211SBarry Smith 62bfb97211SBarry Smith Input Parameters: 63bfb97211SBarry Smith + obj - the Petsc variable 64bfb97211SBarry Smith Thus must be cast with a (PetscObject), for example, 65bfb97211SBarry Smith PetscObjectSetName((PetscObject)mat,name); 66*e04113cfSBarry Smith - viewer - the SAWs viewer 67bfb97211SBarry Smith 68bfb97211SBarry Smith Level: advanced 69bfb97211SBarry Smith 70bfb97211SBarry Smith Concepts: publishing object 71bfb97211SBarry Smith 72*e04113cfSBarry Smith .seealso: PetscObjectSetName(), PetscObjectSAWsViewOff() 73bfb97211SBarry Smith 74bfb97211SBarry Smith @*/ 75*e04113cfSBarry Smith PetscErrorCode PetscObjectViewSAWs(PetscObject obj,PetscViewer viewer) 76bfb97211SBarry Smith { 77bfb97211SBarry Smith PetscErrorCode ierr; 78bfb97211SBarry Smith 79bfb97211SBarry Smith PetscFunctionBegin; 80bfb97211SBarry Smith PetscValidHeader(obj,1); 81ec957eceSBarry Smith if (obj->amsmem) PetscFunctionReturn(0); 82bfb97211SBarry Smith ierr = PetscObjectName(obj);CHKERRQ(ierr); 83bfb97211SBarry Smith 84*e04113cfSBarry Smith PetscStackCallSAWs(SAWS_Directory_Create,(obj->name,&obj->amsmem)); 85*e04113cfSBarry Smith PetscStackCallSAWs(SAWS_New_Variable,(obj->amsmem,"Class",&obj->class_name,1,SAWS_READ,SAWS_STRING)); 86*e04113cfSBarry Smith PetscStackCallSAWs(SAWS_New_Variable,(obj->amsmem,"Type",&obj->type_name,1,SAWS_READ,SAWS_STRING)); 87*e04113cfSBarry Smith PetscStackCallSAWs(SAWS_New_Variable,(obj->amsmem,"Id",&obj->id,1,SAWS_READ,SAWS_INT)); 88*e04113cfSBarry Smith PetscStackCallSAWs(SAWS_New_Variable,(obj->amsmem,"ParentId",&obj->parentid,1,SAWS_READ,SAWS_INT)); 89*e04113cfSBarry Smith PetscStackCallSAWs(SAWS_New_Variable,(obj->amsmem,"Name",&obj->name,1,SAWS_READ,SAWS_STRING)); 90*e04113cfSBarry Smith PetscStackCallSAWs(SAWS_New_Variable,(obj->amsmem,"Publish Block",&obj->amspublishblock,1,SAWS_READ,SAWS_BOOLEAN)); 91*e04113cfSBarry Smith PetscStackCallSAWs(SAWS_New_Variable,(obj->amsmem,"Block",&obj->amsblock,1,SAWS_WRITE,SAWS_BOOLEAN)); 92bfb97211SBarry Smith PetscFunctionReturn(0); 93bfb97211SBarry Smith } 94