1 2 #include <petsc-private/viewerimpl.h> /*I "petscsys.h" I*/ 3 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 "NOFORMAT", 33 "PetscViewerFormat", 34 "PETSC_VIEWER_", 35 0 36 }; 37 38 #undef __FUNCT__ 39 #define __FUNCT__ "PetscViewerSetFormat" 40 /*@C 41 PetscViewerSetFormat - Sets the format for PetscViewers. 42 43 Logically Collective on PetscViewer 44 45 Input Parameters: 46 + viewer - the PetscViewer 47 - format - the format 48 49 Level: intermediate 50 51 Notes: 52 Available formats include 53 + PETSC_VIEWER_DEFAULT - default format 54 . PETSC_VIEWER_ASCII_MATLAB - MATLAB format 55 . PETSC_VIEWER_ASCII_DENSE - print matrix as dense 56 . PETSC_VIEWER_ASCII_IMPL - implementation-specific format 57 (which is in many cases the same as the default) 58 . PETSC_VIEWER_ASCII_INFO - basic information about object 59 . PETSC_VIEWER_ASCII_INFO_DETAIL - more detailed info 60 about object 61 . PETSC_VIEWER_ASCII_COMMON - identical output format for 62 all objects of a particular type 63 . PETSC_VIEWER_ASCII_INDEX - (for vectors) prints the vector 64 element number next to each vector entry 65 . PETSC_VIEWER_ASCII_SYMMODU - print parallel vectors without 66 indicating the processor ranges 67 . PETSC_VIEWER_ASCII_VTK - outputs the object to a VTK file 68 . PETSC_VIEWER_NATIVE - store the object to the binary 69 file in its native format (for example, dense 70 matrices are stored as dense), DMDA vectors are dumped directly to the 71 file instead of being first put in the natural ordering 72 . PETSC_VIEWER_DRAW_BASIC - views the vector with a simple 1d plot 73 . PETSC_VIEWER_DRAW_LG - views the vector with a line graph 74 - PETSC_VIEWER_DRAW_CONTOUR - views the vector with a contour plot 75 76 These formats are most often used for viewing matrices and vectors. 77 78 If a format (for example PETSC_VIEWER_DRAW_CONTOUR) was applied to a viewer 79 where it didn't apply (PETSC_VIEWER_STDOUT_WORLD) it cause the default behavior 80 for that viewer to be used. 81 82 Concepts: PetscViewer^setting format 83 84 .seealso: PetscViewerASCIIOpen(), PetscViewerBinaryOpen(), MatView(), VecView(), PetscViewerType, 85 PetscViewerPushFormat(), PetscViewerPopFormat(), PetscViewerDrawOpen(),PetscViewerSocketOpen() 86 @*/ 87 PetscErrorCode PetscViewerSetFormat(PetscViewer viewer,PetscViewerFormat format) 88 { 89 PetscFunctionBegin; 90 if (!viewer) viewer = PETSC_VIEWER_STDOUT_SELF; 91 PetscValidHeaderSpecific(viewer,PETSC_VIEWER_CLASSID,1); 92 PetscValidLogicalCollectiveEnum(viewer,format,2); 93 viewer->format = format; 94 PetscFunctionReturn(0); 95 } 96 97 #undef __FUNCT__ 98 #define __FUNCT__ "PetscViewerPushFormat" 99 /*@C 100 PetscViewerPushFormat - Sets the format for file PetscViewers. 101 102 Logically Collective on PetscViewer 103 104 Input Parameters: 105 + viewer - the PetscViewer 106 - format - the format 107 108 Level: intermediate 109 110 Notes: 111 Available formats include 112 + PETSC_VIEWER_DEFAULT - default format 113 . PETSC_VIEWER_ASCII_MATLAB - MATLAB format 114 . PETSC_VIEWER_ASCII_IMPL - implementation-specific format 115 (which is in many cases the same as the default) 116 . PETSC_VIEWER_ASCII_INFO - basic information about object 117 . PETSC_VIEWER_ASCII_INFO_DETAIL - more detailed info 118 about object 119 . PETSC_VIEWER_ASCII_COMMON - identical output format for 120 all objects of a particular type 121 . PETSC_VIEWER_ASCII_INDEX - (for vectors) prints the vector 122 element number next to each vector entry 123 . PETSC_VIEWER_NATIVE - store the object to the binary 124 file in its native format (for example, dense 125 matrices are stored as dense), for DMDA vectors displays vectors in DMDA ordering, not natural 126 . PETSC_VIEWER_DRAW_BASIC - views the vector with a simple 1d plot 127 . PETSC_VIEWER_DRAW_LG - views the vector with a line graph 128 - PETSC_VIEWER_DRAW_CONTOUR - views the vector with a contour plot 129 130 These formats are most often used for viewing matrices and vectors. 131 Currently, the object name is used only in the MATLAB format. 132 133 Concepts: PetscViewer^setting format 134 135 .seealso: PetscViewerASCIIOpen(), PetscViewerBinaryOpen(), MatView(), VecView(), 136 PetscViewerSetFormat(), PetscViewerPopFormat() 137 @*/ 138 PetscErrorCode PetscViewerPushFormat(PetscViewer viewer,PetscViewerFormat format) 139 { 140 PetscFunctionBegin; 141 PetscValidHeaderSpecific(viewer,PETSC_VIEWER_CLASSID,1); 142 PetscValidLogicalCollectiveEnum(viewer,format,2); 143 if (viewer->iformat > 9) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"Too many pushes"); 144 145 viewer->formats[viewer->iformat++] = viewer->format; 146 viewer->format = format; 147 PetscFunctionReturn(0); 148 } 149 150 #undef __FUNCT__ 151 #define __FUNCT__ "PetscViewerPopFormat" 152 /*@C 153 PetscViewerPopFormat - Resets the format for file PetscViewers. 154 155 Logically Collective on PetscViewer 156 157 Input Parameters: 158 . viewer - the PetscViewer 159 160 Level: intermediate 161 162 Concepts: PetscViewer^setting format 163 164 .seealso: PetscViewerASCIIOpen(), PetscViewerBinaryOpen(), MatView(), VecView(), 165 PetscViewerSetFormat(), PetscViewerPushFormat() 166 @*/ 167 PetscErrorCode PetscViewerPopFormat(PetscViewer viewer) 168 { 169 PetscFunctionBegin; 170 PetscValidHeaderSpecific(viewer,PETSC_VIEWER_CLASSID,1); 171 if (viewer->iformat <= 0) PetscFunctionReturn(0); 172 173 viewer->format = viewer->formats[--viewer->iformat]; 174 PetscFunctionReturn(0); 175 } 176 177 #undef __FUNCT__ 178 #define __FUNCT__ "PetscViewerGetFormat" 179 PetscErrorCode PetscViewerGetFormat(PetscViewer viewer,PetscViewerFormat *format) 180 { 181 PetscFunctionBegin; 182 *format = viewer->format; 183 PetscFunctionReturn(0); 184 } 185 186 187 188