Actual source code: viewa.c
1: /*$Id: viewa.c,v 1.23 2001/04/10 19:34:10 bsmith Exp $*/
3: #include "src/sys/src/viewer/viewerimpl.h" /*I "petsc.h" I*/
5: /*@C
6: PetscViewerSetFormat - Sets the format for PetscViewers.
8: Collective on PetscViewer
10: Input Parameters:
11: + viewer - the PetscViewer
12: . format - the format
13: - char - optional object name
15: Level: intermediate
17: Notes:
18: Available formats include
19: + PETSC_VIEWER_ASCII_DEFAULT - default format
20: . PETSC_VIEWER_ASCII_MATLAB - Matlab format
21: . PETSC_VIEWER_ASCII_DENSE - print matrix as dense
22: . PETSC_VIEWER_ASCII_IMPL - implementation-specific format
23: (which is in many cases the same as the default)
24: . PETSC_VIEWER_ASCII_INFO - basic information about object
25: . PETSC_VIEWER_ASCII_INFO_LONG - more detailed info
26: about object
27: . PETSC_VIEWER_ASCII_COMMON - identical output format for
28: all objects of a particular type
29: . PETSC_VIEWER_ASCII_INDEX - (for vectors) prints the vector
30: element number next to each vector entry
31: . PETSC_VIEWER_BINARY_NATIVE - store the object to the binary
32: file in its native format (for example, dense
33: matrices are stored as dense)
34: . PETSC_VIEWER_DRAW_BASIC - views the vector with a simple 1d plot
35: . PETSC_VIEWER_DRAW_LG - views the vector with a line graph
36: - PETSC_VIEWER_DRAW_CONTOUR - views the vector with a contour plot
38: These formats are most often used for viewing matrices and vectors.
39: Currently, the object name is used only in the Matlab format.
41: Concepts: PetscViewer^setting format
43: .seealso: PetscViewerASCIIOpen(), PetscViewerBinaryOpen(), MatView(), VecView(),
44: PetscViewerPushFormat(), PetscViewerPopFormat(), PetscViewerDrawOpenX(),PetscViewerSocketOpen()
45: @*/
46: int PetscViewerSetFormat(PetscViewer viewer,PetscViewerFormat format)
47: {
50: viewer->format = format;
51: return(0);
52: }
54: /*@C
55: PetscViewerPushFormat - Sets the format for file PetscViewers.
57: Collective on PetscViewer
59: Input Parameters:
60: + viewer - the PetscViewer
61: . format - the format
62: - char - optional object name
64: Level: intermediate
66: Notes:
67: Available formats include
68: + PETSC_VIEWER_ASCII_DEFAULT - default format
69: . PETSC_VIEWER_ASCII_MATLAB - Matlab format
70: . PETSC_VIEWER_ASCII_IMPL - implementation-specific format
71: (which is in many cases the same as the default)
72: . PETSC_VIEWER_ASCII_INFO - basic information about object
73: . PETSC_VIEWER_ASCII_INFO_LONG - more detailed info
74: about object
75: . PETSC_VIEWER_ASCII_COMMON - identical output format for
76: all objects of a particular type
77: . PETSC_VIEWER_ASCII_INDEX - (for vectors) prints the vector
78: element number next to each vector entry
79: . PETSC_VIEWER_BINARY_NATIVE - store the object to the binary
80: file in its native format (for example, dense
81: matrices are stored as dense)
82: . PETSC_VIEWER_DRAW_BASIC - views the vector with a simple 1d plot
83: . PETSC_VIEWER_DRAW_LG - views the vector with a line graph
84: . PETSC_VIEWER_DRAW_CONTOUR - views the vector with a contour plot
85: - PETSC_VIEWER_NATIVE - for DA vectors displays vectors in DA ordering, not natural
87: These formats are most often used for viewing matrices and vectors.
88: Currently, the object name is used only in the Matlab format.
90: Concepts: PetscViewer^setting format
92: .seealso: PetscViewerASCIIOpen(), PetscViewerBinaryOpen(), MatView(), VecView(),
93: PetscViewerSetFormat(), PetscViewerPopFormat()
94: @*/
95: int PetscViewerPushFormat(PetscViewer viewer,PetscViewerFormat format)
96: {
99: if (viewer->iformat > 9) SETERRQ(PETSC_ERR_ARG_OUTOFRANGE,"Too many pushes");
101: viewer->formats[viewer->iformat++] = viewer->format;
102: viewer->format = format;
104: return(0);
105: }
107: /*@C
108: PetscViewerPopFormat - Resets the format for file PetscViewers.
110: Collective on PetscViewer
112: Input Parameters:
113: . viewer - the PetscViewer
115: Level: intermediate
117: Concepts: PetscViewer^setting format
119: .seealso: PetscViewerASCIIOpen(), PetscViewerBinaryOpen(), MatView(), VecView(),
120: PetscViewerSetFormat(), PetscViewerPushFormat()
121: @*/
122: int PetscViewerPopFormat(PetscViewer viewer)
123: {
126: if (viewer->iformat <= 0) return(0);
128: viewer->format = viewer->formats[--viewer->iformat];
129: return(0);
130: }
132: int PetscViewerGetFormat(PetscViewer viewer,PetscViewerFormat *format)
133: {
135: *format = viewer->format;
136: return(0);
137: }