xref: /petsc/include/petscviewer.h (revision 7b2a1423c364accaa7ca5cca0f9cdfb1ad6de450)
1*7b2a1423SBarry Smith /* $Id: viewer.h,v 1.60 1998/12/21 01:06:07 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 
20*7b2a1423SBarry 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 
27*7b2a1423SBarry Smith extern FList ViewerList;
28*7b2a1423SBarry Smith extern int ViewerRegisterAll(char *);
29*7b2a1423SBarry Smith extern int ViewerRegisterDestroy(void);
30*7b2a1423SBarry Smith 
31*7b2a1423SBarry Smith extern int ViewerRegister_Private(char*,char*,char*,int(*)(Viewer));
32*7b2a1423SBarry Smith #if defined(USE_DYNAMIC_LIBRARIES)
33*7b2a1423SBarry Smith #define ViewerRegister(a,b,c,d) ViewerRegister_Private(a,b,c,0)
34*7b2a1423SBarry Smith #else
35*7b2a1423SBarry Smith #define ViewerRegister(a,b,c,d) ViewerRegister_Private(a,b,c,d)
36*7b2a1423SBarry Smith #endif
37*7b2a1423SBarry Smith extern int ViewerCreate(MPI_Comm,Viewer*);
38*7b2a1423SBarry Smith extern int ViewerSetFromOptions(Viewer);
39*7b2a1423SBarry Smith 
40*7b2a1423SBarry 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*);
44*7b2a1423SBarry 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*);
474b0e389bSBarry Smith 
4877ed5343SBarry Smith extern int ViewerGetOutputname(Viewer,char**);
49bcd2baecSBarry Smith extern int ViewerGetType(Viewer,ViewerType*);
50*7b2a1423SBarry Smith extern int ViewerSetType(Viewer,ViewerType);
519651b370SBarry Smith extern int ViewerDestroy(Viewer);
52ae39576cSLois Curfman McInnes 
53639f9d9dSBarry Smith #define VIEWER_FORMAT_ASCII_DEFAULT       0
54639f9d9dSBarry Smith #define VIEWER_FORMAT_ASCII_MATLAB        1
55639f9d9dSBarry Smith #define VIEWER_FORMAT_ASCII_IMPL          2
56639f9d9dSBarry Smith #define VIEWER_FORMAT_ASCII_INFO          3
57639f9d9dSBarry Smith #define VIEWER_FORMAT_ASCII_INFO_LONG     4
58639f9d9dSBarry Smith #define VIEWER_FORMAT_ASCII_COMMON        5
5909b0ea9bSLois Curfman McInnes #define VIEWER_FORMAT_ASCII_SYMMODU       6
6047e7184fSBarry Smith #define VIEWER_FORMAT_ASCII_INDEX         7
61e24b481bSBarry Smith #define VIEWER_FORMAT_ASCII_DENSE         8
62090de74eSSatish Balay 
63639f9d9dSBarry Smith #define VIEWER_FORMAT_BINARY_DEFAULT      0
64639f9d9dSBarry Smith #define VIEWER_FORMAT_BINARY_NATIVE       1
65090de74eSSatish Balay 
665311e20fSBarry Smith #define VIEWER_FORMAT_DRAW_BASIC          0
675311e20fSBarry Smith #define VIEWER_FORMAT_DRAW_LG             1
680513a670SBarry Smith #define VIEWER_FORMAT_DRAW_CONTOUR        2
695311e20fSBarry Smith 
70e26ad7d8SSatish Balay extern int    ViewerSetFormat(Viewer,int,char[]);
71e26ad7d8SSatish Balay extern int    ViewerPushFormat(Viewer,int,char[]);
725311e20fSBarry Smith extern int    ViewerPopFormat(Viewer);
7390ace30eSBarry Smith extern int    ViewerGetFormat(Viewer,int*);
745fe861cdSBarry Smith extern int    ViewerFlush(Viewer);
754b0e389bSBarry Smith 
7677ed5343SBarry Smith /*
7777ed5343SBarry Smith    Operations explicit to a particular class of viewers
7877ed5343SBarry Smith */
7977ed5343SBarry Smith extern int ViewerASCIIGetPointer(Viewer,FILE**);
800ef38995SBarry Smith extern int ViewerASCIIPrintf(Viewer,const char[],...);
810ef38995SBarry Smith extern int ViewerASCIIPushTab(Viewer);
820ef38995SBarry Smith extern int ViewerASCIIPopTab(Viewer);
8377ed5343SBarry Smith extern int ViewerBinaryGetDescriptor(Viewer,int*);
8477ed5343SBarry Smith extern int ViewerBinaryGetInfoPointer(Viewer,FILE **);
8577ed5343SBarry Smith extern int ViewerStringSPrintf(Viewer,char *,...);
8677ed5343SBarry Smith extern int ViewerDrawClear(Viewer);
8777ed5343SBarry Smith 
8877ed5343SBarry Smith /*
8977ed5343SBarry Smith      These are all the default viewers that do not have
9077ed5343SBarry Smith    to be explicitly opened
9177ed5343SBarry Smith */
926d4a8577SBarry Smith extern Viewer VIEWER_STDOUT_SELF;
936d4a8577SBarry Smith extern Viewer VIEWER_STDERR_SELF;
9425482d47SBarry Smith extern Viewer VIEWER_STDOUT_WORLD;
950752156aSBarry Smith extern Viewer VIEWER_STDOUT_(MPI_Comm);
960752156aSBarry Smith extern int    VIEWER_STDOUT_Destroy(MPI_Comm);
97c22c1629SBarry Smith extern Viewer VIEWER_STDERR_WORLD;
980752156aSBarry Smith extern Viewer VIEWER_STDERR_(MPI_Comm);
990752156aSBarry Smith extern int    VIEWER_STDERR_Destroy(MPI_Comm);
100639f9d9dSBarry Smith extern Viewer VIEWER_DRAWX_WORLD_PRIVATE_0;
101639f9d9dSBarry Smith extern Viewer VIEWER_DRAWX_WORLD_PRIVATE_1;
102639f9d9dSBarry Smith extern Viewer VIEWER_DRAWX_WORLD_PRIVATE_2;
1035311e20fSBarry Smith extern Viewer VIEWER_DRAWX_SELF_PRIVATE;
104*7b2a1423SBarry Smith extern Viewer VIEWER_SOCKET_WORLD_PRIVATE;
105*7b2a1423SBarry Smith extern Viewer VIEWER_SOCKET_SELF_PRIVATE;  /* not yet used */
1065311e20fSBarry Smith 
107cf256101SBarry Smith extern int    ViewerInitializeDrawXWorld_Private_0(void);
108cf256101SBarry Smith extern int    ViewerInitializeDrawXWorld_Private_1(void);
109cf256101SBarry Smith extern int    ViewerInitializeDrawXWorld_Private_2(void);
110cf256101SBarry Smith extern int    ViewerInitializeDrawXSelf_Private(void);
111*7b2a1423SBarry Smith extern int    ViewerInitializeSocketWorld_Private(void);
11258562591SBarry Smith extern Viewer VIEWER_DRAWX_(MPI_Comm);
11356cd22aeSBarry Smith extern int    VIEWER_DRAWX_Destroy(MPI_Comm);
1145311e20fSBarry Smith 
115639f9d9dSBarry Smith #define VIEWER_DRAWX_WORLD_0 \
116639f9d9dSBarry Smith               (ViewerInitializeDrawXWorld_Private_0(),VIEWER_DRAWX_WORLD_PRIVATE_0)
117639f9d9dSBarry Smith #define VIEWER_DRAWX_WORLD_1 \
118639f9d9dSBarry Smith               (ViewerInitializeDrawXWorld_Private_1(),VIEWER_DRAWX_WORLD_PRIVATE_1)
119639f9d9dSBarry Smith #define VIEWER_DRAWX_WORLD_2 \
120639f9d9dSBarry Smith               (ViewerInitializeDrawXWorld_Private_2(),VIEWER_DRAWX_WORLD_PRIVATE_2)
121639f9d9dSBarry Smith 
1225311e20fSBarry Smith #define VIEWER_DRAWX_SELF \
1235311e20fSBarry Smith               (ViewerInitializeDrawXSelf_Private(),VIEWER_DRAWX_SELF_PRIVATE)
124639f9d9dSBarry Smith #define VIEWER_DRAWX_WORLD VIEWER_DRAWX_WORLD_0
125e1311b90SBarry Smith 
126*7b2a1423SBarry Smith #define VIEWER_SOCKET_WORLD \
127*7b2a1423SBarry Smith         (ViewerInitializeSocketWorld_Private(),VIEWER_SOCKET_WORLD_PRIVATE)
128c16cb8f2SBarry Smith 
12977ed5343SBarry Smith /*
13077ed5343SBarry Smith     Viewer based on the ALICE Memory Snooper
13177ed5343SBarry Smith */
132cb5b572fSBarry Smith #if defined(HAVE_AMS)
133cb5b572fSBarry Smith #include "ams.h"
134cb5b572fSBarry Smith extern int    ViewerAMSGetAMSComm(Viewer,AMS_Comm *);
135cb5b572fSBarry Smith extern int    ViewerAMSOpen(MPI_Comm,const char[],Viewer*);
136cb5b572fSBarry Smith extern Viewer VIEWER_AMS_(MPI_Comm);
137cb5b572fSBarry Smith extern int    VIEWER_AMS_Destroy(MPI_Comm);
138cb5b572fSBarry Smith extern Viewer VIEWER_AMS_WORLD_PRIVATE;
139cb5b572fSBarry Smith extern int    ViewerInitializeAMSWorld_Private(void);
140cb5b572fSBarry Smith #define VIEWER_AMS_WORLD (ViewerInitializeAMSWorld_Private(),VIEWER_AMS_WORLD_PRIVATE)
1412eb8c8abSBarry Smith #endif
142cb5b572fSBarry Smith 
143f2b01315SBarry Smith /*
144f2b01315SBarry Smith     Viewer utility routines used by PETSc that are not normally used
145f2b01315SBarry Smith    by users.
146f2b01315SBarry Smith */
147*7b2a1423SBarry Smith extern int  ViewerSocketPutScalar_Private(Viewer,int,int,Scalar*);
148*7b2a1423SBarry Smith extern int  ViewerSocketPutDouble_Private(Viewer,int,int,double*);
149*7b2a1423SBarry Smith extern int  ViewerSocketPutInt_Private(Viewer,int,int*);
150*7b2a1423SBarry Smith extern int  ViewerSocketPutSparse_Private(Viewer,int,int,int,Scalar*,int*,int *);
151f2b01315SBarry Smith extern int  ViewerInitializeASCII_Private(void);
152f2b01315SBarry Smith extern int  ViewerDestroyASCII_Private(void);
153f2b01315SBarry Smith extern int  ViewerDestroyDrawX_Private(void);
154*7b2a1423SBarry Smith extern int  ViewerDestroySocket_Private(void);
155f2b01315SBarry Smith extern int  ViewerDestroyAMS_Private(void);
156f2b01315SBarry Smith 
157cb5b572fSBarry Smith #endif
158cb5b572fSBarry Smith 
159