xref: /petsc/include/petscviewer.h (revision fb9695e52cb52bdd61c020aa3052f0ef9b41684c)
1*fb9695e5SSatish Balay /* $Id: petscviewer.h,v 1.80 2001/01/19 20:43:48 bsmith Exp balay $ */
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"
22*fb9695e5SSatish Balay #define PETSC_VIEWER_BINARY       "binary"
23b0a32e0cSBarry Smith #define PETSC_VIEWER_STRING       "string"
24*fb9695e5SSatish 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 
56*fb9695e5SSatish Balay typedef enum {
57*fb9695e5SSatish Balay   PETSC_VIEWER_ASCII_DEFAULT, PETSC_VIEWER_ASCII_MATLAB, PETSC_VIEWER_ASCII_IMPL,
58*fb9695e5SSatish Balay   PETSC_VIEWER_ASCII_INFO, PETSC_VIEWER_ASCII_INFO_LONG, PETSC_VIEWER_ASCII_COMMON,
59*fb9695e5SSatish Balay   PETSC_VIEWER_ASCII_SYMMODU, PETSC_VIEWER_ASCII_INDEX, PETSC_VIEWER_ASCII_DENSE,
60*fb9695e5SSatish Balay   PETSC_VIEWER_BINARY_DEFAULT, PETSC_VIEWER_BINARY_NATIVE, PETSC_VIEWER_DRAW_BASIC,
61*fb9695e5SSatish Balay   PETSC_VIEWER_DRAW_LG, PETSC_VIEWER_DRAW_CONTOUR, PETSC_VIEWER_DRAW_PORTS,
62*fb9695e5SSatish Balay   PETSC_VIEWER_NATIVE} PetscViewerFormatType;
63090de74eSSatish Balay 
645a655dc6SBarry Smith 
655311e20fSBarry Smith 
66*fb9695e5SSatish Balay EXTERN int PetscViewerSetFormat(PetscViewer,PetscViewerFormatType);
67*fb9695e5SSatish Balay EXTERN int PetscViewerPushFormat(PetscViewer,PetscViewerFormatType);
68b0a32e0cSBarry Smith EXTERN int PetscViewerPopFormat(PetscViewer);
69*fb9695e5SSatish Balay EXTERN int PetscViewerGetFormat(PetscViewer,PetscViewerFormatType*);
70b0a32e0cSBarry Smith EXTERN int PetscViewerFlush(PetscViewer);
714b0e389bSBarry Smith 
7277ed5343SBarry Smith /*
7377ed5343SBarry Smith    Operations explicit to a particular class of viewers
7477ed5343SBarry Smith */
75b0a32e0cSBarry Smith EXTERN int PetscViewerASCIIGetPointer(PetscViewer,FILE**);
76b0a32e0cSBarry Smith EXTERN int PetscViewerASCIIPrintf(PetscViewer,const char[],...);
77b0a32e0cSBarry Smith EXTERN int PetscViewerASCIISynchronizedPrintf(PetscViewer,const char[],...);
78b0a32e0cSBarry Smith EXTERN int PetscViewerASCIIPushTab(PetscViewer);
79b0a32e0cSBarry Smith EXTERN int PetscViewerASCIIPopTab(PetscViewer);
80b0a32e0cSBarry Smith EXTERN int PetscViewerASCIIUseTabs(PetscViewer,PetscTruth);
81b0a32e0cSBarry Smith EXTERN int PetscViewerASCIISetTab(PetscViewer,int);
82b0a32e0cSBarry Smith EXTERN int PetscViewerBinaryGetDescriptor(PetscViewer,int*);
83b0a32e0cSBarry Smith EXTERN int PetscViewerBinaryGetInfoPointer(PetscViewer,FILE **);
84b0a32e0cSBarry Smith EXTERN int PetscViewerBinarySetType(PetscViewer,PetscViewerBinaryType);
85b0a32e0cSBarry Smith EXTERN int PetscViewerStringSPrintf(PetscViewer,char *,...);
86b0a32e0cSBarry Smith EXTERN int PetscViewerStringSetString(PetscViewer,char[],int);
87b0a32e0cSBarry Smith EXTERN int PetscViewerDrawClear(PetscViewer);
88b0a32e0cSBarry Smith EXTERN int PetscViewerDrawSetInfo(PetscViewer,const char[],const char[],int,int,int,int);
89b0a32e0cSBarry Smith EXTERN int PetscViewerSocketSetConnection(PetscViewer,const char[],int);
90c655490fSBarry Smith 
91b0a32e0cSBarry Smith EXTERN int PetscViewerSetFilename(PetscViewer,const char[]);
92b0a32e0cSBarry Smith EXTERN int PetscViewerGetFilename(PetscViewer,char**);
9377ed5343SBarry Smith 
9477ed5343SBarry Smith /*
9577ed5343SBarry Smith      These are all the default viewers that do not have
9677ed5343SBarry Smith    to be explicitly opened
9777ed5343SBarry Smith */
98b0a32e0cSBarry Smith EXTERN PetscViewer PETSC_VIEWER_STDOUT_(MPI_Comm);
99b0a32e0cSBarry Smith EXTERN PetscViewer PETSC_VIEWER_STDERR_(MPI_Comm);
100b0a32e0cSBarry Smith EXTERN PetscViewer PETSC_VIEWER_DRAW_(MPI_Comm);
101b0a32e0cSBarry Smith EXTERN PetscViewer PETSC_VIEWER_SOCKET_(MPI_Comm);
102b0a32e0cSBarry Smith EXTERN PetscViewer PETSC_VIEWER_BINARY_(MPI_Comm);
1035311e20fSBarry Smith 
104b0a32e0cSBarry Smith #define PETSC_VIEWER_STDOUT_SELF  PETSC_VIEWER_STDOUT_(PETSC_COMM_SELF)
105b0a32e0cSBarry Smith #define PETSC_VIEWER_STDOUT_WORLD PETSC_VIEWER_STDOUT_(PETSC_COMM_WORLD)
106b0a32e0cSBarry Smith #define PETSC_VIEWER_STDERR_SELF  PETSC_VIEWER_STDERR_(PETSC_COMM_SELF)
107b0a32e0cSBarry Smith #define PETSC_VIEWER_STDERR_WORLD PETSC_VIEWER_STDERR_(PETSC_COMM_WORLD)
108b0a32e0cSBarry Smith #define PETSC_VIEWER_DRAW_SELF    PETSC_VIEWER_DRAW_(PETSC_COMM_SELF)
109b0a32e0cSBarry Smith #define PETSC_VIEWER_DRAW_WORLD   PETSC_VIEWER_DRAW_(PETSC_COMM_WORLD)
110b0a32e0cSBarry Smith #define PETSC_VIEWER_SOCKET_WORLD PETSC_VIEWER_SOCKET_(PETSC_COMM_WORLD)
111b0a32e0cSBarry Smith #define PETSC_VIEWER_SOCKET_SELF  PETSC_VIEWER_SOCKET_(PETSC_COMM_SELF)
112b0a32e0cSBarry Smith #define PETSC_VIEWER_BINARY_WORLD PETSC_VIEWER_BINARY_(PETSC_COMM_WORLD)
113b0a32e0cSBarry Smith #define PETSC_VIEWER_BINARY_SELF  PETSC_VIEWER_BINARY_(PETSC_COMM_SELF)
11465ef3172SBarry Smith 
11577ed5343SBarry Smith /*
116b0a32e0cSBarry Smith     PetscViewer based on the ALICE Memory Snooper
11777ed5343SBarry Smith */
118aa482453SBarry Smith #if defined(PETSC_HAVE_AMS)
119cb5b572fSBarry Smith #include "ams.h"
120b0a32e0cSBarry Smith EXTERN int         PetscViewerAMSGetAMSComm(PetscViewer,AMS_Comm *);
121b0a32e0cSBarry Smith EXTERN int         PetscViewerAMSOpen(MPI_Comm,const char[],PetscViewer*);
122b0a32e0cSBarry Smith EXTERN PetscViewer PETSC_VIEWER_AMS_(MPI_Comm);
123b0a32e0cSBarry Smith EXTERN int         PETSC_VIEWER_AMS_Destroy(MPI_Comm);
124b0a32e0cSBarry Smith #define PETSC_VIEWER_AMS_WORLD PETSC_VIEWER_AMS_(PETSC_COMM_WORLD)
1252eb8c8abSBarry Smith #endif
126cb5b572fSBarry Smith 
127f2b01315SBarry Smith /*
128b0a32e0cSBarry Smith     PetscViewer utility routines used by PETSc that are not normally used
129f2b01315SBarry Smith    by users.
130f2b01315SBarry Smith */
131b0a32e0cSBarry Smith EXTERN int  PetscViewerSocketPutScalar(PetscViewer,int,int,Scalar*);
132b0a32e0cSBarry Smith EXTERN int  PetscViewerSocketPutReal(PetscViewer,int,int,double*);
133b0a32e0cSBarry Smith EXTERN int  PetscViewerSocketPutInt(PetscViewer,int,int*);
134b0a32e0cSBarry Smith EXTERN int  PetscViewerSocketPutSparse_Private(PetscViewer,int,int,int,Scalar*,int*,int *);
135b0a32e0cSBarry Smith EXTERN int  PetscViewerDestroyAMS_Private(void);
136f2b01315SBarry Smith 
137d132466eSBarry Smith /*
138d132466eSBarry Smith     Manages sets of viewers
139d132466eSBarry Smith */
140b0a32e0cSBarry Smith typedef struct _p_PetscViewers* PetscViewers;
141b0a32e0cSBarry Smith EXTERN int PetscViewersCreate(MPI_Comm,PetscViewers*);
142b0a32e0cSBarry Smith EXTERN int PetscViewersDestroy(PetscViewers);
143b0a32e0cSBarry Smith EXTERN int PetscViewersGetViewer(PetscViewers,int,PetscViewer*);
144d132466eSBarry Smith 
145cb5b572fSBarry Smith #endif
146cb5b572fSBarry Smith 
147e7592fafSBarry Smith 
148e7592fafSBarry Smith 
149e7592fafSBarry Smith 
150