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: #undef __FUNCT__  
  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_BINARY_NATIVE - store the object to the binary
 33:       file in its native format (for example, dense
 34:        matrices are stored as dense)
 35: .    PETSC_VIEWER_DRAW_BASIC - views the vector with a simple 1d plot
 36: .    PETSC_VIEWER_DRAW_LG - views the vector with a line graph
 37: -    PETSC_VIEWER_DRAW_CONTOUR - views the vector with a contour plot

 39:    These formats are most often used for viewing matrices and vectors.
 40:    Currently, the object name is used only in the Matlab format.

 42:    Concepts: PetscViewer^setting format

 44: .seealso: PetscViewerASCIIOpen(), PetscViewerBinaryOpen(), MatView(), VecView(),
 45:           PetscViewerPushFormat(), PetscViewerPopFormat(), PetscViewerDrawOpenX(),PetscViewerSocketOpen()
 46: @*/
 47: int PetscViewerSetFormat(PetscViewer viewer,PetscViewerFormat format)
 48: {
 51:   viewer->format     = format;
 52:   return(0);
 53: }

 55: #undef __FUNCT__  
 57: /*@C
 58:    PetscViewerPushFormat - Sets the format for file PetscViewers.

 60:    Collective on PetscViewer

 62:    Input Parameters:
 63: +  viewer - the PetscViewer
 64: -  format - the format

 66:    Level: intermediate

 68:    Notes:
 69:    Available formats include
 70: +    PETSC_VIEWER_ASCII_DEFAULT - default format
 71: .    PETSC_VIEWER_ASCII_MATLAB - Matlab format
 72: .    PETSC_VIEWER_ASCII_IMPL - implementation-specific format
 73:       (which is in many cases the same as the default)
 74: .    PETSC_VIEWER_ASCII_INFO - basic information about object
 75: .    PETSC_VIEWER_ASCII_INFO_DETAIL - more detailed info
 76:        about object
 77: .    PETSC_VIEWER_ASCII_COMMON - identical output format for
 78:        all objects of a particular type
 79: .    PETSC_VIEWER_ASCII_INDEX - (for vectors) prints the vector
 80:        element number next to each vector entry
 81: .    PETSC_VIEWER_BINARY_NATIVE - store the object to the binary
 82:       file in its native format (for example, dense
 83:        matrices are stored as dense)
 84: .    PETSC_VIEWER_DRAW_BASIC - views the vector with a simple 1d plot
 85: .    PETSC_VIEWER_DRAW_LG - views the vector with a line graph
 86: .    PETSC_VIEWER_DRAW_CONTOUR - views the vector with a contour plot
 87: -    PETSC_VIEWER_NATIVE - for DA vectors displays vectors in DA ordering, not natural

 89:    These formats are most often used for viewing matrices and vectors.
 90:    Currently, the object name is used only in the Matlab format.

 92:    Concepts: PetscViewer^setting format

 94: .seealso: PetscViewerASCIIOpen(), PetscViewerBinaryOpen(), MatView(), VecView(),
 95:           PetscViewerSetFormat(), PetscViewerPopFormat()
 96: @*/
 97: int PetscViewerPushFormat(PetscViewer viewer,PetscViewerFormat format)
 98: {
101:   if (viewer->iformat > 9) SETERRQ(PETSC_ERR_ARG_OUTOFRANGE,"Too many pushes");

103:   viewer->formats[viewer->iformat++]  = viewer->format;
104:   viewer->format                      = format;

106:   return(0);
107: }

109: #undef __FUNCT__  
111: /*@C
112:    PetscViewerPopFormat - Resets the format for file PetscViewers.

114:    Collective on PetscViewer

116:    Input Parameters:
117: .  viewer - the PetscViewer

119:    Level: intermediate

121:    Concepts: PetscViewer^setting format

123: .seealso: PetscViewerASCIIOpen(), PetscViewerBinaryOpen(), MatView(), VecView(),
124:           PetscViewerSetFormat(), PetscViewerPushFormat()
125: @*/
126: int PetscViewerPopFormat(PetscViewer viewer)
127: {
130:   if (viewer->iformat <= 0) return(0);

132:   viewer->format = viewer->formats[--viewer->iformat];
133:   return(0);
134: }

136: #undef __FUNCT__  
138: int PetscViewerGetFormat(PetscViewer viewer,PetscViewerFormat *format)
139: {
141:   *format =  viewer->format;
142:   return(0);
143: }