Actual source code: viewa.c
petsc-3.5.4 2015-05-23
2: #include <petsc-private/viewerimpl.h> /*I "petscsys.h" I*/
4: const char *const PetscViewerFormats[] = {
5: "DEFAULT",
6: "ASCII_MATLAB",
7: "ASCII_MATHEMATICA",
8: "ASCII_IMPL",
9: "ASCII_INFO",
10: "ASCII_INFO_DETAIL",
11: "ASCII_COMMON",
12: "ASCII_SYMMODU",
13: "ASCII_INDEX",
14: "ASCII_DENSE",
15: "ASCII_MATRIXMARKET",
16: "ASCII_VTK",
17: "ASCII_VTK_CELL",
18: "ASCII_VTK_COORDS",
19: "ASCII_PCICE",
20: "ASCII_PYTHON",
21: "ASCII_FACTOR_INFO",
22: "ASCII_LATEX",
23: "DRAW_BASIC",
24: "DRAW_LG",
25: "DRAW_CONTOUR",
26: "DRAW_PORTS",
27: "VTK_VTS",
28: "VTK_VTR",
29: "VTK_VTU",
30: "BINARY_MATLAB",
31: "NATIVE",
32: "HDF5_VIZ",
33: "NOFORMAT",
34: "PetscViewerFormat",
35: "PETSC_VIEWER_",
36: 0
37: };
41: /*@C
42: PetscViewerSetFormat - Sets the format for PetscViewers.
44: Logically Collective on PetscViewer
46: Input Parameters:
47: + viewer - the PetscViewer
48: - format - the format
50: Level: intermediate
52: Notes:
53: Available formats include
54: + PETSC_VIEWER_DEFAULT - default format
55: . PETSC_VIEWER_ASCII_MATLAB - MATLAB format
56: . PETSC_VIEWER_ASCII_DENSE - print matrix as dense
57: . PETSC_VIEWER_ASCII_IMPL - implementation-specific format
58: (which is in many cases the same as the default)
59: . PETSC_VIEWER_ASCII_INFO - basic information about object
60: . PETSC_VIEWER_ASCII_INFO_DETAIL - more detailed info
61: about object
62: . PETSC_VIEWER_ASCII_COMMON - identical output format for
63: all objects of a particular type
64: . PETSC_VIEWER_ASCII_INDEX - (for vectors) prints the vector
65: element number next to each vector entry
66: . PETSC_VIEWER_ASCII_SYMMODU - print parallel vectors without
67: indicating the processor ranges
68: . PETSC_VIEWER_ASCII_VTK - outputs the object to a VTK file
69: . PETSC_VIEWER_NATIVE - store the object to the binary
70: file in its native format (for example, dense
71: matrices are stored as dense), DMDA vectors are dumped directly to the
72: file instead of being first put in the natural ordering
73: . PETSC_VIEWER_DRAW_BASIC - views the vector with a simple 1d plot
74: . PETSC_VIEWER_DRAW_LG - views the vector with a line graph
75: - PETSC_VIEWER_DRAW_CONTOUR - views the vector with a contour plot
77: These formats are most often used for viewing matrices and vectors.
79: If a format (for example PETSC_VIEWER_DRAW_CONTOUR) was applied to a viewer
80: where it didn't apply (PETSC_VIEWER_STDOUT_WORLD) it cause the default behavior
81: for that viewer to be used.
83: Concepts: PetscViewer^setting format
85: .seealso: PetscViewerASCIIOpen(), PetscViewerBinaryOpen(), MatView(), VecView(), PetscViewerType,
86: PetscViewerPushFormat(), PetscViewerPopFormat(), PetscViewerDrawOpen(),PetscViewerSocketOpen()
87: @*/
88: PetscErrorCode PetscViewerSetFormat(PetscViewer viewer,PetscViewerFormat format)
89: {
91: if (!viewer) viewer = PETSC_VIEWER_STDOUT_SELF;
94: viewer->format = format;
95: return(0);
96: }
100: /*@C
101: PetscViewerPushFormat - Sets the format for file PetscViewers.
103: Logically Collective on PetscViewer
105: Input Parameters:
106: + viewer - the PetscViewer
107: - format - the format
109: Level: intermediate
111: Notes:
112: Available formats include
113: + PETSC_VIEWER_DEFAULT - default format
114: . PETSC_VIEWER_ASCII_MATLAB - MATLAB format
115: . PETSC_VIEWER_ASCII_IMPL - implementation-specific format
116: (which is in many cases the same as the default)
117: . PETSC_VIEWER_ASCII_INFO - basic information about object
118: . PETSC_VIEWER_ASCII_INFO_DETAIL - more detailed info
119: about object
120: . PETSC_VIEWER_ASCII_COMMON - identical output format for
121: all objects of a particular type
122: . PETSC_VIEWER_ASCII_INDEX - (for vectors) prints the vector
123: element number next to each vector entry
124: . PETSC_VIEWER_NATIVE - store the object to the binary
125: file in its native format (for example, dense
126: matrices are stored as dense), for DMDA vectors displays vectors in DMDA ordering, not natural
127: . PETSC_VIEWER_DRAW_BASIC - views the vector with a simple 1d plot
128: . PETSC_VIEWER_DRAW_LG - views the vector with a line graph
129: - PETSC_VIEWER_DRAW_CONTOUR - views the vector with a contour plot
131: These formats are most often used for viewing matrices and vectors.
132: Currently, the object name is used only in the MATLAB format.
134: Concepts: PetscViewer^setting format
136: .seealso: PetscViewerASCIIOpen(), PetscViewerBinaryOpen(), MatView(), VecView(),
137: PetscViewerSetFormat(), PetscViewerPopFormat()
138: @*/
139: PetscErrorCode PetscViewerPushFormat(PetscViewer viewer,PetscViewerFormat format)
140: {
144: if (viewer->iformat > 9) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"Too many pushes");
146: viewer->formats[viewer->iformat++] = viewer->format;
147: viewer->format = format;
148: return(0);
149: }
153: /*@C
154: PetscViewerPopFormat - Resets the format for file PetscViewers.
156: Logically Collective on PetscViewer
158: Input Parameters:
159: . viewer - the PetscViewer
161: Level: intermediate
163: Concepts: PetscViewer^setting format
165: .seealso: PetscViewerASCIIOpen(), PetscViewerBinaryOpen(), MatView(), VecView(),
166: PetscViewerSetFormat(), PetscViewerPushFormat()
167: @*/
168: PetscErrorCode PetscViewerPopFormat(PetscViewer viewer)
169: {
172: if (viewer->iformat <= 0) return(0);
174: viewer->format = viewer->formats[--viewer->iformat];
175: return(0);
176: }
180: PetscErrorCode PetscViewerGetFormat(PetscViewer viewer,PetscViewerFormat *format)
181: {
183: *format = viewer->format;
184: return(0);
185: }