xref: /petsc/include/petscviewer.h (revision b16076930e2f42f958c62600ee2ffba798419d87)
1*b1607693SBarry Smith /* $Id: petscviewer.h,v 1.82 2001/01/20 03:33:35 bsmith Exp bsmith $ */
284cb2905SBarry Smith /*
3b0a32e0cSBarry 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 
9b0a32e0cSBarry Smith typedef struct _p_PetscViewer*            PetscViewer;
103c119ea2SBarry Smith 
113c119ea2SBarry Smith /*
12b0a32e0cSBarry 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 
17b0a32e0cSBarry Smith #define PETSC_VIEWER_COOKIE              PETSC_COOKIE+1
18b0a32e0cSBarry Smith typedef char*PetscViewerType;
192eb8c8abSBarry Smith 
20b0a32e0cSBarry Smith #define PETSC_VIEWER_SOCKET       "socket"
21b0a32e0cSBarry Smith #define PETSC_VIEWER_ASCII        "ascii"
22fb9695e5SSatish Balay #define PETSC_VIEWER_BINARY       "binary"
23b0a32e0cSBarry Smith #define PETSC_VIEWER_STRING       "string"
24fb9695e5SSatish Balay #define PETSC_VIEWER_DRAW         "draw"
25b0a32e0cSBarry Smith #define PETSC_VIEWER_AMS          "ams"
2677ed5343SBarry Smith 
27b0a32e0cSBarry Smith extern PetscFList PetscViewerList;
28b0a32e0cSBarry Smith EXTERN int PetscViewerRegisterAll(char *);
29b0a32e0cSBarry Smith EXTERN int PetscViewerRegisterDestroy(void);
307b2a1423SBarry Smith 
31b0a32e0cSBarry Smith EXTERN int PetscViewerRegister(char*,char*,char*,int(*)(PetscViewer));
32aa482453SBarry Smith #if defined(PETSC_USE_DYNAMIC_LIBRARIES)
33b0a32e0cSBarry Smith #define PetscViewerRegisterDynamic(a,b,c,d) PetscViewerRegister(a,b,c,0)
347b2a1423SBarry Smith #else
35b0a32e0cSBarry Smith #define PetscViewerRegisterDynamic(a,b,c,d) PetscViewerRegister(a,b,c,d)
367b2a1423SBarry Smith #endif
37b0a32e0cSBarry Smith EXTERN int PetscViewerCreate(MPI_Comm,PetscViewer*);
38b0a32e0cSBarry Smith EXTERN int PetscViewerSetFromOptions(PetscViewer);
397b2a1423SBarry Smith 
407b2a1423SBarry Smith 
41b0a32e0cSBarry Smith EXTERN int PetscViewerASCIIOpen(MPI_Comm,const char[],PetscViewer*);
42b0a32e0cSBarry Smith typedef enum {PETSC_BINARY_RDONLY,PETSC_BINARY_WRONLY,PETSC_BINARY_CREATE} PetscViewerBinaryType;
43b0a32e0cSBarry Smith EXTERN int PetscViewerBinaryOpen(MPI_Comm,const char[],PetscViewerBinaryType,PetscViewer*);
44b0a32e0cSBarry Smith EXTERN int PetscViewerSocketOpen(MPI_Comm,const char[],int,PetscViewer*);
45b0a32e0cSBarry Smith EXTERN int PetscViewerStringOpen(MPI_Comm,char[],int,PetscViewer*);
46b0a32e0cSBarry Smith EXTERN int PetscViewerDrawOpen(MPI_Comm,const char[],const char[],int,int,int,int,PetscViewer*);
47b0a32e0cSBarry Smith EXTERN int PetscViewerAMSSetCommName(PetscViewer,const char[]);
484b0e389bSBarry Smith 
49b0a32e0cSBarry Smith EXTERN int PetscViewerGetType(PetscViewer,PetscViewerType*);
50b0a32e0cSBarry Smith EXTERN int PetscViewerSetType(PetscViewer,PetscViewerType);
51b0a32e0cSBarry Smith EXTERN int PetscViewerDestroy(PetscViewer);
52b0a32e0cSBarry Smith EXTERN int PetscViewerGetSingleton(PetscViewer,PetscViewer*);
53b0a32e0cSBarry Smith EXTERN int PetscViewerRestoreSingleton(PetscViewer,PetscViewer*);
54ae39576cSLois Curfman McInnes 
55090de74eSSatish Balay 
56fb9695e5SSatish Balay typedef enum {
57f3ef73ceSBarry Smith   PETSC_VIEWER_ASCII_DEFAULT,
58f3ef73ceSBarry Smith   PETSC_VIEWER_ASCII_MATLAB,
59f3ef73ceSBarry Smith   PETSC_VIEWER_ASCII_IMPL,
60f3ef73ceSBarry Smith   PETSC_VIEWER_ASCII_INFO,
61f3ef73ceSBarry Smith   PETSC_VIEWER_ASCII_INFO_LONG,
62f3ef73ceSBarry Smith   PETSC_VIEWER_ASCII_COMMON,
63f3ef73ceSBarry Smith   PETSC_VIEWER_ASCII_SYMMODU,
64f3ef73ceSBarry Smith   PETSC_VIEWER_ASCII_INDEX,
65f3ef73ceSBarry Smith   PETSC_VIEWER_ASCII_DENSE,
66f3ef73ceSBarry Smith   PETSC_VIEWER_BINARY_DEFAULT,
67f3ef73ceSBarry Smith   PETSC_VIEWER_BINARY_NATIVE,
68f3ef73ceSBarry Smith   PETSC_VIEWER_DRAW_BASIC,
69f3ef73ceSBarry Smith   PETSC_VIEWER_DRAW_LG,
70f3ef73ceSBarry Smith   PETSC_VIEWER_DRAW_CONTOUR,
71f3ef73ceSBarry Smith   PETSC_VIEWER_DRAW_PORTS,
72f3ef73ceSBarry Smith   PETSC_VIEWER_NATIVE,
73f3ef73ceSBarry Smith   PETSC_VIEWER_NOFORMAT} PetscViewerFormat;
74090de74eSSatish Balay 
755a655dc6SBarry Smith 
765311e20fSBarry Smith 
77f3ef73ceSBarry Smith EXTERN int PetscViewerSetFormat(PetscViewer,PetscViewerFormat);
78f3ef73ceSBarry Smith EXTERN int PetscViewerPushFormat(PetscViewer,PetscViewerFormat);
79b0a32e0cSBarry Smith EXTERN int PetscViewerPopFormat(PetscViewer);
80f3ef73ceSBarry Smith EXTERN int PetscViewerGetFormat(PetscViewer,PetscViewerFormat*);
81b0a32e0cSBarry Smith EXTERN int PetscViewerFlush(PetscViewer);
824b0e389bSBarry Smith 
8377ed5343SBarry Smith /*
8477ed5343SBarry Smith    Operations explicit to a particular class of viewers
8577ed5343SBarry Smith */
86b0a32e0cSBarry Smith EXTERN int PetscViewerASCIIGetPointer(PetscViewer,FILE**);
87b0a32e0cSBarry Smith EXTERN int PetscViewerASCIIPrintf(PetscViewer,const char[],...);
88b0a32e0cSBarry Smith EXTERN int PetscViewerASCIISynchronizedPrintf(PetscViewer,const char[],...);
89b0a32e0cSBarry Smith EXTERN int PetscViewerASCIIPushTab(PetscViewer);
90b0a32e0cSBarry Smith EXTERN int PetscViewerASCIIPopTab(PetscViewer);
91b0a32e0cSBarry Smith EXTERN int PetscViewerASCIIUseTabs(PetscViewer,PetscTruth);
92b0a32e0cSBarry Smith EXTERN int PetscViewerASCIISetTab(PetscViewer,int);
93b0a32e0cSBarry Smith EXTERN int PetscViewerBinaryGetDescriptor(PetscViewer,int*);
94b0a32e0cSBarry Smith EXTERN int PetscViewerBinaryGetInfoPointer(PetscViewer,FILE **);
95b0a32e0cSBarry Smith EXTERN int PetscViewerBinarySetType(PetscViewer,PetscViewerBinaryType);
96b0a32e0cSBarry Smith EXTERN int PetscViewerStringSPrintf(PetscViewer,char *,...);
97b0a32e0cSBarry Smith EXTERN int PetscViewerStringSetString(PetscViewer,char[],int);
98b0a32e0cSBarry Smith EXTERN int PetscViewerDrawClear(PetscViewer);
99b0a32e0cSBarry Smith EXTERN int PetscViewerDrawSetInfo(PetscViewer,const char[],const char[],int,int,int,int);
100b0a32e0cSBarry Smith EXTERN int PetscViewerSocketSetConnection(PetscViewer,const char[],int);
101c655490fSBarry Smith 
102b0a32e0cSBarry Smith EXTERN int PetscViewerSetFilename(PetscViewer,const char[]);
103b0a32e0cSBarry Smith EXTERN int PetscViewerGetFilename(PetscViewer,char**);
10477ed5343SBarry Smith 
10577ed5343SBarry Smith /*
10677ed5343SBarry Smith      These are all the default viewers that do not have
10777ed5343SBarry Smith    to be explicitly opened
10877ed5343SBarry Smith */
109b0a32e0cSBarry Smith EXTERN PetscViewer PETSC_VIEWER_STDOUT_(MPI_Comm);
110b0a32e0cSBarry Smith EXTERN PetscViewer PETSC_VIEWER_STDERR_(MPI_Comm);
111b0a32e0cSBarry Smith EXTERN PetscViewer PETSC_VIEWER_DRAW_(MPI_Comm);
112b0a32e0cSBarry Smith EXTERN PetscViewer PETSC_VIEWER_SOCKET_(MPI_Comm);
113b0a32e0cSBarry Smith EXTERN PetscViewer PETSC_VIEWER_BINARY_(MPI_Comm);
1145311e20fSBarry Smith 
115b0a32e0cSBarry Smith #define PETSC_VIEWER_STDOUT_SELF  PETSC_VIEWER_STDOUT_(PETSC_COMM_SELF)
116b0a32e0cSBarry Smith #define PETSC_VIEWER_STDOUT_WORLD PETSC_VIEWER_STDOUT_(PETSC_COMM_WORLD)
117b0a32e0cSBarry Smith #define PETSC_VIEWER_STDERR_SELF  PETSC_VIEWER_STDERR_(PETSC_COMM_SELF)
118b0a32e0cSBarry Smith #define PETSC_VIEWER_STDERR_WORLD PETSC_VIEWER_STDERR_(PETSC_COMM_WORLD)
119b0a32e0cSBarry Smith #define PETSC_VIEWER_DRAW_SELF    PETSC_VIEWER_DRAW_(PETSC_COMM_SELF)
120b0a32e0cSBarry Smith #define PETSC_VIEWER_DRAW_WORLD   PETSC_VIEWER_DRAW_(PETSC_COMM_WORLD)
121b0a32e0cSBarry Smith #define PETSC_VIEWER_SOCKET_WORLD PETSC_VIEWER_SOCKET_(PETSC_COMM_WORLD)
122b0a32e0cSBarry Smith #define PETSC_VIEWER_SOCKET_SELF  PETSC_VIEWER_SOCKET_(PETSC_COMM_SELF)
123b0a32e0cSBarry Smith #define PETSC_VIEWER_BINARY_WORLD PETSC_VIEWER_BINARY_(PETSC_COMM_WORLD)
124b0a32e0cSBarry Smith #define PETSC_VIEWER_BINARY_SELF  PETSC_VIEWER_BINARY_(PETSC_COMM_SELF)
12565ef3172SBarry Smith 
12677ed5343SBarry Smith /*
127b0a32e0cSBarry Smith     PetscViewer based on the ALICE Memory Snooper
12877ed5343SBarry Smith */
129aa482453SBarry Smith #if defined(PETSC_HAVE_AMS)
130cb5b572fSBarry Smith #include "ams.h"
131b0a32e0cSBarry Smith EXTERN int         PetscViewerAMSGetAMSComm(PetscViewer,AMS_Comm *);
132b0a32e0cSBarry Smith EXTERN int         PetscViewerAMSOpen(MPI_Comm,const char[],PetscViewer*);
133*b1607693SBarry Smith EXTERN int         PetscViewerAMSLock(PetscViewer);
134b0a32e0cSBarry Smith EXTERN PetscViewer PETSC_VIEWER_AMS_(MPI_Comm);
135b0a32e0cSBarry Smith EXTERN int         PETSC_VIEWER_AMS_Destroy(MPI_Comm);
136b0a32e0cSBarry Smith #define PETSC_VIEWER_AMS_WORLD PETSC_VIEWER_AMS_(PETSC_COMM_WORLD)
1372eb8c8abSBarry Smith #endif
138cb5b572fSBarry Smith 
139f2b01315SBarry Smith /*
140b0a32e0cSBarry Smith     PetscViewer utility routines used by PETSc that are not normally used
141f2b01315SBarry Smith    by users.
142f2b01315SBarry Smith */
143b0a32e0cSBarry Smith EXTERN int  PetscViewerSocketPutScalar(PetscViewer,int,int,Scalar*);
144b0a32e0cSBarry Smith EXTERN int  PetscViewerSocketPutReal(PetscViewer,int,int,double*);
145b0a32e0cSBarry Smith EXTERN int  PetscViewerSocketPutInt(PetscViewer,int,int*);
146b0a32e0cSBarry Smith EXTERN int  PetscViewerSocketPutSparse_Private(PetscViewer,int,int,int,Scalar*,int*,int *);
147b0a32e0cSBarry Smith EXTERN int  PetscViewerDestroyAMS_Private(void);
148f2b01315SBarry Smith 
149d132466eSBarry Smith /*
150d132466eSBarry Smith     Manages sets of viewers
151d132466eSBarry Smith */
152b0a32e0cSBarry Smith typedef struct _p_PetscViewers* PetscViewers;
153b0a32e0cSBarry Smith EXTERN int PetscViewersCreate(MPI_Comm,PetscViewers*);
154b0a32e0cSBarry Smith EXTERN int PetscViewersDestroy(PetscViewers);
155b0a32e0cSBarry Smith EXTERN int PetscViewersGetViewer(PetscViewers,int,PetscViewer*);
156d132466eSBarry Smith 
157cb5b572fSBarry Smith #endif
158cb5b572fSBarry Smith 
159e7592fafSBarry Smith 
160e7592fafSBarry Smith 
161e7592fafSBarry Smith 
162