xref: /petsc/include/petscviewer.h (revision 09573ac72a50d3e7ecd55a2b7f0ef28450cd0a8b)
184cb2905SBarry Smith /*
2b0a32e0cSBarry Smith      PetscViewers are objects where other objects can be looked at or stored.
384cb2905SBarry Smith */
43c119ea2SBarry Smith 
50a835dfdSSatish Balay #if !defined(__PETSCVIEWER_H)
60a835dfdSSatish Balay #define __PETSCVIEWER_H
7dfbe8321SBarry Smith 
8e9fa29b7SSatish Balay #if defined(PETSC_USE_EXTERN_CXX) && defined(__cplusplus)
9e9fa29b7SSatish Balay extern "C" {
10e9fa29b7SSatish Balay #endif
112eb8c8abSBarry Smith 
12b9617806SBarry Smith /*S
13b9617806SBarry Smith      PetscViewer - Abstract PETSc object that helps view (in ASCII, binary, graphically etc)
14b9617806SBarry Smith          other PETSc objects
15b9617806SBarry Smith 
16b9617806SBarry Smith    Level: beginner
17b9617806SBarry Smith 
18b9617806SBarry Smith   Concepts: viewing
19b9617806SBarry Smith 
20b9617806SBarry Smith .seealso:  PetscViewerCreate(), PetscViewerSetType(), PetscViewerType
21b9617806SBarry Smith S*/
22b0a32e0cSBarry Smith typedef struct _p_PetscViewer* PetscViewer;
233c119ea2SBarry Smith 
24e9fa29b7SSatish Balay #if defined(PETSC_USE_EXTERN_CXX) && defined(__cplusplus)
25e9fa29b7SSatish Balay }
26e9fa29b7SSatish Balay #endif
27e9fa29b7SSatish Balay 
28d382aafbSBarry Smith #include "petscsys.h"
298fb59f0aSKris Buschelman 
308fb59f0aSKris Buschelman #if defined(PETSC_USE_EXTERN_CXX) && defined(__cplusplus)
318fb59f0aSKris Buschelman extern "C" {
328fb59f0aSKris Buschelman #endif
338fb59f0aSKris Buschelman 
348738c821SJed Brown extern PETSCSYS_DLLEXPORT PetscClassId PETSC_VIEWER_CLASSID;
358fb59f0aSKris Buschelman 
368fb59f0aSKris Buschelman #if defined(PETSC_USE_EXTERN_CXX) && defined(__cplusplus)
378fb59f0aSKris Buschelman }
388fb59f0aSKris Buschelman #endif
398fb59f0aSKris Buschelman 
40e9fa29b7SSatish Balay 
413c119ea2SBarry Smith /*
42d382aafbSBarry Smith     petscsys.h must be included AFTER the definition of PetscViewer for ADIC to
433c119ea2SBarry Smith    process correctly.
443c119ea2SBarry Smith */
45e9fa29b7SSatish Balay PETSC_EXTERN_CXX_BEGIN
46b9617806SBarry Smith /*E
47b9617806SBarry Smith     PetscViewerType - String with the name of a PETSc PETScViewer
48b9617806SBarry Smith 
49b9617806SBarry Smith    Level: beginner
50b9617806SBarry Smith 
51b9617806SBarry Smith .seealso: PetscViewerSetType(), PetscViewer
52b9617806SBarry Smith E*/
53a313700dSBarry Smith #define PetscViewerType char*
542692d6eeSBarry Smith #define PETSCVIEWERSOCKET       "socket"
552692d6eeSBarry Smith #define PETSCVIEWERASCII        "ascii"
562692d6eeSBarry Smith #define PETSCVIEWERBINARY       "binary"
572692d6eeSBarry Smith #define PETSCVIEWERSTRING       "string"
582692d6eeSBarry Smith #define PETSCVIEWERDRAW         "draw"
592692d6eeSBarry Smith #define PETSCVIEWERVU           "vu"
602692d6eeSBarry Smith #define PETSCVIEWERMATHEMATICA  "mathematica"
612692d6eeSBarry Smith #define PETSCVIEWERNETCDF       "netcdf"
622692d6eeSBarry Smith #define PETSCVIEWERHDF5         "hdf5"
632692d6eeSBarry Smith #define PETSCVIEWERMATLAB       "matlab"
64b3506946SBarry Smith #define PETSCVIEWERAMS          "ams"
6577ed5343SBarry Smith 
66b0a32e0cSBarry Smith extern PetscFList PetscViewerList;
67*09573ac7SBarry Smith extern PetscErrorCode PETSCSYS_DLLEXPORT PetscViewerRegisterAll(const char *);
68*09573ac7SBarry Smith extern PetscErrorCode PETSCSYS_DLLEXPORT PetscViewerRegisterDestroy(void);
69*09573ac7SBarry Smith extern PetscErrorCode PETSCSYS_DLLEXPORT PetscViewerInitializePackage(const char[]);
707b2a1423SBarry Smith 
71*09573ac7SBarry Smith extern PetscErrorCode PETSCSYS_DLLEXPORT PetscViewerRegister(const char*,const char*,const char*,PetscErrorCode (*)(PetscViewer));
7230de9b25SBarry Smith 
7330de9b25SBarry Smith /*MC
7492c97de8SJed Brown    PetscViewerRegisterDynamic - Adds a viewer
7530de9b25SBarry Smith 
7630de9b25SBarry Smith    Synopsis:
771890ba74SBarry Smith    PetscErrorCode PetscViewerRegisterDynamic(const char *name_solver,const char *path,const char *name_create,PetscErrorCode (*routine_create)(PetscViewer))
7830de9b25SBarry Smith 
7930de9b25SBarry Smith    Not Collective
8030de9b25SBarry Smith 
8130de9b25SBarry Smith    Input Parameters:
8292c97de8SJed Brown +  name_solver - name of a new user-defined viewer
8392c97de8SJed Brown .  path - path (either absolute or relative) the library containing this viewer
8430de9b25SBarry Smith .  name_create - name of routine to create method context
8530de9b25SBarry Smith -  routine_create - routine to create method context
8630de9b25SBarry Smith 
8730de9b25SBarry Smith    Level: developer
8830de9b25SBarry Smith 
8930de9b25SBarry Smith    Notes:
9092c97de8SJed Brown    PetscViewerRegisterDynamic() may be called multiple times to add several user-defined viewers.
9130de9b25SBarry Smith 
9230de9b25SBarry Smith    If dynamic libraries are used, then the fourth input argument (routine_create)
9330de9b25SBarry Smith    is ignored.
9430de9b25SBarry Smith 
9530de9b25SBarry Smith    Sample usage:
9630de9b25SBarry Smith .vb
9730de9b25SBarry Smith    PetscViewerRegisterDynamic("my_viewer_type",/home/username/my_lib/lib/libO/solaris/mylib.a,
9830de9b25SBarry Smith                "MyViewerCreate",MyViewerCreate);
9930de9b25SBarry Smith .ve
10030de9b25SBarry Smith 
10130de9b25SBarry Smith    Then, your solver can be chosen with the procedural interface via
10292c97de8SJed Brown $     PetscViewerSetType(viewer,"my_viewer_type")
10330de9b25SBarry Smith    or at runtime via the option
10430de9b25SBarry Smith $     -viewer_type my_viewer_type
10530de9b25SBarry Smith 
10630de9b25SBarry Smith   Concepts: registering^Viewers
10730de9b25SBarry Smith 
10830de9b25SBarry Smith .seealso: PetscViewerRegisterAll(), PetscViewerRegisterDestroy()
10930de9b25SBarry Smith M*/
110aa482453SBarry Smith #if defined(PETSC_USE_DYNAMIC_LIBRARIES)
111b0a32e0cSBarry Smith #define PetscViewerRegisterDynamic(a,b,c,d) PetscViewerRegister(a,b,c,0)
1127b2a1423SBarry Smith #else
113b0a32e0cSBarry Smith #define PetscViewerRegisterDynamic(a,b,c,d) PetscViewerRegister(a,b,c,d)
1147b2a1423SBarry Smith #endif
11530de9b25SBarry Smith 
116*09573ac7SBarry Smith extern PetscErrorCode PETSCSYS_DLLEXPORT PetscViewerCreate(MPI_Comm,PetscViewer*);
117045ff3e0SBarry Smith PetscPolymorphicSubroutine(PetscViewerCreate,(PetscViewer *v),(PETSC_COMM_SELF,v))
118*09573ac7SBarry Smith extern PetscErrorCode PETSCSYS_DLLEXPORT PetscViewerSetFromOptions(PetscViewer);
1197b2a1423SBarry Smith 
120*09573ac7SBarry Smith extern PetscErrorCode PETSCSYS_DLLEXPORT PetscViewerASCIIOpen(MPI_Comm,const char[],PetscViewer*);
121*09573ac7SBarry Smith extern PetscErrorCode PETSCSYS_DLLEXPORT PetscViewerBinaryCreate(MPI_Comm,PetscViewer*);
122*09573ac7SBarry Smith extern PetscErrorCode PETSCSYS_DLLEXPORT PetscViewerBinaryOpen(MPI_Comm,const char[],PetscFileMode,PetscViewer*);
123*09573ac7SBarry Smith extern PetscErrorCode PETSCSYS_DLLEXPORT PetscViewerBinaryGetFlowControl(PetscViewer,PetscInt*);
124*09573ac7SBarry Smith extern PetscErrorCode PETSCSYS_DLLEXPORT PetscViewerBinarySetFlowControl(PetscViewer,PetscInt);
125*09573ac7SBarry Smith extern PetscErrorCode PETSCSYS_DLLEXPORT PetscViewerBinarySetMPIIO(PetscViewer);
126*09573ac7SBarry Smith extern PetscErrorCode PETSCSYS_DLLEXPORT PetscViewerBinaryGetMPIIO(PetscViewer,PetscBool *);
1270fc9d207SBarry Smith #if defined(PETSC_HAVE_MPIIO)
128*09573ac7SBarry Smith extern PetscErrorCode PETSCSYS_DLLEXPORT PetscViewerBinaryGetMPIIODescriptor(PetscViewer,MPI_File*);
129*09573ac7SBarry Smith extern PetscErrorCode PETSCSYS_DLLEXPORT PetscViewerBinaryGetMPIIOOffset(PetscViewer,MPI_Offset*);
130*09573ac7SBarry Smith extern PetscErrorCode PETSCSYS_DLLEXPORT PetscViewerBinaryAddMPIIOOffset(PetscViewer,MPI_Offset);
131951e3c8eSBarry Smith #endif
13239802e9eSBarry Smith 
133*09573ac7SBarry Smith extern PetscErrorCode PETSCSYS_DLLEXPORT PetscViewerSocketOpen(MPI_Comm,const char[],int,PetscViewer*);
134*09573ac7SBarry Smith extern PetscErrorCode PETSCSYS_DLLEXPORT PetscViewerStringOpen(MPI_Comm,char[],PetscInt,PetscViewer*);
135*09573ac7SBarry Smith extern PetscErrorCode PETSCSYS_DLLEXPORT PetscViewerDrawOpen(MPI_Comm,const char[],const char[],int,int,int,int,PetscViewer*);
136*09573ac7SBarry Smith extern PetscErrorCode PETSCSYS_DLLEXPORT PetscViewerMathematicaOpen(MPI_Comm, int, const char[], const char[], PetscViewer *);
137*09573ac7SBarry Smith extern PetscErrorCode PETSCSYS_DLLEXPORT PetscViewerSiloOpen(MPI_Comm, const char[], PetscViewer *);
138*09573ac7SBarry Smith extern PetscErrorCode PETSCSYS_DLLEXPORT PetscViewerMatlabOpen(MPI_Comm,const char[],PetscFileMode,PetscViewer*);
1394b0e389bSBarry Smith 
140*09573ac7SBarry Smith extern PetscErrorCode PETSCSYS_DLLEXPORT PetscViewerGetType(PetscViewer,const PetscViewerType*);
141*09573ac7SBarry Smith extern PetscErrorCode PETSCSYS_DLLEXPORT PetscViewerSetType(PetscViewer,const PetscViewerType);
142*09573ac7SBarry Smith extern PetscErrorCode PETSCSYS_DLLEXPORT PetscViewerDestroy(PetscViewer);
143*09573ac7SBarry Smith extern PetscErrorCode PETSCSYS_DLLEXPORT PetscViewerGetSingleton(PetscViewer,PetscViewer*);
144*09573ac7SBarry Smith extern PetscErrorCode PETSCSYS_DLLEXPORT PetscViewerRestoreSingleton(PetscViewer,PetscViewer*);
145*09573ac7SBarry Smith extern PetscErrorCode PETSCSYS_DLLEXPORT PetscViewerGetSubcomm(PetscViewer,MPI_Comm,PetscViewer*);
146*09573ac7SBarry Smith extern PetscErrorCode PETSCSYS_DLLEXPORT PetscViewerRestoreSubcomm(PetscViewer,MPI_Comm,PetscViewer*);
147ae39576cSLois Curfman McInnes 
148*09573ac7SBarry Smith extern PetscErrorCode PETSCSYS_DLLEXPORT PetscViewerSetUp(PetscViewer);
149*09573ac7SBarry Smith extern PetscErrorCode PETSCSYS_DLLEXPORT PetscViewerView(PetscViewer,PetscViewer);
150f69a0ea3SMatthew Knepley 
151*09573ac7SBarry Smith extern PetscErrorCode PETSCSYS_DLLEXPORT PetscViewerSetOptionsPrefix(PetscViewer,const char[]);
152*09573ac7SBarry Smith extern PetscErrorCode PETSCSYS_DLLEXPORT PetscViewerAppendOptionsPrefix(PetscViewer,const char[]);
153*09573ac7SBarry Smith extern PetscErrorCode PETSCSYS_DLLEXPORT PetscViewerGetOptionsPrefix(PetscViewer,const char*[]);
154090de74eSSatish Balay 
155b9617806SBarry Smith /*E
156b9617806SBarry Smith     PetscViewerFormat - Way a viewer presents the object
157b9617806SBarry Smith 
158b9617806SBarry Smith    Level: beginner
159b9617806SBarry Smith 
160cfaaf4edSHong Zhang    The values below are also listed in finclude/petscviewer.h. If another values is added below it
161cfaaf4edSHong Zhang    must also be added there.
162cfaaf4edSHong Zhang 
163b9617806SBarry Smith .seealso: PetscViewerSetFormat(), PetscViewer, PetscViewerType, PetscViewerPushFormat(), PetscViewerPopFormat()
164b9617806SBarry Smith E*/
165fb9695e5SSatish Balay typedef enum {
166117016b1SBarry Smith   PETSC_VIEWER_DEFAULT,
167f3ef73ceSBarry Smith   PETSC_VIEWER_ASCII_MATLAB,
1684ebda54eSMatthew Knepley   PETSC_VIEWER_ASCII_MATHEMATICA,
169f3ef73ceSBarry Smith   PETSC_VIEWER_ASCII_IMPL,
170f3ef73ceSBarry Smith   PETSC_VIEWER_ASCII_INFO,
171456192e2SBarry Smith   PETSC_VIEWER_ASCII_INFO_DETAIL,
172f3ef73ceSBarry Smith   PETSC_VIEWER_ASCII_COMMON,
173f3ef73ceSBarry Smith   PETSC_VIEWER_ASCII_SYMMODU,
174f3ef73ceSBarry Smith   PETSC_VIEWER_ASCII_INDEX,
175f3ef73ceSBarry Smith   PETSC_VIEWER_ASCII_DENSE,
1763c215bfdSMatthew Knepley   PETSC_VIEWER_ASCII_MATRIXMARKET,
177a505fa5bSMatthew Knepley   PETSC_VIEWER_ASCII_VTK,
178b85befe5SMatthew Knepley   PETSC_VIEWER_ASCII_VTK_CELL,
179b6d733afSMatthew Knepley   PETSC_VIEWER_ASCII_VTK_COORDS,
180493617b5SMatthew Knepley   PETSC_VIEWER_ASCII_PCICE,
181493617b5SMatthew Knepley   PETSC_VIEWER_ASCII_PYLITH,
18239439a91SMatthew Knepley   PETSC_VIEWER_ASCII_PYLITH_LOCAL,
183cfaaf4edSHong Zhang   PETSC_VIEWER_ASCII_PYTHON,
184cfaaf4edSHong Zhang   PETSC_VIEWER_ASCII_FACTOR_INFO,
185f3ef73ceSBarry Smith   PETSC_VIEWER_DRAW_BASIC,
186f3ef73ceSBarry Smith   PETSC_VIEWER_DRAW_LG,
187f3ef73ceSBarry Smith   PETSC_VIEWER_DRAW_CONTOUR,
188f3ef73ceSBarry Smith   PETSC_VIEWER_DRAW_PORTS,
189f3ef73ceSBarry Smith   PETSC_VIEWER_NATIVE,
190cfaaf4edSHong Zhang   PETSC_VIEWER_NOFORMAT
191cfaaf4edSHong Zhang   } PetscViewerFormat;
192090de74eSSatish Balay 
193*09573ac7SBarry Smith extern PetscErrorCode PETSCSYS_DLLEXPORT PetscViewerSetFormat(PetscViewer,PetscViewerFormat);
194*09573ac7SBarry Smith extern PetscErrorCode PETSCSYS_DLLEXPORT PetscViewerPushFormat(PetscViewer,PetscViewerFormat);
195*09573ac7SBarry Smith extern PetscErrorCode PETSCSYS_DLLEXPORT PetscViewerPopFormat(PetscViewer);
196*09573ac7SBarry Smith extern PetscErrorCode PETSCSYS_DLLEXPORT PetscViewerGetFormat(PetscViewer,PetscViewerFormat*);
197*09573ac7SBarry Smith extern PetscErrorCode PETSCSYS_DLLEXPORT PetscViewerFlush(PetscViewer);
1984b0e389bSBarry Smith 
19923d894e5SBarry Smith /*S
20023d894e5SBarry Smith      PetscViewerASCIIMonitor - Context for the default KSP, SNES and TS monitors that print
20123d894e5SBarry Smith                                   ASCII strings of residual norms etc.
20223d894e5SBarry Smith 
20323d894e5SBarry Smith 
20423d894e5SBarry Smith    Level: advanced
20523d894e5SBarry Smith 
20623d894e5SBarry Smith   Concepts: viewing, monitoring
20723d894e5SBarry Smith 
20823d894e5SBarry Smith .seealso:  PetscViewerCreate(), PetscViewerSetType(), PetscViewerType, KSPMonitorSet(), SNESMonitorSet(), TSMonitorSet(),
20923d894e5SBarry Smith            KSPMonitorDefault(), SNESMonitorDefault()
21023d894e5SBarry Smith 
21123d894e5SBarry Smith S*/
21271898facSJed Brown struct _n_PetscViewerASCIIMonitor {
21323d894e5SBarry Smith   PetscViewer viewer;
21423d894e5SBarry Smith   PetscInt    tabs;
21523d894e5SBarry Smith };
21671898facSJed Brown typedef struct _n_PetscViewerASCIIMonitor* PetscViewerASCIIMonitor;
21723d894e5SBarry Smith 
218*09573ac7SBarry Smith extern PetscErrorCode PETSCSYS_DLLEXPORT PetscViewerASCIIMonitorCreate(MPI_Comm,const char *,PetscInt,PetscViewerASCIIMonitor*);
219*09573ac7SBarry Smith extern PetscErrorCode PETSCSYS_DLLEXPORT PetscViewerASCIIMonitorDestroy(PetscViewerASCIIMonitor);
220*09573ac7SBarry Smith extern PetscErrorCode PETSCSYS_DLLEXPORT PetscViewerASCIIMonitorPrintf(PetscViewerASCIIMonitor,const char[],...);
22123d894e5SBarry Smith 
22277ed5343SBarry Smith /*
22377ed5343SBarry Smith    Operations explicit to a particular class of viewers
22477ed5343SBarry Smith */
225ed5c6e3eSMatthew Knepley 
226*09573ac7SBarry Smith extern PetscErrorCode PETSCSYS_DLLEXPORT PetscViewerASCIIGetPointer(PetscViewer,FILE**);
227*09573ac7SBarry Smith extern PetscErrorCode PETSCSYS_DLLEXPORT PetscViewerFileGetMode(PetscViewer,PetscFileMode*);
228*09573ac7SBarry Smith extern PetscErrorCode PETSCSYS_DLLEXPORT PetscViewerFileSetMode(PetscViewer,PetscFileMode);
229*09573ac7SBarry Smith extern PetscErrorCode PETSCSYS_DLLEXPORT PetscViewerASCIIPrintf(PetscViewer,const char[],...);
230*09573ac7SBarry Smith extern PetscErrorCode PETSCSYS_DLLEXPORT PetscViewerASCIISynchronizedPrintf(PetscViewer,const char[],...);
231*09573ac7SBarry Smith extern PetscErrorCode PETSCSYS_DLLEXPORT PetscViewerASCIIPushTab(PetscViewer);
232*09573ac7SBarry Smith extern PetscErrorCode PETSCSYS_DLLEXPORT PetscViewerASCIIPopTab(PetscViewer);
233*09573ac7SBarry Smith extern PetscErrorCode PETSCSYS_DLLEXPORT PetscViewerASCIIUseTabs(PetscViewer,PetscBool );
234*09573ac7SBarry Smith extern PetscErrorCode PETSCSYS_DLLEXPORT PetscViewerASCIISetTab(PetscViewer,PetscInt);
235*09573ac7SBarry Smith extern PetscErrorCode PETSCSYS_DLLEXPORT PetscViewerBinaryGetDescriptor(PetscViewer,int*);
236*09573ac7SBarry Smith extern PetscErrorCode PETSCSYS_DLLEXPORT PetscViewerBinaryGetInfoPointer(PetscViewer,FILE **);
237*09573ac7SBarry Smith extern PetscErrorCode PETSCSYS_DLLEXPORT PetscViewerBinaryRead(PetscViewer,void*,PetscInt,PetscDataType);
238*09573ac7SBarry Smith extern PetscErrorCode PETSCSYS_DLLEXPORT PetscViewerBinaryWrite(PetscViewer,void*,PetscInt,PetscDataType,PetscBool );
239*09573ac7SBarry Smith extern PetscErrorCode PETSCSYS_DLLEXPORT PetscViewerStringSPrintf(PetscViewer,const char[],...);
240*09573ac7SBarry Smith extern PetscErrorCode PETSCSYS_DLLEXPORT PetscViewerStringSetString(PetscViewer,char[],PetscInt);
241*09573ac7SBarry Smith extern PetscErrorCode PETSCSYS_DLLEXPORT PetscViewerDrawClear(PetscViewer);
242*09573ac7SBarry Smith extern PetscErrorCode PETSCSYS_DLLEXPORT PetscViewerDrawSetInfo(PetscViewer,const char[],const char[],int,int,int,int);
243*09573ac7SBarry Smith extern PetscErrorCode PETSCSYS_DLLEXPORT PetscViewerSocketSetConnection(PetscViewer,const char[],int);
244*09573ac7SBarry Smith extern PetscErrorCode PETSCSYS_DLLEXPORT PetscViewerBinarySkipInfo(PetscViewer);
245*09573ac7SBarry Smith extern PetscErrorCode PETSCSYS_DLLEXPORT PetscViewerBinarySetSkipOptions(PetscViewer,PetscBool );
246*09573ac7SBarry Smith extern PetscErrorCode PETSCSYS_DLLEXPORT PetscViewerBinaryGetSkipOptions(PetscViewer,PetscBool *);
247*09573ac7SBarry Smith extern PetscErrorCode PETSCSYS_DLLEXPORT PetscViewerBinaryReadStringArray(PetscViewer,char***);
248*09573ac7SBarry Smith extern PetscErrorCode PETSCSYS_DLLEXPORT PetscViewerBinaryWriteStringArray(PetscViewer,char**);
249c655490fSBarry Smith 
250*09573ac7SBarry Smith extern PetscErrorCode PETSCSYS_DLLEXPORT PetscViewerFileSetName(PetscViewer,const char[]);
251*09573ac7SBarry Smith extern PetscErrorCode PETSCSYS_DLLEXPORT PetscViewerFileGetName(PetscViewer,char**);
25277ed5343SBarry Smith 
253*09573ac7SBarry Smith extern PetscErrorCode PETSCSYS_DLLEXPORT PetscPLAPACKInitializePackage(MPI_Comm com);
254*09573ac7SBarry Smith extern PetscErrorCode PETSCSYS_DLLEXPORT PetscPLAPACKFinalizePackage(void);
25544c6da4fSMatthew Knepley 
256*09573ac7SBarry Smith extern PetscErrorCode PETSCSYS_DLLEXPORT PetscViewerVUGetPointer(PetscViewer, FILE**);
257*09573ac7SBarry Smith extern PetscErrorCode PETSCSYS_DLLEXPORT PetscViewerVUSetVecSeen(PetscViewer, PetscBool );
258*09573ac7SBarry Smith extern PetscErrorCode PETSCSYS_DLLEXPORT PetscViewerVUGetVecSeen(PetscViewer, PetscBool  *);
259*09573ac7SBarry Smith extern PetscErrorCode PETSCSYS_DLLEXPORT PetscViewerVUPrintDeferred(PetscViewer, const char [], ...);
260*09573ac7SBarry Smith extern PetscErrorCode PETSCSYS_DLLEXPORT PetscViewerVUFlushDeferred(PetscViewer);
26155dcf840SMatthew Knepley 
262*09573ac7SBarry Smith extern PetscErrorCode PETSCSYS_DLLEXPORT PetscViewerMathematicaInitializePackage(const char[]);
263*09573ac7SBarry Smith extern PetscErrorCode PETSCSYS_DLLEXPORT PetscViewerMathematicaFinalizePackage(void);
264*09573ac7SBarry Smith extern PetscErrorCode PETSCSYS_DLLEXPORT PetscViewerMathematicaGetName(PetscViewer, const char **);
265*09573ac7SBarry Smith extern PetscErrorCode PETSCSYS_DLLEXPORT PetscViewerMathematicaSetName(PetscViewer, const char []);
266*09573ac7SBarry Smith extern PetscErrorCode PETSCSYS_DLLEXPORT PetscViewerMathematicaClearName(PetscViewer);
267*09573ac7SBarry Smith extern PetscErrorCode PETSCSYS_DLLEXPORT PetscViewerMathematicaSkipPackets(PetscViewer, int);
2684ebda54eSMatthew Knepley 
269*09573ac7SBarry Smith extern PetscErrorCode PETSCSYS_DLLEXPORT PetscViewerSiloGetName(PetscViewer, char **);
270*09573ac7SBarry Smith extern PetscErrorCode PETSCSYS_DLLEXPORT PetscViewerSiloSetName(PetscViewer, const char []);
271*09573ac7SBarry Smith extern PetscErrorCode PETSCSYS_DLLEXPORT PetscViewerSiloClearName(PetscViewer);
272*09573ac7SBarry Smith extern PetscErrorCode PETSCSYS_DLLEXPORT PetscViewerSiloGetMeshName(PetscViewer, char **);
273*09573ac7SBarry Smith extern PetscErrorCode PETSCSYS_DLLEXPORT PetscViewerSiloSetMeshName(PetscViewer, const char []);
274*09573ac7SBarry Smith extern PetscErrorCode PETSCSYS_DLLEXPORT PetscViewerSiloClearMeshName(PetscViewer);
2754ebda54eSMatthew Knepley 
276*09573ac7SBarry Smith extern PetscErrorCode PETSCSYS_DLLEXPORT PetscViewerNetcdfOpen(MPI_Comm,const char[],PetscFileMode,PetscViewer*);
277*09573ac7SBarry Smith extern PetscErrorCode PETSCSYS_DLLEXPORT PetscViewerNetcdfGetID(PetscViewer, int *);
278e3eb5169SDinesh Kaushik 
279*09573ac7SBarry Smith extern PetscErrorCode PETSCSYS_DLLEXPORT PetscViewerHDF5WriteSDS(PetscViewer,float *,int,int *,int);
28000ccbe27SDinesh Kaushik 
281*09573ac7SBarry Smith extern PetscErrorCode PETSCSYS_DLLEXPORT PetscViewerHDF5Open(MPI_Comm,const char[],PetscFileMode,PetscViewer*);
282*09573ac7SBarry Smith extern PetscErrorCode PETSCSYS_DLLEXPORT PetscViewerHDF5PushGroup(PetscViewer,const char *);
283*09573ac7SBarry Smith extern PetscErrorCode PETSCSYS_DLLEXPORT PetscViewerHDF5PopGroup(PetscViewer);
284*09573ac7SBarry Smith extern PetscErrorCode PETSCSYS_DLLEXPORT PetscViewerHDF5GetGroup(PetscViewer, const char **);
285*09573ac7SBarry Smith extern PetscErrorCode PETSCSYS_DLLEXPORT PetscViewerHDF5SetTimestep(PetscViewer,PetscInt);
286*09573ac7SBarry Smith extern PetscErrorCode PETSCSYS_DLLEXPORT PetscViewerHDF5GetTimestep(PetscViewer,PetscInt*);
2878e72c77eSMatthew Knepley #ifdef PETSC_HAVE_HDF5
2888e72c77eSMatthew Knepley #include <hdf5.h>
289*09573ac7SBarry Smith extern PetscErrorCode PETSCSYS_DLLEXPORT PetscViewerHDF5GetFileId(PetscViewer,hid_t*);
290*09573ac7SBarry Smith extern PetscErrorCode PETSCSYS_DLLEXPORT PetscViewerHDF5OpenGroup(PetscViewer, hid_t *, hid_t *);
2918e72c77eSMatthew Knepley #endif
2928e72c77eSMatthew Knepley 
29377ed5343SBarry Smith /*
29477ed5343SBarry Smith      These are all the default viewers that do not have
29577ed5343SBarry Smith    to be explicitly opened
29677ed5343SBarry Smith */
297*09573ac7SBarry Smith extern PetscViewer PETSCSYS_DLLEXPORT PETSC_VIEWER_STDOUT_(MPI_Comm);
298*09573ac7SBarry Smith extern PetscErrorCode PETSCSYS_DLLEXPORT PetscViewerASCIIGetStdout(MPI_Comm,PetscViewer*);
299*09573ac7SBarry Smith extern PetscViewer PETSCSYS_DLLEXPORT PETSC_VIEWER_STDERR_(MPI_Comm);
300*09573ac7SBarry Smith extern PetscErrorCode PETSCSYS_DLLEXPORT PetscViewerASCIIGetStderr(MPI_Comm,PetscViewer*);
301*09573ac7SBarry Smith extern PetscViewer PETSCSYS_DLLEXPORT PETSC_VIEWER_DRAW_(MPI_Comm);
302*09573ac7SBarry Smith extern PetscViewer PETSCSYS_DLLEXPORT PETSC_VIEWER_SOCKET_(MPI_Comm);
303*09573ac7SBarry Smith extern PetscViewer PETSCSYS_DLLEXPORT PETSC_VIEWER_BINARY_(MPI_Comm);
304*09573ac7SBarry Smith extern PetscViewer PETSCSYS_DLLEXPORT PETSC_VIEWER_MATLAB_(MPI_Comm);
305*09573ac7SBarry Smith extern PetscViewer PETSC_VIEWER_MATHEMATICA_WORLD_PRIVATE;
3065311e20fSBarry Smith 
307b0a32e0cSBarry Smith #define PETSC_VIEWER_STDERR_SELF  PETSC_VIEWER_STDERR_(PETSC_COMM_SELF)
308b0a32e0cSBarry Smith #define PETSC_VIEWER_STDERR_WORLD PETSC_VIEWER_STDERR_(PETSC_COMM_WORLD)
30930de9b25SBarry Smith 
31030de9b25SBarry Smith /*MC
31130de9b25SBarry Smith   PETSC_VIEWER_STDOUT_WORLD  - same as PETSC_VIEWER_STDOUT_(PETSC_COMM_WORLD)
31230de9b25SBarry Smith 
31330de9b25SBarry Smith   Level: beginner
31430de9b25SBarry Smith M*/
31530de9b25SBarry Smith #define PETSC_VIEWER_STDOUT_WORLD PETSC_VIEWER_STDOUT_(PETSC_COMM_WORLD)
31630de9b25SBarry Smith 
31730de9b25SBarry Smith /*MC
31830de9b25SBarry Smith   PETSC_VIEWER_STDOUT_SELF  - same as PETSC_VIEWER_STDOUT_(PETSC_COMM_SELF)
31930de9b25SBarry Smith 
32030de9b25SBarry Smith   Level: beginner
32130de9b25SBarry Smith M*/
32230de9b25SBarry Smith #define PETSC_VIEWER_STDOUT_SELF  PETSC_VIEWER_STDOUT_(PETSC_COMM_SELF)
32330de9b25SBarry Smith 
32430de9b25SBarry Smith /*MC
32530de9b25SBarry Smith   PETSC_VIEWER_DRAW_WORLD  - same as PETSC_VIEWER_DRAW_(PETSC_COMM_WORLD)
32630de9b25SBarry Smith 
32730de9b25SBarry Smith   Level: intermediate
32830de9b25SBarry Smith M*/
329b0a32e0cSBarry Smith #define PETSC_VIEWER_DRAW_WORLD   PETSC_VIEWER_DRAW_(PETSC_COMM_WORLD)
33030de9b25SBarry Smith 
33130de9b25SBarry Smith /*MC
33230de9b25SBarry Smith   PETSC_VIEWER_DRAW_SELF  - same as PETSC_VIEWER_DRAW_(PETSC_COMM_SELF)
33330de9b25SBarry Smith 
33430de9b25SBarry Smith   Level: intermediate
33530de9b25SBarry Smith M*/
33630de9b25SBarry Smith #define PETSC_VIEWER_DRAW_SELF    PETSC_VIEWER_DRAW_(PETSC_COMM_SELF)
33730de9b25SBarry Smith 
33830de9b25SBarry Smith /*MC
33930de9b25SBarry Smith   PETSC_VIEWER_SOCKET_WORLD  - same as PETSC_VIEWER_SOCKET_(PETSC_COMM_WORLD)
34030de9b25SBarry Smith 
34130de9b25SBarry Smith   Level: intermediate
34230de9b25SBarry Smith M*/
343b0a32e0cSBarry Smith #define PETSC_VIEWER_SOCKET_WORLD PETSC_VIEWER_SOCKET_(PETSC_COMM_WORLD)
34430de9b25SBarry Smith 
34530de9b25SBarry Smith /*MC
34630de9b25SBarry Smith   PETSC_VIEWER_SOCKET_SELF  - same as PETSC_VIEWER_SOCKET_(PETSC_COMM_SELF)
34730de9b25SBarry Smith 
34830de9b25SBarry Smith   Level: intermediate
34930de9b25SBarry Smith M*/
350b0a32e0cSBarry Smith #define PETSC_VIEWER_SOCKET_SELF  PETSC_VIEWER_SOCKET_(PETSC_COMM_SELF)
35130de9b25SBarry Smith 
35230de9b25SBarry Smith /*MC
35330de9b25SBarry Smith   PETSC_VIEWER_BINARY_WORLD  - same as PETSC_VIEWER_BINARY_(PETSC_COMM_WORLD)
35430de9b25SBarry Smith 
35530de9b25SBarry Smith   Level: intermediate
35630de9b25SBarry Smith M*/
357b0a32e0cSBarry Smith #define PETSC_VIEWER_BINARY_WORLD PETSC_VIEWER_BINARY_(PETSC_COMM_WORLD)
35830de9b25SBarry Smith 
35930de9b25SBarry Smith /*MC
36030de9b25SBarry Smith   PETSC_VIEWER_BINARY_SELF  - same as PETSC_VIEWER_BINARY_(PETSC_COMM_SELF)
36130de9b25SBarry Smith 
36230de9b25SBarry Smith   Level: intermediate
36330de9b25SBarry Smith M*/
364b0a32e0cSBarry Smith #define PETSC_VIEWER_BINARY_SELF  PETSC_VIEWER_BINARY_(PETSC_COMM_SELF)
36530de9b25SBarry Smith 
366cbb32127SBarry Smith /*MC
367cbb32127SBarry Smith   PETSC_VIEWER_MATLAB_WORLD  - same as PETSC_VIEWER_MATLAB_(PETSC_COMM_WORLD)
368cbb32127SBarry Smith 
369cbb32127SBarry Smith   Level: intermediate
370cbb32127SBarry Smith M*/
371cbb32127SBarry Smith #define PETSC_VIEWER_MATLAB_WORLD PETSC_VIEWER_MATLAB_(PETSC_COMM_WORLD)
372cbb32127SBarry Smith 
373cbb32127SBarry Smith /*MC
374cbb32127SBarry Smith   PETSC_VIEWER_MATLAB_SELF  - same as PETSC_VIEWER_MATLAB_(PETSC_COMM_SELF)
375cbb32127SBarry Smith 
376cbb32127SBarry Smith   Level: intermediate
377cbb32127SBarry Smith M*/
378cbb32127SBarry Smith #define PETSC_VIEWER_MATLAB_SELF  PETSC_VIEWER_MATLAB_(PETSC_COMM_SELF)
379cbb32127SBarry Smith 
3807eb62a3eSMatthew Knepley #define PETSC_VIEWER_MATHEMATICA_WORLD (PetscViewerInitializeMathematicaWorld_Private(),PETSC_VIEWER_MATHEMATICA_WORLD_PRIVATE)
38165ef3172SBarry Smith 
382e03d165dSBarry Smith #define PetscViewerFlowControlStart(viewer,mcnt,cnt)  (PetscViewerBinaryGetFlowControl(viewer,mcnt) || PetscViewerBinaryGetFlowControl(viewer,cnt))
38385ebf7a4SBarry Smith #define PetscViewerFlowControlStepMaster(viewer,i,mcnt,cnt) ((i >= mcnt) ?  (mcnt += cnt,MPI_Bcast(&mcnt,1,MPIU_INT,0,((PetscObject)viewer)->comm)) : 0)
384e03d165dSBarry Smith #define PetscViewerFlowControlEndMaster(viewer,mcnt) (mcnt = 0,MPI_Bcast(&mcnt,1,MPIU_INT,0,((PetscObject)viewer)->comm))
385fca9dd48SBarry Smith #define PetscViewerFlowControlStepWorker(viewer,rank,mcnt) 0; while (1) { PetscErrorCode _ierr; \
386fca9dd48SBarry Smith     if (rank < mcnt) break;				\
387e03d165dSBarry Smith   _ierr = MPI_Bcast(&mcnt,1,MPIU_INT,0,((PetscObject)viewer)->comm);CHKERRQ(_ierr);\
388e03d165dSBarry Smith   }
389fca9dd48SBarry Smith #define PetscViewerFlowControlEndWorker(viewer,mcnt) 0; while (1) { PetscErrorCode _ierr; \
390fca9dd48SBarry Smith   _ierr = MPI_Bcast(&mcnt,1,MPIU_INT,0,((PetscObject)viewer)->comm);CHKERRQ(_ierr);\
391fca9dd48SBarry Smith     if (mcnt == 0) break;				\
392fca9dd48SBarry Smith   }
393e03d165dSBarry Smith 
39477ed5343SBarry Smith /*
395cbb32127SBarry Smith    petscViewer writes to Matlab .mat file
396cbb32127SBarry Smith */
397*09573ac7SBarry Smith extern PetscErrorCode PETSCSYS_DLLEXPORT PetscViewerMatlabPutArray(PetscViewer,int,int,const PetscScalar*,const char*);
398*09573ac7SBarry Smith extern PetscErrorCode PETSCSYS_DLLEXPORT PetscViewerMatlabGetArray(PetscViewer,int,int,PetscScalar*,const char*);
399*09573ac7SBarry Smith extern PetscErrorCode PETSCSYS_DLLEXPORT PetscViewerMatlabPutVariable(PetscViewer,const char*,void*);
400cbb32127SBarry Smith 
401b9617806SBarry Smith /*S
4021890ba74SBarry Smith      PetscViewers - Abstract collection of PetscViewers. It is just an expandable array of viewers.
403b9617806SBarry Smith 
404b9617806SBarry Smith    Level: intermediate
405b9617806SBarry Smith 
406b9617806SBarry Smith   Concepts: viewing
407b9617806SBarry Smith 
408b9617806SBarry Smith .seealso:  PetscViewerCreate(), PetscViewerSetType(), PetscViewerType, PetscViewer, PetscViewersCreate(),
409b9617806SBarry Smith            PetscViewersGetViewer()
410b9617806SBarry Smith S*/
41195fbd943SSatish Balay typedef struct _n_PetscViewers* PetscViewers;
412*09573ac7SBarry Smith extern PetscErrorCode PETSCSYS_DLLEXPORT PetscViewersCreate(MPI_Comm,PetscViewers*);
413*09573ac7SBarry Smith extern PetscErrorCode PETSCSYS_DLLEXPORT PetscViewersDestroy(PetscViewers);
414*09573ac7SBarry Smith extern PetscErrorCode PETSCSYS_DLLEXPORT PetscViewersGetViewer(PetscViewers,PetscInt,PetscViewer*);
415d132466eSBarry Smith 
416b3506946SBarry Smith #if defined(PETSC_HAVE_AMS)
417b3506946SBarry Smith #include <ams.h>
418*09573ac7SBarry Smith extern PetscErrorCode PetscViewerAMSSetCommName(PetscViewer,const char[]);
419*09573ac7SBarry Smith extern PetscErrorCode PetscViewerAMSGetAMSComm(PetscViewer,AMS_Comm *);
420*09573ac7SBarry Smith extern PetscErrorCode PetscViewerAMSOpen(MPI_Comm,const char[],PetscViewer*);
421*09573ac7SBarry Smith extern PetscErrorCode PetscViewerAMSLock(PetscViewer);
422*09573ac7SBarry Smith extern PetscViewer    PETSC_VIEWER_AMS_(MPI_Comm);
423*09573ac7SBarry Smith extern PetscErrorCode PETSC_VIEWER_AMS_Destroy(MPI_Comm);
424b3506946SBarry Smith #define PETSC_VIEWER_AMS_WORLD PETSC_VIEWER_AMS_(PETSC_COMM_WORLD)
425b3506946SBarry Smith #endif
426b3506946SBarry Smith 
427b3506946SBarry Smith 
428e9fa29b7SSatish Balay PETSC_EXTERN_CXX_END
429cb5b572fSBarry Smith #endif
430