1 /* 2 PetscViewers are objects where other objects can be looked at or stored. 3 */ 4 5 #if !defined(__PETSCVIEWER_H) 6 #define __PETSCVIEWER_H 7 8 #if defined(PETSC_USE_EXTERN_CXX) && defined(__cplusplus) 9 extern "C" { 10 #endif 11 12 /*S 13 PetscViewer - Abstract PETSc object that helps view (in ASCII, binary, graphically etc) 14 other PETSc objects 15 16 Level: beginner 17 18 Concepts: viewing 19 20 .seealso: PetscViewerCreate(), PetscViewerSetType(), PetscViewerType 21 S*/ 22 typedef struct _p_PetscViewer* PetscViewer; 23 24 #if defined(PETSC_USE_EXTERN_CXX) && defined(__cplusplus) 25 } 26 #endif 27 28 #include "petscsys.h" 29 30 #if defined(PETSC_USE_EXTERN_CXX) && defined(__cplusplus) 31 extern "C" { 32 #endif 33 34 extern PetscClassId PETSC_VIEWER_CLASSID; 35 36 #if defined(PETSC_USE_EXTERN_CXX) && defined(__cplusplus) 37 } 38 #endif 39 40 41 /* 42 petscsys.h must be included AFTER the definition of PetscViewer for ADIC to 43 process correctly. 44 */ 45 PETSC_EXTERN_CXX_BEGIN 46 /*J 47 PetscViewerType - String with the name of a PETSc PETScViewer 48 49 Level: beginner 50 51 .seealso: PetscViewerSetType(), PetscViewer 52 J*/ 53 #define PetscViewerType char* 54 #define PETSCVIEWERSOCKET "socket" 55 #define PETSCVIEWERASCII "ascii" 56 #define PETSCVIEWERBINARY "binary" 57 #define PETSCVIEWERSTRING "string" 58 #define PETSCVIEWERDRAW "draw" 59 #define PETSCVIEWERVU "vu" 60 #define PETSCVIEWERMATHEMATICA "mathematica" 61 #define PETSCVIEWERNETCDF "netcdf" 62 #define PETSCVIEWERHDF5 "hdf5" 63 #define PETSCVIEWERVTK "vtk" 64 #define PETSCVIEWERMATLAB "matlab" 65 #define PETSCVIEWERAMS "ams" 66 67 extern PetscFList PetscViewerList; 68 extern PetscErrorCode PetscViewerRegisterAll(const char *); 69 extern PetscErrorCode PetscViewerRegisterDestroy(void); 70 extern PetscErrorCode PetscViewerInitializePackage(const char[]); 71 72 extern PetscErrorCode PetscViewerRegister(const char*,const char*,const char*,PetscErrorCode (*)(PetscViewer)); 73 74 /*MC 75 PetscViewerRegisterDynamic - Adds a viewer 76 77 Synopsis: 78 PetscErrorCode PetscViewerRegisterDynamic(const char *name_solver,const char *path,const char *name_create,PetscErrorCode (*routine_create)(PetscViewer)) 79 80 Not Collective 81 82 Input Parameters: 83 + name_solver - name of a new user-defined viewer 84 . path - path (either absolute or relative) the library containing this viewer 85 . name_create - name of routine to create method context 86 - routine_create - routine to create method context 87 88 Level: developer 89 90 Notes: 91 PetscViewerRegisterDynamic() may be called multiple times to add several user-defined viewers. 92 93 If dynamic libraries are used, then the fourth input argument (routine_create) 94 is ignored. 95 96 Sample usage: 97 .vb 98 PetscViewerRegisterDynamic("my_viewer_type",/home/username/my_lib/lib/libO/solaris/mylib.a, 99 "MyViewerCreate",MyViewerCreate); 100 .ve 101 102 Then, your solver can be chosen with the procedural interface via 103 $ PetscViewerSetType(viewer,"my_viewer_type") 104 or at runtime via the option 105 $ -viewer_type my_viewer_type 106 107 Concepts: registering^Viewers 108 109 .seealso: PetscViewerRegisterAll(), PetscViewerRegisterDestroy() 110 M*/ 111 #if defined(PETSC_USE_DYNAMIC_LIBRARIES) 112 #define PetscViewerRegisterDynamic(a,b,c,d) PetscViewerRegister(a,b,c,0) 113 #else 114 #define PetscViewerRegisterDynamic(a,b,c,d) PetscViewerRegister(a,b,c,d) 115 #endif 116 117 extern PetscErrorCode PetscViewerCreate(MPI_Comm,PetscViewer*); 118 PetscPolymorphicSubroutine(PetscViewerCreate,(PetscViewer *v),(PETSC_COMM_SELF,v)) 119 extern PetscErrorCode PetscViewerSetFromOptions(PetscViewer); 120 extern PetscErrorCode PetscViewerASCIIOpenWithFILE(MPI_Comm,FILE*,PetscViewer*); 121 122 extern PetscErrorCode PetscViewerASCIIOpen(MPI_Comm,const char[],PetscViewer*); 123 extern PetscErrorCode PetscViewerASCIISetFILE(PetscViewer,FILE*); 124 extern PetscErrorCode PetscViewerBinaryOpen(MPI_Comm,const char[],PetscFileMode,PetscViewer*); 125 extern PetscErrorCode PetscViewerBinaryGetFlowControl(PetscViewer,PetscInt*); 126 extern PetscErrorCode PetscViewerBinarySetFlowControl(PetscViewer,PetscInt); 127 extern PetscErrorCode PetscViewerBinarySetMPIIO(PetscViewer); 128 extern PetscErrorCode PetscViewerBinaryGetMPIIO(PetscViewer,PetscBool *); 129 #if defined(PETSC_HAVE_MPIIO) 130 extern PetscErrorCode PetscViewerBinaryGetMPIIODescriptor(PetscViewer,MPI_File*); 131 extern PetscErrorCode PetscViewerBinaryGetMPIIOOffset(PetscViewer,MPI_Offset*); 132 extern PetscErrorCode PetscViewerBinaryAddMPIIOOffset(PetscViewer,MPI_Offset); 133 #endif 134 135 extern PetscErrorCode PetscViewerSocketOpen(MPI_Comm,const char[],int,PetscViewer*); 136 extern PetscErrorCode PetscViewerStringOpen(MPI_Comm,char[],PetscInt,PetscViewer*); 137 extern PetscErrorCode PetscViewerDrawOpen(MPI_Comm,const char[],const char[],int,int,int,int,PetscViewer*); 138 extern PetscErrorCode PetscViewerMathematicaOpen(MPI_Comm, int, const char[], const char[], PetscViewer *); 139 extern PetscErrorCode PetscViewerSiloOpen(MPI_Comm, const char[], PetscViewer *); 140 extern PetscErrorCode PetscViewerMatlabOpen(MPI_Comm,const char[],PetscFileMode,PetscViewer*); 141 142 extern PetscErrorCode PetscViewerGetType(PetscViewer,const PetscViewerType*); 143 extern PetscErrorCode PetscViewerSetType(PetscViewer,const PetscViewerType); 144 extern PetscErrorCode PetscViewerDestroy(PetscViewer*); 145 extern PetscErrorCode PetscViewerGetSingleton(PetscViewer,PetscViewer*); 146 extern PetscErrorCode PetscViewerRestoreSingleton(PetscViewer,PetscViewer*); 147 extern PetscErrorCode PetscViewerGetSubcomm(PetscViewer,MPI_Comm,PetscViewer*); 148 extern PetscErrorCode PetscViewerRestoreSubcomm(PetscViewer,MPI_Comm,PetscViewer*); 149 150 extern PetscErrorCode PetscViewerSetUp(PetscViewer); 151 extern PetscErrorCode PetscViewerView(PetscViewer,PetscViewer); 152 153 extern PetscErrorCode PetscViewerSetOptionsPrefix(PetscViewer,const char[]); 154 extern PetscErrorCode PetscViewerAppendOptionsPrefix(PetscViewer,const char[]); 155 extern PetscErrorCode PetscViewerGetOptionsPrefix(PetscViewer,const char*[]); 156 157 /*E 158 PetscViewerFormat - Way a viewer presents the object 159 160 Level: beginner 161 162 The values below are also listed in finclude/petscviewer.h. If another values is added below it 163 must also be added there. 164 165 .seealso: PetscViewerSetFormat(), PetscViewer, PetscViewerType, PetscViewerPushFormat(), PetscViewerPopFormat() 166 E*/ 167 typedef enum { 168 PETSC_VIEWER_DEFAULT, 169 PETSC_VIEWER_ASCII_MATLAB, 170 PETSC_VIEWER_ASCII_MATHEMATICA, 171 PETSC_VIEWER_ASCII_IMPL, 172 PETSC_VIEWER_ASCII_INFO, 173 PETSC_VIEWER_ASCII_INFO_DETAIL, 174 PETSC_VIEWER_ASCII_COMMON, 175 PETSC_VIEWER_ASCII_SYMMODU, 176 PETSC_VIEWER_ASCII_INDEX, 177 PETSC_VIEWER_ASCII_DENSE, 178 PETSC_VIEWER_ASCII_MATRIXMARKET, 179 PETSC_VIEWER_ASCII_VTK, 180 PETSC_VIEWER_ASCII_VTK_CELL, 181 PETSC_VIEWER_ASCII_VTK_COORDS, 182 PETSC_VIEWER_ASCII_PCICE, 183 PETSC_VIEWER_ASCII_PYTHON, 184 PETSC_VIEWER_ASCII_FACTOR_INFO, 185 PETSC_VIEWER_ASCII_LATEX, 186 PETSC_VIEWER_DRAW_BASIC, 187 PETSC_VIEWER_DRAW_LG, 188 PETSC_VIEWER_DRAW_CONTOUR, 189 PETSC_VIEWER_DRAW_PORTS, 190 PETSC_VIEWER_VTK_VTS, 191 PETSC_VIEWER_NATIVE, 192 PETSC_VIEWER_NOFORMAT 193 } PetscViewerFormat; 194 extern const char *const PetscViewerFormats[]; 195 196 extern PetscErrorCode PetscViewerSetFormat(PetscViewer,PetscViewerFormat); 197 extern PetscErrorCode PetscViewerPushFormat(PetscViewer,PetscViewerFormat); 198 extern PetscErrorCode PetscViewerPopFormat(PetscViewer); 199 extern PetscErrorCode PetscViewerGetFormat(PetscViewer,PetscViewerFormat*); 200 extern PetscErrorCode PetscViewerFlush(PetscViewer); 201 202 /* 203 Operations explicit to a particular class of viewers 204 */ 205 206 extern PetscErrorCode PetscViewerASCIIGetPointer(PetscViewer,FILE**); 207 extern PetscErrorCode PetscViewerFileGetMode(PetscViewer,PetscFileMode*); 208 extern PetscErrorCode PetscViewerFileSetMode(PetscViewer,PetscFileMode); 209 extern PetscErrorCode PetscViewerASCIIPrintf(PetscViewer,const char[],...); 210 extern PetscErrorCode PetscViewerASCIISynchronizedPrintf(PetscViewer,const char[],...); 211 extern PetscErrorCode PetscViewerASCIISynchronizedAllow(PetscViewer,PetscBool); 212 extern PetscErrorCode PetscViewerASCIIPushTab(PetscViewer); 213 extern PetscErrorCode PetscViewerASCIIPopTab(PetscViewer); 214 extern PetscErrorCode PetscViewerASCIIUseTabs(PetscViewer,PetscBool ); 215 extern PetscErrorCode PetscViewerASCIISetTab(PetscViewer,PetscInt); 216 extern PetscErrorCode PetscViewerASCIIAddTab(PetscViewer,PetscInt); 217 extern PetscErrorCode PetscViewerASCIISubtractTab(PetscViewer,PetscInt); 218 extern PetscErrorCode PetscViewerBinaryGetDescriptor(PetscViewer,int*); 219 extern PetscErrorCode PetscViewerBinaryGetInfoPointer(PetscViewer,FILE **); 220 extern PetscErrorCode PetscViewerBinaryRead(PetscViewer,void*,PetscInt,PetscDataType); 221 extern PetscErrorCode PetscViewerBinaryWrite(PetscViewer,void*,PetscInt,PetscDataType,PetscBool ); 222 extern PetscErrorCode PetscViewerStringSPrintf(PetscViewer,const char[],...); 223 extern PetscErrorCode PetscViewerStringSetString(PetscViewer,char[],PetscInt); 224 extern PetscErrorCode PetscViewerDrawClear(PetscViewer); 225 extern PetscErrorCode PetscViewerDrawSetHold(PetscViewer,PetscBool); 226 extern PetscErrorCode PetscViewerDrawGetHold(PetscViewer,PetscBool*); 227 extern PetscErrorCode PetscViewerDrawSetPause(PetscViewer,PetscReal); 228 extern PetscErrorCode PetscViewerDrawGetPause(PetscViewer,PetscReal*); 229 extern PetscErrorCode PetscViewerDrawSetInfo(PetscViewer,const char[],const char[],int,int,int,int); 230 extern PetscErrorCode PetscViewerDrawResize(PetscViewer,int,int); 231 extern PetscErrorCode PetscViewerDrawSetBounds(PetscViewer,PetscInt,const PetscReal*); 232 extern PetscErrorCode PetscViewerDrawGetBounds(PetscViewer,PetscInt*,const PetscReal**); 233 extern PetscErrorCode PetscViewerSocketSetConnection(PetscViewer,const char[],int); 234 extern PetscErrorCode PetscViewerBinarySkipInfo(PetscViewer); 235 extern PetscErrorCode PetscViewerBinarySetSkipOptions(PetscViewer,PetscBool ); 236 extern PetscErrorCode PetscViewerBinaryGetSkipOptions(PetscViewer,PetscBool *); 237 extern PetscErrorCode PetscViewerBinarySetSkipHeader(PetscViewer,PetscBool); 238 extern PetscErrorCode PetscViewerBinaryGetSkipHeader(PetscViewer,PetscBool*); 239 extern PetscErrorCode PetscViewerBinaryReadStringArray(PetscViewer,char***); 240 extern PetscErrorCode PetscViewerBinaryWriteStringArray(PetscViewer,char**); 241 242 extern PetscErrorCode PetscViewerFileSetName(PetscViewer,const char[]); 243 extern PetscErrorCode PetscViewerFileGetName(PetscViewer,const char**); 244 245 extern PetscErrorCode PetscPLAPACKInitializePackage(MPI_Comm com); 246 extern PetscErrorCode PetscPLAPACKFinalizePackage(void); 247 248 extern PetscErrorCode PetscViewerVUGetPointer(PetscViewer, FILE**); 249 extern PetscErrorCode PetscViewerVUSetVecSeen(PetscViewer, PetscBool ); 250 extern PetscErrorCode PetscViewerVUGetVecSeen(PetscViewer, PetscBool *); 251 extern PetscErrorCode PetscViewerVUPrintDeferred(PetscViewer, const char [], ...); 252 extern PetscErrorCode PetscViewerVUFlushDeferred(PetscViewer); 253 254 extern PetscErrorCode PetscViewerMathematicaInitializePackage(const char[]); 255 extern PetscErrorCode PetscViewerMathematicaFinalizePackage(void); 256 extern PetscErrorCode PetscViewerMathematicaGetName(PetscViewer, const char **); 257 extern PetscErrorCode PetscViewerMathematicaSetName(PetscViewer, const char []); 258 extern PetscErrorCode PetscViewerMathematicaClearName(PetscViewer); 259 extern PetscErrorCode PetscViewerMathematicaSkipPackets(PetscViewer, int); 260 261 extern PetscErrorCode PetscViewerSiloGetName(PetscViewer, char **); 262 extern PetscErrorCode PetscViewerSiloSetName(PetscViewer, const char []); 263 extern PetscErrorCode PetscViewerSiloClearName(PetscViewer); 264 extern PetscErrorCode PetscViewerSiloGetMeshName(PetscViewer, char **); 265 extern PetscErrorCode PetscViewerSiloSetMeshName(PetscViewer, const char []); 266 extern PetscErrorCode PetscViewerSiloClearMeshName(PetscViewer); 267 268 extern PetscErrorCode PetscViewerNetcdfOpen(MPI_Comm,const char[],PetscFileMode,PetscViewer*); 269 extern PetscErrorCode PetscViewerNetcdfGetID(PetscViewer, int *); 270 271 extern PetscErrorCode PetscViewerHDF5WriteSDS(PetscViewer,float *,int,int *,int); 272 273 extern PetscErrorCode PetscViewerHDF5Open(MPI_Comm,const char[],PetscFileMode,PetscViewer*); 274 extern PetscErrorCode PetscViewerHDF5PushGroup(PetscViewer,const char *); 275 extern PetscErrorCode PetscViewerHDF5PopGroup(PetscViewer); 276 extern PetscErrorCode PetscViewerHDF5GetGroup(PetscViewer, const char **); 277 extern PetscErrorCode PetscViewerHDF5IncrementTimestep(PetscViewer); 278 extern PetscErrorCode PetscViewerHDF5SetTimestep(PetscViewer,PetscInt); 279 extern PetscErrorCode PetscViewerHDF5GetTimestep(PetscViewer,PetscInt*); 280 #ifdef PETSC_HAVE_HDF5 281 #include <hdf5.h> 282 extern PetscErrorCode PetscViewerHDF5GetFileId(PetscViewer,hid_t*); 283 extern PetscErrorCode PetscViewerHDF5OpenGroup(PetscViewer, hid_t *, hid_t *); 284 #endif 285 286 typedef enum {PETSC_VTK_POINT_FIELD, PETSC_VTK_POINT_VECTOR_FIELD, PETSC_VTK_CELL_FIELD, PETSC_VTK_CELL_VECTOR_FIELD} PetscViewerVTKFieldType; 287 typedef PetscErrorCode (*PetscViewerVTKWriteFunction)(PetscObject,PetscViewer); 288 extern PetscErrorCode PetscViewerVTKAddField(PetscViewer,PetscObject,PetscViewerVTKWriteFunction,PetscViewerVTKFieldType,PetscObject); 289 extern PetscErrorCode PetscViewerVTKOpen(MPI_Comm,const char[],PetscFileMode,PetscViewer*); 290 291 /* 292 These are all the default viewers that do not have 293 to be explicitly opened 294 */ 295 extern PetscViewer PETSC_VIEWER_STDOUT_(MPI_Comm); 296 extern PetscErrorCode PetscViewerASCIIGetStdout(MPI_Comm,PetscViewer*); 297 extern PetscViewer PETSC_VIEWER_STDERR_(MPI_Comm); 298 extern PetscErrorCode PetscViewerASCIIGetStderr(MPI_Comm,PetscViewer*); 299 extern PetscViewer PETSC_VIEWER_DRAW_(MPI_Comm); 300 extern PetscViewer PETSC_VIEWER_SOCKET_(MPI_Comm); 301 extern PetscViewer PETSC_VIEWER_BINARY_(MPI_Comm); 302 extern PetscViewer PETSC_VIEWER_MATLAB_(MPI_Comm); 303 extern PetscViewer PETSC_VIEWER_MATHEMATICA_WORLD_PRIVATE; 304 305 #define PETSC_VIEWER_STDERR_SELF PETSC_VIEWER_STDERR_(PETSC_COMM_SELF) 306 #define PETSC_VIEWER_STDERR_WORLD PETSC_VIEWER_STDERR_(PETSC_COMM_WORLD) 307 308 /*MC 309 PETSC_VIEWER_STDOUT_WORLD - same as PETSC_VIEWER_STDOUT_(PETSC_COMM_WORLD) 310 311 Level: beginner 312 M*/ 313 #define PETSC_VIEWER_STDOUT_WORLD PETSC_VIEWER_STDOUT_(PETSC_COMM_WORLD) 314 315 /*MC 316 PETSC_VIEWER_STDOUT_SELF - same as PETSC_VIEWER_STDOUT_(PETSC_COMM_SELF) 317 318 Level: beginner 319 M*/ 320 #define PETSC_VIEWER_STDOUT_SELF PETSC_VIEWER_STDOUT_(PETSC_COMM_SELF) 321 322 /*MC 323 PETSC_VIEWER_DRAW_WORLD - same as PETSC_VIEWER_DRAW_(PETSC_COMM_WORLD) 324 325 Level: intermediate 326 M*/ 327 #define PETSC_VIEWER_DRAW_WORLD PETSC_VIEWER_DRAW_(PETSC_COMM_WORLD) 328 329 /*MC 330 PETSC_VIEWER_DRAW_SELF - same as PETSC_VIEWER_DRAW_(PETSC_COMM_SELF) 331 332 Level: intermediate 333 M*/ 334 #define PETSC_VIEWER_DRAW_SELF PETSC_VIEWER_DRAW_(PETSC_COMM_SELF) 335 336 /*MC 337 PETSC_VIEWER_SOCKET_WORLD - same as PETSC_VIEWER_SOCKET_(PETSC_COMM_WORLD) 338 339 Level: intermediate 340 M*/ 341 #define PETSC_VIEWER_SOCKET_WORLD PETSC_VIEWER_SOCKET_(PETSC_COMM_WORLD) 342 343 /*MC 344 PETSC_VIEWER_SOCKET_SELF - same as PETSC_VIEWER_SOCKET_(PETSC_COMM_SELF) 345 346 Level: intermediate 347 M*/ 348 #define PETSC_VIEWER_SOCKET_SELF PETSC_VIEWER_SOCKET_(PETSC_COMM_SELF) 349 350 /*MC 351 PETSC_VIEWER_BINARY_WORLD - same as PETSC_VIEWER_BINARY_(PETSC_COMM_WORLD) 352 353 Level: intermediate 354 M*/ 355 #define PETSC_VIEWER_BINARY_WORLD PETSC_VIEWER_BINARY_(PETSC_COMM_WORLD) 356 357 /*MC 358 PETSC_VIEWER_BINARY_SELF - same as PETSC_VIEWER_BINARY_(PETSC_COMM_SELF) 359 360 Level: intermediate 361 M*/ 362 #define PETSC_VIEWER_BINARY_SELF PETSC_VIEWER_BINARY_(PETSC_COMM_SELF) 363 364 /*MC 365 PETSC_VIEWER_MATLAB_WORLD - same as PETSC_VIEWER_MATLAB_(PETSC_COMM_WORLD) 366 367 Level: intermediate 368 M*/ 369 #define PETSC_VIEWER_MATLAB_WORLD PETSC_VIEWER_MATLAB_(PETSC_COMM_WORLD) 370 371 /*MC 372 PETSC_VIEWER_MATLAB_SELF - same as PETSC_VIEWER_MATLAB_(PETSC_COMM_SELF) 373 374 Level: intermediate 375 M*/ 376 #define PETSC_VIEWER_MATLAB_SELF PETSC_VIEWER_MATLAB_(PETSC_COMM_SELF) 377 378 #define PETSC_VIEWER_MATHEMATICA_WORLD (PetscViewerInitializeMathematicaWorld_Private(),PETSC_VIEWER_MATHEMATICA_WORLD_PRIVATE) 379 380 #define PetscViewerFlowControlStart(viewer,mcnt,cnt) (PetscViewerBinaryGetFlowControl(viewer,mcnt) || PetscViewerBinaryGetFlowControl(viewer,cnt)) 381 #define PetscViewerFlowControlStepMaster(viewer,i,mcnt,cnt) ((i >= mcnt) ? (mcnt += cnt,MPI_Bcast(&mcnt,1,MPIU_INT,0,((PetscObject)viewer)->comm)) : 0) 382 #define PetscViewerFlowControlEndMaster(viewer,mcnt) (mcnt = 0,MPI_Bcast(&mcnt,1,MPIU_INT,0,((PetscObject)viewer)->comm)) 383 #define PetscViewerFlowControlStepWorker(viewer,rank,mcnt) 0; while (1) { PetscErrorCode _ierr; \ 384 if (rank < mcnt) break; \ 385 _ierr = MPI_Bcast(&mcnt,1,MPIU_INT,0,((PetscObject)viewer)->comm);CHKERRQ(_ierr);\ 386 } 387 #define PetscViewerFlowControlEndWorker(viewer,mcnt) 0; while (1) { PetscErrorCode _ierr; \ 388 _ierr = MPI_Bcast(&mcnt,1,MPIU_INT,0,((PetscObject)viewer)->comm);CHKERRQ(_ierr);\ 389 if (mcnt == 0) break; \ 390 } 391 392 /* 393 petscViewer writes to MATLAB .mat file 394 */ 395 extern PetscErrorCode PetscViewerMatlabPutArray(PetscViewer,int,int,const PetscScalar*,const char*); 396 extern PetscErrorCode PetscViewerMatlabGetArray(PetscViewer,int,int,PetscScalar*,const char*); 397 extern PetscErrorCode PetscViewerMatlabPutVariable(PetscViewer,const char*,void*); 398 399 /*S 400 PetscViewers - Abstract collection of PetscViewers. It is just an expandable array of viewers. 401 402 Level: intermediate 403 404 Concepts: viewing 405 406 .seealso: PetscViewerCreate(), PetscViewerSetType(), PetscViewerType, PetscViewer, PetscViewersCreate(), 407 PetscViewersGetViewer() 408 S*/ 409 typedef struct _n_PetscViewers* PetscViewers; 410 extern PetscErrorCode PetscViewersCreate(MPI_Comm,PetscViewers*); 411 extern PetscErrorCode PetscViewersDestroy(PetscViewers*); 412 extern PetscErrorCode PetscViewersGetViewer(PetscViewers,PetscInt,PetscViewer*); 413 414 #if defined(PETSC_HAVE_AMS) 415 #include <ams.h> 416 extern PetscErrorCode PetscViewerAMSSetCommName(PetscViewer,const char[]); 417 extern PetscErrorCode PetscViewerAMSGetAMSComm(PetscViewer,AMS_Comm *); 418 extern PetscErrorCode PetscViewerAMSOpen(MPI_Comm,const char[],PetscViewer*); 419 extern PetscErrorCode PetscViewerAMSLock(PetscViewer); 420 extern PetscViewer PETSC_VIEWER_AMS_(MPI_Comm); 421 extern PetscErrorCode PETSC_VIEWER_AMS_Destroy(MPI_Comm); 422 #define PETSC_VIEWER_AMS_WORLD PETSC_VIEWER_AMS_(PETSC_COMM_WORLD) 423 #endif 424 425 426 PETSC_EXTERN_CXX_END 427 #endif 428