xref: /petsc/include/petscviewer.h (revision 2bf49c77dedd4b28e6efd10dcebd37482390fa09)
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 
282c8e378dSBarry Smith #include <petscsys.h>
298fb59f0aSKris Buschelman 
30014dd563SJed 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*/
4319fd82e9SBarry Smith typedef const char* PetscViewerType;
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 
57014dd563SJed Brown PETSC_EXTERN PetscFList PetscViewerList;
58014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerRegisterAll(const char *);
59014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerRegisterDestroy(void);
60014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerInitializePackage(const char[]);
617b2a1423SBarry Smith 
62014dd563SJed 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 
107014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerCreate(MPI_Comm,PetscViewer*);
108014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerSetFromOptions(PetscViewer);
109014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerASCIIOpenWithFILE(MPI_Comm,FILE*,PetscViewer*);
1107b2a1423SBarry Smith 
111014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerASCIIOpen(MPI_Comm,const char[],PetscViewer*);
112014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerASCIISetFILE(PetscViewer,FILE*);
113014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerBinaryOpen(MPI_Comm,const char[],PetscFileMode,PetscViewer*);
114014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerBinaryGetFlowControl(PetscViewer,PetscInt*);
115014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerBinarySetFlowControl(PetscViewer,PetscInt);
116014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerBinarySetMPIIO(PetscViewer);
117014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerBinaryGetMPIIO(PetscViewer,PetscBool *);
1180fc9d207SBarry Smith #if defined(PETSC_HAVE_MPIIO)
119014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerBinaryGetMPIIODescriptor(PetscViewer,MPI_File*);
120014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerBinaryGetMPIIOOffset(PetscViewer,MPI_Offset*);
121014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerBinaryAddMPIIOOffset(PetscViewer,MPI_Offset);
122951e3c8eSBarry Smith #endif
12339802e9eSBarry Smith 
124014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerSocketOpen(MPI_Comm,const char[],int,PetscViewer*);
125014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerStringOpen(MPI_Comm,char[],PetscInt,PetscViewer*);
126014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerDrawOpen(MPI_Comm,const char[],const char[],int,int,int,int,PetscViewer*);
127014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerMathematicaOpen(MPI_Comm, int, const char[], const char[], PetscViewer *);
128014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerSiloOpen(MPI_Comm, const char[], PetscViewer *);
129014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerMatlabOpen(MPI_Comm,const char[],PetscFileMode,PetscViewer*);
1304b0e389bSBarry Smith 
13119fd82e9SBarry Smith PETSC_EXTERN PetscErrorCode PetscViewerGetType(PetscViewer,PetscViewerType*);
13219fd82e9SBarry Smith PETSC_EXTERN PetscErrorCode PetscViewerSetType(PetscViewer,PetscViewerType);
133014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerDestroy(PetscViewer*);
134014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerGetSingleton(PetscViewer,PetscViewer*);
135014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerRestoreSingleton(PetscViewer,PetscViewer*);
136014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerGetSubcomm(PetscViewer,MPI_Comm,PetscViewer*);
137014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerRestoreSubcomm(PetscViewer,MPI_Comm,PetscViewer*);
138ae39576cSLois Curfman McInnes 
139014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerSetUp(PetscViewer);
140014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerView(PetscViewer,PetscViewer);
141f69a0ea3SMatthew Knepley 
142014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerSetOptionsPrefix(PetscViewer,const char[]);
143014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerAppendOptionsPrefix(PetscViewer,const char[]);
144014dd563SJed 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,
180b263465dSJed Brown   PETSC_VIEWER_VTK_VTU,
181f3ef73ceSBarry Smith   PETSC_VIEWER_NATIVE,
182cfaaf4edSHong Zhang   PETSC_VIEWER_NOFORMAT
183cfaaf4edSHong Zhang   } PetscViewerFormat;
184014dd563SJed Brown PETSC_EXTERN const char *const PetscViewerFormats[];
185090de74eSSatish Balay 
186014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerSetFormat(PetscViewer,PetscViewerFormat);
187014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerPushFormat(PetscViewer,PetscViewerFormat);
188014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerPopFormat(PetscViewer);
189014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerGetFormat(PetscViewer,PetscViewerFormat*);
190014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerFlush(PetscViewer);
1914b0e389bSBarry Smith 
192*2bf49c77SBarry Smith PETSC_EXTERN PetscErrorCode PetscOptionsGetViewer(MPI_Comm,const char[],const char[],PetscViewer*,PetscBool*);
193*2bf49c77SBarry Smith PETSC_EXTERN PetscErrorCode PetscOptionsRestoreViewer(PetscViewer);
194*2bf49c77SBarry Smith 
19577ed5343SBarry Smith /*
19677ed5343SBarry Smith    Operations explicit to a particular class of viewers
19777ed5343SBarry Smith */
198ed5c6e3eSMatthew Knepley 
199014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerASCIIGetPointer(PetscViewer,FILE**);
200014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerFileGetMode(PetscViewer,PetscFileMode*);
201014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerFileSetMode(PetscViewer,PetscFileMode);
202014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerASCIIPrintf(PetscViewer,const char[],...);
203014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerASCIISynchronizedPrintf(PetscViewer,const char[],...);
204014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerASCIISynchronizedAllow(PetscViewer,PetscBool);
205014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerASCIIPushTab(PetscViewer);
206014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerASCIIPopTab(PetscViewer);
207014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerASCIIUseTabs(PetscViewer,PetscBool );
208014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerASCIISetTab(PetscViewer,PetscInt);
209014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerASCIIGetTab(PetscViewer,PetscInt*);
210014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerASCIIAddTab(PetscViewer,PetscInt);
211014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerASCIISubtractTab(PetscViewer,PetscInt);
212014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerBinaryGetDescriptor(PetscViewer,int*);
213014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerBinaryGetInfoPointer(PetscViewer,FILE **);
214014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerBinaryRead(PetscViewer,void*,PetscInt,PetscDataType);
215014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerBinaryWrite(PetscViewer,void*,PetscInt,PetscDataType,PetscBool );
216014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerStringSPrintf(PetscViewer,const char[],...);
217014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerStringSetString(PetscViewer,char[],PetscInt);
218014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerDrawClear(PetscViewer);
219014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerDrawSetHold(PetscViewer,PetscBool);
220014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerDrawGetHold(PetscViewer,PetscBool*);
221014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerDrawSetPause(PetscViewer,PetscReal);
222014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerDrawGetPause(PetscViewer,PetscReal*);
223014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerDrawSetInfo(PetscViewer,const char[],const char[],int,int,int,int);
224014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerDrawResize(PetscViewer,int,int);
225014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerDrawSetBounds(PetscViewer,PetscInt,const PetscReal*);
226014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerDrawGetBounds(PetscViewer,PetscInt*,const PetscReal**);
227014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerSocketSetConnection(PetscViewer,const char[],int);
228014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerBinarySkipInfo(PetscViewer);
229014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerBinarySetSkipOptions(PetscViewer,PetscBool );
230014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerBinaryGetSkipOptions(PetscViewer,PetscBool *);
231014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerBinarySetSkipHeader(PetscViewer,PetscBool);
232014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerBinaryGetSkipHeader(PetscViewer,PetscBool*);
233014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerBinaryReadStringArray(PetscViewer,char***);
234014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerBinaryWriteStringArray(PetscViewer,char**);
235c655490fSBarry Smith 
236014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerFileSetName(PetscViewer,const char[]);
237014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerFileGetName(PetscViewer,const char**);
23877ed5343SBarry Smith 
239014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerVUGetPointer(PetscViewer, FILE**);
240014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerVUSetVecSeen(PetscViewer, PetscBool );
241014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerVUGetVecSeen(PetscViewer, PetscBool  *);
242014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerVUPrintDeferred(PetscViewer, const char [], ...);
243014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerVUFlushDeferred(PetscViewer);
24455dcf840SMatthew Knepley 
245014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerMathematicaInitializePackage(const char[]);
246014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerMathematicaFinalizePackage(void);
247014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerMathematicaGetName(PetscViewer, const char **);
248014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerMathematicaSetName(PetscViewer, const char []);
249014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerMathematicaClearName(PetscViewer);
250014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerMathematicaSkipPackets(PetscViewer, int);
2514ebda54eSMatthew Knepley 
252014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerSiloGetName(PetscViewer, char **);
253014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerSiloSetName(PetscViewer, const char []);
254014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerSiloClearName(PetscViewer);
255014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerSiloGetMeshName(PetscViewer, char **);
256014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerSiloSetMeshName(PetscViewer, const char []);
257014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerSiloClearMeshName(PetscViewer);
2584ebda54eSMatthew Knepley 
259014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerNetcdfOpen(MPI_Comm,const char[],PetscFileMode,PetscViewer*);
260014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerNetcdfGetID(PetscViewer, int *);
261e3eb5169SDinesh Kaushik 
262014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerHDF5WriteSDS(PetscViewer,float *,int,int *,int);
26300ccbe27SDinesh Kaushik 
264014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerHDF5Open(MPI_Comm,const char[],PetscFileMode,PetscViewer*);
265014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerHDF5PushGroup(PetscViewer,const char *);
266014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerHDF5PopGroup(PetscViewer);
267014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerHDF5GetGroup(PetscViewer, const char **);
268014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerHDF5IncrementTimestep(PetscViewer);
269014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerHDF5SetTimestep(PetscViewer,PetscInt);
270014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerHDF5GetTimestep(PetscViewer,PetscInt*);
2718e72c77eSMatthew Knepley #ifdef PETSC_HAVE_HDF5
2728e72c77eSMatthew Knepley #include <hdf5.h>
273014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerHDF5GetFileId(PetscViewer,hid_t*);
274014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerHDF5OpenGroup(PetscViewer, hid_t *, hid_t *);
2758e72c77eSMatthew Knepley #endif
2768e72c77eSMatthew Knepley 
277893c9c94SMatthew G Knepley typedef enum {PETSC_VTK_POINT_FIELD, PETSC_VTK_POINT_VECTOR_FIELD, PETSC_VTK_CELL_FIELD, PETSC_VTK_CELL_VECTOR_FIELD} PetscViewerVTKFieldType;
278638cfed1SJed Brown PETSC_EXTERN_TYPEDEF typedef PetscErrorCode (*PetscViewerVTKWriteFunction)(PetscObject,PetscViewer);
279014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerVTKAddField(PetscViewer,PetscObject,PetscViewerVTKWriteFunction,PetscViewerVTKFieldType,PetscObject);
280014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerVTKOpen(MPI_Comm,const char[],PetscFileMode,PetscViewer*);
2814061b8bfSJed Brown 
28277ed5343SBarry Smith /*
28377ed5343SBarry Smith      These are all the default viewers that do not have
28477ed5343SBarry Smith    to be explicitly opened
28577ed5343SBarry Smith */
286014dd563SJed Brown PETSC_EXTERN PetscViewer    PETSC_VIEWER_STDOUT_(MPI_Comm);
287014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerASCIIGetStdout(MPI_Comm,PetscViewer*);
288014dd563SJed Brown PETSC_EXTERN PetscViewer    PETSC_VIEWER_STDERR_(MPI_Comm);
289014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerASCIIGetStderr(MPI_Comm,PetscViewer*);
290014dd563SJed Brown PETSC_EXTERN PetscViewer    PETSC_VIEWER_DRAW_(MPI_Comm);
291014dd563SJed Brown PETSC_EXTERN PetscViewer    PETSC_VIEWER_SOCKET_(MPI_Comm);
292014dd563SJed Brown PETSC_EXTERN PetscViewer    PETSC_VIEWER_BINARY_(MPI_Comm);
293014dd563SJed Brown PETSC_EXTERN PetscViewer    PETSC_VIEWER_MATLAB_(MPI_Comm);
294014dd563SJed Brown PETSC_EXTERN PetscViewer   PETSC_VIEWER_MATHEMATICA_WORLD_PRIVATE;
2955311e20fSBarry Smith 
296b0a32e0cSBarry Smith #define PETSC_VIEWER_STDERR_SELF  PETSC_VIEWER_STDERR_(PETSC_COMM_SELF)
297b0a32e0cSBarry Smith #define PETSC_VIEWER_STDERR_WORLD PETSC_VIEWER_STDERR_(PETSC_COMM_WORLD)
29830de9b25SBarry Smith 
29930de9b25SBarry Smith /*MC
30030de9b25SBarry Smith   PETSC_VIEWER_STDOUT_WORLD  - same as PETSC_VIEWER_STDOUT_(PETSC_COMM_WORLD)
30130de9b25SBarry Smith 
30230de9b25SBarry Smith   Level: beginner
30330de9b25SBarry Smith M*/
30430de9b25SBarry Smith #define PETSC_VIEWER_STDOUT_WORLD PETSC_VIEWER_STDOUT_(PETSC_COMM_WORLD)
30530de9b25SBarry Smith 
30630de9b25SBarry Smith /*MC
30730de9b25SBarry Smith   PETSC_VIEWER_STDOUT_SELF  - same as PETSC_VIEWER_STDOUT_(PETSC_COMM_SELF)
30830de9b25SBarry Smith 
30930de9b25SBarry Smith   Level: beginner
31030de9b25SBarry Smith M*/
31130de9b25SBarry Smith #define PETSC_VIEWER_STDOUT_SELF  PETSC_VIEWER_STDOUT_(PETSC_COMM_SELF)
31230de9b25SBarry Smith 
31330de9b25SBarry Smith /*MC
31430de9b25SBarry Smith   PETSC_VIEWER_DRAW_WORLD  - same as PETSC_VIEWER_DRAW_(PETSC_COMM_WORLD)
31530de9b25SBarry Smith 
31630de9b25SBarry Smith   Level: intermediate
31730de9b25SBarry Smith M*/
318b0a32e0cSBarry Smith #define PETSC_VIEWER_DRAW_WORLD   PETSC_VIEWER_DRAW_(PETSC_COMM_WORLD)
31930de9b25SBarry Smith 
32030de9b25SBarry Smith /*MC
32130de9b25SBarry Smith   PETSC_VIEWER_DRAW_SELF  - same as PETSC_VIEWER_DRAW_(PETSC_COMM_SELF)
32230de9b25SBarry Smith 
32330de9b25SBarry Smith   Level: intermediate
32430de9b25SBarry Smith M*/
32530de9b25SBarry Smith #define PETSC_VIEWER_DRAW_SELF    PETSC_VIEWER_DRAW_(PETSC_COMM_SELF)
32630de9b25SBarry Smith 
32730de9b25SBarry Smith /*MC
32830de9b25SBarry Smith   PETSC_VIEWER_SOCKET_WORLD  - same as PETSC_VIEWER_SOCKET_(PETSC_COMM_WORLD)
32930de9b25SBarry Smith 
33030de9b25SBarry Smith   Level: intermediate
33130de9b25SBarry Smith M*/
332b0a32e0cSBarry Smith #define PETSC_VIEWER_SOCKET_WORLD PETSC_VIEWER_SOCKET_(PETSC_COMM_WORLD)
33330de9b25SBarry Smith 
33430de9b25SBarry Smith /*MC
33530de9b25SBarry Smith   PETSC_VIEWER_SOCKET_SELF  - same as PETSC_VIEWER_SOCKET_(PETSC_COMM_SELF)
33630de9b25SBarry Smith 
33730de9b25SBarry Smith   Level: intermediate
33830de9b25SBarry Smith M*/
339b0a32e0cSBarry Smith #define PETSC_VIEWER_SOCKET_SELF  PETSC_VIEWER_SOCKET_(PETSC_COMM_SELF)
34030de9b25SBarry Smith 
34130de9b25SBarry Smith /*MC
34230de9b25SBarry Smith   PETSC_VIEWER_BINARY_WORLD  - same as PETSC_VIEWER_BINARY_(PETSC_COMM_WORLD)
34330de9b25SBarry Smith 
34430de9b25SBarry Smith   Level: intermediate
34530de9b25SBarry Smith M*/
346b0a32e0cSBarry Smith #define PETSC_VIEWER_BINARY_WORLD PETSC_VIEWER_BINARY_(PETSC_COMM_WORLD)
34730de9b25SBarry Smith 
34830de9b25SBarry Smith /*MC
34930de9b25SBarry Smith   PETSC_VIEWER_BINARY_SELF  - same as PETSC_VIEWER_BINARY_(PETSC_COMM_SELF)
35030de9b25SBarry Smith 
35130de9b25SBarry Smith   Level: intermediate
35230de9b25SBarry Smith M*/
353b0a32e0cSBarry Smith #define PETSC_VIEWER_BINARY_SELF  PETSC_VIEWER_BINARY_(PETSC_COMM_SELF)
35430de9b25SBarry Smith 
355cbb32127SBarry Smith /*MC
356cbb32127SBarry Smith   PETSC_VIEWER_MATLAB_WORLD  - same as PETSC_VIEWER_MATLAB_(PETSC_COMM_WORLD)
357cbb32127SBarry Smith 
358cbb32127SBarry Smith   Level: intermediate
359cbb32127SBarry Smith M*/
360cbb32127SBarry Smith #define PETSC_VIEWER_MATLAB_WORLD PETSC_VIEWER_MATLAB_(PETSC_COMM_WORLD)
361cbb32127SBarry Smith 
362cbb32127SBarry Smith /*MC
363cbb32127SBarry Smith   PETSC_VIEWER_MATLAB_SELF  - same as PETSC_VIEWER_MATLAB_(PETSC_COMM_SELF)
364cbb32127SBarry Smith 
365cbb32127SBarry Smith   Level: intermediate
366cbb32127SBarry Smith M*/
367cbb32127SBarry Smith #define PETSC_VIEWER_MATLAB_SELF  PETSC_VIEWER_MATLAB_(PETSC_COMM_SELF)
368cbb32127SBarry Smith 
3697eb62a3eSMatthew Knepley #define PETSC_VIEWER_MATHEMATICA_WORLD (PetscViewerInitializeMathematicaWorld_Private(),PETSC_VIEWER_MATHEMATICA_WORLD_PRIVATE)
37065ef3172SBarry Smith 
371e03d165dSBarry Smith #define PetscViewerFlowControlStart(viewer,mcnt,cnt)  (PetscViewerBinaryGetFlowControl(viewer,mcnt) || PetscViewerBinaryGetFlowControl(viewer,cnt))
37285ebf7a4SBarry Smith #define PetscViewerFlowControlStepMaster(viewer,i,mcnt,cnt) ((i >= mcnt) ?  (mcnt += cnt,MPI_Bcast(&mcnt,1,MPIU_INT,0,((PetscObject)viewer)->comm)) : 0)
373e03d165dSBarry Smith #define PetscViewerFlowControlEndMaster(viewer,mcnt) (mcnt = 0,MPI_Bcast(&mcnt,1,MPIU_INT,0,((PetscObject)viewer)->comm))
374fca9dd48SBarry Smith #define PetscViewerFlowControlStepWorker(viewer,rank,mcnt) 0; while (1) { PetscErrorCode _ierr; \
375fca9dd48SBarry Smith     if (rank < mcnt) break;				\
376e03d165dSBarry Smith   _ierr = MPI_Bcast(&mcnt,1,MPIU_INT,0,((PetscObject)viewer)->comm);CHKERRQ(_ierr);\
377e03d165dSBarry Smith   }
378fca9dd48SBarry Smith #define PetscViewerFlowControlEndWorker(viewer,mcnt) 0; while (1) { PetscErrorCode _ierr; \
379fca9dd48SBarry Smith   _ierr = MPI_Bcast(&mcnt,1,MPIU_INT,0,((PetscObject)viewer)->comm);CHKERRQ(_ierr);\
380fca9dd48SBarry Smith     if (mcnt == 0) break;				\
381fca9dd48SBarry Smith   }
382e03d165dSBarry Smith 
38377ed5343SBarry Smith /*
384a5057860SBarry Smith    PetscViewer writes to MATLAB .mat file
385cbb32127SBarry Smith */
386014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerMatlabPutArray(PetscViewer,int,int,const PetscScalar*,const char*);
387014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerMatlabGetArray(PetscViewer,int,int,PetscScalar*,const char*);
388014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerMatlabPutVariable(PetscViewer,const char*,void*);
389cbb32127SBarry Smith 
390b9617806SBarry Smith /*S
3911890ba74SBarry Smith      PetscViewers - Abstract collection of PetscViewers. It is just an expandable array of viewers.
392b9617806SBarry Smith 
393b9617806SBarry Smith    Level: intermediate
394b9617806SBarry Smith 
395b9617806SBarry Smith   Concepts: viewing
396b9617806SBarry Smith 
397b9617806SBarry Smith .seealso:  PetscViewerCreate(), PetscViewerSetType(), PetscViewerType, PetscViewer, PetscViewersCreate(),
398b9617806SBarry Smith            PetscViewersGetViewer()
399b9617806SBarry Smith S*/
40095fbd943SSatish Balay typedef struct _n_PetscViewers* PetscViewers;
401014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewersCreate(MPI_Comm,PetscViewers*);
402014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewersDestroy(PetscViewers*);
403014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewersGetViewer(PetscViewers,PetscInt,PetscViewer*);
404d132466eSBarry Smith 
405b3506946SBarry Smith #if defined(PETSC_HAVE_AMS)
406b3506946SBarry Smith #include <ams.h>
407014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerAMSSetCommName(PetscViewer,const char[]);
408014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerAMSGetAMSComm(PetscViewer,AMS_Comm *);
409014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerAMSOpen(MPI_Comm,const char[],PetscViewer*);
410014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerAMSLock(PetscViewer);
411014dd563SJed Brown PETSC_EXTERN PetscViewer    PETSC_VIEWER_AMS_(MPI_Comm);
412014dd563SJed Brown PETSC_EXTERN PetscErrorCode PETSC_VIEWER_AMS_Destroy(MPI_Comm);
413b3506946SBarry Smith #define PETSC_VIEWER_AMS_WORLD PETSC_VIEWER_AMS_(PETSC_COMM_WORLD)
414b3506946SBarry Smith #endif
415b3506946SBarry Smith 
416cb5b572fSBarry Smith #endif
417