xref: /petsc/include/petscviewer.h (revision 89d949e22d93de971d3ed7d7fdc00f23508da20b)
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 
86420c192SJed Brown #include <petscsys.h>
9c619b03eSJed Brown #include <petscviewertypes.h>
10e9fa29b7SSatish Balay 
11014dd563SJed Brown PETSC_EXTERN PetscClassId PETSC_VIEWER_CLASSID;
12e9fa29b7SSatish Balay 
1376bdecfbSBarry Smith /*J
14b9617806SBarry Smith     PetscViewerType - String with the name of a PETSc PETScViewer
15b9617806SBarry Smith 
16b9617806SBarry Smith    Level: beginner
17b9617806SBarry Smith 
188f6c3df8SBarry Smith .seealso: PetscViewerSetType(), PetscViewer, PetscViewerRegister(), PetscViewerCreate()
1976bdecfbSBarry Smith J*/
2019fd82e9SBarry Smith typedef const char* PetscViewerType;
212692d6eeSBarry Smith #define PETSCVIEWERSOCKET       "socket"
222692d6eeSBarry Smith #define PETSCVIEWERASCII        "ascii"
232692d6eeSBarry Smith #define PETSCVIEWERBINARY       "binary"
242692d6eeSBarry Smith #define PETSCVIEWERSTRING       "string"
252692d6eeSBarry Smith #define PETSCVIEWERDRAW         "draw"
262692d6eeSBarry Smith #define PETSCVIEWERVU           "vu"
272692d6eeSBarry Smith #define PETSCVIEWERMATHEMATICA  "mathematica"
282692d6eeSBarry Smith #define PETSCVIEWERNETCDF       "netcdf"
292692d6eeSBarry Smith #define PETSCVIEWERHDF5         "hdf5"
304061b8bfSJed Brown #define PETSCVIEWERVTK          "vtk"
312692d6eeSBarry Smith #define PETSCVIEWERMATLAB       "matlab"
32e04113cfSBarry Smith #define PETSCVIEWERSAWS          "saws"
3377ed5343SBarry Smith 
34140e18c1SBarry Smith PETSC_EXTERN PetscFunctionList PetscViewerList;
35607a6623SBarry Smith PETSC_EXTERN PetscErrorCode PetscViewerRegisterAll(void);
36607a6623SBarry Smith PETSC_EXTERN PetscErrorCode PetscViewerInitializePackage(void);
377b2a1423SBarry Smith 
38bdf89e91SBarry Smith PETSC_EXTERN PetscErrorCode PetscViewerRegister(const char[],PetscErrorCode (*)(PetscViewer));
3930de9b25SBarry Smith 
40014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerCreate(MPI_Comm,PetscViewer*);
41014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerSetFromOptions(PetscViewer);
42014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerASCIIOpenWithFILE(MPI_Comm,FILE*,PetscViewer*);
437b2a1423SBarry Smith 
44014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerASCIIOpen(MPI_Comm,const char[],PetscViewer*);
45014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerASCIISetFILE(PetscViewer,FILE*);
46014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerBinaryOpen(MPI_Comm,const char[],PetscFileMode,PetscViewer*);
47014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerBinaryGetFlowControl(PetscViewer,PetscInt*);
48014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerBinarySetFlowControl(PetscViewer,PetscInt);
49014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerBinarySetMPIIO(PetscViewer);
50014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerBinaryGetMPIIO(PetscViewer,PetscBool *);
510fc9d207SBarry Smith #if defined(PETSC_HAVE_MPIIO)
52014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerBinaryGetMPIIODescriptor(PetscViewer,MPI_File*);
53014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerBinaryGetMPIIOOffset(PetscViewer,MPI_Offset*);
54014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerBinaryAddMPIIOOffset(PetscViewer,MPI_Offset);
55951e3c8eSBarry Smith #endif
5639802e9eSBarry Smith 
57014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerSocketOpen(MPI_Comm,const char[],int,PetscViewer*);
58*89d949e2SBarry Smith PETSC_EXTERN PetscErrorCode PetscViewerStringOpen(MPI_Comm,char[],size_t,PetscViewer*);
59014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerDrawOpen(MPI_Comm,const char[],const char[],int,int,int,int,PetscViewer*);
60d1da0b69SBarry Smith #include <petscdrawtypes.h>
61d1da0b69SBarry Smith PETSC_EXTERN PetscErrorCode PetscViewerDrawSetDrawType(PetscViewer,PetscDrawType);
62014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerMathematicaOpen(MPI_Comm, int, const char[], const char[], PetscViewer *);
63014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerSiloOpen(MPI_Comm, const char[], PetscViewer *);
64014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerMatlabOpen(MPI_Comm,const char[],PetscFileMode,PetscViewer*);
654b0e389bSBarry Smith 
6619fd82e9SBarry Smith PETSC_EXTERN PetscErrorCode PetscViewerGetType(PetscViewer,PetscViewerType*);
6719fd82e9SBarry Smith PETSC_EXTERN PetscErrorCode PetscViewerSetType(PetscViewer,PetscViewerType);
68014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerDestroy(PetscViewer*);
69014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerGetSingleton(PetscViewer,PetscViewer*);
70014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerRestoreSingleton(PetscViewer,PetscViewer*);
71014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerGetSubcomm(PetscViewer,MPI_Comm,PetscViewer*);
72014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerRestoreSubcomm(PetscViewer,MPI_Comm,PetscViewer*);
73ae39576cSLois Curfman McInnes 
74014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerSetUp(PetscViewer);
75014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerView(PetscViewer,PetscViewer);
76ce1779c8SBarry Smith PETSC_STATIC_INLINE PetscErrorCode PetscViewerViewFromOptions(PetscViewer A,const char prefix[],const char name[]) {return PetscObjectViewFromOptions((PetscObject)A,prefix,name);}
77f69a0ea3SMatthew Knepley 
78014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerSetOptionsPrefix(PetscViewer,const char[]);
79014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerAppendOptionsPrefix(PetscViewer,const char[]);
80014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerGetOptionsPrefix(PetscViewer,const char*[]);
81090de74eSSatish Balay 
82b9617806SBarry Smith /*E
83b9617806SBarry Smith     PetscViewerFormat - Way a viewer presents the object
84b9617806SBarry Smith 
85b9617806SBarry Smith    Level: beginner
86b9617806SBarry Smith 
87cfaaf4edSHong Zhang    The values below are also listed in finclude/petscviewer.h. If another values is added below it
88cfaaf4edSHong Zhang    must also be added there.
89cfaaf4edSHong Zhang 
90b9617806SBarry Smith .seealso: PetscViewerSetFormat(), PetscViewer, PetscViewerType, PetscViewerPushFormat(), PetscViewerPopFormat()
91b9617806SBarry Smith E*/
92fb9695e5SSatish Balay typedef enum {
93117016b1SBarry Smith   PETSC_VIEWER_DEFAULT,
94f3ef73ceSBarry Smith   PETSC_VIEWER_ASCII_MATLAB,
954ebda54eSMatthew Knepley   PETSC_VIEWER_ASCII_MATHEMATICA,
96f3ef73ceSBarry Smith   PETSC_VIEWER_ASCII_IMPL,
97f3ef73ceSBarry Smith   PETSC_VIEWER_ASCII_INFO,
98456192e2SBarry Smith   PETSC_VIEWER_ASCII_INFO_DETAIL,
99f3ef73ceSBarry Smith   PETSC_VIEWER_ASCII_COMMON,
100f3ef73ceSBarry Smith   PETSC_VIEWER_ASCII_SYMMODU,
101f3ef73ceSBarry Smith   PETSC_VIEWER_ASCII_INDEX,
102f3ef73ceSBarry Smith   PETSC_VIEWER_ASCII_DENSE,
1033c215bfdSMatthew Knepley   PETSC_VIEWER_ASCII_MATRIXMARKET,
104a505fa5bSMatthew Knepley   PETSC_VIEWER_ASCII_VTK,
105b85befe5SMatthew Knepley   PETSC_VIEWER_ASCII_VTK_CELL,
106b6d733afSMatthew Knepley   PETSC_VIEWER_ASCII_VTK_COORDS,
107493617b5SMatthew Knepley   PETSC_VIEWER_ASCII_PCICE,
108cfaaf4edSHong Zhang   PETSC_VIEWER_ASCII_PYTHON,
109cfaaf4edSHong Zhang   PETSC_VIEWER_ASCII_FACTOR_INFO,
11067ad5babSMatthew G Knepley   PETSC_VIEWER_ASCII_LATEX,
111f3ef73ceSBarry Smith   PETSC_VIEWER_DRAW_BASIC,
112f3ef73ceSBarry Smith   PETSC_VIEWER_DRAW_LG,
113f3ef73ceSBarry Smith   PETSC_VIEWER_DRAW_CONTOUR,
114f3ef73ceSBarry Smith   PETSC_VIEWER_DRAW_PORTS,
1154061b8bfSJed Brown   PETSC_VIEWER_VTK_VTS,
116a13bc4e3SShao-Ching Huang   PETSC_VIEWER_VTK_VTR,
117b263465dSJed Brown   PETSC_VIEWER_VTK_VTU,
118a261c58fSBarry Smith   PETSC_VIEWER_BINARY_MATLAB,
119f3ef73ceSBarry Smith   PETSC_VIEWER_NATIVE,
120cfaaf4edSHong Zhang   PETSC_VIEWER_NOFORMAT
121cfaaf4edSHong Zhang   } PetscViewerFormat;
122014dd563SJed Brown PETSC_EXTERN const char *const PetscViewerFormats[];
123090de74eSSatish Balay 
124014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerSetFormat(PetscViewer,PetscViewerFormat);
125014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerPushFormat(PetscViewer,PetscViewerFormat);
126014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerPopFormat(PetscViewer);
127014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerGetFormat(PetscViewer,PetscViewerFormat*);
128014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerFlush(PetscViewer);
1294b0e389bSBarry Smith 
130cffb1e40SBarry Smith PETSC_EXTERN PetscErrorCode PetscOptionsGetViewer(MPI_Comm,const char[],const char[],PetscViewer*,PetscViewerFormat*,PetscBool*);
131cffb1e40SBarry Smith PETSC_EXTERN PetscErrorCode PetscOptionsViewer(const char[],const char[],const char[],PetscViewer*,PetscViewerFormat *,PetscBool *);
1322bf49c77SBarry Smith 
13377ed5343SBarry Smith /*
13477ed5343SBarry Smith    Operations explicit to a particular class of viewers
13577ed5343SBarry Smith */
136ed5c6e3eSMatthew Knepley 
137014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerASCIIGetPointer(PetscViewer,FILE**);
138014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerFileGetMode(PetscViewer,PetscFileMode*);
139014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerFileSetMode(PetscViewer,PetscFileMode);
140014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerASCIIPrintf(PetscViewer,const char[],...);
141014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerASCIISynchronizedPrintf(PetscViewer,const char[],...);
142014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerASCIISynchronizedAllow(PetscViewer,PetscBool);
143014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerASCIIPushTab(PetscViewer);
144014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerASCIIPopTab(PetscViewer);
145014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerASCIIUseTabs(PetscViewer,PetscBool );
146014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerASCIISetTab(PetscViewer,PetscInt);
147014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerASCIIGetTab(PetscViewer,PetscInt*);
148014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerASCIIAddTab(PetscViewer,PetscInt);
149014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerASCIISubtractTab(PetscViewer,PetscInt);
150014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerBinaryGetDescriptor(PetscViewer,int*);
151014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerBinaryGetInfoPointer(PetscViewer,FILE **);
152014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerBinaryRead(PetscViewer,void*,PetscInt,PetscDataType);
153014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerBinaryWrite(PetscViewer,void*,PetscInt,PetscDataType,PetscBool );
154014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerStringSPrintf(PetscViewer,const char[],...);
155014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerStringSetString(PetscViewer,char[],PetscInt);
156014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerDrawClear(PetscViewer);
157014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerDrawSetHold(PetscViewer,PetscBool);
158014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerDrawGetHold(PetscViewer,PetscBool*);
159014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerDrawSetPause(PetscViewer,PetscReal);
160014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerDrawGetPause(PetscViewer,PetscReal*);
161014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerDrawSetInfo(PetscViewer,const char[],const char[],int,int,int,int);
162014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerDrawResize(PetscViewer,int,int);
163014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerDrawSetBounds(PetscViewer,PetscInt,const PetscReal*);
164014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerDrawGetBounds(PetscViewer,PetscInt*,const PetscReal**);
165014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerSocketSetConnection(PetscViewer,const char[],int);
166014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerBinarySkipInfo(PetscViewer);
167014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerBinarySetSkipOptions(PetscViewer,PetscBool );
168014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerBinaryGetSkipOptions(PetscViewer,PetscBool *);
169014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerBinarySetSkipHeader(PetscViewer,PetscBool);
170014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerBinaryGetSkipHeader(PetscViewer,PetscBool*);
171014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerBinaryReadStringArray(PetscViewer,char***);
172014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerBinaryWriteStringArray(PetscViewer,char**);
173c655490fSBarry Smith 
174014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerFileSetName(PetscViewer,const char[]);
175014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerFileGetName(PetscViewer,const char**);
17677ed5343SBarry Smith 
177014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerVUGetPointer(PetscViewer, FILE**);
178014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerVUSetVecSeen(PetscViewer, PetscBool );
179014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerVUGetVecSeen(PetscViewer, PetscBool  *);
180014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerVUPrintDeferred(PetscViewer, const char [], ...);
181014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerVUFlushDeferred(PetscViewer);
18255dcf840SMatthew Knepley 
183607a6623SBarry Smith PETSC_EXTERN PetscErrorCode PetscViewerMathematicaInitializePackage(void);
184014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerMathematicaFinalizePackage(void);
185014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerMathematicaGetName(PetscViewer, const char **);
186014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerMathematicaSetName(PetscViewer, const char []);
187014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerMathematicaClearName(PetscViewer);
188014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerMathematicaSkipPackets(PetscViewer, int);
1894ebda54eSMatthew Knepley 
190014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerSiloGetName(PetscViewer, char **);
191014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerSiloSetName(PetscViewer, const char []);
192014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerSiloClearName(PetscViewer);
193014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerSiloGetMeshName(PetscViewer, char **);
194014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerSiloSetMeshName(PetscViewer, const char []);
195014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerSiloClearMeshName(PetscViewer);
1964ebda54eSMatthew Knepley 
197014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerNetcdfOpen(MPI_Comm,const char[],PetscFileMode,PetscViewer*);
198014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerNetcdfGetID(PetscViewer, int *);
199e3eb5169SDinesh Kaushik 
200893c9c94SMatthew G Knepley typedef enum {PETSC_VTK_POINT_FIELD, PETSC_VTK_POINT_VECTOR_FIELD, PETSC_VTK_CELL_FIELD, PETSC_VTK_CELL_VECTOR_FIELD} PetscViewerVTKFieldType;
20118e2ec27SBarry Smith PETSC_EXTERN PetscErrorCode PetscViewerVTKAddField(PetscViewer,PetscObject,PetscErrorCode (*PetscViewerVTKWriteFunction)(PetscObject,PetscViewer),PetscViewerVTKFieldType,PetscObject);
202014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerVTKOpen(MPI_Comm,const char[],PetscFileMode,PetscViewer*);
2034061b8bfSJed Brown 
20477ed5343SBarry Smith /*
205d70abbfaSBarry Smith      These are all the default viewers that do not have to be explicitly opened
20677ed5343SBarry Smith */
207014dd563SJed Brown PETSC_EXTERN PetscViewer    PETSC_VIEWER_STDOUT_(MPI_Comm);
208014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerASCIIGetStdout(MPI_Comm,PetscViewer*);
209014dd563SJed Brown PETSC_EXTERN PetscViewer    PETSC_VIEWER_STDERR_(MPI_Comm);
210014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerASCIIGetStderr(MPI_Comm,PetscViewer*);
211014dd563SJed Brown PETSC_EXTERN PetscViewer    PETSC_VIEWER_DRAW_(MPI_Comm);
212014dd563SJed Brown PETSC_EXTERN PetscViewer    PETSC_VIEWER_SOCKET_(MPI_Comm);
213014dd563SJed Brown PETSC_EXTERN PetscViewer    PETSC_VIEWER_BINARY_(MPI_Comm);
214014dd563SJed Brown PETSC_EXTERN PetscViewer    PETSC_VIEWER_MATLAB_(MPI_Comm);
215014dd563SJed Brown PETSC_EXTERN PetscViewer   PETSC_VIEWER_MATHEMATICA_WORLD_PRIVATE;
2165311e20fSBarry Smith 
217b0a32e0cSBarry Smith #define PETSC_VIEWER_STDERR_SELF  PETSC_VIEWER_STDERR_(PETSC_COMM_SELF)
218b0a32e0cSBarry Smith #define PETSC_VIEWER_STDERR_WORLD PETSC_VIEWER_STDERR_(PETSC_COMM_WORLD)
21930de9b25SBarry Smith 
22030de9b25SBarry Smith /*MC
22130de9b25SBarry Smith   PETSC_VIEWER_STDOUT_WORLD  - same as PETSC_VIEWER_STDOUT_(PETSC_COMM_WORLD)
22230de9b25SBarry Smith 
22330de9b25SBarry Smith   Level: beginner
22430de9b25SBarry Smith M*/
22530de9b25SBarry Smith #define PETSC_VIEWER_STDOUT_WORLD PETSC_VIEWER_STDOUT_(PETSC_COMM_WORLD)
22630de9b25SBarry Smith 
22730de9b25SBarry Smith /*MC
22830de9b25SBarry Smith   PETSC_VIEWER_STDOUT_SELF  - same as PETSC_VIEWER_STDOUT_(PETSC_COMM_SELF)
22930de9b25SBarry Smith 
23030de9b25SBarry Smith   Level: beginner
23130de9b25SBarry Smith M*/
23230de9b25SBarry Smith #define PETSC_VIEWER_STDOUT_SELF  PETSC_VIEWER_STDOUT_(PETSC_COMM_SELF)
23330de9b25SBarry Smith 
23430de9b25SBarry Smith /*MC
23530de9b25SBarry Smith   PETSC_VIEWER_DRAW_WORLD  - same as PETSC_VIEWER_DRAW_(PETSC_COMM_WORLD)
23630de9b25SBarry Smith 
23730de9b25SBarry Smith   Level: intermediate
23830de9b25SBarry Smith M*/
239b0a32e0cSBarry Smith #define PETSC_VIEWER_DRAW_WORLD   PETSC_VIEWER_DRAW_(PETSC_COMM_WORLD)
24030de9b25SBarry Smith 
24130de9b25SBarry Smith /*MC
24230de9b25SBarry Smith   PETSC_VIEWER_DRAW_SELF  - same as PETSC_VIEWER_DRAW_(PETSC_COMM_SELF)
24330de9b25SBarry Smith 
24430de9b25SBarry Smith   Level: intermediate
24530de9b25SBarry Smith M*/
24630de9b25SBarry Smith #define PETSC_VIEWER_DRAW_SELF    PETSC_VIEWER_DRAW_(PETSC_COMM_SELF)
24730de9b25SBarry Smith 
24830de9b25SBarry Smith /*MC
24930de9b25SBarry Smith   PETSC_VIEWER_SOCKET_WORLD  - same as PETSC_VIEWER_SOCKET_(PETSC_COMM_WORLD)
25030de9b25SBarry Smith 
25130de9b25SBarry Smith   Level: intermediate
25230de9b25SBarry Smith M*/
253b0a32e0cSBarry Smith #define PETSC_VIEWER_SOCKET_WORLD PETSC_VIEWER_SOCKET_(PETSC_COMM_WORLD)
25430de9b25SBarry Smith 
25530de9b25SBarry Smith /*MC
25630de9b25SBarry Smith   PETSC_VIEWER_SOCKET_SELF  - same as PETSC_VIEWER_SOCKET_(PETSC_COMM_SELF)
25730de9b25SBarry Smith 
25830de9b25SBarry Smith   Level: intermediate
25930de9b25SBarry Smith M*/
260b0a32e0cSBarry Smith #define PETSC_VIEWER_SOCKET_SELF  PETSC_VIEWER_SOCKET_(PETSC_COMM_SELF)
26130de9b25SBarry Smith 
26230de9b25SBarry Smith /*MC
26330de9b25SBarry Smith   PETSC_VIEWER_BINARY_WORLD  - same as PETSC_VIEWER_BINARY_(PETSC_COMM_WORLD)
26430de9b25SBarry Smith 
26530de9b25SBarry Smith   Level: intermediate
26630de9b25SBarry Smith M*/
267b0a32e0cSBarry Smith #define PETSC_VIEWER_BINARY_WORLD PETSC_VIEWER_BINARY_(PETSC_COMM_WORLD)
26830de9b25SBarry Smith 
26930de9b25SBarry Smith /*MC
27030de9b25SBarry Smith   PETSC_VIEWER_BINARY_SELF  - same as PETSC_VIEWER_BINARY_(PETSC_COMM_SELF)
27130de9b25SBarry Smith 
27230de9b25SBarry Smith   Level: intermediate
27330de9b25SBarry Smith M*/
274b0a32e0cSBarry Smith #define PETSC_VIEWER_BINARY_SELF  PETSC_VIEWER_BINARY_(PETSC_COMM_SELF)
27530de9b25SBarry Smith 
276cbb32127SBarry Smith /*MC
277cbb32127SBarry Smith   PETSC_VIEWER_MATLAB_WORLD  - same as PETSC_VIEWER_MATLAB_(PETSC_COMM_WORLD)
278cbb32127SBarry Smith 
279cbb32127SBarry Smith   Level: intermediate
280cbb32127SBarry Smith M*/
281cbb32127SBarry Smith #define PETSC_VIEWER_MATLAB_WORLD PETSC_VIEWER_MATLAB_(PETSC_COMM_WORLD)
282cbb32127SBarry Smith 
283cbb32127SBarry Smith /*MC
284cbb32127SBarry Smith   PETSC_VIEWER_MATLAB_SELF  - same as PETSC_VIEWER_MATLAB_(PETSC_COMM_SELF)
285cbb32127SBarry Smith 
286cbb32127SBarry Smith   Level: intermediate
287cbb32127SBarry Smith M*/
288cbb32127SBarry Smith #define PETSC_VIEWER_MATLAB_SELF  PETSC_VIEWER_MATLAB_(PETSC_COMM_SELF)
289cbb32127SBarry Smith 
2907eb62a3eSMatthew Knepley #define PETSC_VIEWER_MATHEMATICA_WORLD (PetscViewerInitializeMathematicaWorld_Private(),PETSC_VIEWER_MATHEMATICA_WORLD_PRIVATE)
29165ef3172SBarry Smith 
292639ff905SBarry Smith #undef __FUNCT__
293639ff905SBarry Smith #define __FUNCT__ "PetscViewerFlowControlStart"
294639ff905SBarry Smith PETSC_STATIC_INLINE PetscErrorCode PetscViewerFlowControlStart(PetscViewer viewer,PetscInt *mcnt,PetscInt *cnt)
295639ff905SBarry Smith {
296639ff905SBarry Smith   PetscErrorCode ierr;
297639ff905SBarry Smith   PetscFunctionBegin;
298639ff905SBarry Smith   ierr = PetscViewerBinaryGetFlowControl(viewer,mcnt);CHKERRQ(ierr);
299639ff905SBarry Smith   ierr = PetscViewerBinaryGetFlowControl(viewer,cnt);CHKERRQ(ierr);
300639ff905SBarry Smith   PetscFunctionReturn(0);
301e03d165dSBarry Smith }
302639ff905SBarry Smith 
303639ff905SBarry Smith #undef __FUNCT__
304639ff905SBarry Smith #define __FUNCT__ "PetscViewerFlowControlStepMaster"
305639ff905SBarry Smith PETSC_STATIC_INLINE PetscErrorCode PetscViewerFlowControlStepMaster(PetscViewer viewer,PetscInt i,PetscInt *mcnt,PetscInt cnt)
306639ff905SBarry Smith {
307639ff905SBarry Smith   PetscErrorCode ierr;
308639ff905SBarry Smith   MPI_Comm       comm;
309639ff905SBarry Smith 
310639ff905SBarry Smith   PetscFunctionBegin;
311639ff905SBarry Smith   ierr = PetscObjectGetComm((PetscObject)viewer,&comm);CHKERRQ(ierr);
312639ff905SBarry Smith   if (i >= *mcnt) {
313639ff905SBarry Smith     *mcnt += cnt;
314639ff905SBarry Smith     ierr = MPI_Bcast(mcnt,1,MPIU_INT,0,comm);CHKERRQ(ierr);
315639ff905SBarry Smith   }
316639ff905SBarry Smith   PetscFunctionReturn(0);
317639ff905SBarry Smith }
318639ff905SBarry Smith 
319639ff905SBarry Smith #undef __FUNCT__
320639ff905SBarry Smith #define __FUNCT__ "PetscViewerFlowControlEndMaster"
321639ff905SBarry Smith PETSC_STATIC_INLINE PetscErrorCode PetscViewerFlowControlEndMaster(PetscViewer viewer,PetscInt *mcnt)
322639ff905SBarry Smith {
323639ff905SBarry Smith   PetscErrorCode ierr;
324639ff905SBarry Smith   MPI_Comm       comm;
325639ff905SBarry Smith   PetscFunctionBegin;
326639ff905SBarry Smith   ierr = PetscObjectGetComm((PetscObject)viewer,&comm);CHKERRQ(ierr);
327639ff905SBarry Smith   *mcnt = 0;
328639ff905SBarry Smith   ierr = MPI_Bcast(mcnt,1,MPIU_INT,0,comm);CHKERRQ(ierr);
329639ff905SBarry Smith   PetscFunctionReturn(0);
330639ff905SBarry Smith }
331639ff905SBarry Smith 
332639ff905SBarry Smith #undef __FUNCT__
333639ff905SBarry Smith #define __FUNCT__ "PetscViewerFlowControlStepWorker"
334639ff905SBarry Smith PETSC_STATIC_INLINE PetscErrorCode PetscViewerFlowControlStepWorker(PetscViewer viewer,PetscMPIInt rank,PetscInt *mcnt)
335639ff905SBarry Smith {
336639ff905SBarry Smith   PetscErrorCode ierr;
337639ff905SBarry Smith   MPI_Comm       comm;
338639ff905SBarry Smith   PetscFunctionBegin;
339639ff905SBarry Smith   ierr = PetscObjectGetComm((PetscObject)viewer,&comm);CHKERRQ(ierr);
340639ff905SBarry Smith   while (PETSC_TRUE) {
341639ff905SBarry Smith     if (rank < *mcnt) break;
342639ff905SBarry Smith     ierr = MPI_Bcast(mcnt,1,MPIU_INT,0,comm);CHKERRQ(ierr);
343639ff905SBarry Smith   }
344639ff905SBarry Smith   PetscFunctionReturn(0);
345639ff905SBarry Smith }
346639ff905SBarry Smith 
347639ff905SBarry Smith #undef __FUNCT__
348639ff905SBarry Smith #define __FUNCT__ "PetscViewerFlowControlEndWorker"
349639ff905SBarry Smith PETSC_STATIC_INLINE PetscErrorCode PetscViewerFlowControlEndWorker(PetscViewer viewer,PetscInt *mcnt)
350639ff905SBarry Smith {
351639ff905SBarry Smith   PetscErrorCode ierr;
352639ff905SBarry Smith   MPI_Comm       comm;
353639ff905SBarry Smith   PetscFunctionBegin;
354639ff905SBarry Smith   ierr = PetscObjectGetComm((PetscObject)viewer,&comm);CHKERRQ(ierr);
355639ff905SBarry Smith   while (PETSC_TRUE) {
356639ff905SBarry Smith     ierr = MPI_Bcast(mcnt,1,MPIU_INT,0,comm);CHKERRQ(ierr);
357639ff905SBarry Smith     if (!*mcnt) break;
358639ff905SBarry Smith   }
359639ff905SBarry Smith   PetscFunctionReturn(0);
360fca9dd48SBarry Smith }
361e03d165dSBarry Smith 
36277ed5343SBarry Smith /*
363a5057860SBarry Smith    PetscViewer writes to MATLAB .mat file
364cbb32127SBarry Smith */
365014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerMatlabPutArray(PetscViewer,int,int,const PetscScalar*,const char*);
366014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerMatlabGetArray(PetscViewer,int,int,PetscScalar*,const char*);
367014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerMatlabPutVariable(PetscViewer,const char*,void*);
368cbb32127SBarry Smith 
369e04113cfSBarry Smith #if defined(PETSC_HAVE_SAWS)
370e04113cfSBarry Smith PETSC_EXTERN PetscErrorCode PetscObjectViewSAWs(PetscObject,PetscViewer);
371bfb97211SBarry Smith #endif
372bfb97211SBarry Smith 
373b9617806SBarry Smith /*S
3741890ba74SBarry Smith      PetscViewers - Abstract collection of PetscViewers. It is just an expandable array of viewers.
375b9617806SBarry Smith 
376b9617806SBarry Smith    Level: intermediate
377b9617806SBarry Smith 
378b9617806SBarry Smith   Concepts: viewing
379b9617806SBarry Smith 
380b9617806SBarry Smith .seealso:  PetscViewerCreate(), PetscViewerSetType(), PetscViewerType, PetscViewer, PetscViewersCreate(),
381b9617806SBarry Smith            PetscViewersGetViewer()
382b9617806SBarry Smith S*/
38395fbd943SSatish Balay typedef struct _n_PetscViewers* PetscViewers;
384014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewersCreate(MPI_Comm,PetscViewers*);
385014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewersDestroy(PetscViewers*);
386014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewersGetViewer(PetscViewers,PetscInt,PetscViewer*);
387d132466eSBarry Smith 
388e1e7ae07SJed Brown /* Reset __FUNCT__ in case the user does not define it themselves */
389e1e7ae07SJed Brown #undef __FUNCT__
390e1e7ae07SJed Brown #define __FUNCT__ "User provided function"
391e1e7ae07SJed Brown 
392cb5b572fSBarry Smith #endif
393