Actual source code: viewa.c
1: #define PETSC_DLL
3: #include "src/sys/viewer/viewerimpl.h" /*I "petsc.h" I*/
7: /*@C
8: PetscViewerSetFormat - Sets the format for PetscViewers.
10: Collective on PetscViewer
12: Input Parameters:
13: + viewer - the PetscViewer
14: - format - the format
16: Level: intermediate
18: Notes:
19: Available formats include
20: + PETSC_VIEWER_ASCII_DEFAULT - default format
21: . PETSC_VIEWER_ASCII_MATLAB - Matlab format
22: . PETSC_VIEWER_ASCII_DENSE - print matrix as dense
23: . PETSC_VIEWER_ASCII_IMPL - implementation-specific format
24: (which is in many cases the same as the default)
25: . PETSC_VIEWER_ASCII_INFO - basic information about object
26: . PETSC_VIEWER_ASCII_INFO_DETAIL - more detailed info
27: about object
28: . PETSC_VIEWER_ASCII_COMMON - identical output format for
29: all objects of a particular type
30: . PETSC_VIEWER_ASCII_INDEX - (for vectors) prints the vector
31: element number next to each vector entry
32: . PETSC_VIEWER_ASCII_SYMMODU - print parallel vectors without
33: indicating the processor ranges
34: . PETSC_VIEWER_BINARY_NATIVE - store the object to the binary
35: file in its native format (for example, dense
36: matrices are stored as dense)
37: . PETSC_VIEWER_DRAW_BASIC - views the vector with a simple 1d plot
38: . PETSC_VIEWER_DRAW_LG - views the vector with a line graph
39: - PETSC_VIEWER_DRAW_CONTOUR - views the vector with a contour plot
41: These formats are most often used for viewing matrices and vectors.
43: If a format (for example PETSC_VIEWER_DRAW_CONTOUR) was applied to a viewer
44: where it didn't apply (PETSC_VIEWER_STDOUT_WORLD) it cause the default behavior
45: for that viewer to be used.
46:
47: Concepts: PetscViewer^setting format
49: .seealso: PetscViewerASCIIOpen(), PetscViewerBinaryOpen(), MatView(), VecView(),
50: PetscViewerPushFormat(), PetscViewerPopFormat(), PetscViewerDrawOpen(),PetscViewerSocketOpen()
51: @*/
52: PetscErrorCode PetscViewerSetFormat(PetscViewer viewer,PetscViewerFormat format)
53: {
56: CHKMEMQ;
57: viewer->format = format;
58: CHKMEMQ;
59: return(0);
60: }
64: /*@C
65: PetscViewerPushFormat - Sets the format for file PetscViewers.
67: Collective on PetscViewer
69: Input Parameters:
70: + viewer - the PetscViewer
71: - format - the format
73: Level: intermediate
75: Notes:
76: Available formats include
77: + PETSC_VIEWER_ASCII_DEFAULT - default format
78: . PETSC_VIEWER_ASCII_MATLAB - Matlab format
79: . PETSC_VIEWER_ASCII_IMPL - implementation-specific format
80: (which is in many cases the same as the default)
81: . PETSC_VIEWER_ASCII_INFO - basic information about object
82: . PETSC_VIEWER_ASCII_INFO_DETAIL - more detailed info
83: about object
84: . PETSC_VIEWER_ASCII_COMMON - identical output format for
85: all objects of a particular type
86: . PETSC_VIEWER_ASCII_INDEX - (for vectors) prints the vector
87: element number next to each vector entry
88: . PETSC_VIEWER_BINARY_NATIVE - store the object to the binary
89: file in its native format (for example, dense
90: matrices are stored as dense)
91: . PETSC_VIEWER_DRAW_BASIC - views the vector with a simple 1d plot
92: . PETSC_VIEWER_DRAW_LG - views the vector with a line graph
93: . PETSC_VIEWER_DRAW_CONTOUR - views the vector with a contour plot
94: - PETSC_VIEWER_NATIVE - for DA vectors displays vectors in DA ordering, not natural
96: These formats are most often used for viewing matrices and vectors.
97: Currently, the object name is used only in the Matlab format.
99: Concepts: PetscViewer^setting format
101: .seealso: PetscViewerASCIIOpen(), PetscViewerBinaryOpen(), MatView(), VecView(),
102: PetscViewerSetFormat(), PetscViewerPopFormat()
103: @*/
104: PetscErrorCode PetscViewerPushFormat(PetscViewer viewer,PetscViewerFormat format)
105: {
108: if (viewer->iformat > 9) SETERRQ(PETSC_ERR_ARG_OUTOFRANGE,"Too many pushes");
110: viewer->formats[viewer->iformat++] = viewer->format;
111: viewer->format = format;
113: return(0);
114: }
118: /*@C
119: PetscViewerPopFormat - Resets the format for file PetscViewers.
121: Collective on PetscViewer
123: Input Parameters:
124: . viewer - the PetscViewer
126: Level: intermediate
128: Concepts: PetscViewer^setting format
130: .seealso: PetscViewerASCIIOpen(), PetscViewerBinaryOpen(), MatView(), VecView(),
131: PetscViewerSetFormat(), PetscViewerPushFormat()
132: @*/
133: PetscErrorCode PetscViewerPopFormat(PetscViewer viewer)
134: {
137: if (viewer->iformat <= 0) return(0);
139: viewer->format = viewer->formats[--viewer->iformat];
140: return(0);
141: }
145: PetscErrorCode PetscViewerGetFormat(PetscViewer viewer,PetscViewerFormat *format)
146: {
148: *format = viewer->format;
149: return(0);
150: }