1*5ef9f2a5SBarry Smith /* $Id: viewer.h,v 1.65 1999/01/14 17:01:45 bsmith Exp bsmith $ */ 284cb2905SBarry Smith /* 384cb2905SBarry Smith Viewers are objects where other objects can be looked at or stored. 484cb2905SBarry Smith */ 53c119ea2SBarry Smith 688d459dfSBarry Smith #if !defined(__VIEWER_H) 788d459dfSBarry Smith #define __VIEWER_H 82eb8c8abSBarry Smith 9f09e8eb9SSatish Balay typedef struct _p_Viewer* Viewer; 103c119ea2SBarry Smith 113c119ea2SBarry Smith /* 123c119ea2SBarry Smith petsc.h must be included AFTER the definition of Viewer for ADIC to 133c119ea2SBarry Smith process correctly. 143c119ea2SBarry Smith */ 152eb8c8abSBarry Smith #include "petsc.h" 162eb8c8abSBarry Smith 172eb8c8abSBarry Smith #define VIEWER_COOKIE PETSC_COOKIE+1 1877ed5343SBarry Smith typedef char* ViewerType; 192eb8c8abSBarry Smith 207b2a1423SBarry Smith #define SOCKET_VIEWER "socket" 2177ed5343SBarry Smith #define ASCII_VIEWER "ascii" 2277ed5343SBarry Smith #define BINARY_VIEWER "binary" 2377ed5343SBarry Smith #define STRING_VIEWER "string" 2477ed5343SBarry Smith #define DRAW_VIEWER "draw" 2577ed5343SBarry Smith #define AMS_VIEWER "ams" 2677ed5343SBarry Smith 277b2a1423SBarry Smith extern FList ViewerList; 287b2a1423SBarry Smith extern int ViewerRegisterAll(char *); 297b2a1423SBarry Smith extern int ViewerRegisterDestroy(void); 307b2a1423SBarry Smith 317b2a1423SBarry Smith extern int ViewerRegister_Private(char*,char*,char*,int(*)(Viewer)); 327b2a1423SBarry Smith #if defined(USE_DYNAMIC_LIBRARIES) 337b2a1423SBarry Smith #define ViewerRegister(a,b,c,d) ViewerRegister_Private(a,b,c,0) 347b2a1423SBarry Smith #else 357b2a1423SBarry Smith #define ViewerRegister(a,b,c,d) ViewerRegister_Private(a,b,c,d) 367b2a1423SBarry Smith #endif 377b2a1423SBarry Smith extern int ViewerCreate(MPI_Comm,Viewer*); 387b2a1423SBarry Smith extern int ViewerSetFromOptions(Viewer); 397b2a1423SBarry Smith 407b2a1423SBarry Smith 4177ed5343SBarry Smith extern int ViewerASCIIOpen(MPI_Comm,const char[],Viewer*); 424b0e389bSBarry Smith typedef enum {BINARY_RDONLY, BINARY_WRONLY, BINARY_CREATE} ViewerBinaryType; 4377ed5343SBarry Smith extern int ViewerBinaryOpen(MPI_Comm,const char[],ViewerBinaryType,Viewer*); 447b2a1423SBarry Smith extern int ViewerSocketOpen(MPI_Comm,const char[],int,Viewer*); 45e26ad7d8SSatish Balay extern int ViewerStringOpen(MPI_Comm,char[],int, Viewer*); 4677ed5343SBarry Smith extern int ViewerDrawOpen(MPI_Comm,const char[],const char[],int,int,int,int,Viewer*); 47*5ef9f2a5SBarry Smith extern int ViewerAMSSetCommName(Viewer,const char[]); 484b0e389bSBarry Smith 4977ed5343SBarry Smith extern int ViewerGetOutputname(Viewer,char**); 50bcd2baecSBarry Smith extern int ViewerGetType(Viewer,ViewerType*); 517b2a1423SBarry Smith extern int ViewerSetType(Viewer,ViewerType); 529651b370SBarry Smith extern int ViewerDestroy(Viewer); 53ae39576cSLois Curfman McInnes 54639f9d9dSBarry Smith #define VIEWER_FORMAT_ASCII_DEFAULT 0 55639f9d9dSBarry Smith #define VIEWER_FORMAT_ASCII_MATLAB 1 56639f9d9dSBarry Smith #define VIEWER_FORMAT_ASCII_IMPL 2 57639f9d9dSBarry Smith #define VIEWER_FORMAT_ASCII_INFO 3 58639f9d9dSBarry Smith #define VIEWER_FORMAT_ASCII_INFO_LONG 4 59639f9d9dSBarry Smith #define VIEWER_FORMAT_ASCII_COMMON 5 6009b0ea9bSLois Curfman McInnes #define VIEWER_FORMAT_ASCII_SYMMODU 6 6147e7184fSBarry Smith #define VIEWER_FORMAT_ASCII_INDEX 7 62e24b481bSBarry Smith #define VIEWER_FORMAT_ASCII_DENSE 8 63090de74eSSatish Balay 64639f9d9dSBarry Smith #define VIEWER_FORMAT_BINARY_DEFAULT 0 65639f9d9dSBarry Smith #define VIEWER_FORMAT_BINARY_NATIVE 1 66090de74eSSatish Balay 675311e20fSBarry Smith #define VIEWER_FORMAT_DRAW_BASIC 0 685311e20fSBarry Smith #define VIEWER_FORMAT_DRAW_LG 1 690513a670SBarry Smith #define VIEWER_FORMAT_DRAW_CONTOUR 2 705311e20fSBarry Smith 71e26ad7d8SSatish Balay extern int ViewerSetFormat(Viewer,int,char[]); 72e26ad7d8SSatish Balay extern int ViewerPushFormat(Viewer,int,char[]); 735311e20fSBarry Smith extern int ViewerPopFormat(Viewer); 7490ace30eSBarry Smith extern int ViewerGetFormat(Viewer,int*); 755fe861cdSBarry Smith extern int ViewerFlush(Viewer); 764b0e389bSBarry Smith 7777ed5343SBarry Smith /* 7877ed5343SBarry Smith Operations explicit to a particular class of viewers 7977ed5343SBarry Smith */ 8077ed5343SBarry Smith extern int ViewerASCIIGetPointer(Viewer,FILE**); 810ef38995SBarry Smith extern int ViewerASCIIPrintf(Viewer,const char[],...); 820ef38995SBarry Smith extern int ViewerASCIIPushTab(Viewer); 830ef38995SBarry Smith extern int ViewerASCIIPopTab(Viewer); 8477ed5343SBarry Smith extern int ViewerBinaryGetDescriptor(Viewer,int*); 8577ed5343SBarry Smith extern int ViewerBinaryGetInfoPointer(Viewer,FILE **); 86c655490fSBarry Smith extern int ViewerBinarySetType(Viewer,ViewerBinaryType); 8777ed5343SBarry Smith extern int ViewerStringSPrintf(Viewer,char *,...); 88c655490fSBarry Smith extern int ViewerStringSetString(Viewer,char[],int); 8977ed5343SBarry Smith extern int ViewerDrawClear(Viewer); 90c655490fSBarry Smith extern int ViewerDrawSetInfo(Viewer,const char[],const char[],int,int,int,int); 9126fae399SBarry Smith extern int ViewerSocketSetConnection(Viewer,const char[],int); 92c655490fSBarry Smith 93c655490fSBarry Smith extern int ViewerSetFilename(Viewer,const char[]); 9477ed5343SBarry Smith 9577ed5343SBarry Smith /* 9677ed5343SBarry Smith These are all the default viewers that do not have 9777ed5343SBarry Smith to be explicitly opened 9877ed5343SBarry Smith */ 996d4a8577SBarry Smith extern Viewer VIEWER_STDOUT_SELF; 1006d4a8577SBarry Smith extern Viewer VIEWER_STDERR_SELF; 10125482d47SBarry Smith extern Viewer VIEWER_STDOUT_WORLD; 1020752156aSBarry Smith extern Viewer VIEWER_STDOUT_(MPI_Comm); 1030752156aSBarry Smith extern int VIEWER_STDOUT_Destroy(MPI_Comm); 104c22c1629SBarry Smith extern Viewer VIEWER_STDERR_WORLD; 1050752156aSBarry Smith extern Viewer VIEWER_STDERR_(MPI_Comm); 1060752156aSBarry Smith extern int VIEWER_STDERR_Destroy(MPI_Comm); 107c655490fSBarry Smith extern Viewer VIEWER_DRAW_WORLD_PRIVATE_0; 108c655490fSBarry Smith extern Viewer VIEWER_DRAW_WORLD_PRIVATE_1; 109c655490fSBarry Smith extern Viewer VIEWER_DRAW_WORLD_PRIVATE_2; 110c655490fSBarry Smith extern Viewer VIEWER_DRAW_SELF_PRIVATE; 1117b2a1423SBarry Smith extern Viewer VIEWER_SOCKET_WORLD_PRIVATE; 1127b2a1423SBarry Smith extern Viewer VIEWER_SOCKET_SELF_PRIVATE; /* not yet used */ 1135311e20fSBarry Smith 114f4d8af11SBarry Smith extern int ViewerInitializeDrawWorld_Private_0(void); 115f4d8af11SBarry Smith extern int ViewerInitializeDrawWorld_Private_1(void); 116f4d8af11SBarry Smith extern int ViewerInitializeDrawWorld_Private_2(void); 117f4d8af11SBarry Smith extern int ViewerInitializeDrawSelf_Private(void); 1187b2a1423SBarry Smith extern int ViewerInitializeSocketWorld_Private(void); 119c655490fSBarry Smith extern Viewer VIEWER_DRAW_(MPI_Comm); 120c655490fSBarry Smith extern int VIEWER_DRAW_Destroy(MPI_Comm); 121c655490fSBarry Smith extern Viewer VIEWER_SOCKET_(MPI_Comm); 122c655490fSBarry Smith extern int VIEWER_SOCKET_Destroy(MPI_Comm); 1235311e20fSBarry Smith 124c655490fSBarry Smith #define VIEWER_DRAW_WORLD_0 \ 125f4d8af11SBarry Smith (ViewerInitializeDrawWorld_Private_0(),VIEWER_DRAW_WORLD_PRIVATE_0) 126c655490fSBarry Smith #define VIEWER_DRAW_WORLD_1 \ 127f4d8af11SBarry Smith (ViewerInitializeDrawWorld_Private_1(),VIEWER_DRAW_WORLD_PRIVATE_1) 128c655490fSBarry Smith #define VIEWER_DRAW_WORLD_2 \ 129f4d8af11SBarry Smith (ViewerInitializeDrawWorld_Private_2(),VIEWER_DRAW_WORLD_PRIVATE_2) 130639f9d9dSBarry Smith 131c655490fSBarry Smith #define VIEWER_DRAW_SELF \ 132f4d8af11SBarry Smith (ViewerInitializeDrawSelf_Private(),VIEWER_DRAW_SELF_PRIVATE) 133c655490fSBarry Smith #define VIEWER_DRAW_WORLD VIEWER_DRAW_WORLD_0 134e1311b90SBarry Smith 1357b2a1423SBarry Smith #define VIEWER_SOCKET_WORLD \ 1367b2a1423SBarry Smith (ViewerInitializeSocketWorld_Private(),VIEWER_SOCKET_WORLD_PRIVATE) 137c16cb8f2SBarry Smith 13877ed5343SBarry Smith /* 13977ed5343SBarry Smith Viewer based on the ALICE Memory Snooper 14077ed5343SBarry Smith */ 141cb5b572fSBarry Smith #if defined(HAVE_AMS) 142cb5b572fSBarry Smith #include "ams.h" 143cb5b572fSBarry Smith extern int ViewerAMSGetAMSComm(Viewer,AMS_Comm *); 144cb5b572fSBarry Smith extern int ViewerAMSOpen(MPI_Comm,const char[],Viewer*); 145cb5b572fSBarry Smith extern Viewer VIEWER_AMS_(MPI_Comm); 146cb5b572fSBarry Smith extern int VIEWER_AMS_Destroy(MPI_Comm); 147cb5b572fSBarry Smith extern Viewer VIEWER_AMS_WORLD_PRIVATE; 148cb5b572fSBarry Smith extern int ViewerInitializeAMSWorld_Private(void); 149cb5b572fSBarry Smith #define VIEWER_AMS_WORLD (ViewerInitializeAMSWorld_Private(),VIEWER_AMS_WORLD_PRIVATE) 1502eb8c8abSBarry Smith #endif 151cb5b572fSBarry Smith 152f2b01315SBarry Smith /* 153f2b01315SBarry Smith Viewer utility routines used by PETSc that are not normally used 154f2b01315SBarry Smith by users. 155f2b01315SBarry Smith */ 1567b2a1423SBarry Smith extern int ViewerSocketPutScalar_Private(Viewer,int,int,Scalar*); 1577b2a1423SBarry Smith extern int ViewerSocketPutDouble_Private(Viewer,int,int,double*); 1587b2a1423SBarry Smith extern int ViewerSocketPutInt_Private(Viewer,int,int*); 1597b2a1423SBarry Smith extern int ViewerSocketPutSparse_Private(Viewer,int,int,int,Scalar*,int*,int *); 160f2b01315SBarry Smith extern int ViewerInitializeASCII_Private(void); 161f2b01315SBarry Smith extern int ViewerDestroyASCII_Private(void); 162f4d8af11SBarry Smith extern int ViewerDestroyDraw_Private(void); 1637b2a1423SBarry Smith extern int ViewerDestroySocket_Private(void); 164f2b01315SBarry Smith extern int ViewerDestroyAMS_Private(void); 165f2b01315SBarry Smith 166cb5b572fSBarry Smith #endif 167cb5b572fSBarry Smith 168