184cb2905SBarry Smith /* 2b0a32e0cSBarry Smith PetscViewers are objects where other objects can be looked at or stored. 384cb2905SBarry Smith */ 43c119ea2SBarry Smith 50a835dfdSSatish Balay #if !defined(__PETSCVIEWER_H) 60a835dfdSSatish Balay #define __PETSCVIEWER_H 7dfbe8321SBarry Smith 8e9fa29b7SSatish Balay #if defined(PETSC_USE_EXTERN_CXX) && defined(__cplusplus) 9e9fa29b7SSatish Balay extern "C" { 10e9fa29b7SSatish Balay #endif 112eb8c8abSBarry Smith 12b9617806SBarry Smith /*S 13b9617806SBarry Smith PetscViewer - Abstract PETSc object that helps view (in ASCII, binary, graphically etc) 14b9617806SBarry Smith other PETSc objects 15b9617806SBarry Smith 16b9617806SBarry Smith Level: beginner 17b9617806SBarry Smith 18b9617806SBarry Smith Concepts: viewing 19b9617806SBarry Smith 20b9617806SBarry Smith .seealso: PetscViewerCreate(), PetscViewerSetType(), PetscViewerType 21b9617806SBarry Smith S*/ 22b0a32e0cSBarry Smith typedef struct _p_PetscViewer* PetscViewer; 233c119ea2SBarry Smith 24e9fa29b7SSatish Balay #if defined(PETSC_USE_EXTERN_CXX) && defined(__cplusplus) 25e9fa29b7SSatish Balay } 26e9fa29b7SSatish Balay #endif 27e9fa29b7SSatish Balay 282c8e378dSBarry Smith #include <petscsys.h> 298fb59f0aSKris Buschelman 30014dd563SJed Brown PETSC_EXTERN PetscClassId PETSC_VIEWER_CLASSID; 31e9fa29b7SSatish Balay 3276bdecfbSBarry Smith /*J 33b9617806SBarry Smith PetscViewerType - String with the name of a PETSc PETScViewer 34b9617806SBarry Smith 35b9617806SBarry Smith Level: beginner 36b9617806SBarry Smith 37b9617806SBarry Smith .seealso: PetscViewerSetType(), PetscViewer 3876bdecfbSBarry Smith J*/ 3919fd82e9SBarry Smith typedef const char* PetscViewerType; 402692d6eeSBarry Smith #define PETSCVIEWERSOCKET "socket" 412692d6eeSBarry Smith #define PETSCVIEWERASCII "ascii" 422692d6eeSBarry Smith #define PETSCVIEWERBINARY "binary" 432692d6eeSBarry Smith #define PETSCVIEWERSTRING "string" 442692d6eeSBarry Smith #define PETSCVIEWERDRAW "draw" 452692d6eeSBarry Smith #define PETSCVIEWERVU "vu" 462692d6eeSBarry Smith #define PETSCVIEWERMATHEMATICA "mathematica" 472692d6eeSBarry Smith #define PETSCVIEWERNETCDF "netcdf" 482692d6eeSBarry Smith #define PETSCVIEWERHDF5 "hdf5" 494061b8bfSJed Brown #define PETSCVIEWERVTK "vtk" 502692d6eeSBarry Smith #define PETSCVIEWERMATLAB "matlab" 51b3506946SBarry Smith #define PETSCVIEWERAMS "ams" 5277ed5343SBarry Smith 53014dd563SJed Brown PETSC_EXTERN PetscFList PetscViewerList; 54014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerRegisterAll(const char *); 55014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerRegisterDestroy(void); 56014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerInitializePackage(const char[]); 577b2a1423SBarry Smith 58014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerRegister(const char*,const char*,const char*,PetscErrorCode (*)(PetscViewer)); 5930de9b25SBarry Smith 6030de9b25SBarry Smith /*MC 6192c97de8SJed Brown PetscViewerRegisterDynamic - Adds a viewer 6230de9b25SBarry Smith 63*f2ba6396SBarry Smith Synopsis 64*f2ba6396SBarry Smith #include "petscviewer.h" 651890ba74SBarry Smith PetscErrorCode PetscViewerRegisterDynamic(const char *name_solver,const char *path,const char *name_create,PetscErrorCode (*routine_create)(PetscViewer)) 6630de9b25SBarry Smith 6730de9b25SBarry Smith Not Collective 6830de9b25SBarry Smith 6930de9b25SBarry Smith Input Parameters: 7092c97de8SJed Brown + name_solver - name of a new user-defined viewer 7192c97de8SJed Brown . path - path (either absolute or relative) the library containing this viewer 7230de9b25SBarry Smith . name_create - name of routine to create method context 7330de9b25SBarry Smith - routine_create - routine to create method context 7430de9b25SBarry Smith 7530de9b25SBarry Smith Level: developer 7630de9b25SBarry Smith 7730de9b25SBarry Smith Notes: 7892c97de8SJed Brown PetscViewerRegisterDynamic() may be called multiple times to add several user-defined viewers. 7930de9b25SBarry Smith 8030de9b25SBarry Smith If dynamic libraries are used, then the fourth input argument (routine_create) 8130de9b25SBarry Smith is ignored. 8230de9b25SBarry Smith 8330de9b25SBarry Smith Sample usage: 8430de9b25SBarry Smith .vb 8530de9b25SBarry Smith PetscViewerRegisterDynamic("my_viewer_type",/home/username/my_lib/lib/libO/solaris/mylib.a, 8630de9b25SBarry Smith "MyViewerCreate",MyViewerCreate); 8730de9b25SBarry Smith .ve 8830de9b25SBarry Smith 8930de9b25SBarry Smith Then, your solver can be chosen with the procedural interface via 9092c97de8SJed Brown $ PetscViewerSetType(viewer,"my_viewer_type") 9130de9b25SBarry Smith or at runtime via the option 9230de9b25SBarry Smith $ -viewer_type my_viewer_type 9330de9b25SBarry Smith 9430de9b25SBarry Smith Concepts: registering^Viewers 9530de9b25SBarry Smith 9630de9b25SBarry Smith .seealso: PetscViewerRegisterAll(), PetscViewerRegisterDestroy() 9730de9b25SBarry Smith M*/ 98aa482453SBarry Smith #if defined(PETSC_USE_DYNAMIC_LIBRARIES) 99b0a32e0cSBarry Smith #define PetscViewerRegisterDynamic(a,b,c,d) PetscViewerRegister(a,b,c,0) 1007b2a1423SBarry Smith #else 101b0a32e0cSBarry Smith #define PetscViewerRegisterDynamic(a,b,c,d) PetscViewerRegister(a,b,c,d) 1027b2a1423SBarry Smith #endif 10330de9b25SBarry Smith 104014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerCreate(MPI_Comm,PetscViewer*); 105014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerSetFromOptions(PetscViewer); 106014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerASCIIOpenWithFILE(MPI_Comm,FILE*,PetscViewer*); 1077b2a1423SBarry Smith 108014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerASCIIOpen(MPI_Comm,const char[],PetscViewer*); 109014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerASCIISetFILE(PetscViewer,FILE*); 110014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerBinaryOpen(MPI_Comm,const char[],PetscFileMode,PetscViewer*); 111014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerBinaryGetFlowControl(PetscViewer,PetscInt*); 112014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerBinarySetFlowControl(PetscViewer,PetscInt); 113014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerBinarySetMPIIO(PetscViewer); 114014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerBinaryGetMPIIO(PetscViewer,PetscBool *); 1150fc9d207SBarry Smith #if defined(PETSC_HAVE_MPIIO) 116014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerBinaryGetMPIIODescriptor(PetscViewer,MPI_File*); 117014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerBinaryGetMPIIOOffset(PetscViewer,MPI_Offset*); 118014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerBinaryAddMPIIOOffset(PetscViewer,MPI_Offset); 119951e3c8eSBarry Smith #endif 12039802e9eSBarry Smith 121014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerSocketOpen(MPI_Comm,const char[],int,PetscViewer*); 122014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerStringOpen(MPI_Comm,char[],PetscInt,PetscViewer*); 123014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerDrawOpen(MPI_Comm,const char[],const char[],int,int,int,int,PetscViewer*); 124014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerMathematicaOpen(MPI_Comm, int, const char[], const char[], PetscViewer *); 125014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerSiloOpen(MPI_Comm, const char[], PetscViewer *); 126014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerMatlabOpen(MPI_Comm,const char[],PetscFileMode,PetscViewer*); 1274b0e389bSBarry Smith 12819fd82e9SBarry Smith PETSC_EXTERN PetscErrorCode PetscViewerGetType(PetscViewer,PetscViewerType*); 12919fd82e9SBarry Smith PETSC_EXTERN PetscErrorCode PetscViewerSetType(PetscViewer,PetscViewerType); 130014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerDestroy(PetscViewer*); 131014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerGetSingleton(PetscViewer,PetscViewer*); 132014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerRestoreSingleton(PetscViewer,PetscViewer*); 133014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerGetSubcomm(PetscViewer,MPI_Comm,PetscViewer*); 134014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerRestoreSubcomm(PetscViewer,MPI_Comm,PetscViewer*); 135ae39576cSLois Curfman McInnes 136014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerSetUp(PetscViewer); 137014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerView(PetscViewer,PetscViewer); 138f69a0ea3SMatthew Knepley 139014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerSetOptionsPrefix(PetscViewer,const char[]); 140014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerAppendOptionsPrefix(PetscViewer,const char[]); 141014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerGetOptionsPrefix(PetscViewer,const char*[]); 142090de74eSSatish Balay 143b9617806SBarry Smith /*E 144b9617806SBarry Smith PetscViewerFormat - Way a viewer presents the object 145b9617806SBarry Smith 146b9617806SBarry Smith Level: beginner 147b9617806SBarry Smith 148cfaaf4edSHong Zhang The values below are also listed in finclude/petscviewer.h. If another values is added below it 149cfaaf4edSHong Zhang must also be added there. 150cfaaf4edSHong Zhang 151b9617806SBarry Smith .seealso: PetscViewerSetFormat(), PetscViewer, PetscViewerType, PetscViewerPushFormat(), PetscViewerPopFormat() 152b9617806SBarry Smith E*/ 153fb9695e5SSatish Balay typedef enum { 154117016b1SBarry Smith PETSC_VIEWER_DEFAULT, 155f3ef73ceSBarry Smith PETSC_VIEWER_ASCII_MATLAB, 1564ebda54eSMatthew Knepley PETSC_VIEWER_ASCII_MATHEMATICA, 157f3ef73ceSBarry Smith PETSC_VIEWER_ASCII_IMPL, 158f3ef73ceSBarry Smith PETSC_VIEWER_ASCII_INFO, 159456192e2SBarry Smith PETSC_VIEWER_ASCII_INFO_DETAIL, 160f3ef73ceSBarry Smith PETSC_VIEWER_ASCII_COMMON, 161f3ef73ceSBarry Smith PETSC_VIEWER_ASCII_SYMMODU, 162f3ef73ceSBarry Smith PETSC_VIEWER_ASCII_INDEX, 163f3ef73ceSBarry Smith PETSC_VIEWER_ASCII_DENSE, 1643c215bfdSMatthew Knepley PETSC_VIEWER_ASCII_MATRIXMARKET, 165a505fa5bSMatthew Knepley PETSC_VIEWER_ASCII_VTK, 166b85befe5SMatthew Knepley PETSC_VIEWER_ASCII_VTK_CELL, 167b6d733afSMatthew Knepley PETSC_VIEWER_ASCII_VTK_COORDS, 168493617b5SMatthew Knepley PETSC_VIEWER_ASCII_PCICE, 169cfaaf4edSHong Zhang PETSC_VIEWER_ASCII_PYTHON, 170cfaaf4edSHong Zhang PETSC_VIEWER_ASCII_FACTOR_INFO, 17167ad5babSMatthew G Knepley PETSC_VIEWER_ASCII_LATEX, 172f3ef73ceSBarry Smith PETSC_VIEWER_DRAW_BASIC, 173f3ef73ceSBarry Smith PETSC_VIEWER_DRAW_LG, 174f3ef73ceSBarry Smith PETSC_VIEWER_DRAW_CONTOUR, 175f3ef73ceSBarry Smith PETSC_VIEWER_DRAW_PORTS, 1764061b8bfSJed Brown PETSC_VIEWER_VTK_VTS, 177b263465dSJed Brown PETSC_VIEWER_VTK_VTU, 178f3ef73ceSBarry Smith PETSC_VIEWER_NATIVE, 179cfaaf4edSHong Zhang PETSC_VIEWER_NOFORMAT 180cfaaf4edSHong Zhang } PetscViewerFormat; 181014dd563SJed Brown PETSC_EXTERN const char *const PetscViewerFormats[]; 182090de74eSSatish Balay 183014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerSetFormat(PetscViewer,PetscViewerFormat); 184014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerPushFormat(PetscViewer,PetscViewerFormat); 185014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerPopFormat(PetscViewer); 186014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerGetFormat(PetscViewer,PetscViewerFormat*); 187014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerFlush(PetscViewer); 1884b0e389bSBarry Smith 189cffb1e40SBarry Smith PETSC_EXTERN PetscErrorCode PetscOptionsGetViewer(MPI_Comm,const char[],const char[],PetscViewer*,PetscViewerFormat*,PetscBool*); 190cffb1e40SBarry Smith PETSC_EXTERN PetscErrorCode PetscOptionsViewer(const char[],const char[],const char[],PetscViewer*,PetscViewerFormat *,PetscBool *); 1912bf49c77SBarry Smith 19277ed5343SBarry Smith /* 19377ed5343SBarry Smith Operations explicit to a particular class of viewers 19477ed5343SBarry Smith */ 195ed5c6e3eSMatthew Knepley 196014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerASCIIGetPointer(PetscViewer,FILE**); 197014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerFileGetMode(PetscViewer,PetscFileMode*); 198014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerFileSetMode(PetscViewer,PetscFileMode); 199014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerASCIIPrintf(PetscViewer,const char[],...); 200014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerASCIISynchronizedPrintf(PetscViewer,const char[],...); 201014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerASCIISynchronizedAllow(PetscViewer,PetscBool); 202014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerASCIIPushTab(PetscViewer); 203014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerASCIIPopTab(PetscViewer); 204014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerASCIIUseTabs(PetscViewer,PetscBool ); 205014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerASCIISetTab(PetscViewer,PetscInt); 206014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerASCIIGetTab(PetscViewer,PetscInt*); 207014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerASCIIAddTab(PetscViewer,PetscInt); 208014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerASCIISubtractTab(PetscViewer,PetscInt); 209014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerBinaryGetDescriptor(PetscViewer,int*); 210014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerBinaryGetInfoPointer(PetscViewer,FILE **); 211014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerBinaryRead(PetscViewer,void*,PetscInt,PetscDataType); 212014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerBinaryWrite(PetscViewer,void*,PetscInt,PetscDataType,PetscBool ); 213014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerStringSPrintf(PetscViewer,const char[],...); 214014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerStringSetString(PetscViewer,char[],PetscInt); 215014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerDrawClear(PetscViewer); 216014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerDrawSetHold(PetscViewer,PetscBool); 217014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerDrawGetHold(PetscViewer,PetscBool*); 218014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerDrawSetPause(PetscViewer,PetscReal); 219014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerDrawGetPause(PetscViewer,PetscReal*); 220014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerDrawSetInfo(PetscViewer,const char[],const char[],int,int,int,int); 221014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerDrawResize(PetscViewer,int,int); 222014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerDrawSetBounds(PetscViewer,PetscInt,const PetscReal*); 223014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerDrawGetBounds(PetscViewer,PetscInt*,const PetscReal**); 224014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerSocketSetConnection(PetscViewer,const char[],int); 225014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerBinarySkipInfo(PetscViewer); 226014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerBinarySetSkipOptions(PetscViewer,PetscBool ); 227014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerBinaryGetSkipOptions(PetscViewer,PetscBool *); 228014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerBinarySetSkipHeader(PetscViewer,PetscBool); 229014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerBinaryGetSkipHeader(PetscViewer,PetscBool*); 230014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerBinaryReadStringArray(PetscViewer,char***); 231014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerBinaryWriteStringArray(PetscViewer,char**); 232c655490fSBarry Smith 233014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerFileSetName(PetscViewer,const char[]); 234014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerFileGetName(PetscViewer,const char**); 23577ed5343SBarry Smith 236014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerVUGetPointer(PetscViewer, FILE**); 237014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerVUSetVecSeen(PetscViewer, PetscBool ); 238014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerVUGetVecSeen(PetscViewer, PetscBool *); 239014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerVUPrintDeferred(PetscViewer, const char [], ...); 240014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerVUFlushDeferred(PetscViewer); 24155dcf840SMatthew Knepley 242014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerMathematicaInitializePackage(const char[]); 243014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerMathematicaFinalizePackage(void); 244014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerMathematicaGetName(PetscViewer, const char **); 245014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerMathematicaSetName(PetscViewer, const char []); 246014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerMathematicaClearName(PetscViewer); 247014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerMathematicaSkipPackets(PetscViewer, int); 2484ebda54eSMatthew Knepley 249014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerSiloGetName(PetscViewer, char **); 250014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerSiloSetName(PetscViewer, const char []); 251014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerSiloClearName(PetscViewer); 252014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerSiloGetMeshName(PetscViewer, char **); 253014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerSiloSetMeshName(PetscViewer, const char []); 254014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerSiloClearMeshName(PetscViewer); 2554ebda54eSMatthew Knepley 256014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerNetcdfOpen(MPI_Comm,const char[],PetscFileMode,PetscViewer*); 257014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerNetcdfGetID(PetscViewer, int *); 258e3eb5169SDinesh Kaushik 259014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerHDF5WriteSDS(PetscViewer,float *,int,int *,int); 26000ccbe27SDinesh Kaushik 261014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerHDF5Open(MPI_Comm,const char[],PetscFileMode,PetscViewer*); 262014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerHDF5PushGroup(PetscViewer,const char *); 263014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerHDF5PopGroup(PetscViewer); 264014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerHDF5GetGroup(PetscViewer, const char **); 265014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerHDF5IncrementTimestep(PetscViewer); 266014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerHDF5SetTimestep(PetscViewer,PetscInt); 267014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerHDF5GetTimestep(PetscViewer,PetscInt*); 2688e72c77eSMatthew Knepley #ifdef PETSC_HAVE_HDF5 2698e72c77eSMatthew Knepley #include <hdf5.h> 270014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerHDF5GetFileId(PetscViewer,hid_t*); 271014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerHDF5OpenGroup(PetscViewer, hid_t *, hid_t *); 2728e72c77eSMatthew Knepley #endif 2738e72c77eSMatthew Knepley 274893c9c94SMatthew G Knepley typedef enum {PETSC_VTK_POINT_FIELD, PETSC_VTK_POINT_VECTOR_FIELD, PETSC_VTK_CELL_FIELD, PETSC_VTK_CELL_VECTOR_FIELD} PetscViewerVTKFieldType; 275638cfed1SJed Brown PETSC_EXTERN_TYPEDEF typedef PetscErrorCode (*PetscViewerVTKWriteFunction)(PetscObject,PetscViewer); 276014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerVTKAddField(PetscViewer,PetscObject,PetscViewerVTKWriteFunction,PetscViewerVTKFieldType,PetscObject); 277014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerVTKOpen(MPI_Comm,const char[],PetscFileMode,PetscViewer*); 2784061b8bfSJed Brown 27977ed5343SBarry Smith /* 28077ed5343SBarry Smith These are all the default viewers that do not have 28177ed5343SBarry Smith to be explicitly opened 28277ed5343SBarry Smith */ 283014dd563SJed Brown PETSC_EXTERN PetscViewer PETSC_VIEWER_STDOUT_(MPI_Comm); 284014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerASCIIGetStdout(MPI_Comm,PetscViewer*); 285014dd563SJed Brown PETSC_EXTERN PetscViewer PETSC_VIEWER_STDERR_(MPI_Comm); 286014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerASCIIGetStderr(MPI_Comm,PetscViewer*); 287014dd563SJed Brown PETSC_EXTERN PetscViewer PETSC_VIEWER_DRAW_(MPI_Comm); 288014dd563SJed Brown PETSC_EXTERN PetscViewer PETSC_VIEWER_SOCKET_(MPI_Comm); 289014dd563SJed Brown PETSC_EXTERN PetscViewer PETSC_VIEWER_BINARY_(MPI_Comm); 290014dd563SJed Brown PETSC_EXTERN PetscViewer PETSC_VIEWER_MATLAB_(MPI_Comm); 291014dd563SJed Brown PETSC_EXTERN PetscViewer PETSC_VIEWER_MATHEMATICA_WORLD_PRIVATE; 2925311e20fSBarry Smith 293b0a32e0cSBarry Smith #define PETSC_VIEWER_STDERR_SELF PETSC_VIEWER_STDERR_(PETSC_COMM_SELF) 294b0a32e0cSBarry Smith #define PETSC_VIEWER_STDERR_WORLD PETSC_VIEWER_STDERR_(PETSC_COMM_WORLD) 29530de9b25SBarry Smith 29630de9b25SBarry Smith /*MC 29730de9b25SBarry Smith PETSC_VIEWER_STDOUT_WORLD - same as PETSC_VIEWER_STDOUT_(PETSC_COMM_WORLD) 29830de9b25SBarry Smith 29930de9b25SBarry Smith Level: beginner 30030de9b25SBarry Smith M*/ 30130de9b25SBarry Smith #define PETSC_VIEWER_STDOUT_WORLD PETSC_VIEWER_STDOUT_(PETSC_COMM_WORLD) 30230de9b25SBarry Smith 30330de9b25SBarry Smith /*MC 30430de9b25SBarry Smith PETSC_VIEWER_STDOUT_SELF - same as PETSC_VIEWER_STDOUT_(PETSC_COMM_SELF) 30530de9b25SBarry Smith 30630de9b25SBarry Smith Level: beginner 30730de9b25SBarry Smith M*/ 30830de9b25SBarry Smith #define PETSC_VIEWER_STDOUT_SELF PETSC_VIEWER_STDOUT_(PETSC_COMM_SELF) 30930de9b25SBarry Smith 31030de9b25SBarry Smith /*MC 31130de9b25SBarry Smith PETSC_VIEWER_DRAW_WORLD - same as PETSC_VIEWER_DRAW_(PETSC_COMM_WORLD) 31230de9b25SBarry Smith 31330de9b25SBarry Smith Level: intermediate 31430de9b25SBarry Smith M*/ 315b0a32e0cSBarry Smith #define PETSC_VIEWER_DRAW_WORLD PETSC_VIEWER_DRAW_(PETSC_COMM_WORLD) 31630de9b25SBarry Smith 31730de9b25SBarry Smith /*MC 31830de9b25SBarry Smith PETSC_VIEWER_DRAW_SELF - same as PETSC_VIEWER_DRAW_(PETSC_COMM_SELF) 31930de9b25SBarry Smith 32030de9b25SBarry Smith Level: intermediate 32130de9b25SBarry Smith M*/ 32230de9b25SBarry Smith #define PETSC_VIEWER_DRAW_SELF PETSC_VIEWER_DRAW_(PETSC_COMM_SELF) 32330de9b25SBarry Smith 32430de9b25SBarry Smith /*MC 32530de9b25SBarry Smith PETSC_VIEWER_SOCKET_WORLD - same as PETSC_VIEWER_SOCKET_(PETSC_COMM_WORLD) 32630de9b25SBarry Smith 32730de9b25SBarry Smith Level: intermediate 32830de9b25SBarry Smith M*/ 329b0a32e0cSBarry Smith #define PETSC_VIEWER_SOCKET_WORLD PETSC_VIEWER_SOCKET_(PETSC_COMM_WORLD) 33030de9b25SBarry Smith 33130de9b25SBarry Smith /*MC 33230de9b25SBarry Smith PETSC_VIEWER_SOCKET_SELF - same as PETSC_VIEWER_SOCKET_(PETSC_COMM_SELF) 33330de9b25SBarry Smith 33430de9b25SBarry Smith Level: intermediate 33530de9b25SBarry Smith M*/ 336b0a32e0cSBarry Smith #define PETSC_VIEWER_SOCKET_SELF PETSC_VIEWER_SOCKET_(PETSC_COMM_SELF) 33730de9b25SBarry Smith 33830de9b25SBarry Smith /*MC 33930de9b25SBarry Smith PETSC_VIEWER_BINARY_WORLD - same as PETSC_VIEWER_BINARY_(PETSC_COMM_WORLD) 34030de9b25SBarry Smith 34130de9b25SBarry Smith Level: intermediate 34230de9b25SBarry Smith M*/ 343b0a32e0cSBarry Smith #define PETSC_VIEWER_BINARY_WORLD PETSC_VIEWER_BINARY_(PETSC_COMM_WORLD) 34430de9b25SBarry Smith 34530de9b25SBarry Smith /*MC 34630de9b25SBarry Smith PETSC_VIEWER_BINARY_SELF - same as PETSC_VIEWER_BINARY_(PETSC_COMM_SELF) 34730de9b25SBarry Smith 34830de9b25SBarry Smith Level: intermediate 34930de9b25SBarry Smith M*/ 350b0a32e0cSBarry Smith #define PETSC_VIEWER_BINARY_SELF PETSC_VIEWER_BINARY_(PETSC_COMM_SELF) 35130de9b25SBarry Smith 352cbb32127SBarry Smith /*MC 353cbb32127SBarry Smith PETSC_VIEWER_MATLAB_WORLD - same as PETSC_VIEWER_MATLAB_(PETSC_COMM_WORLD) 354cbb32127SBarry Smith 355cbb32127SBarry Smith Level: intermediate 356cbb32127SBarry Smith M*/ 357cbb32127SBarry Smith #define PETSC_VIEWER_MATLAB_WORLD PETSC_VIEWER_MATLAB_(PETSC_COMM_WORLD) 358cbb32127SBarry Smith 359cbb32127SBarry Smith /*MC 360cbb32127SBarry Smith PETSC_VIEWER_MATLAB_SELF - same as PETSC_VIEWER_MATLAB_(PETSC_COMM_SELF) 361cbb32127SBarry Smith 362cbb32127SBarry Smith Level: intermediate 363cbb32127SBarry Smith M*/ 364cbb32127SBarry Smith #define PETSC_VIEWER_MATLAB_SELF PETSC_VIEWER_MATLAB_(PETSC_COMM_SELF) 365cbb32127SBarry Smith 3667eb62a3eSMatthew Knepley #define PETSC_VIEWER_MATHEMATICA_WORLD (PetscViewerInitializeMathematicaWorld_Private(),PETSC_VIEWER_MATHEMATICA_WORLD_PRIVATE) 36765ef3172SBarry Smith 368e03d165dSBarry Smith #define PetscViewerFlowControlStart(viewer,mcnt,cnt) (PetscViewerBinaryGetFlowControl(viewer,mcnt) || PetscViewerBinaryGetFlowControl(viewer,cnt)) 36985ebf7a4SBarry Smith #define PetscViewerFlowControlStepMaster(viewer,i,mcnt,cnt) ((i >= mcnt) ? (mcnt += cnt,MPI_Bcast(&mcnt,1,MPIU_INT,0,((PetscObject)viewer)->comm)) : 0) 370e03d165dSBarry Smith #define PetscViewerFlowControlEndMaster(viewer,mcnt) (mcnt = 0,MPI_Bcast(&mcnt,1,MPIU_INT,0,((PetscObject)viewer)->comm)) 371fca9dd48SBarry Smith #define PetscViewerFlowControlStepWorker(viewer,rank,mcnt) 0; while (1) { PetscErrorCode _ierr; \ 372fca9dd48SBarry Smith if (rank < mcnt) break; \ 373e03d165dSBarry Smith _ierr = MPI_Bcast(&mcnt,1,MPIU_INT,0,((PetscObject)viewer)->comm);CHKERRQ(_ierr);\ 374e03d165dSBarry Smith } 375fca9dd48SBarry Smith #define PetscViewerFlowControlEndWorker(viewer,mcnt) 0; while (1) { PetscErrorCode _ierr; \ 376fca9dd48SBarry Smith _ierr = MPI_Bcast(&mcnt,1,MPIU_INT,0,((PetscObject)viewer)->comm);CHKERRQ(_ierr);\ 377fca9dd48SBarry Smith if (mcnt == 0) break; \ 378fca9dd48SBarry Smith } 379e03d165dSBarry Smith 38077ed5343SBarry Smith /* 381a5057860SBarry Smith PetscViewer writes to MATLAB .mat file 382cbb32127SBarry Smith */ 383014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerMatlabPutArray(PetscViewer,int,int,const PetscScalar*,const char*); 384014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerMatlabGetArray(PetscViewer,int,int,PetscScalar*,const char*); 385014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerMatlabPutVariable(PetscViewer,const char*,void*); 386cbb32127SBarry Smith 387b9617806SBarry Smith /*S 3881890ba74SBarry Smith PetscViewers - Abstract collection of PetscViewers. It is just an expandable array of viewers. 389b9617806SBarry Smith 390b9617806SBarry Smith Level: intermediate 391b9617806SBarry Smith 392b9617806SBarry Smith Concepts: viewing 393b9617806SBarry Smith 394b9617806SBarry Smith .seealso: PetscViewerCreate(), PetscViewerSetType(), PetscViewerType, PetscViewer, PetscViewersCreate(), 395b9617806SBarry Smith PetscViewersGetViewer() 396b9617806SBarry Smith S*/ 39795fbd943SSatish Balay typedef struct _n_PetscViewers* PetscViewers; 398014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewersCreate(MPI_Comm,PetscViewers*); 399014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewersDestroy(PetscViewers*); 400014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewersGetViewer(PetscViewers,PetscInt,PetscViewer*); 401d132466eSBarry Smith 402b3506946SBarry Smith #if defined(PETSC_HAVE_AMS) 403b3506946SBarry Smith #include <ams.h> 404014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerAMSSetCommName(PetscViewer,const char[]); 405014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerAMSGetAMSComm(PetscViewer,AMS_Comm *); 406014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerAMSOpen(MPI_Comm,const char[],PetscViewer*); 407014dd563SJed Brown PETSC_EXTERN PetscErrorCode PetscViewerAMSLock(PetscViewer); 408014dd563SJed Brown PETSC_EXTERN PetscViewer PETSC_VIEWER_AMS_(MPI_Comm); 409014dd563SJed Brown PETSC_EXTERN PetscErrorCode PETSC_VIEWER_AMS_Destroy(MPI_Comm); 410b3506946SBarry Smith #define PETSC_VIEWER_AMS_WORLD PETSC_VIEWER_AMS_(PETSC_COMM_WORLD) 411b3506946SBarry Smith #endif 412b3506946SBarry Smith 413cb5b572fSBarry Smith #endif 414