xref: /petsc/include/petscviewer.h (revision 3c215bfd7ffe5205697a4bb7f4e57601f7cc8f49)
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 
288fb59f0aSKris Buschelman #include "petsc.h"
298fb59f0aSKris Buschelman 
308fb59f0aSKris Buschelman #if defined(PETSC_USE_EXTERN_CXX) && defined(__cplusplus)
318fb59f0aSKris Buschelman extern "C" {
328fb59f0aSKris Buschelman #endif
338fb59f0aSKris Buschelman 
34ff73aad6SKris Buschelman extern PETSC_DLLEXPORT PetscCookie PETSC_VIEWER_COOKIE;
358fb59f0aSKris Buschelman 
368fb59f0aSKris Buschelman #if defined(PETSC_USE_EXTERN_CXX) && defined(__cplusplus)
378fb59f0aSKris Buschelman }
388fb59f0aSKris Buschelman #endif
398fb59f0aSKris Buschelman 
40e9fa29b7SSatish Balay 
413c119ea2SBarry Smith /*
42b0a32e0cSBarry Smith     petsc.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*
54b0a32e0cSBarry Smith #define PETSC_VIEWER_SOCKET       "socket"
55b0a32e0cSBarry Smith #define PETSC_VIEWER_ASCII        "ascii"
56fb9695e5SSatish Balay #define PETSC_VIEWER_BINARY       "binary"
57b0a32e0cSBarry Smith #define PETSC_VIEWER_STRING       "string"
58fb9695e5SSatish Balay #define PETSC_VIEWER_DRAW         "draw"
5944c73c46SMatthew Knepley #define PETSC_VIEWER_VU           "vu"
604ebda54eSMatthew Knepley #define PETSC_VIEWER_MATHEMATICA  "mathematica"
614ebda54eSMatthew Knepley #define PETSC_VIEWER_SILO         "silo"
62e3eb5169SDinesh Kaushik #define PETSC_VIEWER_NETCDF       "netcdf"
6300ccbe27SDinesh Kaushik #define PETSC_VIEWER_HDF4         "hdf4"
648e72c77eSMatthew Knepley #define PETSC_VIEWER_HDF5         "hdf5"
65cbb32127SBarry Smith #define PETSC_VIEWER_MATLAB       "matlab"
6677ed5343SBarry Smith 
67b0a32e0cSBarry Smith extern PetscFList PetscViewerList;
68ff73aad6SKris Buschelman EXTERN PetscErrorCode PETSC_DLLEXPORT PetscViewerRegisterAll(const char *);
69ff73aad6SKris Buschelman EXTERN PetscErrorCode PETSC_DLLEXPORT PetscViewerRegisterDestroy(void);
7090e10c2fSBarry Smith EXTERN PetscErrorCode PETSC_DLLEXPORT PetscViewerInitializePackage(const char[]);
717b2a1423SBarry Smith 
72ff73aad6SKris Buschelman EXTERN PetscErrorCode PETSC_DLLEXPORT PetscViewerRegister(const char*,const char*,const char*,PetscErrorCode (*)(PetscViewer));
7330de9b25SBarry Smith 
7430de9b25SBarry Smith /*MC
7530de9b25SBarry Smith    PetscViewerRegisterDynamic - Adds a method to the Krylov subspace solver package.
7630de9b25SBarry Smith 
7730de9b25SBarry Smith    Synopsis:
78d360dc6fSBarry Smith    PetscErrorCode PetscViewerRegisterDynamic(char *name_solver,char *path,char *name_create,PetscErrorCode (*routine_create)(PetscViewer))
7930de9b25SBarry Smith 
8030de9b25SBarry Smith    Not Collective
8130de9b25SBarry Smith 
8230de9b25SBarry Smith    Input Parameters:
8330de9b25SBarry Smith +  name_solver - name of a new user-defined solver
8430de9b25SBarry Smith .  path - path (either absolute or relative) the library containing this solver
8530de9b25SBarry Smith .  name_create - name of routine to create method context
8630de9b25SBarry Smith -  routine_create - routine to create method context
8730de9b25SBarry Smith 
8830de9b25SBarry Smith    Level: developer
8930de9b25SBarry Smith 
9030de9b25SBarry Smith    Notes:
9130de9b25SBarry Smith    PetscViewerRegisterDynamic() may be called multiple times to add several user-defined solvers.
9230de9b25SBarry Smith 
9330de9b25SBarry Smith    If dynamic libraries are used, then the fourth input argument (routine_create)
9430de9b25SBarry Smith    is ignored.
9530de9b25SBarry Smith 
9630de9b25SBarry Smith    Sample usage:
9730de9b25SBarry Smith .vb
9830de9b25SBarry Smith    PetscViewerRegisterDynamic("my_viewer_type",/home/username/my_lib/lib/libO/solaris/mylib.a,
9930de9b25SBarry Smith                "MyViewerCreate",MyViewerCreate);
10030de9b25SBarry Smith .ve
10130de9b25SBarry Smith 
10230de9b25SBarry Smith    Then, your solver can be chosen with the procedural interface via
10330de9b25SBarry Smith $     PetscViewerSetType(ksp,"my_viewer_type")
10430de9b25SBarry Smith    or at runtime via the option
10530de9b25SBarry Smith $     -viewer_type my_viewer_type
10630de9b25SBarry Smith 
10730de9b25SBarry Smith   Concepts: registering^Viewers
10830de9b25SBarry Smith 
10930de9b25SBarry Smith .seealso: PetscViewerRegisterAll(), PetscViewerRegisterDestroy()
11030de9b25SBarry Smith M*/
111aa482453SBarry Smith #if defined(PETSC_USE_DYNAMIC_LIBRARIES)
112b0a32e0cSBarry Smith #define PetscViewerRegisterDynamic(a,b,c,d) PetscViewerRegister(a,b,c,0)
1137b2a1423SBarry Smith #else
114b0a32e0cSBarry Smith #define PetscViewerRegisterDynamic(a,b,c,d) PetscViewerRegister(a,b,c,d)
1157b2a1423SBarry Smith #endif
11630de9b25SBarry Smith 
117ff73aad6SKris Buschelman EXTERN PetscErrorCode PETSC_DLLEXPORT PetscViewerCreate(MPI_Comm,PetscViewer*);
118045ff3e0SBarry Smith PetscPolymorphicSubroutine(PetscViewerCreate,(PetscViewer *v),(PETSC_COMM_SELF,v))
119ff73aad6SKris Buschelman EXTERN PetscErrorCode PETSC_DLLEXPORT PetscViewerSetFromOptions(PetscViewer);
1207b2a1423SBarry Smith 
121ff73aad6SKris Buschelman EXTERN PetscErrorCode PETSC_DLLEXPORT PetscViewerASCIIOpen(MPI_Comm,const char[],PetscViewer*);
122b1967279SMatthew Knepley EXTERN PetscErrorCode PETSC_DLLEXPORT PetscViewerBinaryCreate(MPI_Comm,PetscViewer*);
1233c67689dSBarry Smith EXTERN PetscErrorCode PETSC_DLLEXPORT PetscViewerBinaryOpen(MPI_Comm,const char[],PetscFileMode,PetscViewer*);
12439802e9eSBarry Smith EXTERN PetscErrorCode PETSC_DLLEXPORT PetscViewerBinarySetMPIIO(PetscViewer);
12539802e9eSBarry Smith EXTERN PetscErrorCode PETSC_DLLEXPORT PetscViewerBinaryGetMPIIO(PetscViewer,PetscTruth*);
1260fc9d207SBarry Smith #if defined(PETSC_HAVE_MPIIO)
12739802e9eSBarry Smith EXTERN PetscErrorCode PETSC_DLLEXPORT PetscViewerBinaryGetMPIIODescriptor(PetscViewer,MPI_File*);
12839802e9eSBarry Smith EXTERN PetscErrorCode PETSC_DLLEXPORT PetscViewerBinaryGetMPIIOOffset(PetscViewer,MPI_Offset*);
12939802e9eSBarry Smith EXTERN PetscErrorCode PETSC_DLLEXPORT PetscViewerBinaryAddMPIIOOffset(PetscViewer,MPI_Offset);
130951e3c8eSBarry Smith #endif
13139802e9eSBarry Smith 
132ff73aad6SKris Buschelman EXTERN PetscErrorCode PETSC_DLLEXPORT PetscViewerSocketOpen(MPI_Comm,const char[],int,PetscViewer*);
133ff73aad6SKris Buschelman EXTERN PetscErrorCode PETSC_DLLEXPORT PetscViewerStringOpen(MPI_Comm,char[],PetscInt,PetscViewer*);
134ff73aad6SKris Buschelman EXTERN PetscErrorCode PETSC_DLLEXPORT PetscViewerDrawOpen(MPI_Comm,const char[],const char[],int,int,int,int,PetscViewer*);
135ff73aad6SKris Buschelman EXTERN PetscErrorCode PETSC_DLLEXPORT PetscViewerMathematicaOpen(MPI_Comm, int, const char[], const char[], PetscViewer *);
136ff73aad6SKris Buschelman EXTERN PetscErrorCode PETSC_DLLEXPORT PetscViewerSiloOpen(MPI_Comm, const char[], PetscViewer *);
1373c67689dSBarry Smith EXTERN PetscErrorCode PETSC_DLLEXPORT PetscViewerMatlabOpen(MPI_Comm,const char[],PetscFileMode,PetscViewer*);
1384b0e389bSBarry Smith 
139a313700dSBarry Smith EXTERN PetscErrorCode PETSC_DLLEXPORT PetscViewerGetType(PetscViewer,const PetscViewerType*);
140a313700dSBarry Smith EXTERN PetscErrorCode PETSC_DLLEXPORT PetscViewerSetType(PetscViewer,const PetscViewerType);
141ff73aad6SKris Buschelman EXTERN PetscErrorCode PETSC_DLLEXPORT PetscViewerDestroy(PetscViewer);
142ff73aad6SKris Buschelman EXTERN PetscErrorCode PETSC_DLLEXPORT PetscViewerGetSingleton(PetscViewer,PetscViewer*);
143ff73aad6SKris Buschelman EXTERN PetscErrorCode PETSC_DLLEXPORT PetscViewerRestoreSingleton(PetscViewer,PetscViewer*);
144a98ce0f4SHong Zhang EXTERN PetscErrorCode PETSC_DLLEXPORT PetscViewerGetSubcomm(PetscViewer,MPI_Comm,PetscViewer*);
145a98ce0f4SHong Zhang EXTERN PetscErrorCode PETSC_DLLEXPORT PetscViewerRestoreSubcomm(PetscViewer,MPI_Comm,PetscViewer*);
146ae39576cSLois Curfman McInnes 
147f69a0ea3SMatthew Knepley EXTERN PetscErrorCode PETSC_DLLEXPORT PetscViewerSetUp(PetscViewer);
148f69a0ea3SMatthew Knepley EXTERN PetscErrorCode PETSC_DLLEXPORT PetscViewerView(PetscViewer,PetscViewer);
149f69a0ea3SMatthew Knepley 
150f69a0ea3SMatthew Knepley EXTERN PetscErrorCode PETSC_DLLEXPORT PetscViewerSetOptionsPrefix(PetscViewer,const char[]);
151f69a0ea3SMatthew Knepley EXTERN PetscErrorCode PETSC_DLLEXPORT PetscViewerAppendOptionsPrefix(PetscViewer,const char[]);
152f69a0ea3SMatthew Knepley EXTERN PetscErrorCode PETSC_DLLEXPORT PetscViewerGetOptionsPrefix(PetscViewer,const char*[]);
153090de74eSSatish Balay 
154b9617806SBarry Smith /*E
155b9617806SBarry Smith     PetscViewerFormat - Way a viewer presents the object
156b9617806SBarry Smith 
157b9617806SBarry Smith    Level: beginner
158b9617806SBarry Smith 
159cfaaf4edSHong Zhang    The values below are also listed in finclude/petscviewer.h. If another values is added below it
160cfaaf4edSHong Zhang    must also be added there.
161cfaaf4edSHong Zhang 
162b9617806SBarry Smith .seealso: PetscViewerSetFormat(), PetscViewer, PetscViewerType, PetscViewerPushFormat(), PetscViewerPopFormat()
163b9617806SBarry Smith E*/
164fb9695e5SSatish Balay typedef enum {
165f3ef73ceSBarry Smith   PETSC_VIEWER_ASCII_DEFAULT,
166f3ef73ceSBarry Smith   PETSC_VIEWER_ASCII_MATLAB,
1674ebda54eSMatthew Knepley   PETSC_VIEWER_ASCII_MATHEMATICA,
168f3ef73ceSBarry Smith   PETSC_VIEWER_ASCII_IMPL,
169f3ef73ceSBarry Smith   PETSC_VIEWER_ASCII_INFO,
170456192e2SBarry Smith   PETSC_VIEWER_ASCII_INFO_DETAIL,
171f3ef73ceSBarry Smith   PETSC_VIEWER_ASCII_COMMON,
172f3ef73ceSBarry Smith   PETSC_VIEWER_ASCII_SYMMODU,
173f3ef73ceSBarry Smith   PETSC_VIEWER_ASCII_INDEX,
174f3ef73ceSBarry Smith   PETSC_VIEWER_ASCII_DENSE,
175*3c215bfdSMatthew Knepley   PETSC_VIEWER_ASCII_MATRIXMARKET,
176a505fa5bSMatthew Knepley   PETSC_VIEWER_ASCII_VTK,
177b85befe5SMatthew Knepley   PETSC_VIEWER_ASCII_VTK_CELL,
178b6d733afSMatthew Knepley   PETSC_VIEWER_ASCII_VTK_COORDS,
179493617b5SMatthew Knepley   PETSC_VIEWER_ASCII_PCICE,
180493617b5SMatthew Knepley   PETSC_VIEWER_ASCII_PYLITH,
18139439a91SMatthew Knepley   PETSC_VIEWER_ASCII_PYLITH_LOCAL,
182cfaaf4edSHong Zhang   PETSC_VIEWER_ASCII_PYTHON,
183cfaaf4edSHong Zhang   PETSC_VIEWER_ASCII_FACTOR_INFO,
184f3ef73ceSBarry Smith   PETSC_VIEWER_BINARY_DEFAULT,
185f3ef73ceSBarry Smith   PETSC_VIEWER_BINARY_NATIVE,
186f3ef73ceSBarry Smith   PETSC_VIEWER_DRAW_BASIC,
187f3ef73ceSBarry Smith   PETSC_VIEWER_DRAW_LG,
188f3ef73ceSBarry Smith   PETSC_VIEWER_DRAW_CONTOUR,
189f3ef73ceSBarry Smith   PETSC_VIEWER_DRAW_PORTS,
190f3ef73ceSBarry Smith   PETSC_VIEWER_NATIVE,
191cfaaf4edSHong Zhang   PETSC_VIEWER_NOFORMAT
192cfaaf4edSHong Zhang   } PetscViewerFormat;
193090de74eSSatish Balay 
194ff73aad6SKris Buschelman EXTERN PetscErrorCode PETSC_DLLEXPORT PetscViewerSetFormat(PetscViewer,PetscViewerFormat);
195ff73aad6SKris Buschelman EXTERN PetscErrorCode PETSC_DLLEXPORT PetscViewerPushFormat(PetscViewer,PetscViewerFormat);
196ff73aad6SKris Buschelman EXTERN PetscErrorCode PETSC_DLLEXPORT PetscViewerPopFormat(PetscViewer);
197ff73aad6SKris Buschelman EXTERN PetscErrorCode PETSC_DLLEXPORT PetscViewerGetFormat(PetscViewer,PetscViewerFormat*);
198ff73aad6SKris Buschelman EXTERN PetscErrorCode PETSC_DLLEXPORT PetscViewerFlush(PetscViewer);
1994b0e389bSBarry Smith 
20023d894e5SBarry Smith /*S
20123d894e5SBarry Smith      PetscViewerASCIIMonitor - Context for the default KSP, SNES and TS monitors that print
20223d894e5SBarry Smith                                   ASCII strings of residual norms etc.
20323d894e5SBarry Smith 
20423d894e5SBarry Smith 
20523d894e5SBarry Smith    Level: advanced
20623d894e5SBarry Smith 
20723d894e5SBarry Smith   Concepts: viewing, monitoring
20823d894e5SBarry Smith 
20923d894e5SBarry Smith .seealso:  PetscViewerCreate(), PetscViewerSetType(), PetscViewerType, KSPMonitorSet(), SNESMonitorSet(), TSMonitorSet(),
21023d894e5SBarry Smith            KSPMonitorDefault(), SNESMonitorDefault()
21123d894e5SBarry Smith 
21223d894e5SBarry Smith S*/
21323d894e5SBarry Smith struct _p_PetscViewerASCIIMonitor {
21423d894e5SBarry Smith   PetscViewer viewer;
21523d894e5SBarry Smith   PetscInt    tabs;
21623d894e5SBarry Smith };
21723d894e5SBarry Smith typedef struct _p_PetscViewerASCIIMonitor* PetscViewerASCIIMonitor;
21823d894e5SBarry Smith 
21923d894e5SBarry Smith EXTERN PetscErrorCode PETSC_DLLEXPORT PetscViewerASCIIMonitorCreate(MPI_Comm,const char *,PetscInt,PetscViewerASCIIMonitor*);
22023d894e5SBarry Smith EXTERN PetscErrorCode PETSC_DLLEXPORT PetscViewerASCIIMonitorDestroy(PetscViewerASCIIMonitor);
22123d894e5SBarry Smith EXTERN PetscErrorCode PETSC_DLLEXPORT PetscViewerASCIIMonitorPrintf(PetscViewerASCIIMonitor,const char[],...);
22223d894e5SBarry Smith 
22377ed5343SBarry Smith /*
22477ed5343SBarry Smith    Operations explicit to a particular class of viewers
22577ed5343SBarry Smith */
226ed5c6e3eSMatthew Knepley 
227ff73aad6SKris Buschelman EXTERN PetscErrorCode PETSC_DLLEXPORT PetscViewerASCIIGetPointer(PetscViewer,FILE**);
2287d0c5eb9SMatthew Knepley EXTERN PetscErrorCode PETSC_DLLEXPORT PetscViewerFileGetMode(PetscViewer,PetscFileMode*);
2293c67689dSBarry Smith EXTERN PetscErrorCode PETSC_DLLEXPORT PetscViewerFileSetMode(PetscViewer,PetscFileMode);
230ff73aad6SKris Buschelman EXTERN PetscErrorCode PETSC_DLLEXPORT PetscViewerASCIIPrintf(PetscViewer,const char[],...) PETSC_PRINTF_FORMAT_CHECK(2,3);
231ff73aad6SKris Buschelman EXTERN PetscErrorCode PETSC_DLLEXPORT PetscViewerASCIISynchronizedPrintf(PetscViewer,const char[],...) PETSC_PRINTF_FORMAT_CHECK(2,3);
232ff73aad6SKris Buschelman EXTERN PetscErrorCode PETSC_DLLEXPORT PetscViewerASCIIPushTab(PetscViewer);
233ff73aad6SKris Buschelman EXTERN PetscErrorCode PETSC_DLLEXPORT PetscViewerASCIIPopTab(PetscViewer);
234ff73aad6SKris Buschelman EXTERN PetscErrorCode PETSC_DLLEXPORT PetscViewerASCIIUseTabs(PetscViewer,PetscTruth);
235ff73aad6SKris Buschelman EXTERN PetscErrorCode PETSC_DLLEXPORT PetscViewerASCIISetTab(PetscViewer,PetscInt);
236ff73aad6SKris Buschelman EXTERN PetscErrorCode PETSC_DLLEXPORT PetscViewerBinaryGetDescriptor(PetscViewer,int*);
237ff73aad6SKris Buschelman EXTERN PetscErrorCode PETSC_DLLEXPORT PetscViewerBinaryGetInfoPointer(PetscViewer,FILE **);
238f588057bSBarry Smith EXTERN PetscErrorCode PETSC_DLLEXPORT PetscViewerBinaryRead(PetscViewer,void*,PetscInt,PetscDataType);
239f588057bSBarry Smith EXTERN PetscErrorCode PETSC_DLLEXPORT PetscViewerBinaryWrite(PetscViewer,void*,PetscInt,PetscDataType,PetscTruth);
240ff73aad6SKris Buschelman EXTERN PetscErrorCode PETSC_DLLEXPORT PetscViewerStringSPrintf(PetscViewer,const char[],...) PETSC_PRINTF_FORMAT_CHECK(2,3);
241ff73aad6SKris Buschelman EXTERN PetscErrorCode PETSC_DLLEXPORT PetscViewerStringSetString(PetscViewer,char[],PetscInt);
242ff73aad6SKris Buschelman EXTERN PetscErrorCode PETSC_DLLEXPORT PetscViewerDrawClear(PetscViewer);
243ff73aad6SKris Buschelman EXTERN PetscErrorCode PETSC_DLLEXPORT PetscViewerDrawSetInfo(PetscViewer,const char[],const char[],int,int,int,int);
244ff73aad6SKris Buschelman EXTERN PetscErrorCode PETSC_DLLEXPORT PetscViewerSocketSetConnection(PetscViewer,const char[],PetscInt);
245ff73aad6SKris Buschelman EXTERN PetscErrorCode PETSC_DLLEXPORT PetscViewerBinarySkipInfo(PetscViewer);
2469dcbbd2bSBarry Smith EXTERN PetscErrorCode PETSC_DLLEXPORT PetscViewerBinarySetSkipOptions(PetscViewer,PetscTruth);
2479dcbbd2bSBarry Smith EXTERN PetscErrorCode PETSC_DLLEXPORT PetscViewerBinaryGetSkipOptions(PetscViewer,PetscTruth*);
2488a13ba5bSBarry Smith EXTERN PetscErrorCode PETSC_DLLEXPORT PetscViewerBinaryReadStringArray(PetscViewer,char***);
2498a13ba5bSBarry Smith EXTERN PetscErrorCode PETSC_DLLEXPORT PetscViewerBinaryWriteStringArray(PetscViewer,char**);
250c655490fSBarry Smith 
2513c67689dSBarry Smith EXTERN PetscErrorCode PETSC_DLLEXPORT PetscViewerFileSetName(PetscViewer,const char[]);
2523c67689dSBarry Smith EXTERN PetscErrorCode PETSC_DLLEXPORT PetscViewerFileGetName(PetscViewer,char**);
25377ed5343SBarry Smith 
254e5bd5246SBarry Smith EXTERN PetscErrorCode PETSC_DLLEXPORT PetscPLAPACKInitializePackage(const char[]);
255ff73aad6SKris Buschelman EXTERN PetscErrorCode PETSC_DLLEXPORT PetscPLAPACKFinalizePackage(void);
25644c6da4fSMatthew Knepley 
257ff73aad6SKris Buschelman EXTERN PetscErrorCode PETSC_DLLEXPORT PetscViewerVUGetPointer(PetscViewer, FILE**);
258ff73aad6SKris Buschelman EXTERN PetscErrorCode PETSC_DLLEXPORT PetscViewerVUSetVecSeen(PetscViewer, PetscTruth);
259ff73aad6SKris Buschelman EXTERN PetscErrorCode PETSC_DLLEXPORT PetscViewerVUGetVecSeen(PetscViewer, PetscTruth *);
260ff73aad6SKris Buschelman EXTERN PetscErrorCode PETSC_DLLEXPORT PetscViewerVUPrintDeferred(PetscViewer, const char [], ...) PETSC_PRINTF_FORMAT_CHECK(2,3);
261ff73aad6SKris Buschelman EXTERN PetscErrorCode PETSC_DLLEXPORT PetscViewerVUFlushDeferred(PetscViewer);
26255dcf840SMatthew Knepley 
263e5bd5246SBarry Smith EXTERN PetscErrorCode PETSC_DLLEXPORT PetscViewerMathematicaInitializePackage(const char[]);
264ff73aad6SKris Buschelman EXTERN PetscErrorCode PETSC_DLLEXPORT PetscViewerMathematicaFinalizePackage(void);
265ff73aad6SKris Buschelman EXTERN PetscErrorCode PETSC_DLLEXPORT PetscViewerMathematicaGetName(PetscViewer, const char **);
266ff73aad6SKris Buschelman EXTERN PetscErrorCode PETSC_DLLEXPORT PetscViewerMathematicaSetName(PetscViewer, const char []);
267ff73aad6SKris Buschelman EXTERN PetscErrorCode PETSC_DLLEXPORT PetscViewerMathematicaClearName(PetscViewer);
268ff73aad6SKris Buschelman EXTERN PetscErrorCode PETSC_DLLEXPORT PetscViewerMathematicaSkipPackets(PetscViewer, int);
2694ebda54eSMatthew Knepley 
270ff73aad6SKris Buschelman EXTERN PetscErrorCode PETSC_DLLEXPORT PetscViewerSiloGetName(PetscViewer, char **);
271ff73aad6SKris Buschelman EXTERN PetscErrorCode PETSC_DLLEXPORT PetscViewerSiloSetName(PetscViewer, const char []);
272ff73aad6SKris Buschelman EXTERN PetscErrorCode PETSC_DLLEXPORT PetscViewerSiloClearName(PetscViewer);
273ff73aad6SKris Buschelman EXTERN PetscErrorCode PETSC_DLLEXPORT PetscViewerSiloGetMeshName(PetscViewer, char **);
274ff73aad6SKris Buschelman EXTERN PetscErrorCode PETSC_DLLEXPORT PetscViewerSiloSetMeshName(PetscViewer, const char []);
275ff73aad6SKris Buschelman EXTERN PetscErrorCode PETSC_DLLEXPORT PetscViewerSiloClearMeshName(PetscViewer);
2764ebda54eSMatthew Knepley 
2773c67689dSBarry Smith EXTERN PetscErrorCode PETSC_DLLEXPORT PetscViewerNetcdfOpen(MPI_Comm,const char[],PetscFileMode,PetscViewer*);
278ff73aad6SKris Buschelman EXTERN PetscErrorCode PETSC_DLLEXPORT PetscViewerNetcdfGetID(PetscViewer, int *);
279e3eb5169SDinesh Kaushik 
2803c67689dSBarry Smith EXTERN PetscErrorCode PETSC_DLLEXPORT PetscViewerHDF4Open(MPI_Comm,const char[],PetscFileMode,PetscViewer*);
281b864a7bfSBarry Smith EXTERN PetscErrorCode PETSC_DLLEXPORT PetscViewerHDF4WriteSDS(PetscViewer,float *,int,int *,int);
28200ccbe27SDinesh Kaushik 
2838e72c77eSMatthew Knepley EXTERN PetscErrorCode PETSC_DLLEXPORT PetscViewerHDF5Open(MPI_Comm,const char[],PetscFileMode,PetscViewer*);
2848e72c77eSMatthew Knepley #ifdef PETSC_HAVE_HDF5
2858e72c77eSMatthew Knepley #include <hdf5.h>
2861d1a0024SBarry Smith EXTERN PetscErrorCode PETSC_DLLEXPORT PetscViewerHDF5GetFileId(PetscViewer,hid_t*);
2878e72c77eSMatthew Knepley #endif
2888e72c77eSMatthew Knepley 
28977ed5343SBarry Smith /*
29077ed5343SBarry Smith      These are all the default viewers that do not have
29177ed5343SBarry Smith    to be explicitly opened
29277ed5343SBarry Smith */
293ff73aad6SKris Buschelman EXTERN PetscViewer PETSC_DLLEXPORT PETSC_VIEWER_STDOUT_(MPI_Comm);
2943050cee2SBarry Smith EXTERN PetscErrorCode PETSC_DLLEXPORT PetscViewerASCIIGetStdout(MPI_Comm,PetscViewer*);
295ff73aad6SKris Buschelman EXTERN PetscViewer PETSC_DLLEXPORT PETSC_VIEWER_STDERR_(MPI_Comm);
2963050cee2SBarry Smith EXTERN PetscErrorCode PETSC_DLLEXPORT PetscViewerASCIIGetStderr(MPI_Comm,PetscViewer*);
297ff73aad6SKris Buschelman EXTERN PetscViewer PETSC_DLLEXPORT PETSC_VIEWER_DRAW_(MPI_Comm);
298ff73aad6SKris Buschelman EXTERN PetscViewer PETSC_DLLEXPORT PETSC_VIEWER_SOCKET_(MPI_Comm);
299ff73aad6SKris Buschelman EXTERN PetscViewer PETSC_DLLEXPORT PETSC_VIEWER_BINARY_(MPI_Comm);
300ff73aad6SKris Buschelman EXTERN PetscViewer PETSC_DLLEXPORT PETSC_VIEWER_MATLAB_(MPI_Comm);
3017eb62a3eSMatthew Knepley EXTERN PetscViewer PETSC_VIEWER_MATHEMATICA_WORLD_PRIVATE;
3025311e20fSBarry Smith 
303b0a32e0cSBarry Smith #define PETSC_VIEWER_STDERR_SELF  PETSC_VIEWER_STDERR_(PETSC_COMM_SELF)
304b0a32e0cSBarry Smith #define PETSC_VIEWER_STDERR_WORLD PETSC_VIEWER_STDERR_(PETSC_COMM_WORLD)
30530de9b25SBarry Smith 
30630de9b25SBarry Smith /*MC
30730de9b25SBarry Smith   PETSC_VIEWER_STDOUT_WORLD  - same as PETSC_VIEWER_STDOUT_(PETSC_COMM_WORLD)
30830de9b25SBarry Smith 
30930de9b25SBarry Smith   Level: beginner
31030de9b25SBarry Smith M*/
31130de9b25SBarry Smith #define PETSC_VIEWER_STDOUT_WORLD PETSC_VIEWER_STDOUT_(PETSC_COMM_WORLD)
31230de9b25SBarry Smith 
31330de9b25SBarry Smith /*MC
31430de9b25SBarry Smith   PETSC_VIEWER_STDOUT_SELF  - same as PETSC_VIEWER_STDOUT_(PETSC_COMM_SELF)
31530de9b25SBarry Smith 
31630de9b25SBarry Smith   Level: beginner
31730de9b25SBarry Smith M*/
31830de9b25SBarry Smith #define PETSC_VIEWER_STDOUT_SELF  PETSC_VIEWER_STDOUT_(PETSC_COMM_SELF)
31930de9b25SBarry Smith 
32030de9b25SBarry Smith /*MC
32130de9b25SBarry Smith   PETSC_VIEWER_DRAW_WORLD  - same as PETSC_VIEWER_DRAW_(PETSC_COMM_WORLD)
32230de9b25SBarry Smith 
32330de9b25SBarry Smith   Level: intermediate
32430de9b25SBarry Smith M*/
325b0a32e0cSBarry Smith #define PETSC_VIEWER_DRAW_WORLD   PETSC_VIEWER_DRAW_(PETSC_COMM_WORLD)
32630de9b25SBarry Smith 
32730de9b25SBarry Smith /*MC
32830de9b25SBarry Smith   PETSC_VIEWER_DRAW_SELF  - same as PETSC_VIEWER_DRAW_(PETSC_COMM_SELF)
32930de9b25SBarry Smith 
33030de9b25SBarry Smith   Level: intermediate
33130de9b25SBarry Smith M*/
33230de9b25SBarry Smith #define PETSC_VIEWER_DRAW_SELF    PETSC_VIEWER_DRAW_(PETSC_COMM_SELF)
33330de9b25SBarry Smith 
33430de9b25SBarry Smith /*MC
33530de9b25SBarry Smith   PETSC_VIEWER_SOCKET_WORLD  - same as PETSC_VIEWER_SOCKET_(PETSC_COMM_WORLD)
33630de9b25SBarry Smith 
33730de9b25SBarry Smith   Level: intermediate
33830de9b25SBarry Smith M*/
339b0a32e0cSBarry Smith #define PETSC_VIEWER_SOCKET_WORLD PETSC_VIEWER_SOCKET_(PETSC_COMM_WORLD)
34030de9b25SBarry Smith 
34130de9b25SBarry Smith /*MC
34230de9b25SBarry Smith   PETSC_VIEWER_SOCKET_SELF  - same as PETSC_VIEWER_SOCKET_(PETSC_COMM_SELF)
34330de9b25SBarry Smith 
34430de9b25SBarry Smith   Level: intermediate
34530de9b25SBarry Smith M*/
346b0a32e0cSBarry Smith #define PETSC_VIEWER_SOCKET_SELF  PETSC_VIEWER_SOCKET_(PETSC_COMM_SELF)
34730de9b25SBarry Smith 
34830de9b25SBarry Smith /*MC
34930de9b25SBarry Smith   PETSC_VIEWER_BINARY_WORLD  - same as PETSC_VIEWER_BINARY_(PETSC_COMM_WORLD)
35030de9b25SBarry Smith 
35130de9b25SBarry Smith   Level: intermediate
35230de9b25SBarry Smith M*/
353b0a32e0cSBarry Smith #define PETSC_VIEWER_BINARY_WORLD PETSC_VIEWER_BINARY_(PETSC_COMM_WORLD)
35430de9b25SBarry Smith 
35530de9b25SBarry Smith /*MC
35630de9b25SBarry Smith   PETSC_VIEWER_BINARY_SELF  - same as PETSC_VIEWER_BINARY_(PETSC_COMM_SELF)
35730de9b25SBarry Smith 
35830de9b25SBarry Smith   Level: intermediate
35930de9b25SBarry Smith M*/
360b0a32e0cSBarry Smith #define PETSC_VIEWER_BINARY_SELF  PETSC_VIEWER_BINARY_(PETSC_COMM_SELF)
36130de9b25SBarry Smith 
362cbb32127SBarry Smith /*MC
363cbb32127SBarry Smith   PETSC_VIEWER_MATLAB_WORLD  - same as PETSC_VIEWER_MATLAB_(PETSC_COMM_WORLD)
364cbb32127SBarry Smith 
365cbb32127SBarry Smith   Level: intermediate
366cbb32127SBarry Smith M*/
367cbb32127SBarry Smith #define PETSC_VIEWER_MATLAB_WORLD PETSC_VIEWER_MATLAB_(PETSC_COMM_WORLD)
368cbb32127SBarry Smith 
369cbb32127SBarry Smith /*MC
370cbb32127SBarry Smith   PETSC_VIEWER_MATLAB_SELF  - same as PETSC_VIEWER_MATLAB_(PETSC_COMM_SELF)
371cbb32127SBarry Smith 
372cbb32127SBarry Smith   Level: intermediate
373cbb32127SBarry Smith M*/
374cbb32127SBarry Smith #define PETSC_VIEWER_MATLAB_SELF  PETSC_VIEWER_MATLAB_(PETSC_COMM_SELF)
375cbb32127SBarry Smith 
3767eb62a3eSMatthew Knepley #define PETSC_VIEWER_MATHEMATICA_WORLD (PetscViewerInitializeMathematicaWorld_Private(),PETSC_VIEWER_MATHEMATICA_WORLD_PRIVATE)
37765ef3172SBarry Smith 
37877ed5343SBarry Smith /*
379cbb32127SBarry Smith    petscViewer writes to Matlab .mat file
380cbb32127SBarry Smith */
381ff73aad6SKris Buschelman EXTERN PetscErrorCode PETSC_DLLEXPORT PetscViewerMatlabPutArray(PetscViewer,int,int,PetscScalar*,char*);
382ff73aad6SKris Buschelman EXTERN PetscErrorCode PETSC_DLLEXPORT PetscViewerMatlabGetArray(PetscViewer,int,int,PetscScalar*,char*);
383ff73aad6SKris Buschelman EXTERN PetscErrorCode PETSC_DLLEXPORT PetscViewerMatlabPutVariable(PetscViewer,const char*,void*);
384cbb32127SBarry Smith 
385b9617806SBarry Smith /*S
386b9617806SBarry Smith      PetscViewers - Abstract collection of PetscViewers
387b9617806SBarry Smith 
388b9617806SBarry Smith    Level: intermediate
389b9617806SBarry Smith 
390b9617806SBarry Smith   Concepts: viewing
391b9617806SBarry Smith 
392b9617806SBarry Smith .seealso:  PetscViewerCreate(), PetscViewerSetType(), PetscViewerType, PetscViewer, PetscViewersCreate(),
393b9617806SBarry Smith            PetscViewersGetViewer()
394b9617806SBarry Smith S*/
39595fbd943SSatish Balay typedef struct _n_PetscViewers* PetscViewers;
396ff73aad6SKris Buschelman EXTERN PetscErrorCode PETSC_DLLEXPORT PetscViewersCreate(MPI_Comm,PetscViewers*);
397ff73aad6SKris Buschelman EXTERN PetscErrorCode PETSC_DLLEXPORT PetscViewersDestroy(PetscViewers);
3989c666560SBarry Smith EXTERN PetscErrorCode PETSC_DLLEXPORT PetscViewersGetViewer(PetscViewers,PetscInt,PetscViewer*);
399d132466eSBarry Smith 
400e9fa29b7SSatish Balay PETSC_EXTERN_CXX_END
401cb5b572fSBarry Smith #endif
402