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
14: Level: intermediate
16: Notes:
17: Available formats include
18: + PETSC_VIEWER_ASCII_DEFAULT - default format
19: . PETSC_VIEWER_ASCII_MATLAB - Matlab format
20: . PETSC_VIEWER_ASCII_DENSE - print matrix as dense
21: . PETSC_VIEWER_ASCII_IMPL - implementation-specific format
22: (which is in many cases the same as the default)
23: . PETSC_VIEWER_ASCII_INFO - basic information about object
24: . PETSC_VIEWER_ASCII_INFO_LONG - more detailed info
25: about object
26: . PETSC_VIEWER_ASCII_COMMON - identical output format for
27: all objects of a particular type
28: . PETSC_VIEWER_ASCII_INDEX - (for vectors) prints the vector
29: element number next to each vector entry
30: . PETSC_VIEWER_BINARY_NATIVE - store the object to the binary
31: file in its native format (for example, dense
32: matrices are stored as dense)
33: . PETSC_VIEWER_DRAW_BASIC - views the vector with a simple 1d plot
34: . PETSC_VIEWER_DRAW_LG - views the vector with a line graph
35: - PETSC_VIEWER_DRAW_CONTOUR - views the vector with a contour plot
37: These formats are most often used for viewing matrices and vectors.
38: Currently, the object name is used only in the Matlab format.
40: Concepts: PetscViewer^setting format
42: .seealso: PetscViewerASCIIOpen(), PetscViewerBinaryOpen(), MatView(), VecView(),
43: PetscViewerPushFormat(), PetscViewerPopFormat(), PetscViewerDrawOpenX(),PetscViewerSocketOpen()
44: @*/
45: int PetscViewerSetFormat(PetscViewer viewer,PetscViewerFormat format)
46: {
49: viewer->format = format;
50: return(0);
51: }
53: /*@C
54: PetscViewerPushFormat - Sets the format for file PetscViewers.
56: Collective on PetscViewer
58: Input Parameters:
59: + viewer - the PetscViewer
60: - format - the format
62: Level: intermediate
64: Notes:
65: Available formats include
66: + PETSC_VIEWER_ASCII_DEFAULT - default format
67: . PETSC_VIEWER_ASCII_MATLAB - Matlab format
68: . PETSC_VIEWER_ASCII_IMPL - implementation-specific format
69: (which is in many cases the same as the default)
70: . PETSC_VIEWER_ASCII_INFO - basic information about object
71: . PETSC_VIEWER_ASCII_INFO_LONG - more detailed info
72: about object
73: . PETSC_VIEWER_ASCII_COMMON - identical output format for
74: all objects of a particular type
75: . PETSC_VIEWER_ASCII_INDEX - (for vectors) prints the vector
76: element number next to each vector entry
77: . PETSC_VIEWER_BINARY_NATIVE - store the object to the binary
78: file in its native format (for example, dense
79: matrices are stored as dense)
80: . PETSC_VIEWER_DRAW_BASIC - views the vector with a simple 1d plot
81: . PETSC_VIEWER_DRAW_LG - views the vector with a line graph
82: . PETSC_VIEWER_DRAW_CONTOUR - views the vector with a contour plot
83: - PETSC_VIEWER_NATIVE - for DA vectors displays vectors in DA ordering, not natural
85: These formats are most often used for viewing matrices and vectors.
86: Currently, the object name is used only in the Matlab format.
88: Concepts: PetscViewer^setting format
90: .seealso: PetscViewerASCIIOpen(), PetscViewerBinaryOpen(), MatView(), VecView(),
91: PetscViewerSetFormat(), PetscViewerPopFormat()
92: @*/
93: int PetscViewerPushFormat(PetscViewer viewer,PetscViewerFormat format)
94: {
97: if (viewer->iformat > 9) SETERRQ(PETSC_ERR_ARG_OUTOFRANGE,"Too many pushes");
99: viewer->formats[viewer->iformat++] = viewer->format;
100: viewer->format = format;
102: return(0);
103: }
105: /*@C
106: PetscViewerPopFormat - Resets the format for file PetscViewers.
108: Collective on PetscViewer
110: Input Parameters:
111: . viewer - the PetscViewer
113: Level: intermediate
115: Concepts: PetscViewer^setting format
117: .seealso: PetscViewerASCIIOpen(), PetscViewerBinaryOpen(), MatView(), VecView(),
118: PetscViewerSetFormat(), PetscViewerPushFormat()
119: @*/
120: int PetscViewerPopFormat(PetscViewer viewer)
121: {
124: if (viewer->iformat <= 0) return(0);
126: viewer->format = viewer->formats[--viewer->iformat];
127: return(0);
128: }
130: int PetscViewerGetFormat(PetscViewer viewer,PetscViewerFormat *format)
131: {
133: *format = viewer->format;
134: return(0);
135: }