xref: /petsc/include/petscviewer.h (revision f2b01315562db6b71c100df2f4d953f40f911f1a)
1*f2b01315SBarry Smith /* $Id: viewer.h,v 1.58 1998/12/03 04:07:00 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**);
6677ed5343SBarry Smith extern int ViewerBinaryGetDescriptor(Viewer,int*);
6777ed5343SBarry Smith extern int ViewerBinaryGetInfoPointer(Viewer,FILE **);
6877ed5343SBarry Smith extern int ViewerStringSPrintf(Viewer,char *,...);
6977ed5343SBarry Smith extern int ViewerDrawClear(Viewer);
7077ed5343SBarry Smith 
7177ed5343SBarry Smith /*
7277ed5343SBarry Smith      These are all the default viewers that do not have
7377ed5343SBarry Smith    to be explicitly opened
7477ed5343SBarry Smith */
756d4a8577SBarry Smith extern Viewer VIEWER_STDOUT_SELF;
766d4a8577SBarry Smith extern Viewer VIEWER_STDERR_SELF;
7725482d47SBarry Smith extern Viewer VIEWER_STDOUT_WORLD;
780752156aSBarry Smith extern Viewer VIEWER_STDOUT_(MPI_Comm);
790752156aSBarry Smith extern int    VIEWER_STDOUT_Destroy(MPI_Comm);
80c22c1629SBarry Smith extern Viewer VIEWER_STDERR_WORLD;
810752156aSBarry Smith extern Viewer VIEWER_STDERR_(MPI_Comm);
820752156aSBarry Smith extern int    VIEWER_STDERR_Destroy(MPI_Comm);
83639f9d9dSBarry Smith extern Viewer VIEWER_DRAWX_WORLD_PRIVATE_0;
84639f9d9dSBarry Smith extern Viewer VIEWER_DRAWX_WORLD_PRIVATE_1;
85639f9d9dSBarry Smith extern Viewer VIEWER_DRAWX_WORLD_PRIVATE_2;
865311e20fSBarry Smith extern Viewer VIEWER_DRAWX_SELF_PRIVATE;
87c16cb8f2SBarry Smith extern Viewer VIEWER_MATLAB_WORLD_PRIVATE;
88c16cb8f2SBarry Smith extern Viewer VIEWER_MATLAB_SELF_PRIVATE;  /* not yet used */
895311e20fSBarry Smith 
90cf256101SBarry Smith extern int    ViewerInitializeDrawXWorld_Private_0(void);
91cf256101SBarry Smith extern int    ViewerInitializeDrawXWorld_Private_1(void);
92cf256101SBarry Smith extern int    ViewerInitializeDrawXWorld_Private_2(void);
93cf256101SBarry Smith extern int    ViewerInitializeDrawXSelf_Private(void);
94cf256101SBarry Smith extern int    ViewerInitializeMatlabWorld_Private(void);
9558562591SBarry Smith extern Viewer VIEWER_DRAWX_(MPI_Comm);
9656cd22aeSBarry Smith extern int    VIEWER_DRAWX_Destroy(MPI_Comm);
975311e20fSBarry Smith 
98639f9d9dSBarry Smith #define VIEWER_DRAWX_WORLD_0 \
99639f9d9dSBarry Smith               (ViewerInitializeDrawXWorld_Private_0(),VIEWER_DRAWX_WORLD_PRIVATE_0)
100639f9d9dSBarry Smith #define VIEWER_DRAWX_WORLD_1 \
101639f9d9dSBarry Smith               (ViewerInitializeDrawXWorld_Private_1(),VIEWER_DRAWX_WORLD_PRIVATE_1)
102639f9d9dSBarry Smith #define VIEWER_DRAWX_WORLD_2 \
103639f9d9dSBarry Smith               (ViewerInitializeDrawXWorld_Private_2(),VIEWER_DRAWX_WORLD_PRIVATE_2)
104639f9d9dSBarry Smith 
1055311e20fSBarry Smith #define VIEWER_DRAWX_SELF \
1065311e20fSBarry Smith               (ViewerInitializeDrawXSelf_Private(),VIEWER_DRAWX_SELF_PRIVATE)
107639f9d9dSBarry Smith #define VIEWER_DRAWX_WORLD VIEWER_DRAWX_WORLD_0
108e1311b90SBarry Smith 
109c16cb8f2SBarry Smith #define VIEWER_MATLAB_WORLD \
110c16cb8f2SBarry Smith         (ViewerInitializeMatlabWorld_Private(),VIEWER_MATLAB_WORLD_PRIVATE)
111c16cb8f2SBarry Smith 
11277ed5343SBarry Smith /*
11377ed5343SBarry Smith     Viewer based on the ALICE Memory Snooper
11477ed5343SBarry Smith */
115cb5b572fSBarry Smith #if defined(HAVE_AMS)
116cb5b572fSBarry Smith #include "ams.h"
117cb5b572fSBarry Smith extern int    ViewerAMSGetAMSComm(Viewer,AMS_Comm *);
118cb5b572fSBarry Smith extern int    ViewerAMSOpen(MPI_Comm,const char[],Viewer*);
119cb5b572fSBarry Smith extern Viewer VIEWER_AMS_(MPI_Comm);
120cb5b572fSBarry Smith extern int    VIEWER_AMS_Destroy(MPI_Comm);
121cb5b572fSBarry Smith extern Viewer VIEWER_AMS_WORLD_PRIVATE;
122cb5b572fSBarry Smith extern int    ViewerInitializeAMSWorld_Private(void);
123cb5b572fSBarry Smith #define VIEWER_AMS_WORLD (ViewerInitializeAMSWorld_Private(),VIEWER_AMS_WORLD_PRIVATE)
1242eb8c8abSBarry Smith #endif
125cb5b572fSBarry Smith 
126*f2b01315SBarry Smith /*
127*f2b01315SBarry Smith     Viewer utility routines used by PETSc that are not normally used
128*f2b01315SBarry Smith    by users.
129*f2b01315SBarry Smith */
130*f2b01315SBarry Smith extern int  ViewerMatlabPutScalar_Private(Viewer,int,int,Scalar*);
131*f2b01315SBarry Smith extern int  ViewerMatlabPutDouble_Private(Viewer,int,int,double*);
132*f2b01315SBarry Smith extern int  ViewerMatlabPutInt_Private(Viewer,int,int*);
133*f2b01315SBarry Smith extern int  ViewerMatlabPutSparse_Private(Viewer,int,int,int,Scalar*,int*,int *);
134*f2b01315SBarry Smith extern int  ViewerInitializeASCII_Private(void);
135*f2b01315SBarry Smith extern int  ViewerDestroyASCII_Private(void);
136*f2b01315SBarry Smith extern int  ViewerDestroyDrawX_Private(void);
137*f2b01315SBarry Smith extern int  ViewerDestroyMatlab_Private(void);
138*f2b01315SBarry Smith extern int  ViewerDestroyAMS_Private(void);
139*f2b01315SBarry Smith 
140cb5b572fSBarry Smith #endif
141cb5b572fSBarry Smith 
142