1*0ef38995SBarry Smith /* $Id: viewer.h,v 1.59 1998/12/04 23:31:39 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 2077ed5343SBarry Smith #define MATLAB_VIEWER "matlab" 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 2777ed5343SBarry Smith extern int ViewerASCIIOpen(MPI_Comm,const char[],Viewer*); 284b0e389bSBarry Smith typedef enum {BINARY_RDONLY, BINARY_WRONLY, BINARY_CREATE} ViewerBinaryType; 2977ed5343SBarry Smith extern int ViewerBinaryOpen(MPI_Comm,const char[],ViewerBinaryType,Viewer*); 30e26ad7d8SSatish Balay extern int ViewerMatlabOpen(MPI_Comm,const char[],int,Viewer*); 31e26ad7d8SSatish Balay extern int ViewerStringOpen(MPI_Comm,char[],int, Viewer*); 3277ed5343SBarry Smith extern int ViewerDrawOpen(MPI_Comm,const char[],const char[],int,int,int,int,Viewer*); 33e26ad7d8SSatish Balay extern int ViewerDrawOpenVRML(MPI_Comm,const char[],const char[],Viewer*); 344b0e389bSBarry Smith 3577ed5343SBarry Smith extern int ViewerGetOutputname(Viewer,char**); 36bcd2baecSBarry Smith extern int ViewerGetType(Viewer,ViewerType*); 379651b370SBarry Smith extern int ViewerDestroy(Viewer); 38ae39576cSLois Curfman McInnes 39639f9d9dSBarry Smith #define VIEWER_FORMAT_ASCII_DEFAULT 0 40639f9d9dSBarry Smith #define VIEWER_FORMAT_ASCII_MATLAB 1 41639f9d9dSBarry Smith #define VIEWER_FORMAT_ASCII_IMPL 2 42639f9d9dSBarry Smith #define VIEWER_FORMAT_ASCII_INFO 3 43639f9d9dSBarry Smith #define VIEWER_FORMAT_ASCII_INFO_LONG 4 44639f9d9dSBarry Smith #define VIEWER_FORMAT_ASCII_COMMON 5 4509b0ea9bSLois Curfman McInnes #define VIEWER_FORMAT_ASCII_SYMMODU 6 4647e7184fSBarry Smith #define VIEWER_FORMAT_ASCII_INDEX 7 47e24b481bSBarry Smith #define VIEWER_FORMAT_ASCII_DENSE 8 48090de74eSSatish Balay 49639f9d9dSBarry Smith #define VIEWER_FORMAT_BINARY_DEFAULT 0 50639f9d9dSBarry Smith #define VIEWER_FORMAT_BINARY_NATIVE 1 51090de74eSSatish Balay 525311e20fSBarry Smith #define VIEWER_FORMAT_DRAW_BASIC 0 535311e20fSBarry Smith #define VIEWER_FORMAT_DRAW_LG 1 540513a670SBarry Smith #define VIEWER_FORMAT_DRAW_CONTOUR 2 555311e20fSBarry Smith 56e26ad7d8SSatish Balay extern int ViewerSetFormat(Viewer,int,char[]); 57e26ad7d8SSatish Balay extern int ViewerPushFormat(Viewer,int,char[]); 585311e20fSBarry Smith extern int ViewerPopFormat(Viewer); 5990ace30eSBarry Smith extern int ViewerGetFormat(Viewer,int*); 605fe861cdSBarry Smith extern int ViewerFlush(Viewer); 614b0e389bSBarry Smith 6277ed5343SBarry Smith /* 6377ed5343SBarry Smith Operations explicit to a particular class of viewers 6477ed5343SBarry Smith */ 6577ed5343SBarry Smith extern int ViewerASCIIGetPointer(Viewer,FILE**); 66*0ef38995SBarry Smith extern int ViewerASCIIPrintf(Viewer,const char[],...); 67*0ef38995SBarry Smith extern int ViewerASCIIPushTab(Viewer); 68*0ef38995SBarry Smith extern int ViewerASCIIPopTab(Viewer); 6977ed5343SBarry Smith extern int ViewerBinaryGetDescriptor(Viewer,int*); 7077ed5343SBarry Smith extern int ViewerBinaryGetInfoPointer(Viewer,FILE **); 7177ed5343SBarry Smith extern int ViewerStringSPrintf(Viewer,char *,...); 7277ed5343SBarry Smith extern int ViewerDrawClear(Viewer); 7377ed5343SBarry Smith 7477ed5343SBarry Smith /* 7577ed5343SBarry Smith These are all the default viewers that do not have 7677ed5343SBarry Smith to be explicitly opened 7777ed5343SBarry Smith */ 786d4a8577SBarry Smith extern Viewer VIEWER_STDOUT_SELF; 796d4a8577SBarry Smith extern Viewer VIEWER_STDERR_SELF; 8025482d47SBarry Smith extern Viewer VIEWER_STDOUT_WORLD; 810752156aSBarry Smith extern Viewer VIEWER_STDOUT_(MPI_Comm); 820752156aSBarry Smith extern int VIEWER_STDOUT_Destroy(MPI_Comm); 83c22c1629SBarry Smith extern Viewer VIEWER_STDERR_WORLD; 840752156aSBarry Smith extern Viewer VIEWER_STDERR_(MPI_Comm); 850752156aSBarry Smith extern int VIEWER_STDERR_Destroy(MPI_Comm); 86639f9d9dSBarry Smith extern Viewer VIEWER_DRAWX_WORLD_PRIVATE_0; 87639f9d9dSBarry Smith extern Viewer VIEWER_DRAWX_WORLD_PRIVATE_1; 88639f9d9dSBarry Smith extern Viewer VIEWER_DRAWX_WORLD_PRIVATE_2; 895311e20fSBarry Smith extern Viewer VIEWER_DRAWX_SELF_PRIVATE; 90c16cb8f2SBarry Smith extern Viewer VIEWER_MATLAB_WORLD_PRIVATE; 91c16cb8f2SBarry Smith extern Viewer VIEWER_MATLAB_SELF_PRIVATE; /* not yet used */ 925311e20fSBarry Smith 93cf256101SBarry Smith extern int ViewerInitializeDrawXWorld_Private_0(void); 94cf256101SBarry Smith extern int ViewerInitializeDrawXWorld_Private_1(void); 95cf256101SBarry Smith extern int ViewerInitializeDrawXWorld_Private_2(void); 96cf256101SBarry Smith extern int ViewerInitializeDrawXSelf_Private(void); 97cf256101SBarry Smith extern int ViewerInitializeMatlabWorld_Private(void); 9858562591SBarry Smith extern Viewer VIEWER_DRAWX_(MPI_Comm); 9956cd22aeSBarry Smith extern int VIEWER_DRAWX_Destroy(MPI_Comm); 1005311e20fSBarry Smith 101639f9d9dSBarry Smith #define VIEWER_DRAWX_WORLD_0 \ 102639f9d9dSBarry Smith (ViewerInitializeDrawXWorld_Private_0(),VIEWER_DRAWX_WORLD_PRIVATE_0) 103639f9d9dSBarry Smith #define VIEWER_DRAWX_WORLD_1 \ 104639f9d9dSBarry Smith (ViewerInitializeDrawXWorld_Private_1(),VIEWER_DRAWX_WORLD_PRIVATE_1) 105639f9d9dSBarry Smith #define VIEWER_DRAWX_WORLD_2 \ 106639f9d9dSBarry Smith (ViewerInitializeDrawXWorld_Private_2(),VIEWER_DRAWX_WORLD_PRIVATE_2) 107639f9d9dSBarry Smith 1085311e20fSBarry Smith #define VIEWER_DRAWX_SELF \ 1095311e20fSBarry Smith (ViewerInitializeDrawXSelf_Private(),VIEWER_DRAWX_SELF_PRIVATE) 110639f9d9dSBarry Smith #define VIEWER_DRAWX_WORLD VIEWER_DRAWX_WORLD_0 111e1311b90SBarry Smith 112c16cb8f2SBarry Smith #define VIEWER_MATLAB_WORLD \ 113c16cb8f2SBarry Smith (ViewerInitializeMatlabWorld_Private(),VIEWER_MATLAB_WORLD_PRIVATE) 114c16cb8f2SBarry Smith 11577ed5343SBarry Smith /* 11677ed5343SBarry Smith Viewer based on the ALICE Memory Snooper 11777ed5343SBarry Smith */ 118cb5b572fSBarry Smith #if defined(HAVE_AMS) 119cb5b572fSBarry Smith #include "ams.h" 120cb5b572fSBarry Smith extern int ViewerAMSGetAMSComm(Viewer,AMS_Comm *); 121cb5b572fSBarry Smith extern int ViewerAMSOpen(MPI_Comm,const char[],Viewer*); 122cb5b572fSBarry Smith extern Viewer VIEWER_AMS_(MPI_Comm); 123cb5b572fSBarry Smith extern int VIEWER_AMS_Destroy(MPI_Comm); 124cb5b572fSBarry Smith extern Viewer VIEWER_AMS_WORLD_PRIVATE; 125cb5b572fSBarry Smith extern int ViewerInitializeAMSWorld_Private(void); 126cb5b572fSBarry Smith #define VIEWER_AMS_WORLD (ViewerInitializeAMSWorld_Private(),VIEWER_AMS_WORLD_PRIVATE) 1272eb8c8abSBarry Smith #endif 128cb5b572fSBarry Smith 129f2b01315SBarry Smith /* 130f2b01315SBarry Smith Viewer utility routines used by PETSc that are not normally used 131f2b01315SBarry Smith by users. 132f2b01315SBarry Smith */ 133f2b01315SBarry Smith extern int ViewerMatlabPutScalar_Private(Viewer,int,int,Scalar*); 134f2b01315SBarry Smith extern int ViewerMatlabPutDouble_Private(Viewer,int,int,double*); 135f2b01315SBarry Smith extern int ViewerMatlabPutInt_Private(Viewer,int,int*); 136f2b01315SBarry Smith extern int ViewerMatlabPutSparse_Private(Viewer,int,int,int,Scalar*,int*,int *); 137f2b01315SBarry Smith extern int ViewerInitializeASCII_Private(void); 138f2b01315SBarry Smith extern int ViewerDestroyASCII_Private(void); 139f2b01315SBarry Smith extern int ViewerDestroyDrawX_Private(void); 140f2b01315SBarry Smith extern int ViewerDestroyMatlab_Private(void); 141f2b01315SBarry Smith extern int ViewerDestroyAMS_Private(void); 142f2b01315SBarry Smith 143cb5b572fSBarry Smith #endif 144cb5b572fSBarry Smith 145