Actual source code: petscviewer.h
1: /*
2: PetscViewers are objects where other objects can be looked at or stored.
3: */
10: #endif
12: /*S
13: PetscViewer - Abstract PETSc object that helps view (in ASCII, binary, graphically etc)
14: other PETSc objects
16: Level: beginner
18: Concepts: viewing
20: .seealso: PetscViewerCreate(), PetscViewerSetType(), PetscViewerType
21: S*/
22: typedef struct _p_PetscViewer* PetscViewer;
25: }
26: #endif
28: #include petscsys.h
32: #endif
37: }
38: #endif
41: /*
42: petscsys.h must be included AFTER the definition of PetscViewer for ADIC to
43: process correctly.
44: */
46: /*J
47: PetscViewerType - String with the name of a PETSc PETScViewer
49: Level: beginner
51: .seealso: PetscViewerSetType(), PetscViewer
52: J*/
53: #define PetscViewerType char*
54: #define PETSCVIEWERSOCKET "socket"
55: #define PETSCVIEWERASCII "ascii"
56: #define PETSCVIEWERBINARY "binary"
57: #define PETSCVIEWERSTRING "string"
58: #define PETSCVIEWERDRAW "draw"
59: #define PETSCVIEWERVU "vu"
60: #define PETSCVIEWERMATHEMATICA "mathematica"
61: #define PETSCVIEWERNETCDF "netcdf"
62: #define PETSCVIEWERHDF5 "hdf5"
63: #define PETSCVIEWERMATLAB "matlab"
64: #define PETSCVIEWERAMS "ams"
73: /*MC
74: PetscViewerRegisterDynamic - Adds a viewer
76: Synopsis:
77: PetscErrorCode PetscViewerRegisterDynamic(const char *name_solver,const char *path,const char *name_create,PetscErrorCode (*routine_create)(PetscViewer))
79: Not Collective
81: Input Parameters:
82: + name_solver - name of a new user-defined viewer
83: . path - path (either absolute or relative) the library containing this viewer
84: . name_create - name of routine to create method context
85: - routine_create - routine to create method context
87: Level: developer
89: Notes:
90: PetscViewerRegisterDynamic() may be called multiple times to add several user-defined viewers.
92: If dynamic libraries are used, then the fourth input argument (routine_create)
93: is ignored.
95: Sample usage:
96: .vb
97: PetscViewerRegisterDynamic("my_viewer_type",/home/username/my_lib/lib/libO/solaris/mylib.a,
98: "MyViewerCreate",MyViewerCreate);
99: .ve
101: Then, your solver can be chosen with the procedural interface via
102: $ PetscViewerSetType(viewer,"my_viewer_type")
103: or at runtime via the option
104: $ -viewer_type my_viewer_type
106: Concepts: registering^Viewers
108: .seealso: PetscViewerRegisterAll(), PetscViewerRegisterDestroy()
109: M*/
110: #if defined(PETSC_USE_DYNAMIC_LIBRARIES)
111: #define PetscViewerRegisterDynamic(a,b,c,d) PetscViewerRegister(a,b,c,0)
112: #else
113: #define PetscViewerRegisterDynamic(a,b,c,d) PetscViewerRegister(a,b,c,d)
114: #endif
117: PetscPolymorphicSubroutine(PetscViewerCreate,(PetscViewer *v),(PETSC_COMM_SELF,v))
128: #if defined(PETSC_HAVE_MPIIO)
132: #endif
156: /*E
157: PetscViewerFormat - Way a viewer presents the object
159: Level: beginner
161: The values below are also listed in finclude/petscviewer.h. If another values is added below it
162: must also be added there.
164: .seealso: PetscViewerSetFormat(), PetscViewer, PetscViewerType, PetscViewerPushFormat(), PetscViewerPopFormat()
165: E*/
166: typedef enum {
167: PETSC_VIEWER_DEFAULT,
168: PETSC_VIEWER_ASCII_MATLAB,
169: PETSC_VIEWER_ASCII_MATHEMATICA,
170: PETSC_VIEWER_ASCII_IMPL,
171: PETSC_VIEWER_ASCII_INFO,
172: PETSC_VIEWER_ASCII_INFO_DETAIL,
173: PETSC_VIEWER_ASCII_COMMON,
174: PETSC_VIEWER_ASCII_SYMMODU,
175: PETSC_VIEWER_ASCII_INDEX,
176: PETSC_VIEWER_ASCII_DENSE,
177: PETSC_VIEWER_ASCII_MATRIXMARKET,
178: PETSC_VIEWER_ASCII_VTK,
179: PETSC_VIEWER_ASCII_VTK_CELL,
180: PETSC_VIEWER_ASCII_VTK_COORDS,
181: PETSC_VIEWER_ASCII_PCICE,
182: PETSC_VIEWER_ASCII_PYTHON,
183: PETSC_VIEWER_ASCII_FACTOR_INFO,
184: PETSC_VIEWER_DRAW_BASIC,
185: PETSC_VIEWER_DRAW_LG,
186: PETSC_VIEWER_DRAW_CONTOUR,
187: PETSC_VIEWER_DRAW_PORTS,
188: PETSC_VIEWER_NATIVE,
189: PETSC_VIEWER_NOFORMAT
190: } PetscViewerFormat;
198: /*
199: Operations explicit to a particular class of viewers
200: */
276: #ifdef PETSC_HAVE_HDF5
277: #include <hdf5.h>
280: #endif
282: /*
283: These are all the default viewers that do not have
284: to be explicitly opened
285: */
296: #define PETSC_VIEWER_STDERR_SELF PETSC_VIEWER_STDERR_(PETSC_COMM_SELF)
297: #define PETSC_VIEWER_STDERR_WORLD PETSC_VIEWER_STDERR_(PETSC_COMM_WORLD)
299: /*MC
300: PETSC_VIEWER_STDOUT_WORLD - same as PETSC_VIEWER_STDOUT_(PETSC_COMM_WORLD)
302: Level: beginner
303: M*/
304: #define PETSC_VIEWER_STDOUT_WORLD PETSC_VIEWER_STDOUT_(PETSC_COMM_WORLD)
306: /*MC
307: PETSC_VIEWER_STDOUT_SELF - same as PETSC_VIEWER_STDOUT_(PETSC_COMM_SELF)
309: Level: beginner
310: M*/
311: #define PETSC_VIEWER_STDOUT_SELF PETSC_VIEWER_STDOUT_(PETSC_COMM_SELF)
313: /*MC
314: PETSC_VIEWER_DRAW_WORLD - same as PETSC_VIEWER_DRAW_(PETSC_COMM_WORLD)
316: Level: intermediate
317: M*/
318: #define PETSC_VIEWER_DRAW_WORLD PETSC_VIEWER_DRAW_(PETSC_COMM_WORLD)
320: /*MC
321: PETSC_VIEWER_DRAW_SELF - same as PETSC_VIEWER_DRAW_(PETSC_COMM_SELF)
323: Level: intermediate
324: M*/
325: #define PETSC_VIEWER_DRAW_SELF PETSC_VIEWER_DRAW_(PETSC_COMM_SELF)
327: /*MC
328: PETSC_VIEWER_SOCKET_WORLD - same as PETSC_VIEWER_SOCKET_(PETSC_COMM_WORLD)
330: Level: intermediate
331: M*/
332: #define PETSC_VIEWER_SOCKET_WORLD PETSC_VIEWER_SOCKET_(PETSC_COMM_WORLD)
334: /*MC
335: PETSC_VIEWER_SOCKET_SELF - same as PETSC_VIEWER_SOCKET_(PETSC_COMM_SELF)
337: Level: intermediate
338: M*/
339: #define PETSC_VIEWER_SOCKET_SELF PETSC_VIEWER_SOCKET_(PETSC_COMM_SELF)
341: /*MC
342: PETSC_VIEWER_BINARY_WORLD - same as PETSC_VIEWER_BINARY_(PETSC_COMM_WORLD)
344: Level: intermediate
345: M*/
346: #define PETSC_VIEWER_BINARY_WORLD PETSC_VIEWER_BINARY_(PETSC_COMM_WORLD)
348: /*MC
349: PETSC_VIEWER_BINARY_SELF - same as PETSC_VIEWER_BINARY_(PETSC_COMM_SELF)
351: Level: intermediate
352: M*/
353: #define PETSC_VIEWER_BINARY_SELF PETSC_VIEWER_BINARY_(PETSC_COMM_SELF)
355: /*MC
356: PETSC_VIEWER_MATLAB_WORLD - same as PETSC_VIEWER_MATLAB_(PETSC_COMM_WORLD)
358: Level: intermediate
359: M*/
360: #define PETSC_VIEWER_MATLAB_WORLD PETSC_VIEWER_MATLAB_(PETSC_COMM_WORLD)
362: /*MC
363: PETSC_VIEWER_MATLAB_SELF - same as PETSC_VIEWER_MATLAB_(PETSC_COMM_SELF)
365: Level: intermediate
366: M*/
367: #define PETSC_VIEWER_MATLAB_SELF PETSC_VIEWER_MATLAB_(PETSC_COMM_SELF)
369: #define PETSC_VIEWER_MATHEMATICA_WORLD (PetscViewerInitializeMathematicaWorld_Private(),PETSC_VIEWER_MATHEMATICA_WORLD_PRIVATE)
371: #define PetscViewerFlowControlStart(viewer,mcnt,cnt) (PetscViewerBinaryGetFlowControl(viewer,mcnt) || PetscViewerBinaryGetFlowControl(viewer,cnt))
372: #define PetscViewerFlowControlStepMaster(viewer,i,mcnt,cnt) ((i >= mcnt) ? (mcnt += cnt,MPI_Bcast(&mcnt,1,MPIU_INT,0,((PetscObject)viewer)->comm)) : 0)
373: #define PetscViewerFlowControlEndMaster(viewer,mcnt) (mcnt = 0,MPI_Bcast(&mcnt,1,MPIU_INT,0,((PetscObject)viewer)->comm))
374: #define PetscViewerFlowControlStepWorker(viewer,rank,mcnt) 0; while (1) { PetscErrorCode _ierr; \
375: if (rank < mcnt) break; \
376: _MPI_Bcast(&mcnt,1,MPIU_INT,0,((PetscObject)viewer)->comm);CHKERRQ(_ierr);\
377: }
378: #define PetscViewerFlowControlEndWorker(viewer,mcnt) 0; while (1) { PetscErrorCode _ierr; \
379: _MPI_Bcast(&mcnt,1,MPIU_INT,0,((PetscObject)viewer)->comm);CHKERRQ(_ierr);\
380: if (mcnt == 0) break; \
381: }
383: /*
384: petscViewer writes to MATLAB .mat file
385: */
390: /*S
391: PetscViewers - Abstract collection of PetscViewers. It is just an expandable array of viewers.
393: Level: intermediate
395: Concepts: viewing
397: .seealso: PetscViewerCreate(), PetscViewerSetType(), PetscViewerType, PetscViewer, PetscViewersCreate(),
398: PetscViewersGetViewer()
399: S*/
400: typedef struct _n_PetscViewers* PetscViewers;
405: #if defined(PETSC_HAVE_AMS)
406: #include <ams.h>
413: #define PETSC_VIEWER_AMS_WORLD PETSC_VIEWER_AMS_(PETSC_COMM_WORLD)
414: #endif
418: #endif