1*b0a32e0cSBarry Smith /* $Id: petscviewer.h,v 1.77 2000/07/27 15:46:05 bsmith Exp bsmith $ */ 284cb2905SBarry Smith /* 3*b0a32e0cSBarry Smith PetscViewers are objects where other objects can be looked at or stored. 484cb2905SBarry Smith */ 53c119ea2SBarry Smith 60a835dfdSSatish Balay #if !defined(__PETSCVIEWER_H) 70a835dfdSSatish Balay #define __PETSCVIEWER_H 82eb8c8abSBarry Smith 9*b0a32e0cSBarry Smith typedef struct _p_PetscViewer* PetscViewer; 103c119ea2SBarry Smith 113c119ea2SBarry Smith /* 12*b0a32e0cSBarry Smith petsc.h must be included AFTER the definition of PetscViewer for ADIC to 133c119ea2SBarry Smith process correctly. 143c119ea2SBarry Smith */ 152eb8c8abSBarry Smith #include "petsc.h" 162eb8c8abSBarry Smith 17*b0a32e0cSBarry Smith #define PETSC_VIEWER_COOKIE PETSC_COOKIE+1 18*b0a32e0cSBarry Smith typedef char*PetscViewerType; 192eb8c8abSBarry Smith 20*b0a32e0cSBarry Smith #define PETSC_VIEWER_SOCKET "socket" 21*b0a32e0cSBarry Smith #define PETSC_VIEWER_ASCII "ascii" 22*b0a32e0cSBarry Smith #define PETSC_BINARY_VIEWER "binary" 23*b0a32e0cSBarry Smith #define PETSC_VIEWER_STRING "string" 24*b0a32e0cSBarry Smith #define PETSC_DRAW_VIEWER "draw" 25*b0a32e0cSBarry Smith #define PETSC_VIEWER_AMS "ams" 2677ed5343SBarry Smith 27*b0a32e0cSBarry Smith extern PetscFList PetscViewerList; 28*b0a32e0cSBarry Smith EXTERN int PetscViewerRegisterAll(char *); 29*b0a32e0cSBarry Smith EXTERN int PetscViewerRegisterDestroy(void); 307b2a1423SBarry Smith 31*b0a32e0cSBarry Smith EXTERN int PetscViewerRegister(char*,char*,char*,int(*)(PetscViewer)); 32aa482453SBarry Smith #if defined(PETSC_USE_DYNAMIC_LIBRARIES) 33*b0a32e0cSBarry Smith #define PetscViewerRegisterDynamic(a,b,c,d) PetscViewerRegister(a,b,c,0) 347b2a1423SBarry Smith #else 35*b0a32e0cSBarry Smith #define PetscViewerRegisterDynamic(a,b,c,d) PetscViewerRegister(a,b,c,d) 367b2a1423SBarry Smith #endif 37*b0a32e0cSBarry Smith EXTERN int PetscViewerCreate(MPI_Comm,PetscViewer*); 38*b0a32e0cSBarry Smith EXTERN int PetscViewerSetFromOptions(PetscViewer); 397b2a1423SBarry Smith 407b2a1423SBarry Smith 41*b0a32e0cSBarry Smith EXTERN int PetscViewerASCIIOpen(MPI_Comm,const char[],PetscViewer*); 42*b0a32e0cSBarry Smith typedef enum {PETSC_BINARY_RDONLY,PETSC_BINARY_WRONLY,PETSC_BINARY_CREATE} PetscViewerBinaryType; 43*b0a32e0cSBarry Smith EXTERN int PetscViewerBinaryOpen(MPI_Comm,const char[],PetscViewerBinaryType,PetscViewer*); 44*b0a32e0cSBarry Smith EXTERN int PetscViewerSocketOpen(MPI_Comm,const char[],int,PetscViewer*); 45*b0a32e0cSBarry Smith EXTERN int PetscViewerStringOpen(MPI_Comm,char[],int,PetscViewer*); 46*b0a32e0cSBarry Smith EXTERN int PetscViewerDrawOpen(MPI_Comm,const char[],const char[],int,int,int,int,PetscViewer*); 47*b0a32e0cSBarry Smith EXTERN int PetscViewerAMSSetCommName(PetscViewer,const char[]); 484b0e389bSBarry Smith 49*b0a32e0cSBarry Smith EXTERN int PetscViewerGetOutputname(PetscViewer,char**); 50*b0a32e0cSBarry Smith EXTERN int PetscViewerGetType(PetscViewer,PetscViewerType*); 51*b0a32e0cSBarry Smith EXTERN int PetscViewerSetType(PetscViewer,PetscViewerType); 52*b0a32e0cSBarry Smith EXTERN int PetscViewerDestroy(PetscViewer); 53*b0a32e0cSBarry Smith EXTERN int PetscViewerGetSingleton(PetscViewer,PetscViewer*); 54*b0a32e0cSBarry Smith EXTERN int PetscViewerRestoreSingleton(PetscViewer,PetscViewer*); 55ae39576cSLois Curfman McInnes 56*b0a32e0cSBarry Smith #define PETSC_VIEWER_FORMAT_ASCII_DEFAULT 0 57*b0a32e0cSBarry Smith #define PETSC_VIEWER_FORMAT_ASCII_MATLAB 1 58*b0a32e0cSBarry Smith #define PETSC_VIEWER_FORMAT_ASCII_IMPL 2 59*b0a32e0cSBarry Smith #define PETSC_VIEWER_FORMAT_ASCII_INFO 3 60*b0a32e0cSBarry Smith #define PETSC_VIEWER_FORMAT_ASCII_INFO_LONG 4 61*b0a32e0cSBarry Smith #define PETSC_VIEWER_FORMAT_ASCII_COMMON 5 62*b0a32e0cSBarry Smith #define PETSC_VIEWER_FORMAT_ASCII_SYMMODU 6 63*b0a32e0cSBarry Smith #define PETSC_VIEWER_FORMAT_ASCII_INDEX 7 64*b0a32e0cSBarry Smith #define PETSC_VIEWER_FORMAT_ASCII_DENSE 8 65090de74eSSatish Balay 66*b0a32e0cSBarry Smith #define PETSC_VIEWER_FORMAT_BINARY_DEFAULT 9 67*b0a32e0cSBarry Smith #define PETSC_VIEWER_FORMAT_BINARY_NATIVE 10 68090de74eSSatish Balay 69*b0a32e0cSBarry Smith #define PETSC_VIEWER_FORMAT_DRAW_BASIC 11 70*b0a32e0cSBarry Smith #define PETSC_VIEWER_FORMAT_DRAW_LG 12 71*b0a32e0cSBarry Smith #define PETSC_VIEWER_FORMAT_DRAW_CONTOUR 13 72*b0a32e0cSBarry Smith #define PETSC_VIEWER_FORMAT_DRAW_PORTS 15 735a655dc6SBarry Smith 74*b0a32e0cSBarry Smith #define PETSC_VIEWER_FORMAT_NATIVE 14 755311e20fSBarry Smith 76*b0a32e0cSBarry Smith EXTERN int PetscViewerSetFormat(PetscViewer,int,char[]); 77*b0a32e0cSBarry Smith EXTERN int PetscViewerPushFormat(PetscViewer,int,char[]); 78*b0a32e0cSBarry Smith EXTERN int PetscViewerPopFormat(PetscViewer); 79*b0a32e0cSBarry Smith EXTERN int PetscViewerGetFormat(PetscViewer,int*); 80*b0a32e0cSBarry Smith EXTERN int PetscViewerFlush(PetscViewer); 814b0e389bSBarry Smith 8277ed5343SBarry Smith /* 8377ed5343SBarry Smith Operations explicit to a particular class of viewers 8477ed5343SBarry Smith */ 85*b0a32e0cSBarry Smith EXTERN int PetscViewerASCIIGetPointer(PetscViewer,FILE**); 86*b0a32e0cSBarry Smith EXTERN int PetscViewerASCIIPrintf(PetscViewer,const char[],...); 87*b0a32e0cSBarry Smith EXTERN int PetscViewerASCIISynchronizedPrintf(PetscViewer,const char[],...); 88*b0a32e0cSBarry Smith EXTERN int PetscViewerASCIIPushTab(PetscViewer); 89*b0a32e0cSBarry Smith EXTERN int PetscViewerASCIIPopTab(PetscViewer); 90*b0a32e0cSBarry Smith EXTERN int PetscViewerASCIIUseTabs(PetscViewer,PetscTruth); 91*b0a32e0cSBarry Smith EXTERN int PetscViewerASCIISetTab(PetscViewer,int); 92*b0a32e0cSBarry Smith EXTERN int PetscViewerBinaryGetDescriptor(PetscViewer,int*); 93*b0a32e0cSBarry Smith EXTERN int PetscViewerBinaryGetInfoPointer(PetscViewer,FILE **); 94*b0a32e0cSBarry Smith EXTERN int PetscViewerBinarySetType(PetscViewer,PetscViewerBinaryType); 95*b0a32e0cSBarry Smith EXTERN int PetscViewerStringSPrintf(PetscViewer,char *,...); 96*b0a32e0cSBarry Smith EXTERN int PetscViewerStringSetString(PetscViewer,char[],int); 97*b0a32e0cSBarry Smith EXTERN int PetscViewerDrawClear(PetscViewer); 98*b0a32e0cSBarry Smith EXTERN int PetscViewerDrawSetInfo(PetscViewer,const char[],const char[],int,int,int,int); 99*b0a32e0cSBarry Smith EXTERN int PetscViewerSocketSetConnection(PetscViewer,const char[],int); 100c655490fSBarry Smith 101*b0a32e0cSBarry Smith EXTERN int PetscViewerSetFilename(PetscViewer,const char[]); 102*b0a32e0cSBarry Smith EXTERN int PetscViewerGetFilename(PetscViewer,char**); 10377ed5343SBarry Smith 10477ed5343SBarry Smith /* 10577ed5343SBarry Smith These are all the default viewers that do not have 10677ed5343SBarry Smith to be explicitly opened 10777ed5343SBarry Smith */ 108*b0a32e0cSBarry Smith EXTERN PetscViewer PETSC_VIEWER_STDOUT_(MPI_Comm); 109*b0a32e0cSBarry Smith EXTERN PetscViewer PETSC_VIEWER_STDERR_(MPI_Comm); 110*b0a32e0cSBarry Smith EXTERN PetscViewer PETSC_VIEWER_DRAW_(MPI_Comm); 111*b0a32e0cSBarry Smith EXTERN PetscViewer PETSC_VIEWER_SOCKET_(MPI_Comm); 112*b0a32e0cSBarry Smith EXTERN PetscViewer PETSC_VIEWER_BINARY_(MPI_Comm); 1135311e20fSBarry Smith 114*b0a32e0cSBarry Smith #define PETSC_VIEWER_STDOUT_SELF PETSC_VIEWER_STDOUT_(PETSC_COMM_SELF) 115*b0a32e0cSBarry Smith #define PETSC_VIEWER_STDOUT_WORLD PETSC_VIEWER_STDOUT_(PETSC_COMM_WORLD) 116*b0a32e0cSBarry Smith #define PETSC_VIEWER_STDERR_SELF PETSC_VIEWER_STDERR_(PETSC_COMM_SELF) 117*b0a32e0cSBarry Smith #define PETSC_VIEWER_STDERR_WORLD PETSC_VIEWER_STDERR_(PETSC_COMM_WORLD) 118*b0a32e0cSBarry Smith #define PETSC_VIEWER_DRAW_SELF PETSC_VIEWER_DRAW_(PETSC_COMM_SELF) 119*b0a32e0cSBarry Smith #define PETSC_VIEWER_DRAW_WORLD PETSC_VIEWER_DRAW_(PETSC_COMM_WORLD) 120*b0a32e0cSBarry Smith #define PETSC_VIEWER_SOCKET_WORLD PETSC_VIEWER_SOCKET_(PETSC_COMM_WORLD) 121*b0a32e0cSBarry Smith #define PETSC_VIEWER_SOCKET_SELF PETSC_VIEWER_SOCKET_(PETSC_COMM_SELF) 122*b0a32e0cSBarry Smith #define PETSC_VIEWER_BINARY_WORLD PETSC_VIEWER_BINARY_(PETSC_COMM_WORLD) 123*b0a32e0cSBarry Smith #define PETSC_VIEWER_BINARY_SELF PETSC_VIEWER_BINARY_(PETSC_COMM_SELF) 12465ef3172SBarry Smith 12577ed5343SBarry Smith /* 126*b0a32e0cSBarry Smith PetscViewer based on the ALICE Memory Snooper 12777ed5343SBarry Smith */ 128aa482453SBarry Smith #if defined(PETSC_HAVE_AMS) 129cb5b572fSBarry Smith #include "ams.h" 130*b0a32e0cSBarry Smith EXTERN int PetscViewerAMSGetAMSComm(PetscViewer,AMS_Comm *); 131*b0a32e0cSBarry Smith EXTERN int PetscViewerAMSOpen(MPI_Comm,const char[],PetscViewer*); 132*b0a32e0cSBarry Smith EXTERN PetscViewer PETSC_VIEWER_AMS_(MPI_Comm); 133*b0a32e0cSBarry Smith EXTERN int PETSC_VIEWER_AMS_Destroy(MPI_Comm); 134*b0a32e0cSBarry Smith #define PETSC_VIEWER_AMS_WORLD PETSC_VIEWER_AMS_(PETSC_COMM_WORLD) 1352eb8c8abSBarry Smith #endif 136cb5b572fSBarry Smith 137f2b01315SBarry Smith /* 138*b0a32e0cSBarry Smith PetscViewer utility routines used by PETSc that are not normally used 139f2b01315SBarry Smith by users. 140f2b01315SBarry Smith */ 141*b0a32e0cSBarry Smith EXTERN int PetscViewerSocketPutScalar(PetscViewer,int,int,Scalar*); 142*b0a32e0cSBarry Smith EXTERN int PetscViewerSocketPutReal(PetscViewer,int,int,double*); 143*b0a32e0cSBarry Smith EXTERN int PetscViewerSocketPutInt(PetscViewer,int,int*); 144*b0a32e0cSBarry Smith EXTERN int PetscViewerSocketPutSparse_Private(PetscViewer,int,int,int,Scalar*,int*,int *); 145*b0a32e0cSBarry Smith EXTERN int PetscViewerDestroyAMS_Private(void); 146f2b01315SBarry Smith 147d132466eSBarry Smith /* 148d132466eSBarry Smith Manages sets of viewers 149d132466eSBarry Smith */ 150*b0a32e0cSBarry Smith typedef struct _p_PetscViewers* PetscViewers; 151*b0a32e0cSBarry Smith EXTERN int PetscViewersCreate(MPI_Comm,PetscViewers*); 152*b0a32e0cSBarry Smith EXTERN int PetscViewersDestroy(PetscViewers); 153*b0a32e0cSBarry Smith EXTERN int PetscViewersGetViewer(PetscViewers,int,PetscViewer*); 154d132466eSBarry Smith 155cb5b572fSBarry Smith #endif 156cb5b572fSBarry Smith 157e7592fafSBarry Smith 158e7592fafSBarry Smith 159e7592fafSBarry Smith 160