Skip to main content
`Ctrl`+`K`

# PetscViewerFileSetMode

Sets the open mode of file

## Synopsis

    #include "petscviewer.h"
    PetscErrorCode PetscViewerFileSetMode(PetscViewer viewer, PetscFileMode mode)

Logically Collective

## Input Parameters

- viewer - the `PetscViewer`; must be a `PETSCVIEWERBINARY`, `PETSCVIEWERMATLAB`, `PETSCVIEWERHDF5`, or `PETSCVIEWERASCII` `PetscViewer`

- mode - open mode of file

        FILE_MODE_WRITE - create new file for output
        FILE_MODE_READ - open existing file for input
        FILE_MODE_APPEND - open existing file for output

## See Also

Viewers: Looking at PETSc Objects, `PetscViewerCreate()`, `PetscViewerSetType()`, `PetscViewerBinaryOpen()`

## Level

advanced

## Location

src/sys/classes/viewer/impls/binary/binv.c

## Examples

src/dm/tutorials/ex15.c
src/dm/tutorials/ex21.c
src/sys/classes/viewer/tutorials/ex1.c
src/dm/tutorials/ex20.c
src/dm/impls/plex/tutorials/ex19.c
src/snes/tutorials/ex12.c
src/ksp/ksp/tutorials/ex70.c
src/mat/tutorials/ex10.c
src/ksp/ksp/tutorials/ex43.c

## Implementations

PetscViewerFileSetMode_ExodusII() in src/dm/impls/plex/exodusii/plexexodusii2.c
PetscViewerFileSetMode_ADIOS() in src/sys/classes/viewer/impls/adios/adios.c
PetscViewerFileSetMode_ASCII() in src/sys/classes/viewer/impls/ascii/filev.c
PetscViewerFileSetMode_Binary() in src/sys/classes/viewer/impls/binary/binv.c
PetscViewerFileSetMode_CGNS() in src/sys/classes/viewer/impls/cgns/cgnsv.c
PetscViewerFileSetMode_HDF5() in src/sys/classes/viewer/impls/hdf5/impl/ihdf5v.c
PetscViewerFileSetMode_Matlab() in src/sys/classes/viewer/impls/matlab/vmatlab.c
PetscViewerFileSetMode_VTK() in src/sys/classes/viewer/impls/vtk/vtkv.c
PetscViewerFileSetMode_VU() in src/sys/classes/viewer/impls/vu/petscvu.c

Index of all Viewer routines
Table of Contents for all manual pages
Index of all manual pages