xref: /petsc/include/petscviewer.h (revision 014dd563d73e9fc78d056590fa6cf997782bf92d)
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 
30*014dd563SJed Brown PETSC_EXTERN PetscClassId PETSC_VIEWER_CLASSID;
31e9fa29b7SSatish Balay 
323c119ea2SBarry Smith /*
33d382aafbSBarry Smith     petscsys.h must be included AFTER the definition of PetscViewer for ADIC to
343c119ea2SBarry Smith    process correctly.
353c119ea2SBarry Smith */
3676bdecfbSBarry Smith /*J
37b9617806SBarry Smith     PetscViewerType - String with the name of a PETSc PETScViewer
38b9617806SBarry Smith 
39b9617806SBarry Smith    Level: beginner
40b9617806SBarry Smith 
41b9617806SBarry Smith .seealso: PetscViewerSetType(), PetscViewer
4276bdecfbSBarry Smith J*/
43a313700dSBarry Smith #define PetscViewerType char*
442692d6eeSBarry Smith #define PETSCVIEWERSOCKET       "socket"
452692d6eeSBarry Smith #define PETSCVIEWERASCII        "ascii"
462692d6eeSBarry Smith #define PETSCVIEWERBINARY       "binary"
472692d6eeSBarry Smith #define PETSCVIEWERSTRING       "string"
482692d6eeSBarry Smith #define PETSCVIEWERDRAW         "draw"
492692d6eeSBarry Smith #define PETSCVIEWERVU           "vu"
502692d6eeSBarry Smith #define PETSCVIEWERMATHEMATICA  "mathematica"
512692d6eeSBarry Smith #define PETSCVIEWERNETCDF       "netcdf"
522692d6eeSBarry Smith #define PETSCVIEWERHDF5         "hdf5"
534061b8bfSJed Brown #define PETSCVIEWERVTK          "vtk"
542692d6eeSBarry Smith #define PETSCVIEWERMATLAB       "matlab"
55b3506946SBarry Smith #define PETSCVIEWERAMS          "ams"
5677ed5343SBarry Smith 
57*014dd563SJed Brown PETSC_EXTERN PetscFList PetscViewerList;
58*014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerRegisterAll(const char *);
59*014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerRegisterDestroy(void);
60*014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerInitializePackage(const char[]);
617b2a1423SBarry Smith 
62*014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerRegister(const char*,const char*,const char*,PetscErrorCode (*)(PetscViewer));
6330de9b25SBarry Smith 
6430de9b25SBarry Smith /*MC
6592c97de8SJed Brown    PetscViewerRegisterDynamic - Adds a viewer
6630de9b25SBarry Smith 
6730de9b25SBarry Smith    Synopsis:
681890ba74SBarry Smith    PetscErrorCode PetscViewerRegisterDynamic(const char *name_solver,const char *path,const char *name_create,PetscErrorCode (*routine_create)(PetscViewer))
6930de9b25SBarry Smith 
7030de9b25SBarry Smith    Not Collective
7130de9b25SBarry Smith 
7230de9b25SBarry Smith    Input Parameters:
7392c97de8SJed Brown +  name_solver - name of a new user-defined viewer
7492c97de8SJed Brown .  path - path (either absolute or relative) the library containing this viewer
7530de9b25SBarry Smith .  name_create - name of routine to create method context
7630de9b25SBarry Smith -  routine_create - routine to create method context
7730de9b25SBarry Smith 
7830de9b25SBarry Smith    Level: developer
7930de9b25SBarry Smith 
8030de9b25SBarry Smith    Notes:
8192c97de8SJed Brown    PetscViewerRegisterDynamic() may be called multiple times to add several user-defined viewers.
8230de9b25SBarry Smith 
8330de9b25SBarry Smith    If dynamic libraries are used, then the fourth input argument (routine_create)
8430de9b25SBarry Smith    is ignored.
8530de9b25SBarry Smith 
8630de9b25SBarry Smith    Sample usage:
8730de9b25SBarry Smith .vb
8830de9b25SBarry Smith    PetscViewerRegisterDynamic("my_viewer_type",/home/username/my_lib/lib/libO/solaris/mylib.a,
8930de9b25SBarry Smith                "MyViewerCreate",MyViewerCreate);
9030de9b25SBarry Smith .ve
9130de9b25SBarry Smith 
9230de9b25SBarry Smith    Then, your solver can be chosen with the procedural interface via
9392c97de8SJed Brown $     PetscViewerSetType(viewer,"my_viewer_type")
9430de9b25SBarry Smith    or at runtime via the option
9530de9b25SBarry Smith $     -viewer_type my_viewer_type
9630de9b25SBarry Smith 
9730de9b25SBarry Smith   Concepts: registering^Viewers
9830de9b25SBarry Smith 
9930de9b25SBarry Smith .seealso: PetscViewerRegisterAll(), PetscViewerRegisterDestroy()
10030de9b25SBarry Smith M*/
101aa482453SBarry Smith #if defined(PETSC_USE_DYNAMIC_LIBRARIES)
102b0a32e0cSBarry Smith #define PetscViewerRegisterDynamic(a,b,c,d) PetscViewerRegister(a,b,c,0)
1037b2a1423SBarry Smith #else
104b0a32e0cSBarry Smith #define PetscViewerRegisterDynamic(a,b,c,d) PetscViewerRegister(a,b,c,d)
1057b2a1423SBarry Smith #endif
10630de9b25SBarry Smith 
107*014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerCreate(MPI_Comm,PetscViewer*);
108*014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerSetFromOptions(PetscViewer);
109*014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerASCIIOpenWithFILE(MPI_Comm,FILE*,PetscViewer*);
1107b2a1423SBarry Smith 
111*014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerASCIIOpen(MPI_Comm,const char[],PetscViewer*);
112*014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerASCIISetFILE(PetscViewer,FILE*);
113*014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerBinaryOpen(MPI_Comm,const char[],PetscFileMode,PetscViewer*);
114*014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerBinaryGetFlowControl(PetscViewer,PetscInt*);
115*014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerBinarySetFlowControl(PetscViewer,PetscInt);
116*014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerBinarySetMPIIO(PetscViewer);
117*014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerBinaryGetMPIIO(PetscViewer,PetscBool *);
1180fc9d207SBarry Smith #if defined(PETSC_HAVE_MPIIO)
119*014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerBinaryGetMPIIODescriptor(PetscViewer,MPI_File*);
120*014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerBinaryGetMPIIOOffset(PetscViewer,MPI_Offset*);
121*014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerBinaryAddMPIIOOffset(PetscViewer,MPI_Offset);
122951e3c8eSBarry Smith #endif
12339802e9eSBarry Smith 
124*014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerSocketOpen(MPI_Comm,const char[],int,PetscViewer*);
125*014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerStringOpen(MPI_Comm,char[],PetscInt,PetscViewer*);
126*014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerDrawOpen(MPI_Comm,const char[],const char[],int,int,int,int,PetscViewer*);
127*014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerMathematicaOpen(MPI_Comm, int, const char[], const char[], PetscViewer *);
128*014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerSiloOpen(MPI_Comm, const char[], PetscViewer *);
129*014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerMatlabOpen(MPI_Comm,const char[],PetscFileMode,PetscViewer*);
1304b0e389bSBarry Smith 
131*014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerGetType(PetscViewer,const PetscViewerType*);
132*014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerSetType(PetscViewer,const PetscViewerType);
133*014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerDestroy(PetscViewer*);
134*014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerGetSingleton(PetscViewer,PetscViewer*);
135*014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerRestoreSingleton(PetscViewer,PetscViewer*);
136*014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerGetSubcomm(PetscViewer,MPI_Comm,PetscViewer*);
137*014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerRestoreSubcomm(PetscViewer,MPI_Comm,PetscViewer*);
138ae39576cSLois Curfman McInnes 
139*014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerSetUp(PetscViewer);
140*014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerView(PetscViewer,PetscViewer);
141f69a0ea3SMatthew Knepley 
142*014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerSetOptionsPrefix(PetscViewer,const char[]);
143*014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerAppendOptionsPrefix(PetscViewer,const char[]);
144*014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerGetOptionsPrefix(PetscViewer,const char*[]);
145090de74eSSatish Balay 
146b9617806SBarry Smith /*E
147b9617806SBarry Smith     PetscViewerFormat - Way a viewer presents the object
148b9617806SBarry Smith 
149b9617806SBarry Smith    Level: beginner
150b9617806SBarry Smith 
151cfaaf4edSHong Zhang    The values below are also listed in finclude/petscviewer.h. If another values is added below it
152cfaaf4edSHong Zhang    must also be added there.
153cfaaf4edSHong Zhang 
154b9617806SBarry Smith .seealso: PetscViewerSetFormat(), PetscViewer, PetscViewerType, PetscViewerPushFormat(), PetscViewerPopFormat()
155b9617806SBarry Smith E*/
156fb9695e5SSatish Balay typedef enum {
157117016b1SBarry Smith   PETSC_VIEWER_DEFAULT,
158f3ef73ceSBarry Smith   PETSC_VIEWER_ASCII_MATLAB,
1594ebda54eSMatthew Knepley   PETSC_VIEWER_ASCII_MATHEMATICA,
160f3ef73ceSBarry Smith   PETSC_VIEWER_ASCII_IMPL,
161f3ef73ceSBarry Smith   PETSC_VIEWER_ASCII_INFO,
162456192e2SBarry Smith   PETSC_VIEWER_ASCII_INFO_DETAIL,
163f3ef73ceSBarry Smith   PETSC_VIEWER_ASCII_COMMON,
164f3ef73ceSBarry Smith   PETSC_VIEWER_ASCII_SYMMODU,
165f3ef73ceSBarry Smith   PETSC_VIEWER_ASCII_INDEX,
166f3ef73ceSBarry Smith   PETSC_VIEWER_ASCII_DENSE,
1673c215bfdSMatthew Knepley   PETSC_VIEWER_ASCII_MATRIXMARKET,
168a505fa5bSMatthew Knepley   PETSC_VIEWER_ASCII_VTK,
169b85befe5SMatthew Knepley   PETSC_VIEWER_ASCII_VTK_CELL,
170b6d733afSMatthew Knepley   PETSC_VIEWER_ASCII_VTK_COORDS,
171493617b5SMatthew Knepley   PETSC_VIEWER_ASCII_PCICE,
172cfaaf4edSHong Zhang   PETSC_VIEWER_ASCII_PYTHON,
173cfaaf4edSHong Zhang   PETSC_VIEWER_ASCII_FACTOR_INFO,
17467ad5babSMatthew G Knepley   PETSC_VIEWER_ASCII_LATEX,
175f3ef73ceSBarry Smith   PETSC_VIEWER_DRAW_BASIC,
176f3ef73ceSBarry Smith   PETSC_VIEWER_DRAW_LG,
177f3ef73ceSBarry Smith   PETSC_VIEWER_DRAW_CONTOUR,
178f3ef73ceSBarry Smith   PETSC_VIEWER_DRAW_PORTS,
1794061b8bfSJed Brown   PETSC_VIEWER_VTK_VTS,
180f3ef73ceSBarry Smith   PETSC_VIEWER_NATIVE,
181cfaaf4edSHong Zhang   PETSC_VIEWER_NOFORMAT
182cfaaf4edSHong Zhang   } PetscViewerFormat;
183*014dd563SJed Brown PETSC_EXTERN const char *const PetscViewerFormats[];
184090de74eSSatish Balay 
185*014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerSetFormat(PetscViewer,PetscViewerFormat);
186*014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerPushFormat(PetscViewer,PetscViewerFormat);
187*014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerPopFormat(PetscViewer);
188*014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerGetFormat(PetscViewer,PetscViewerFormat*);
189*014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerFlush(PetscViewer);
1904b0e389bSBarry Smith 
19177ed5343SBarry Smith /*
19277ed5343SBarry Smith    Operations explicit to a particular class of viewers
19377ed5343SBarry Smith */
194ed5c6e3eSMatthew Knepley 
195*014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerASCIIGetPointer(PetscViewer,FILE**);
196*014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerFileGetMode(PetscViewer,PetscFileMode*);
197*014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerFileSetMode(PetscViewer,PetscFileMode);
198*014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerASCIIPrintf(PetscViewer,const char[],...);
199*014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerASCIISynchronizedPrintf(PetscViewer,const char[],...);
200*014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerASCIISynchronizedAllow(PetscViewer,PetscBool);
201*014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerASCIIPushTab(PetscViewer);
202*014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerASCIIPopTab(PetscViewer);
203*014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerASCIIUseTabs(PetscViewer,PetscBool );
204*014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerASCIISetTab(PetscViewer,PetscInt);
205*014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerASCIIGetTab(PetscViewer,PetscInt*);
206*014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerASCIIAddTab(PetscViewer,PetscInt);
207*014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerASCIISubtractTab(PetscViewer,PetscInt);
208*014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerBinaryGetDescriptor(PetscViewer,int*);
209*014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerBinaryGetInfoPointer(PetscViewer,FILE **);
210*014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerBinaryRead(PetscViewer,void*,PetscInt,PetscDataType);
211*014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerBinaryWrite(PetscViewer,void*,PetscInt,PetscDataType,PetscBool );
212*014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerStringSPrintf(PetscViewer,const char[],...);
213*014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerStringSetString(PetscViewer,char[],PetscInt);
214*014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerDrawClear(PetscViewer);
215*014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerDrawSetHold(PetscViewer,PetscBool);
216*014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerDrawGetHold(PetscViewer,PetscBool*);
217*014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerDrawSetPause(PetscViewer,PetscReal);
218*014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerDrawGetPause(PetscViewer,PetscReal*);
219*014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerDrawSetInfo(PetscViewer,const char[],const char[],int,int,int,int);
220*014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerDrawResize(PetscViewer,int,int);
221*014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerDrawSetBounds(PetscViewer,PetscInt,const PetscReal*);
222*014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerDrawGetBounds(PetscViewer,PetscInt*,const PetscReal**);
223*014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerSocketSetConnection(PetscViewer,const char[],int);
224*014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerBinarySkipInfo(PetscViewer);
225*014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerBinarySetSkipOptions(PetscViewer,PetscBool );
226*014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerBinaryGetSkipOptions(PetscViewer,PetscBool *);
227*014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerBinarySetSkipHeader(PetscViewer,PetscBool);
228*014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerBinaryGetSkipHeader(PetscViewer,PetscBool*);
229*014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerBinaryReadStringArray(PetscViewer,char***);
230*014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerBinaryWriteStringArray(PetscViewer,char**);
231c655490fSBarry Smith 
232*014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerFileSetName(PetscViewer,const char[]);
233*014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerFileGetName(PetscViewer,const char**);
23477ed5343SBarry Smith 
235*014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscPLAPACKInitializePackage(MPI_Comm com);
236*014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscPLAPACKFinalizePackage(void);
23744c6da4fSMatthew Knepley 
238*014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerVUGetPointer(PetscViewer, FILE**);
239*014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerVUSetVecSeen(PetscViewer, PetscBool );
240*014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerVUGetVecSeen(PetscViewer, PetscBool  *);
241*014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerVUPrintDeferred(PetscViewer, const char [], ...);
242*014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerVUFlushDeferred(PetscViewer);
24355dcf840SMatthew Knepley 
244*014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerMathematicaInitializePackage(const char[]);
245*014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerMathematicaFinalizePackage(void);
246*014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerMathematicaGetName(PetscViewer, const char **);
247*014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerMathematicaSetName(PetscViewer, const char []);
248*014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerMathematicaClearName(PetscViewer);
249*014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerMathematicaSkipPackets(PetscViewer, int);
2504ebda54eSMatthew Knepley 
251*014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerSiloGetName(PetscViewer, char **);
252*014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerSiloSetName(PetscViewer, const char []);
253*014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerSiloClearName(PetscViewer);
254*014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerSiloGetMeshName(PetscViewer, char **);
255*014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerSiloSetMeshName(PetscViewer, const char []);
256*014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerSiloClearMeshName(PetscViewer);
2574ebda54eSMatthew Knepley 
258*014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerNetcdfOpen(MPI_Comm,const char[],PetscFileMode,PetscViewer*);
259*014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerNetcdfGetID(PetscViewer, int *);
260e3eb5169SDinesh Kaushik 
261*014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerHDF5WriteSDS(PetscViewer,float *,int,int *,int);
26200ccbe27SDinesh Kaushik 
263*014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerHDF5Open(MPI_Comm,const char[],PetscFileMode,PetscViewer*);
264*014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerHDF5PushGroup(PetscViewer,const char *);
265*014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerHDF5PopGroup(PetscViewer);
266*014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerHDF5GetGroup(PetscViewer, const char **);
267*014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerHDF5IncrementTimestep(PetscViewer);
268*014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerHDF5SetTimestep(PetscViewer,PetscInt);
269*014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerHDF5GetTimestep(PetscViewer,PetscInt*);
2708e72c77eSMatthew Knepley #ifdef PETSC_HAVE_HDF5
2718e72c77eSMatthew Knepley #include <hdf5.h>
272*014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerHDF5GetFileId(PetscViewer,hid_t*);
273*014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerHDF5OpenGroup(PetscViewer, hid_t *, hid_t *);
2748e72c77eSMatthew Knepley #endif
2758e72c77eSMatthew Knepley 
276893c9c94SMatthew G Knepley typedef enum {PETSC_VTK_POINT_FIELD, PETSC_VTK_POINT_VECTOR_FIELD, PETSC_VTK_CELL_FIELD, PETSC_VTK_CELL_VECTOR_FIELD} PetscViewerVTKFieldType;
2774061b8bfSJed Brown typedef PetscErrorCode (*PetscViewerVTKWriteFunction)(PetscObject,PetscViewer);
278*014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerVTKAddField(PetscViewer,PetscObject,PetscViewerVTKWriteFunction,PetscViewerVTKFieldType,PetscObject);
279*014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerVTKOpen(MPI_Comm,const char[],PetscFileMode,PetscViewer*);
2804061b8bfSJed Brown 
28177ed5343SBarry Smith /*
28277ed5343SBarry Smith      These are all the default viewers that do not have
28377ed5343SBarry Smith    to be explicitly opened
28477ed5343SBarry Smith */
285*014dd563SJed Brown PETSC_EXTERN PetscViewer    PETSC_VIEWER_STDOUT_(MPI_Comm);
286*014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerASCIIGetStdout(MPI_Comm,PetscViewer*);
287*014dd563SJed Brown PETSC_EXTERN PetscViewer    PETSC_VIEWER_STDERR_(MPI_Comm);
288*014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerASCIIGetStderr(MPI_Comm,PetscViewer*);
289*014dd563SJed Brown PETSC_EXTERN PetscViewer    PETSC_VIEWER_DRAW_(MPI_Comm);
290*014dd563SJed Brown PETSC_EXTERN PetscViewer    PETSC_VIEWER_SOCKET_(MPI_Comm);
291*014dd563SJed Brown PETSC_EXTERN PetscViewer    PETSC_VIEWER_BINARY_(MPI_Comm);
292*014dd563SJed Brown PETSC_EXTERN PetscViewer    PETSC_VIEWER_MATLAB_(MPI_Comm);
293*014dd563SJed Brown PETSC_EXTERN PetscViewer   PETSC_VIEWER_MATHEMATICA_WORLD_PRIVATE;
2945311e20fSBarry Smith 
295b0a32e0cSBarry Smith #define PETSC_VIEWER_STDERR_SELF  PETSC_VIEWER_STDERR_(PETSC_COMM_SELF)
296b0a32e0cSBarry Smith #define PETSC_VIEWER_STDERR_WORLD PETSC_VIEWER_STDERR_(PETSC_COMM_WORLD)
29730de9b25SBarry Smith 
29830de9b25SBarry Smith /*MC
29930de9b25SBarry Smith   PETSC_VIEWER_STDOUT_WORLD  - same as PETSC_VIEWER_STDOUT_(PETSC_COMM_WORLD)
30030de9b25SBarry Smith 
30130de9b25SBarry Smith   Level: beginner
30230de9b25SBarry Smith M*/
30330de9b25SBarry Smith #define PETSC_VIEWER_STDOUT_WORLD PETSC_VIEWER_STDOUT_(PETSC_COMM_WORLD)
30430de9b25SBarry Smith 
30530de9b25SBarry Smith /*MC
30630de9b25SBarry Smith   PETSC_VIEWER_STDOUT_SELF  - same as PETSC_VIEWER_STDOUT_(PETSC_COMM_SELF)
30730de9b25SBarry Smith 
30830de9b25SBarry Smith   Level: beginner
30930de9b25SBarry Smith M*/
31030de9b25SBarry Smith #define PETSC_VIEWER_STDOUT_SELF  PETSC_VIEWER_STDOUT_(PETSC_COMM_SELF)
31130de9b25SBarry Smith 
31230de9b25SBarry Smith /*MC
31330de9b25SBarry Smith   PETSC_VIEWER_DRAW_WORLD  - same as PETSC_VIEWER_DRAW_(PETSC_COMM_WORLD)
31430de9b25SBarry Smith 
31530de9b25SBarry Smith   Level: intermediate
31630de9b25SBarry Smith M*/
317b0a32e0cSBarry Smith #define PETSC_VIEWER_DRAW_WORLD   PETSC_VIEWER_DRAW_(PETSC_COMM_WORLD)
31830de9b25SBarry Smith 
31930de9b25SBarry Smith /*MC
32030de9b25SBarry Smith   PETSC_VIEWER_DRAW_SELF  - same as PETSC_VIEWER_DRAW_(PETSC_COMM_SELF)
32130de9b25SBarry Smith 
32230de9b25SBarry Smith   Level: intermediate
32330de9b25SBarry Smith M*/
32430de9b25SBarry Smith #define PETSC_VIEWER_DRAW_SELF    PETSC_VIEWER_DRAW_(PETSC_COMM_SELF)
32530de9b25SBarry Smith 
32630de9b25SBarry Smith /*MC
32730de9b25SBarry Smith   PETSC_VIEWER_SOCKET_WORLD  - same as PETSC_VIEWER_SOCKET_(PETSC_COMM_WORLD)
32830de9b25SBarry Smith 
32930de9b25SBarry Smith   Level: intermediate
33030de9b25SBarry Smith M*/
331b0a32e0cSBarry Smith #define PETSC_VIEWER_SOCKET_WORLD PETSC_VIEWER_SOCKET_(PETSC_COMM_WORLD)
33230de9b25SBarry Smith 
33330de9b25SBarry Smith /*MC
33430de9b25SBarry Smith   PETSC_VIEWER_SOCKET_SELF  - same as PETSC_VIEWER_SOCKET_(PETSC_COMM_SELF)
33530de9b25SBarry Smith 
33630de9b25SBarry Smith   Level: intermediate
33730de9b25SBarry Smith M*/
338b0a32e0cSBarry Smith #define PETSC_VIEWER_SOCKET_SELF  PETSC_VIEWER_SOCKET_(PETSC_COMM_SELF)
33930de9b25SBarry Smith 
34030de9b25SBarry Smith /*MC
34130de9b25SBarry Smith   PETSC_VIEWER_BINARY_WORLD  - same as PETSC_VIEWER_BINARY_(PETSC_COMM_WORLD)
34230de9b25SBarry Smith 
34330de9b25SBarry Smith   Level: intermediate
34430de9b25SBarry Smith M*/
345b0a32e0cSBarry Smith #define PETSC_VIEWER_BINARY_WORLD PETSC_VIEWER_BINARY_(PETSC_COMM_WORLD)
34630de9b25SBarry Smith 
34730de9b25SBarry Smith /*MC
34830de9b25SBarry Smith   PETSC_VIEWER_BINARY_SELF  - same as PETSC_VIEWER_BINARY_(PETSC_COMM_SELF)
34930de9b25SBarry Smith 
35030de9b25SBarry Smith   Level: intermediate
35130de9b25SBarry Smith M*/
352b0a32e0cSBarry Smith #define PETSC_VIEWER_BINARY_SELF  PETSC_VIEWER_BINARY_(PETSC_COMM_SELF)
35330de9b25SBarry Smith 
354cbb32127SBarry Smith /*MC
355cbb32127SBarry Smith   PETSC_VIEWER_MATLAB_WORLD  - same as PETSC_VIEWER_MATLAB_(PETSC_COMM_WORLD)
356cbb32127SBarry Smith 
357cbb32127SBarry Smith   Level: intermediate
358cbb32127SBarry Smith M*/
359cbb32127SBarry Smith #define PETSC_VIEWER_MATLAB_WORLD PETSC_VIEWER_MATLAB_(PETSC_COMM_WORLD)
360cbb32127SBarry Smith 
361cbb32127SBarry Smith /*MC
362cbb32127SBarry Smith   PETSC_VIEWER_MATLAB_SELF  - same as PETSC_VIEWER_MATLAB_(PETSC_COMM_SELF)
363cbb32127SBarry Smith 
364cbb32127SBarry Smith   Level: intermediate
365cbb32127SBarry Smith M*/
366cbb32127SBarry Smith #define PETSC_VIEWER_MATLAB_SELF  PETSC_VIEWER_MATLAB_(PETSC_COMM_SELF)
367cbb32127SBarry Smith 
3687eb62a3eSMatthew Knepley #define PETSC_VIEWER_MATHEMATICA_WORLD (PetscViewerInitializeMathematicaWorld_Private(),PETSC_VIEWER_MATHEMATICA_WORLD_PRIVATE)
36965ef3172SBarry Smith 
370e03d165dSBarry Smith #define PetscViewerFlowControlStart(viewer,mcnt,cnt)  (PetscViewerBinaryGetFlowControl(viewer,mcnt) || PetscViewerBinaryGetFlowControl(viewer,cnt))
37185ebf7a4SBarry Smith #define PetscViewerFlowControlStepMaster(viewer,i,mcnt,cnt) ((i >= mcnt) ?  (mcnt += cnt,MPI_Bcast(&mcnt,1,MPIU_INT,0,((PetscObject)viewer)->comm)) : 0)
372e03d165dSBarry Smith #define PetscViewerFlowControlEndMaster(viewer,mcnt) (mcnt = 0,MPI_Bcast(&mcnt,1,MPIU_INT,0,((PetscObject)viewer)->comm))
373fca9dd48SBarry Smith #define PetscViewerFlowControlStepWorker(viewer,rank,mcnt) 0; while (1) { PetscErrorCode _ierr; \
374fca9dd48SBarry Smith     if (rank < mcnt) break;				\
375e03d165dSBarry Smith   _ierr = MPI_Bcast(&mcnt,1,MPIU_INT,0,((PetscObject)viewer)->comm);CHKERRQ(_ierr);\
376e03d165dSBarry Smith   }
377fca9dd48SBarry Smith #define PetscViewerFlowControlEndWorker(viewer,mcnt) 0; while (1) { PetscErrorCode _ierr; \
378fca9dd48SBarry Smith   _ierr = MPI_Bcast(&mcnt,1,MPIU_INT,0,((PetscObject)viewer)->comm);CHKERRQ(_ierr);\
379fca9dd48SBarry Smith     if (mcnt == 0) break;				\
380fca9dd48SBarry Smith   }
381e03d165dSBarry Smith 
38277ed5343SBarry Smith /*
383a5057860SBarry Smith    PetscViewer writes to MATLAB .mat file
384cbb32127SBarry Smith */
385*014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerMatlabPutArray(PetscViewer,int,int,const PetscScalar*,const char*);
386*014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerMatlabGetArray(PetscViewer,int,int,PetscScalar*,const char*);
387*014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerMatlabPutVariable(PetscViewer,const char*,void*);
388cbb32127SBarry Smith 
389b9617806SBarry Smith /*S
3901890ba74SBarry Smith      PetscViewers - Abstract collection of PetscViewers. It is just an expandable array of viewers.
391b9617806SBarry Smith 
392b9617806SBarry Smith    Level: intermediate
393b9617806SBarry Smith 
394b9617806SBarry Smith   Concepts: viewing
395b9617806SBarry Smith 
396b9617806SBarry Smith .seealso:  PetscViewerCreate(), PetscViewerSetType(), PetscViewerType, PetscViewer, PetscViewersCreate(),
397b9617806SBarry Smith            PetscViewersGetViewer()
398b9617806SBarry Smith S*/
39995fbd943SSatish Balay typedef struct _n_PetscViewers* PetscViewers;
400*014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewersCreate(MPI_Comm,PetscViewers*);
401*014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewersDestroy(PetscViewers*);
402*014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewersGetViewer(PetscViewers,PetscInt,PetscViewer*);
403d132466eSBarry Smith 
404b3506946SBarry Smith #if defined(PETSC_HAVE_AMS)
405b3506946SBarry Smith #include <ams.h>
406*014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerAMSSetCommName(PetscViewer,const char[]);
407*014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerAMSGetAMSComm(PetscViewer,AMS_Comm *);
408*014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerAMSOpen(MPI_Comm,const char[],PetscViewer*);
409*014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerAMSLock(PetscViewer);
410*014dd563SJed Brown PETSC_EXTERN PetscViewer    PETSC_VIEWER_AMS_(MPI_Comm);
411*014dd563SJed Brown PETSC_EXTERN PetscErrorCode PETSC_VIEWER_AMS_Destroy(MPI_Comm);
412b3506946SBarry Smith #define PETSC_VIEWER_AMS_WORLD PETSC_VIEWER_AMS_(PETSC_COMM_WORLD)
413b3506946SBarry Smith #endif
414b3506946SBarry Smith 
415cb5b572fSBarry Smith #endif
416