PetscViewer - Low-level Interface

The PetscViewer component provides flexible I/O capabilities for visualizing and saving PETSc objects, including vectors, matrices, and other data structures. Viewers support multiple output formats for analysis, debugging, and post-processing.

Overview

PETSc viewers enable:

  • Text output: ASCII formatted data for debugging
  • Binary I/O: Efficient storage and checkpointing
  • Visualization: Integration with visualization tools (VTK, HDF5, MATLAB)
  • Monitoring: Runtime inspection of solver progress
  • Logging: Recording solver statistics and performance data

Available viewer types:

  • PETSCVIEWERASCII: Human-readable text output
  • PETSCVIEWERBINARY: Platform-independent binary format
  • PETSCVIEWERVTK: VTK format for ParaView, VisIt
  • PETSCVIEWERHDF5: HDF5 hierarchical data format
  • PETSCVIEWERDRAW: X-window graphics (2D plots, contours)
  • PETSCVIEWERSOCKET: Network streaming to MATLAB, Python
  • PETSCVIEWERMATLAB: MATLAB-compatible output

Basic Usage

using PETSc, MPI

# Initialize MPI and PETSc
MPI.Init()
petsclib = PETSc.getlib()
PETSc.initialize(petsclib)

# Create a viewer for ASCII output to stdout
viewer = LibPETSc.PetscViewerCreate(petsclib, LibPETSc.PETSC_COMM_SELF)
LibPETSc.PetscViewerSetType(petsclib, viewer, "ascii")  # String convenience wrapper
LibPETSc.PetscViewerFileSetMode(petsclib, viewer, LibPETSc.FILE_MODE_WRITE)

# View a vector
# LibPETSc.VecView(petsclib, vec, viewer)

# View a matrix  
# LibPETSc.MatView(petsclib, mat, viewer)

# Cleanup - wrap in Ref since PetscViewerDestroy expects Ptr{PetscViewer}
viewer_ref = Ref(viewer)
LibPETSc.PetscViewerDestroy(petsclib, viewer_ref)

# Finalize PETSc and MPI
PETSc.finalize(petsclib)
MPI.Finalize()

Convenience Functions

For commonly used viewers, PETSc.jl provides convenience functions:

using PETSc, MPI

# Initialize MPI and PETSc
MPI.Init()
petsclib = PETSc.getlib()
PETSc.initialize(petsclib)

# Get stdout viewer (single process)
viewer_stdout_self = LibPETSc.PETSC_VIEWER_STDOUT_SELF(petsclib)

# Get stdout viewer (all processes)
viewer_stdout_world = LibPETSc.PETSC_VIEWER_STDOUT_WORLD(petsclib)

# Get stderr viewer (single process)
viewer_stderr_self = LibPETSc.PETSC_VIEWER_STDERR_SELF(petsclib)

# Get stderr viewer (all processes)
viewer_stderr_world = LibPETSc.PETSC_VIEWER_STDERR_WORLD(petsclib)

# Finalize PETSc and MPI
PETSc.finalize(petsclib)
MPI.Finalize()

# Use them to view objects
# LibPETSc.VecView(petsclib, vec, viewer_stdout_self)
# LibPETSc.MatView(petsclib, mat, viewer_stderr_world)

Output to Files

ASCII File Output

# Create ASCII file viewer
viewer = Ref{LibPETSc.PetscViewer}()
LibPETSc.PetscViewerASCIIOpen(petsclib, LibPETSc.PETSC_COMM_SELF, "output.txt", viewer)

# Set format (optional)
LibPETSc.PetscViewerPushFormat(petsclib, viewer[], LibPETSc.PETSC_VIEWER_ASCII_MATLAB)

# View object
# LibPETSc.MatView(petsclib, mat, viewer[])

LibPETSc.PetscViewerDestroy(petsclib, viewer)

# Finalize PETSc and MPI
PETSc.finalize(petsclib)
MPI.Finalize()

Binary File Output

# Create binary viewer for checkpointing
viewer = Ref{LibPETSc.PetscViewer}()
LibPETSc.PetscViewerBinaryOpen(petsclib, MPI.COMM_WORLD, "checkpoint.dat", 
                               LibPETSc.FILE_MODE_WRITE, viewer)

# Save vector
# LibPETSc.VecView(petsclib, vec, viewer[])

# Save matrix
# LibPETSc.MatView(petsclib, mat, viewer[])

LibPETSc.PetscViewerDestroy(petsclib, viewer)

# Finalize PETSc and MPI
PETSc.finalize(petsclib)
MPI.Finalize()

Loading from Binary Files

# Open for reading
viewer = Ref{LibPETSc.PetscViewer}()
LibPETSc.PetscViewerBinaryOpen(petsclib, MPI.COMM_WORLD, "checkpoint.dat",
                               LibPETSc.FILE_MODE_READ, viewer)

# Load vector
vec = LibPETSc.VecCreate(petsclib, MPI.COMM_WORLD)
LibPETSc.VecLoad(petsclib, vec, viewer[])

LibPETSc.PetscViewerDestroy(petsclib, viewer)

# Finalize PETSc and MPI
PETSc.finalize(petsclib)
MPI.Finalize()

Visualization Formats

VTK Output

# Create VTK viewer for ParaView/VisIt
viewer = Ref{LibPETSc.PetscViewer}()
LibPETSc.PetscViewerVTKOpen(petsclib, MPI.COMM_WORLD, "solution.vtu",
                            LibPETSc.FILE_MODE_WRITE, viewer)

# View DM-based solution
# LibPETSc.DMView(petsclib, dm, viewer[])
# LibPETSc.VecView(petsclib, solution, viewer[])

LibPETSc.PetscViewerDestroy(petsclib, viewer)

# Finalize PETSc and MPI
PETSc.finalize(petsclib)
MPI.Finalize()

HDF5 Output

# Create HDF5 viewer for hierarchical data
viewer = Ref{LibPETSc.PetscViewer}()
LibPETSc.PetscViewerHDF5Open(petsclib, MPI.COMM_WORLD, "data.h5",
                             LibPETSc.FILE_MODE_WRITE, viewer)

# Organize data in groups
LibPETSc.PetscViewerHDF5PushGroup(petsclib, viewer[], "/timestep_001")
# LibPETSc.VecView(petsclib, vec, viewer[])
LibPETSc.PetscViewerHDF5PopGroup(petsclib, viewer[])

LibPETSc.PetscViewerDestroy(petsclib, viewer)

# Finalize PETSc and MPI
PETSc.finalize(petsclib)
MPI.Finalize()

Standard Viewers

PETSc provides predefined viewers:

# Standard output
LibPETSc.PETSC_VIEWER_STDOUT_SELF(petsclib)
LibPETSc.PETSC_VIEWER_STDOUT_WORLD(petsclib)

# Standard error
LibPETSc.PETSC_VIEWER_STDERR_SELF(petsclib)
LibPETSc.PETSC_VIEWER_STDERR_WORLD(petsclib)

# Example: view to stdout
# LibPETSc.VecView(petsclib, vec, LibPETSc.PETSC_VIEWER_STDOUT_WORLD(petsclib))

Format Options

Control output detail with PetscViewerPushFormat:

  • PETSCVIEWERDEFAULT: Standard format
  • PETSCVIEWERASCII_MATLAB: MATLAB-compatible format
  • PETSCVIEWERASCII_DENSE: Dense matrix format
  • PETSCVIEWERASCII_INFO: Summary information only
  • PETSCVIEWERASCIIINFODETAIL: Detailed information

Draw Viewer (Graphics)

For interactive 2D visualization:

# Create draw viewer (X-window)
viewer = Ref{LibPETSc.PetscViewer}()
LibPETSc.PetscViewerDrawOpen(petsclib, LibPETSc.PETSC_COMM_SELF, C_NULL, "Plot", 
                              0, 0, 600, 600, viewer)

# View vector as bar chart
# LibPETSc.VecView(petsclib, vec, viewer[])

# View matrix structure
# LibPETSc.MatView(petsclib, mat, viewer[])

LibPETSc.PetscViewerDestroy(petsclib, viewer)

# Finalize PETSc and MPI
PETSc.finalize(petsclib)
MPI.Finalize()

Socket Viewer (MATLAB/Python)

Stream data to external tools:

# Create socket viewer
viewer = Ref{LibPETSc.PetscViewer}()
LibPETSc.PetscViewerSocketOpen(petsclib, MPI.COMM_WORLD, "localhost", 5000, viewer)

# Send data
# LibPETSc.VecView(petsclib, vec, viewer[])

LibPETSc.PetscViewerDestroy(petsclib, viewer)

# Finalize PETSc and MPI
PETSc.finalize(petsclib)
MPI.Finalize()

Monitoring Convergence

Viewers are used with KSP/SNES monitors:

# Monitor KSP residuals (automatic viewer to stdout)
# LibPETSc.KSPMonitorSet(petsclib, ksp, LibPETSc.KSPMonitorDefault, 
#                        LibPETSc.PETSC_VIEWER_STDOUT_SELF(petsclib), C_NULL)

Function Reference

PETSc.LibPETSc.PETSC_VIEWER_STDERR_SELFMethod
viewer::PetscViewer = PETSC_VIEWER_STDERR_SELF(petsclib::PetscLibType)

Get the default PETSc STDERR viewer for MPI.COMM_SELF

Not Collective

Input Parameter:

  • petsclib - the PETSc library instance

Output Parameter:

  • viewer - the viewer

Level: beginner

-seealso: PETSC_VIEWER_STDERR_WORLD, PetscViewerASCIIGetStderr()

source
PETSc.LibPETSc.PETSC_VIEWER_STDERR_WORLDMethod
viewer::PetscViewer = PETSC_VIEWER_STDERR_WORLD(petsclib::PetscLibType)

Get the default PETSc STDERR viewer for MPI.COMM_WORLD

Collective on MPI.COMM_WORLD

Input Parameter:

  • petsclib - the PETSc library instance

Output Parameter:

  • viewer - the viewer

Level: beginner

-seealso: PETSC_VIEWER_STDERR_SELF, PetscViewerASCIIGetStderr()

source
PETSc.LibPETSc.PETSC_VIEWER_STDOUT_SELFMethod
viewer::PetscViewer = PETSC_VIEWER_STDOUT_SELF(petsclib::PetscLibType)

Get the default PETSc STDOUT viewer for MPI.COMM_SELF

Not Collective

Input Parameter:

  • petsclib - the PETSc library instance

Output Parameter:

  • viewer - the viewer

Level: beginner

-seealso: PETSC_VIEWER_STDOUT_WORLD, PetscViewerASCIIGetStdout()

source
PETSc.LibPETSc.PETSC_VIEWER_STDOUT_WORLDMethod
viewer::PetscViewer = PETSC_VIEWER_STDOUT_WORLD(petsclib::PetscLibType)

Get the default PETSc STDOUT viewer for MPI.COMM_WORLD

Collective on MPI.COMM_WORLD

Input Parameter:

  • petsclib - the PETSc library instance

Output Parameter:

  • viewer - the viewer

Level: beginner

-seealso: PETSC_VIEWER_STDOUT_SELF, PetscViewerASCIIGetStdout()

source
PETSc.LibPETSc.PetscViewerADIOSOpenMethod
PetscViewerADIOSOpen(petsclib::PetscLibType,comm::MPI_Comm, name::String, type::PetscFileMode, adiosv::PetscViewer)

Opens a file for ADIOS input/output.

Collective

Input Parameters:

  • comm - MPI communicator
  • name - name of file
  • type - type of file

-seealso: PetscViewerASCIIOpen(), PetscViewerPushFormat(), PetscViewerDestroy(), PetscViewerHDF5Open(), VecView(), MatView(), VecLoad(), PetscViewerSetType(), PetscViewerFileSetMode(), PetscViewerFileSetName() MatLoad(), PetscFileMode, PetscViewer

External Links

source
PETSc.LibPETSc.PetscViewerASCIIAddTabMethod
PetscViewerASCIIAddTab(petsclib::PetscLibType,viewer::PetscViewer, tabs::PetscInt)

Add to the number of times a PETSCVIEWERASCII viewer tabs before printing

Not Collective, but only first processor in set has any effect; No Fortran Support

Input Parameters:

  • viewer - obtained with PetscViewerASCIIOpen()
  • tabs - number of tabs

Level: developer

-seealso: , PETSCVIEWERASCII, PetscPrintf(), PetscSynchronizedPrintf(), PetscViewerASCIIPrintf(), PetscViewerASCIIPopTab(), PetscViewerASCIISynchronizedPrintf(), PetscViewerASCIIOpen(), PetscViewerCreate(), PetscViewerDestroy(), PetscViewerSetType(), PetscViewerASCIIGetPointer(), PetscViewerASCIIPushTab()

External Links

source
PETSc.LibPETSc.PetscViewerASCIIGetPointerMethod
PetscViewerASCIIGetPointer(petsclib::PetscLibType,viewer::PetscViewer, fd::Libc.FILE)

Extracts the file pointer from an ASCII PetscViewer.

Not Collective, depending on the viewer the value may be meaningless except for process 0 of the viewer; No Fortran Support

Input Parameter:

  • viewer - PetscViewer context, obtained from PetscViewerASCIIOpen()

Output Parameter:

  • fd - file pointer

Level: intermediate

-seealso: , PETSCVIEWERASCII, PetscViewerASCIIOpen(), PetscViewerDestroy(), PetscViewerSetType(), PetscViewerCreate(), PetscViewerASCIIPrintf(), PetscViewerASCIISynchronizedPrintf(), PetscViewerFlush()

External Links

source
PETSc.LibPETSc.PetscViewerASCIIGetStderrMethod
PetscViewerASCIIGetStderr(petsclib::PetscLibType,comm::MPI_Comm, viewer::PetscViewer)

Creates a PETSCVIEWERASCII PetscViewer shared by all MPI processes in a communicator that prints to stderr. Error returning version of PETSC_VIEWER_STDERR_()

Collective

Input Parameter:

  • comm - the MPI communicator to share the PetscViewer

Output Parameter:

  • viewer - the viewer

Level: beginner

-seealso: , PetscViewerASCIIGetStdout(), PETSC_VIEWER_DRAW_(), PetscViewerASCIIOpen(), PETSC_VIEWER_STDERR_, PETSC_VIEWER_STDERR_WORLD, PETSC_VIEWER_STDERR_SELF

External Links

source
PETSc.LibPETSc.PetscViewerASCIIGetStdoutMethod
PetscViewerASCIIGetStdout(petsclib::PetscLibType,comm::MPI_Comm, viewer::PetscViewer)

Creates a PETSCVIEWERASCII PetscViewer shared by all processes in a communicator that prints to stdout. Error returning version of PETSC_VIEWER_STDOUT_()

Collective

Input Parameter:

  • comm - the MPI communicator to share the PetscViewer

Output Parameter:

  • viewer - the viewer

Level: beginner

-seealso: , PetscViewerASCIIGetStderr(), PETSC_VIEWER_DRAW_(), PetscViewerASCIIOpen(), PETSC_VIEWER_STDERR_, PETSC_VIEWER_STDOUT_WORLD, PETSC_VIEWER_STDOUT_SELF

External Links

source
PETSc.LibPETSc.PetscViewerASCIIGetTabMethod
tabs::PetscInt = PetscViewerASCIIGetTab(petsclib::PetscLibType,viewer::PetscViewer)

Return the number of tabs used by PetscViewer.

Not Collective, meaningful on first processor only; No Fortran Support

Input Parameter:

  • viewer - obtained with PetscViewerASCIIOpen()

Output Parameter:

  • tabs - number of tabs

Level: developer

-seealso: , PETSCVIEWERASCII, PetscPrintf(), PetscSynchronizedPrintf(), PetscViewerASCIIPrintf(), PetscViewerASCIISetTab(), PetscViewerASCIIPopTab(), PetscViewerASCIISynchronizedPrintf(), PetscViewerASCIIOpen(), PetscViewerCreate(), PetscViewerDestroy(), PetscViewerSetType(), PetscViewerASCIIGetPointer(), PetscViewerASCIIPushTab()

External Links

source
PETSc.LibPETSc.PetscViewerASCIIOpenMethod
PetscViewerASCIIOpen(petsclib::PetscLibType,comm::MPI_Comm, name::String, viewer::PetscViewer)

Opens an ASCII file for writing as a PETSCVIEWERASCII PetscViewer.

Collective

Input Parameters:

  • comm - the communicator
  • name - the file name

Output Parameter:

  • viewer - the PetscViewer to use with the specified file

Level: beginner

-seealso: , MatView(), VecView(), PetscViewerDestroy(), PetscViewerBinaryOpen(), PetscViewerASCIIRead(), PETSCVIEWERASCII PetscViewerASCIIGetPointer(), PetscViewerPushFormat(), PETSC_VIEWER_STDOUT_, PETSC_VIEWER_STDERR_, PETSC_VIEWER_STDOUT_WORLD, PETSC_VIEWER_STDOUT_SELF, PetscViewerASCIIGetStdout(), PetscViewerASCIIGetStderr()

External Links

source
PETSc.LibPETSc.PetscViewerASCIIOpenWithFILEMethod
PetscViewerASCIIOpenWithFILE(petsclib::PetscLibType,comm::MPI_Comm, fd::Libc.FILE, viewer::PetscViewer)

Given an open file creates an PETSCVIEWERASCII viewer that prints to it.

Collective

Input Parameters:

  • comm - the communicator
  • fd - the FILE pointer

Output Parameter:

  • viewer - the PetscViewer to use with the specified file

Level: beginner

-seealso: , MatView(), VecView(), PetscViewerDestroy(), PetscViewerBinaryOpen(), PetscViewerASCIIOpenWithFileUnit(), PetscViewerASCIIGetPointer(), PetscViewerPushFormat(), PETSC_VIEWER_STDOUT_, PETSC_VIEWER_STDERR_, PETSC_VIEWER_STDOUT_WORLD, PETSC_VIEWER_STDOUT_SELF, PetscViewerASCIIOpen(), PetscViewerASCIISetFILE(), PETSCVIEWERASCII

External Links

source
PETSc.LibPETSc.PetscViewerASCIIPopSynchronizedMethod
PetscViewerASCIIPopSynchronized(petsclib::PetscLibType,viewer::PetscViewer)

Undoes most recent PetscViewerASCIIPushSynchronized() for this viewer

Collective

Input Parameter:

  • viewer - obtained with PetscViewerASCIIOpen()

Level: intermediate

-seealso: , PetscViewerASCIIPushSynchronized(), PetscViewerASCIISynchronizedPrintf(), PetscViewerFlush(), PetscSynchronizedPrintf(), PetscViewerASCIIPrintf(), PetscViewerASCIIOpen(), PetscViewerCreate(), PetscViewerDestroy(), PetscViewerSetType()

External Links

source
PETSc.LibPETSc.PetscViewerASCIIPopTabMethod
PetscViewerASCIIPopTab(petsclib::PetscLibType,viewer::PetscViewer)

Removes one tab from the amount that PetscViewerASCIIPrintf() lines are tabbed that was provided by PetscViewerASCIIPushTab()

Not Collective, but only first MPI rank in the viewer has any effect; No Fortran Support

Input Parameter:

  • viewer - obtained with PetscViewerASCIIOpen()

Level: developer

-seealso: , PetscPrintf(), PetscSynchronizedPrintf(), PetscViewerASCIIPrintf(), PetscViewerASCIIPushTab(), PetscViewerASCIISynchronizedPrintf(), PetscViewerASCIIOpen(), PetscViewerCreate(), PetscViewerDestroy(), PetscViewerSetType(), PetscViewerASCIIGetPointer()

External Links

source
PETSc.LibPETSc.PetscViewerASCIIPushSynchronizedMethod
PetscViewerASCIIPushSynchronized(petsclib::PetscLibType,viewer::PetscViewer)

Allows calls to PetscViewerASCIISynchronizedPrintf() for this viewer

Collective

Input Parameter:

  • viewer - obtained with PetscViewerASCIIOpen()

Level: intermediate

-seealso: , PetscViewerASCIISynchronizedPrintf(), PetscViewerFlush(), PetscViewerASCIIPopSynchronized(), PetscSynchronizedPrintf(), PetscViewerASCIIPrintf(), PetscViewerASCIIOpen(), PetscViewerCreate(), PetscViewerDestroy(), PetscViewerSetType()

External Links

source
PETSc.LibPETSc.PetscViewerASCIIPushTabMethod
PetscViewerASCIIPushTab(petsclib::PetscLibType,viewer::PetscViewer)

Adds one more tab to the amount that PetscViewerASCIIPrintf() lines are tabbed.

Not Collective, but only first MPI rank in the viewer has any effect; No Fortran Support

Input Parameter:

  • viewer - obtained with PetscViewerASCIIOpen()

Level: developer

-seealso: , PetscPrintf(), PetscSynchronizedPrintf(), PetscViewerASCIIPrintf(), PetscViewerASCIIPopTab(), PetscViewerASCIISynchronizedPrintf(), PetscViewerASCIIOpen(), PetscViewerCreate(), PetscViewerDestroy(), PetscViewerSetType(), PetscViewerASCIIGetPointer()

External Links

source
PETSc.LibPETSc.PetscViewerASCIIReadMethod
count::PetscInt = PetscViewerASCIIRead(petsclib::PetscLibType,viewer::PetscViewer, data::Cvoid, num::PetscInt, dtype::PetscDataType)

Reads from a PETSCVIEWERASCII file

Only MPI rank 0 in the PetscViewer may call this

Input Parameters:

  • viewer - the PETSCVIEWERASCII viewer
  • data - location to write the data, treated as an array of type indicated by datatype
  • num - number of items of data to read
  • dtype - type of data to read

Output Parameter:

  • count - number of items of data actually read, or NULL

Level: beginner

-seealso: , PetscViewerASCIIOpen(), PetscViewerPushFormat(), PetscViewerDestroy(), PetscViewerCreate(), PetscViewerFileSetMode(), PetscViewerFileSetName() VecView(), MatView(), VecLoad(), MatLoad(), PetscViewerBinaryGetDescriptor(), PetscViewerBinaryGetInfoPointer(), PetscFileMode, PetscViewer, PetscViewerBinaryRead()

External Links

source
PETSc.LibPETSc.PetscViewerASCIISetFILEMethod
PetscViewerASCIISetFILE(petsclib::PetscLibType,viewer::PetscViewer, fd::Libc.FILE)

Given an open file sets the PETSCVIEWERASCII viewer to use the file for output

Not Collective

Input Parameters:

  • viewer - the PetscViewer to use with the specified file
  • fd - the FILE pointer

Level: beginner

-seealso: MatView(), VecView(), PetscViewerDestroy(), PetscViewerBinaryOpen(), PetscViewerASCIISetFileUnit(), PetscViewerASCIIGetPointer(), PetscViewerPushFormat(), PETSC_VIEWER_STDOUT_, PETSC_VIEWER_STDERR_, PETSC_VIEWER_STDOUT_WORLD, PETSC_VIEWER_STDOUT_SELF, PetscViewerASCIIOpen(), PetscViewerASCIIOpenWithFILE(), PETSCVIEWERASCII

External Links

source
PETSc.LibPETSc.PetscViewerASCIISetTabMethod
PetscViewerASCIISetTab(petsclib::PetscLibType,viewer::PetscViewer, tabs::PetscInt)

Causes PetscViewer to tab in a number of times before printing

Not Collective, but only first processor in set has any effect; No Fortran Support

Input Parameters:

  • viewer - obtained with PetscViewerASCIIOpen()
  • tabs - number of tabs

Level: developer

-seealso: , PETSCVIEWERASCII, PetscPrintf(), PetscSynchronizedPrintf(), PetscViewerASCIIPrintf(), PetscViewerASCIIGetTab(), PetscViewerASCIIPopTab(), PetscViewerASCIISynchronizedPrintf(), PetscViewerASCIIOpen(), PetscViewerCreate(), PetscViewerDestroy(), PetscViewerSetType(), PetscViewerASCIIGetPointer(), PetscViewerASCIIPushTab()

External Links

source
PETSc.LibPETSc.PetscViewerASCIISubtractTabMethod
PetscViewerASCIISubtractTab(petsclib::PetscLibType,viewer::PetscViewer, tabs::PetscInt)

Subtracts from the number of times a PETSCVIEWERASCII viewer tabs before printing

Not Collective, but only first processor in set has any effect; No Fortran Support

Input Parameters:

  • viewer - obtained with PetscViewerASCIIOpen()
  • tabs - number of tabs

Level: developer

-seealso: , PETSCVIEWERASCII, PetscPrintf(), PetscSynchronizedPrintf(), PetscViewerASCIIPrintf(), PetscViewerASCIIPopTab(), PetscViewerASCIISynchronizedPrintf(), PetscViewerASCIIOpen(), PetscViewerCreate(), PetscViewerDestroy(), PetscViewerSetType(), PetscViewerASCIIGetPointer(), PetscViewerASCIIPushTab()

External Links

source
PETSc.LibPETSc.PetscViewerASCIIUseTabsMethod
PetscViewerASCIIUseTabs(petsclib::PetscLibType,viewer::PetscViewer, flg::PetscBool)

Turns on or off the use of tabs with the PETSCVIEWERASCII PetscViewer

Not Collective, but only first MPI rank in the viewer has any effect; No Fortran Support

Input Parameters:

  • viewer - obtained with PetscViewerASCIIOpen()
  • flg - PETSC_TRUE or PETSC_FALSE

Level: developer

-seealso: , PetscPrintf(), PetscSynchronizedPrintf(), PetscViewerASCIIPrintf(), PetscViewerASCIIPopTab(), PetscViewerASCIISynchronizedPrintf(), PetscViewerASCIIPushTab(), PetscViewerASCIIOpen(), PetscViewerCreate(), PetscViewerDestroy(), PetscViewerSetType(), PetscViewerASCIIGetPointer()

External Links

source
PETSc.LibPETSc.PetscViewerAndFormatCreateMethod
vf::PetscViewerAndFormat = PetscViewerAndFormatCreate(petsclib::PetscLibType,viewer::PetscViewer, format::PetscViewerFormat)

Creates a PetscViewerAndFormat struct.

Collective

Input Parameters:

  • viewer - the viewer
  • format - the format

Output Parameter:

  • vf - viewer and format object

Level: developer

-seealso: , PetscViewer, PetscViewerAndFormat, PetscViewerFormat, PetscViewerSocketOpen(), PetscViewerASCIIOpen(), PetscViewerCreate(), PetscViewerDrawOpen(), PetscViewerAndFormatDestroy()

External Links

source
PETSc.LibPETSc.PetscViewerAndFormatDestroyMethod
PetscViewerAndFormatDestroy(petsclib::PetscLibType,vf::PetscViewerAndFormat)

Destroys a PetscViewerAndFormat struct created with PetscViewerAndFormatCreate()

Collective

Input Parameter:

  • vf - the PetscViewerAndFormat to be destroyed.

Level: developer

-seealso: , PetscViewer, PetscViewerAndFormat, PetscViewerFormat, PetscViewerAndFormatCreate(), PetscViewerSocketOpen(), PetscViewerASCIIOpen(), PetscViewerCreate(), PetscViewerDrawOpen()

External Links

source
PETSc.LibPETSc.PetscViewerAppendOptionsPrefixMethod
PetscViewerAppendOptionsPrefix(petsclib::PetscLibType,viewer::PetscViewer, prefix::String)

Appends to the prefix used for searching for PetscViewer options in the database during PetscViewerSetFromOptions().

Logically Collective

Input Parameters:

  • viewer - the PetscViewer context
  • prefix - the prefix to prepend to all option names

Level: advanced

-seealso: , PetscViewer, PetscViewerGetOptionsPrefix(), PetscViewerSetOptionsPrefix()

External Links

source
PETSc.LibPETSc.PetscViewerBinaryAddMPIIOOffsetMethod
PetscViewerBinaryAddMPIIOOffset(petsclib::PetscLibType,viewer::PetscViewer, off::MPI_Offset)

Adds to the current global offset

Logically Collective; No Fortran Support

Input Parameters:

  • viewer - PetscViewer context, obtained from PetscViewerBinaryOpen()
  • off - the addition to the global offset

Level: advanced

-seealso: , PETSCVIEWERBINARY, PetscViewerBinaryOpen(), PetscViewerBinaryGetInfoPointer(), PetscViewerBinaryGetUseMPIIO(), PetscViewerBinarySetUseMPIIO(), PetscViewerBinaryGetMPIIOOffset()

External Links

source
PETSc.LibPETSc.PetscViewerBinaryGetDescriptorMethod
PetscViewerBinaryGetDescriptor(petsclib::PetscLibType,viewer::PetscViewer, fdes::Cint)

Extracts the file descriptor from a PetscViewer of PetscViewerType PETSCVIEWERBINARY.

Collective because it may trigger a PetscViewerSetUp() call; No Fortran Support

Input Parameter:

  • viewer - PetscViewer context, obtained from PetscViewerBinaryOpen()

Output Parameter:

  • fdes - file descriptor

Level: advanced

-seealso: , PETSCVIEWERBINARY, PetscViewerBinaryOpen(), PetscViewerBinaryGetInfoPointer()

External Links

source
PETSc.LibPETSc.PetscViewerBinaryGetFlowControlMethod
fc::PetscInt = PetscViewerBinaryGetFlowControl(petsclib::PetscLibType,viewer::PetscViewer)

Returns how many messages are allowed to be outstanding at the same time during parallel IO reads/writes

Not Collective

Input Parameter:

  • viewer - PetscViewer context, obtained from PetscViewerBinaryOpen()

Output Parameter:

  • fc - the number of messages

Level: advanced

-seealso: , PETSCVIEWERBINARY, PetscViewerBinaryOpen(), PetscViewerBinaryGetInfoPointer(), PetscViewerBinarySetFlowControl()

External Links

source
PETSc.LibPETSc.PetscViewerBinaryGetInfoPointerMethod
PetscViewerBinaryGetInfoPointer(petsclib::PetscLibType,viewer::PetscViewer, file::Libc.FILE)

Extracts the file pointer for the ASCII .info file associated with a binary file.

Not Collective; No Fortran Support

Input Parameter:

  • viewer - PetscViewer context, obtained from PetscViewerBinaryOpen()

Output Parameter:

  • file - file pointer Always returns NULL if not a binary viewer

Level: advanced

-seealso: , PETSCVIEWERBINARY, PetscViewerBinaryOpen(), PetscViewerBinaryGetDescriptor(), PetscViewerBinaryGetSkipInfo(), PetscViewerBinarySetSkipInfo()

External Links

source
PETSc.LibPETSc.PetscViewerBinaryGetMPIIODescriptorMethod
PetscViewerBinaryGetMPIIODescriptor(petsclib::PetscLibType,viewer::PetscViewer, fdes::MPI_File)

Extracts the MPI IO file descriptor from a PetscViewer.

Not Collective; No Fortran Support

Input Parameter:

  • viewer - PetscViewer context, obtained from PetscViewerBinaryOpen()

Output Parameter:

  • fdes - file descriptor

Level: advanced

-seealso: , PETSCVIEWERBINARY, PetscViewerBinaryOpen(), PetscViewerBinaryGetInfoPointer(), PetscViewerBinaryGetUseMPIIO(), PetscViewerBinarySetUseMPIIO(), PetscViewerBinaryGetMPIIOOffset()

External Links

source
PETSc.LibPETSc.PetscViewerBinaryGetMPIIOOffsetMethod
PetscViewerBinaryGetMPIIOOffset(petsclib::PetscLibType,viewer::PetscViewer, off::MPI_Offset)

Gets the current global offset that should be passed to MPI_File_set_view() or MPI_File_{write|read}_at[_all]()

Not Collective; No Fortran Support

Input Parameter:

  • viewer - PetscViewer context, obtained from PetscViewerBinaryOpen()

Output Parameter:

  • off - the current global offset

Level: advanced

-seealso: , PETSCVIEWERBINARY, PetscViewerBinaryOpen(), PetscViewerBinaryGetInfoPointer(), PetscViewerBinaryGetUseMPIIO(), PetscViewerBinarySetUseMPIIO(), PetscViewerBinaryAddMPIIOOffset()

External Links

source
PETSc.LibPETSc.PetscViewerBinaryGetSkipHeaderMethod
skip::PetscBool = PetscViewerBinaryGetSkipHeader(petsclib::PetscLibType,viewer::PetscViewer)

checks whether to write a header with size information on output, or just raw data

Not Collective

Input Parameter:

  • viewer - PetscViewer context, obtained from PetscViewerBinaryOpen()

Output Parameter:

  • skip - PETSC_TRUE means do not write header

Level: advanced

-seealso: , PETSCVIEWERBINARY, PetscViewerBinaryOpen(), PetscViewerBinaryGetDescriptor(), PetscViewerBinarySkipInfo(), PetscViewerBinarySetSkipHeader()

External Links

source
PETSc.LibPETSc.PetscViewerBinaryGetSkipInfoMethod
skip::PetscBool = PetscViewerBinaryGetSkipInfo(petsclib::PetscLibType,viewer::PetscViewer)

check if viewer wrote a .info file

Not Collective

Input Parameter:

  • viewer - PetscViewer context, obtained from PetscViewerBinaryOpen()

Output Parameter:

  • skip - PETSC_TRUE implies the .info file was not generated

Level: advanced

-seealso: , PETSCVIEWERBINARY, PetscViewerBinaryOpen(), PetscViewerBinaryGetDescriptor(), PetscViewerBinarySetSkipOptions(), PetscViewerBinarySetSkipInfo(), PetscViewerBinaryGetInfoPointer()

External Links

source
PETSc.LibPETSc.PetscViewerBinaryGetSkipOptionsMethod
skip::PetscBool = PetscViewerBinaryGetSkipOptions(petsclib::PetscLibType,viewer::PetscViewer)

checks if viewer uses the PETSc options database when loading objects

Not Collective

Input Parameter:

  • viewer - PetscViewer context, obtained from PetscViewerBinaryOpen()

Output Parameter:

  • skip - PETSC_TRUE means do not use

Level: advanced

-seealso: , PETSCVIEWERBINARY, PetscViewerBinaryOpen(), PetscViewerBinaryGetDescriptor(), PetscViewerBinarySkipInfo(), PetscViewerBinarySetSkipOptions()

External Links

source
PETSc.LibPETSc.PetscViewerBinaryGetUseMPIIOMethod
use::PetscBool = PetscViewerBinaryGetUseMPIIO(petsclib::PetscLibType,viewer::PetscViewer)

Returns PETSC_TRUE if the binary viewer uses MPI

Not Collective

Input Parameter:

  • viewer - PetscViewer context, obtained from PetscViewerBinaryOpen(); must be a PETSCVIEWERBINARY

Output Parameter:

  • use - PETSC_TRUE if MPI-IO is being used

Level: advanced

-seealso: , PETSCVIEWERBINARY, PetscViewerBinaryOpen(), PetscViewerBinaryGetInfoPointer(), PetscViewerBinarySetUseMPIIO(), PetscViewerBinaryGetMPIIOOffset()

External Links

source
PETSc.LibPETSc.PetscViewerBinaryOpenMethod
PetscViewerBinaryOpen(petsclib::PetscLibType,comm::MPI_Comm, name::String, mode::PetscFileMode, viewer::PetscViewer)

Opens a file for binary input/output.

Collective

Input Parameters:

  • comm - MPI communicator
  • name - name of file
  • mode - open mode of file

-seealso: , PETSCVIEWERBINARY, PetscViewerASCIIOpen(), PetscViewerPushFormat(), PetscViewerDestroy(), VecView(), MatView(), VecLoad(), MatLoad(), PetscViewerBinaryGetDescriptor(), PetscViewerBinaryGetInfoPointer(), PetscFileMode, PetscViewer, PetscViewerBinaryRead(), PetscViewerBinarySetUseMPIIO(), PetscViewerBinaryGetUseMPIIO(), PetscViewerBinaryGetMPIIOOffset()

External Links

source
PETSc.LibPETSc.PetscViewerBinaryReadMethod
count::PetscInt = PetscViewerBinaryRead(petsclib::PetscLibType,viewer::PetscViewer, data::Cvoid, num::PetscInt, dtype::PetscDataType)

Reads from a binary file, all processors get the same result

Collective; No Fortran Support

Input Parameters:

  • viewer - the PETSCVIEWERBINARY viewer
  • num - number of items of data to read
  • dtype - type of data to read

Output Parameters:

  • data - location of the read data, treated as an array of the type indicated by dtype
  • count - number of items of data actually read, or NULL.

Level: beginner

-seealso: , PETSCVIEWERBINARY, PetscViewerASCIIOpen(), PetscViewerPushFormat(), PetscViewerDestroy(), VecView(), MatView(), VecLoad(), MatLoad(), PetscViewerBinaryGetDescriptor(), PetscViewerBinaryGetInfoPointer(), PetscFileMode, PetscViewer

External Links

source
PETSc.LibPETSc.PetscViewerBinaryReadAllMethod
PetscViewerBinaryReadAll(petsclib::PetscLibType,viewer::PetscViewer, data::Cvoid, count::PetscCount, start::PetscCount, total::PetscCount, dtype::PetscDataType)

reads from a binary file from all MPI processes, each rank receives its own portion of the data

Collective; No Fortran Support

Input Parameters:

  • viewer - the PETSCVIEWERBINARY viewer
  • count - local number of items of data to read
  • start - local start, can be PETSC_DETERMINE
  • total - global number of items of data to read, can be PETSC_DETERMINE
  • dtype - type of data to read

Output Parameter:

  • data - location of data, treated as an array of type indicated by dtype

Level: advanced

-seealso: , PETSCVIEWERBINARY, PetscViewerBinaryOpen(), PetscViewerBinarySetUseMPIIO(), PetscViewerBinaryRead(), PetscViewerBinaryWriteAll()

External Links

source
PETSc.LibPETSc.PetscViewerBinaryReadStringArrayMethod
PetscViewerBinaryReadStringArray(petsclib::PetscLibType,viewer::PetscViewer, data::Cchar)

reads a binary file an array of strings to all MPI processes

Collective; No Fortran Support

Input Parameter:

  • viewer - the PETSCVIEWERBINARY viewer

Output Parameter:

  • data - location of the array of strings

Level: intermediate

-seealso: , PETSCVIEWERBINARY, PetscViewerASCIIOpen(), PetscViewerPushFormat(), PetscViewerDestroy(), VecView(), MatView(), VecLoad(), MatLoad(), PetscViewerBinaryGetDescriptor(), PetscViewerBinaryGetInfoPointer(), PetscFileMode, PetscViewer, PetscViewerBinaryRead()

External Links

source
PETSc.LibPETSc.PetscViewerBinarySetFlowControlMethod
PetscViewerBinarySetFlowControl(petsclib::PetscLibType,viewer::PetscViewer, fc::PetscInt)

Sets how many messages are allowed to be outstanding at the same time during parallel IO reads/writes

Not Collective

Input Parameters:

  • viewer - PetscViewer context, obtained from PetscViewerBinaryOpen()
  • fc - the number of messages, defaults to 256 if this function was not called

Level: advanced

-seealso: , PETSCVIEWERBINARY, PetscViewerBinaryOpen(), PetscViewerBinaryGetInfoPointer(), PetscViewerBinaryGetFlowControl()

External Links

source
PETSc.LibPETSc.PetscViewerBinarySetSkipHeaderMethod
PetscViewerBinarySetSkipHeader(petsclib::PetscLibType,viewer::PetscViewer, skip::PetscBool)

do not write a header with size information on output, just raw data

Not Collective

Input Parameters:

  • viewer - PetscViewer context, obtained from PetscViewerBinaryOpen()
  • skip - PETSC_TRUE means do not write header

Options Database Key:

  • -viewer_binary_skip_header <true or false> - true means do not write header

Level: advanced

-seealso: , PETSCVIEWERBINARY, PetscViewerBinaryOpen(), PetscViewerBinaryGetDescriptor(), PetscViewerBinarySkipInfo(), PetscViewerBinaryGetSkipHeader()

External Links

source
PETSc.LibPETSc.PetscViewerBinarySetSkipInfoMethod
PetscViewerBinarySetSkipInfo(petsclib::PetscLibType,viewer::PetscViewer, skip::PetscBool)

Binary file will not have .info file created with it

Not Collective

Input Parameters:

  • viewer - PetscViewer context, obtained from PetscViewerCreate()
  • skip - PETSC_TRUE implies the .info file will not be generated

Options Database Key:

  • -viewer_binary_skip_info - true indicates do not generate .info file

Level: advanced

-seealso: , PETSCVIEWERBINARY, PetscViewerBinaryOpen(), PetscViewerBinaryGetDescriptor(), PetscViewerBinarySetSkipOptions(), PetscViewerBinaryGetSkipOptions(), PetscViewerBinaryGetSkipInfo(), PetscViewerBinaryGetInfoPointer()

External Links

source
PETSc.LibPETSc.PetscViewerBinarySetSkipOptionsMethod
PetscViewerBinarySetSkipOptions(petsclib::PetscLibType,viewer::PetscViewer, skip::PetscBool)

do not use values in the PETSc options database when loading objects

Not Collective

Input Parameters:

  • viewer - PetscViewer context, obtained from PetscViewerBinaryOpen()
  • skip - PETSC_TRUE means do not use the options from the options database

Options Database Key:

  • -viewer_binary_skip_options <true or false> - true means do not use the options from the options database

Level: advanced

-seealso: , PETSCVIEWERBINARY, PetscViewerBinaryOpen(), PetscViewerBinaryGetDescriptor(), PetscViewerBinarySkipInfo(), PetscViewerBinaryGetSkipOptions()

External Links

source
PETSc.LibPETSc.PetscViewerBinarySetUseMPIIOMethod
PetscViewerBinarySetUseMPIIO(petsclib::PetscLibType,viewer::PetscViewer, use::PetscBool)

Sets a binary viewer to use MPI before PetscViewerFileSetName()

Logically Collective

Input Parameters:

  • viewer - the PetscViewer; must be a PETSCVIEWERBINARY
  • use - PETSC_TRUE means MPI-IO will be used

Options Database Key:

  • -viewer_binary_mpiio - <true or false> flag for using MPI-IO

Level: advanced

-seealso: , PETSCVIEWERBINARY, PetscViewerFileSetMode(), PetscViewerCreate(), PetscViewerSetType(), PetscViewerBinaryOpen(), PetscViewerBinaryGetUseMPIIO()

External Links

source
PETSc.LibPETSc.PetscViewerBinarySkipInfoMethod
PetscViewerBinarySkipInfo(petsclib::PetscLibType,viewer::PetscViewer)

Binary file will not have .info file created with it

Not Collective

Input Parameter:

  • viewer - PetscViewer context, obtained from PetscViewerCreate()

Options Database Key:

  • -viewer_binary_skip_info - true indicates do not generate .info file

Level: advanced

-seealso: , PETSCVIEWERBINARY, PetscViewerBinaryOpen(), PetscViewerBinaryGetDescriptor(), PetscViewerBinarySetSkipOptions(), PetscViewerBinaryGetSkipOptions(), PetscViewerBinaryGetSkipInfo()

External Links

source
PETSc.LibPETSc.PetscViewerBinaryWriteMethod
PetscViewerBinaryWrite(petsclib::PetscLibType,viewer::PetscViewer, data::Cvoid, count::PetscInt, dtype::PetscDataType)

writes to a binary file, only from the first MPI rank

Collective; No Fortran Support

Input Parameters:

  • viewer - the PETSCVIEWERBINARY viewer
  • data - location of data, treated as an array of the type indicated by dtype
  • count - number of items of data to write
  • dtype - type of data to write

Level: beginner

-seealso: , PETSCVIEWERBINARY, PetscViewerASCIIOpen(), PetscViewerPushFormat(), PetscViewerDestroy(), VecView(), MatView(), VecLoad(), MatLoad(), PetscViewerBinaryGetDescriptor(), PetscDataType PetscViewerBinaryGetInfoPointer(), PetscFileMode, PetscViewer, PetscViewerBinaryRead()

External Links

source
PETSc.LibPETSc.PetscViewerBinaryWriteAllMethod
PetscViewerBinaryWriteAll(petsclib::PetscLibType,viewer::PetscViewer, data::Cvoid, count::PetscCount, start::PetscCount, total::PetscCount, dtype::PetscDataType)

writes to a binary file from all MPI processes, each rank writes its own portion of the data

Collective; No Fortran Support

Input Parameters:

  • viewer - the PETSCVIEWERBINARY viewer
  • data - location of data
  • count - local number of items of data to write, treated as an array of type indicated by dtype
  • start - local start, can be PETSC_DETERMINE
  • total - global number of items of data to write, can be PETSC_DETERMINE
  • dtype - type of data to write

Level: advanced

-seealso: , PETSCVIEWERBINARY, PetscViewerBinaryOpen(), PetscViewerBinarySetUseMPIIO(), PetscViewerBinaryReadAll()

External Links

source
PETSc.LibPETSc.PetscViewerBinaryWriteStringArrayMethod
PetscViewerBinaryWriteStringArray(petsclib::PetscLibType,viewer::PetscViewer, data::String)

writes to a binary file, only from the first MPI rank, an array of strings

Collective; No Fortran Support

Input Parameters:

  • viewer - the PETSCVIEWERBINARY viewer
  • data - location of the array of strings

Level: intermediate

-seealso: , PETSCVIEWERBINARY, PetscViewerASCIIOpen(), PetscViewerPushFormat(), PetscViewerDestroy(), VecView(), MatView(), VecLoad(), MatLoad(), PetscViewerBinaryGetDescriptor(), PetscViewerBinaryGetInfoPointer(), PetscFileMode, PetscViewer, PetscViewerBinaryRead()

External Links

source
PETSc.LibPETSc.PetscViewerCGNSGetSolutionIndexMethod
solution_id::PetscInt = PetscViewerCGNSGetSolutionIndex(petsclib::PetscLibType,viewer::PetscViewer)

Get index of solution

Not Collective

Input Parameter:

  • viewer - PETSCVIEWERCGNS PetscViewer for CGNS input/output to use with the specified file

Output Parameter:

  • solution_id - Index of the solution id

Level: intermediate

-seealso: PETSCVIEWERCGNS, PetscViewerCGNSSetSolutionIndex(), PetscViewerCGNSGetSolutionInfo()

External Links

source
PETSc.LibPETSc.PetscViewerCGNSGetSolutionIterationMethod
iteration::PetscInt,set::PetscBool = PetscViewerCGNSGetSolutionIteration(petsclib::PetscLibType,viewer::PetscViewer)

Gets the solution iteration for the FlowSolution of the viewer

Collective

Input Parameter:

  • viewer - PETSCVIEWERCGNS PetscViewer for CGNS input/output to use with the specified file

Output Parameters:

  • iteration - Solution iteration of the FlowSolution_t node
  • set - Whether the time data is in the file

Level: intermediate

-seealso: PETSCVIEWERCGNS, PetscViewer, PetscViewerCGNSGetSolutionTime(), PetscViewerCGNSSetSolutionIndex(), PetscViewerCGNSGetSolutionIndex(), PetscViewerCGNSGetSolutionName()

External Links

source
PETSc.LibPETSc.PetscViewerCGNSGetSolutionNameMethod
PetscViewerCGNSGetSolutionName(petsclib::PetscLibType,viewer::PetscViewer, name::String)

Gets name of FlowSolution of the viewer

Collective

Input Parameter:

  • viewer - PETSCVIEWERCGNS PetscViewer for CGNS input/output to use with the specified file

Output Parameter:

  • name - Name of the FlowSolution_t node corresponding to the solution index

Level: intermediate

-seealso: PETSCVIEWERCGNS, PetscViewer, PetscViewerCGNSSetSolutionIndex(), PetscViewerCGNSGetSolutionIndex(), PetscViewerCGNSGetSolutionTime()

External Links

source
PETSc.LibPETSc.PetscViewerCGNSGetSolutionTimeMethod
time::PetscReal,set::PetscBool = PetscViewerCGNSGetSolutionTime(petsclib::PetscLibType,viewer::PetscViewer)

Gets the solution time for the FlowSolution of the viewer

Collective

Input Parameter:

  • viewer - PETSCVIEWERCGNS PetscViewer for CGNS input/output to use with the specified file

Output Parameters:

  • time - Solution time of the FlowSolution_t node
  • set - Whether the time data is in the file

Level: intermediate

-seealso: PETSCVIEWERCGNS, PetscViewer, PetscViewerCGNSGetSolutionIteration(), PetscViewerCGNSSetSolutionIndex(), PetscViewerCGNSGetSolutionIndex(), PetscViewerCGNSGetSolutionName()

External Links

source
PETSc.LibPETSc.PetscViewerCGNSOpenMethod
PetscViewerCGNSOpen(petsclib::PetscLibType,comm::MPI_Comm, name::String, type::PetscFileMode, viewer::PetscViewer)

Opens a file for CGNS input/output.

Collective

Input Parameters:

  • comm - MPI communicator
  • name - name of file
  • type - type of file

-seealso: PETSCVIEWERCGNS, PetscViewer, PetscViewerPushFormat(), PetscViewerDestroy(), DMLoad(), PetscFileMode, PetscViewerSetType(), PetscViewerFileSetMode(), PetscViewerFileSetName()

External Links

source
PETSc.LibPETSc.PetscViewerCGNSSetSolutionIndexMethod
PetscViewerCGNSSetSolutionIndex(petsclib::PetscLibType,viewer::PetscViewer, solution_id::PetscInt)

Set index of solution

Not Collective

Input Parameters:

  • viewer - PETSCVIEWERCGNS PetscViewer for CGNS input/output to use with the specified file
  • solution_id - Index of the solution id, or -1 for the last solution on the file

Level: intermediate

-seealso: PETSCVIEWERCGNS, PetscViewerCGNSGetSolutionIndex(), PetscViewerCGNSGetSolutionInfo()

External Links

source
PETSc.LibPETSc.PetscViewerCheckReadableMethod
PetscViewerCheckReadable(petsclib::PetscLibType,viewer::PetscViewer)

Check whether the viewer can be read from, generates an error if not

Collective

Input Parameter:

  • viewer - the PetscViewer context

Level: intermediate

-seealso: , PetscViewer, PetscViewerReadable(), PetscViewerCheckWritable(), PetscViewerCreate(), PetscViewerFileSetMode(), PetscViewerFileSetType()

External Links

source
PETSc.LibPETSc.PetscViewerCheckWritableMethod
PetscViewerCheckWritable(petsclib::PetscLibType,viewer::PetscViewer)

Check whether the viewer can be written to, generates an error if not

Collective

Input Parameter:

  • viewer - the PetscViewer context

Level: intermediate

-seealso: , PetscViewer, PetscViewerWritable(), PetscViewerCheckReadable(), PetscViewerCreate(), PetscViewerFileSetMode(), PetscViewerFileSetType()

External Links

source
PETSc.LibPETSc.PetscViewerCreateMethod
inviewer::PetscViewer = PetscViewerCreate(petsclib::PetscLibType,comm::MPI_Comm)

Creates a viewing context. A PetscViewer represents a file, a graphical window, a Unix socket or a variety of other ways of viewing a PETSc object

Collective

Input Parameter:

  • comm - MPI communicator

Output Parameter:

  • inviewer - location to put the PetscViewer context

Level: advanced

-seealso: , PetscViewer, PetscViewerDestroy(), PetscViewerSetType(), PetscViewerType

External Links

source
PETSc.LibPETSc.PetscViewerDestroyMethod
PetscViewerDestroy(petsclib::PetscLibType,viewer::PetscViewer)

Destroys a PetscViewer.

Collective

Input Parameter:

  • viewer - the PetscViewer to be destroyed.

Level: beginner

-seealso: , PetscViewer, PetscViewerCreate(), PetscViewerSocketOpen(), PetscViewerASCIIOpen(), PetscViewerDrawOpen()

External Links

source
PETSc.LibPETSc.PetscViewerDrawBaseAddMethod
PetscViewerDrawBaseAdd(petsclib::PetscLibType,viewer::PetscViewer, windownumber::PetscInt)

add to the base integer that is added to the windownumber passed to PetscViewerDrawGetDraw()

Logically Collective

Input Parameters:

  • viewer - the PetscViewer (created with PetscViewerDrawOpen())
  • windownumber - how much to add to the base

Level: developer

-seealso: , PetscViewerDrawGetLG(), PetscViewerDrawGetAxis(), PetscViewerDrawOpen(), PetscViewerDrawGetDraw(), PetscViewerDrawBaseSet()

External Links

source
PETSc.LibPETSc.PetscViewerDrawBaseSetMethod
PetscViewerDrawBaseSet(petsclib::PetscLibType,viewer::PetscViewer, windownumber::PetscInt)

sets the base integer that is added to the windownumber passed to PetscViewerDrawGetDraw()

Logically Collective

Input Parameters:

  • viewer - the PetscViewer (created with PetscViewerDrawOpen())
  • windownumber - value to set the base

Level: developer

-seealso: , PetscViewerDrawGetLG(), PetscViewerDrawGetAxis(), PetscViewerDrawOpen(), PetscViewerDrawGetDraw(), PetscViewerDrawBaseAdd()

External Links

source
PETSc.LibPETSc.PetscViewerDrawClearMethod
PetscViewerDrawClear(petsclib::PetscLibType,viewer::PetscViewer)

Clears a PetscDraw graphic associated with a PetscViewer.

Not Collective

Input Parameter:

  • viewer - the PetscViewer

Level: intermediate

-seealso: , PETSCVIEWERDRAW, PetscViewerDrawOpen(), PetscViewerDrawGetDraw(),

External Links

source
PETSc.LibPETSc.PetscViewerDrawGetBoundsMethod
nbounds::PetscInt,bounds::Vector{PetscReal} = PetscViewerDrawGetBounds(petsclib::PetscLibType,viewer::PetscViewer)

gets the upper and lower bounds to be used in plotting set with PetscViewerDrawSetBounds()

Collective

Input Parameter:

  • viewer - the PetscViewer (created with PetscViewerDrawOpen())

Output Parameters:

  • nbounds - number of plots that can be made with this viewer, for example the dof passed to DMDACreate()
  • bounds - the actual bounds, the size of this is 2*nbounds, the values are stored in the order min F0, max F0, min F1, max F1, .....

Level: intermediate

-seealso: , PETSCVIEWERDRAW, PetscViewerDrawGetLG(), PetscViewerDrawGetAxis(), PetscViewerDrawOpen(), PetscViewerDrawSetBounds()

External Links

source
PETSc.LibPETSc.PetscViewerDrawGetDrawMethod
PetscViewerDrawGetDraw(petsclib::PetscLibType,viewer::PetscViewer, windownumber::PetscInt, draw::PetscDraw)

Returns PetscDraw object from PETSCVIEWERDRAW PetscViewer object. This PetscDraw object may then be used to perform graphics using PetscDraw commands.

Collective

Input Parameters:

  • viewer - the PetscViewer (created with PetscViewerDrawOpen() of type PETSCVIEWERDRAW)
  • windownumber - indicates which subwindow (usually 0) to obtain

Output Parameter:

  • draw - the draw object

Level: intermediate

-seealso: , PETSCVIEWERDRAW, PetscViewerDrawGetLG(), PetscViewerDrawGetAxis(), PetscViewerDrawOpen()

External Links

source
PETSc.LibPETSc.PetscViewerDrawGetDrawAxisMethod
PetscViewerDrawGetDrawAxis(petsclib::PetscLibType,viewer::PetscViewer, windownumber::PetscInt, drawaxis::PetscDrawAxis)

Returns a PetscDrawAxis object from a PetscViewer object of type PETSCVIEWERDRAW. This PetscDrawAxis object may then be used to perform graphics using PetscDrawAxis commands.

Collective

Input Parameters:

  • viewer - the PetscViewer (created with PetscViewerDrawOpen())
  • windownumber - indicates which subwindow (usually 0)

Output Parameter:

  • drawaxis - the draw axis object

Level: advanced

-seealso: , PetscViewerDrawGetDraw(), PetscViewerDrawGetLG(), PetscViewerDrawOpen()

External Links

source
PETSc.LibPETSc.PetscViewerDrawGetDrawLGMethod
PetscViewerDrawGetDrawLG(petsclib::PetscLibType,viewer::PetscViewer, windownumber::PetscInt, drawlg::PetscDrawLG)

Returns a PetscDrawLG object from PetscViewer object of type PETSCVIEWERDRAW. This PetscDrawLG object may then be used to perform graphics using PetscDrawLG commands.

Collective

Input Parameters:

  • viewer - the PetscViewer (created with PetscViewerDrawOpen())
  • windownumber - indicates which subwindow (usually 0)

Output Parameter:

  • drawlg - the draw line graph object

Level: intermediate

-seealso: , PetscDrawLG, PetscViewerDrawGetDraw(), PetscViewerDrawGetAxis(), PetscViewerDrawOpen()

External Links

source
PETSc.LibPETSc.PetscViewerDrawGetHoldMethod
hold::PetscBool = PetscViewerDrawGetHold(petsclib::PetscLibType,viewer::PetscViewer)

Checks if the PETSCVIEWERDRAW PetscViewer holds previous image when drawing new image

Not Collective

Input Parameter:

  • viewer - the PetscViewer

Output Parameter:

  • hold - indicates to hold or not

Level: intermediate

-seealso: , PETSCVIEWERDRAW, PetscViewerDrawOpen(), PetscViewerDrawGetDraw(),

External Links

source
PETSc.LibPETSc.PetscViewerDrawGetPauseMethod
pause::PetscReal = PetscViewerDrawGetPause(petsclib::PetscLibType,viewer::PetscViewer)

Gets the pause value (how long to pause before an image is changed) in the PETSCVIEWERDRAW PetscViewer

Not Collective

Input Parameter:

  • viewer - the PetscViewer

Output Parameter:

  • pause - the pause value

Level: intermediate

-seealso: , PETSCVIEWERDRAW, PetscViewerDrawOpen(), PetscViewerDrawGetDraw(),

External Links

source
PETSc.LibPETSc.PetscViewerDrawOpenMethod
PetscViewerDrawOpen(petsclib::PetscLibType,comm::MPI_Comm, display::String, title::String, x::Cint, y::Cint, w::Cint, h::Cint, viewer::PetscViewer)

Opens a PetscDraw window for use as a PetscViewer with type PETSCVIEWERDRAW.

Collective

Input Parameters:

  • comm - communicator that will share window
  • display - the X display on which to open, or NULL for the local machine
  • title - the title to put in the title bar, or NULL for no title
  • x - horizontal screen coordinate of the upper left corner of window, or use PETSC_DECIDE
  • y - vertical screen coordinate of the upper left corner of window, or use PETSC_DECIDE
  • w - window width in pixels, or may use PETSC_DECIDE or PETSC_DRAW_FULL_SIZE, PETSC_DRAW_HALF_SIZE,PETSC_DRAW_THIRD_SIZE, PETSC_DRAW_QUARTER_SIZE
  • h - window height in pixels, or may use PETSC_DECIDE or PETSC_DRAW_FULL_SIZE, PETSC_DRAW_HALF_SIZE,PETSC_DRAW_THIRD_SIZE, PETSC_DRAW_QUARTER_SIZE

Output Parameter:

  • viewer - the PetscViewer

Options Database Keys:

  • -draw_type - use x or null
  • -nox - Disables all x-windows output
  • -display <name> - Specifies name of machine for the X display
  • -geometry <x,y,w,h> - allows setting the window location and size
  • -draw_pause <pause> - Sets time (in seconds) that the

program pauses after PetscDrawPause() has been called (0 is default, -1 implies until user input).

Level: beginner

-seealso: , PETSCVIEWERDRAW, PetscDrawCreate(), PetscViewerDestroy(), PetscViewerDrawGetDraw(), PetscViewerCreate(), PETSC_VIEWER_DRAW_, PETSC_VIEWER_DRAW_WORLD, PETSC_VIEWER_DRAW_SELF

External Links

source
PETSc.LibPETSc.PetscViewerDrawSetBoundsMethod
PetscViewerDrawSetBounds(petsclib::PetscLibType,viewer::PetscViewer, nbounds::PetscInt, bounds::PetscReal)

sets the upper and lower bounds to be used in plotting in a PETSCVIEWERDRAW PetscViewer

Collective

Input Parameters:

  • viewer - the PetscViewer (created with PetscViewerDrawOpen())
  • nbounds - number of plots that can be made with this viewer, for example the dof passed to DMDACreate()
  • bounds - the actual bounds, the size of this is 2*nbounds, the values are stored in the order min F0, max F0, min F1, max F1, .....

Options Database Key:

  • -draw_bounds minF0,maxF0,minF1,maxF1 - the lower left and upper right bounds

Level: intermediate

-seealso: , PETSCVIEWERDRAW, PetscViewerDrawGetLG(), PetscViewerDrawGetAxis(), PetscViewerDrawOpen()

External Links

source
PETSc.LibPETSc.PetscViewerDrawSetHoldMethod
PetscViewerDrawSetHold(petsclib::PetscLibType,viewer::PetscViewer, hold::PetscBool)

Holds previous image when drawing new image in a PETSCVIEWERDRAW

Not Collective

Input Parameters:

  • viewer - the PetscViewer
  • hold - PETSC_TRUE indicates to hold the previous image

Level: intermediate

-seealso: , PETSCVIEWERDRAW, PetscViewerDrawOpen(), PetscViewerDrawGetDraw(),

External Links

source
PETSc.LibPETSc.PetscViewerDrawSetPauseMethod
PetscViewerDrawSetPause(petsclib::PetscLibType,viewer::PetscViewer, pause::PetscReal)

Sets a pause for each PetscDraw in the PETSCVIEWERDRAW PetscViewer

Not Collective

Input Parameters:

  • viewer - the PetscViewer
  • pause - the pause value

Level: intermediate

-seealso: , PETSCVIEWERDRAW, PetscViewerDrawOpen(), PetscViewerDrawGetDraw(),

External Links

source
PETSc.LibPETSc.PetscViewerExodusIIGetIdMethod
PetscViewerExodusIIGetId(petsclib::PetscLibType,viewer::PetscViewer, exoid::Cint)

Get the file id of the PETSCVIEWEREXODUSII file

Logically Collective

Input Parameter:

  • viewer - the PetscViewer

Output Parameter:

  • exoid - The ExodusII file id

Level: intermediate

-seealso: PETSCVIEWEREXODUSII, PetscViewer, PetscViewerFileSetMode(), PetscViewerCreate(), PetscViewerSetType(), PetscViewerBinaryOpen()

External Links

source
PETSc.LibPETSc.PetscViewerExodusIIGetNodalVariableMethod
PetscViewerExodusIIGetNodalVariable(petsclib::PetscLibType,viewer::PetscViewer, num::PetscExodusIIInt)

Gets the number of nodal variables in an ExodusII file

Collective

Input Parameters:

  • viewer - a PetscViewer of type PETSCVIEWEREXODUSII

Output Parameter:

  • num - the number variables in the ExodusII file

Level: intermediate

-seealso: PETSCVIEWEREXODUSII, PetscViewer, PetscViewerCreate(), PetscViewerDestroy(), PetscViewerExodusIIOpen(), PetscViewerSetType(), PetscViewerType, PetscViewerExodusIISetNodalVariable()

External Links

source
PETSc.LibPETSc.PetscViewerExodusIIGetNodalVariableIndexMethod
PetscViewerExodusIIGetNodalVariableIndex(petsclib::PetscLibType,viewer::PetscViewer, name::String, varIndex::PetscExodusIIInt)

return the location of a nodal variable in an ExodusII file given its name

Collective

Input Parameters:

  • viewer - a PetscViewer of type PETSCVIEWEREXODUSII
  • name - the name of the result

Output Parameter:

  • varIndex - the location of the variable in the exodus file or -1 if the variable is not found

Level: beginner

-seealso: PetscViewerExodusIISetNodalVariable(), PetscViewerExodusIIGetNodalVariable(), PetscViewerExodusIISetNodalVariableName(), PetscViewerExodusIISetNodalVariableNames(), PetscViewerExodusIIGetNodalVariableName(), PetscViewerExodusIIGetNodalVariableNames()

External Links

source
PETSc.LibPETSc.PetscViewerExodusIIGetNodalVariableNameMethod
PetscViewerExodusIIGetNodalVariableName(petsclib::PetscLibType,viewer::PetscViewer, idx::PetscExodusIIInt, name::String)

Gets the name of a nodal variable.

Collective;

Input Parameters:

  • viewer - a PetscViewer of type PETSCVIEWEREXODUSII
  • idx - the index for which you want to save the name

Output Parameter:

  • name - string array containing name characters

Level: intermediate

-seealso: PETSCVIEWEREXODUSII, PetscViewer, PetscViewerCreate(), PetscViewerDestroy(), PetscViewerExodusIIOpen(), PetscViewerSetType(), PetscViewerType, PetscViewerExodusIISetNodalVariableName()

External Links

source
PETSc.LibPETSc.PetscViewerExodusIIGetNodalVariableNamesMethod
PetscViewerExodusIIGetNodalVariableNames(petsclib::PetscLibType,viewer::PetscViewer, numVars::PetscExodusIIInt, varNames::String)

Gets the names of all nodal variables.

Collective; No Fortran Support

Input Parameters:

  • viewer - a PetscViewer of type PETSCVIEWEREXODUSII
  • numVars - the number of nodal variable names to retrieve

Output Parameter:

  • varNames - returns an array of char pointers where the nodal variable names are

Level: intermediate

-seealso: PETSCVIEWEREXODUSII, PetscViewer, PetscViewerCreate(), PetscViewerDestroy(), PetscViewerExodusIIOpen(), PetscViewerSetType(), PetscViewerType, PetscViewerExodusIISetNodalVariableNames()

External Links

source
PETSc.LibPETSc.PetscViewerExodusIIGetOrderMethod
PetscViewerExodusIIGetOrder(petsclib::PetscLibType,viewer::PetscViewer, order::PetscInt)

Get the elements order in the ExodusII file.

Collective

Input Parameters:

  • viewer - the PETSCVIEWEREXODUSII viewer
  • order - elements order

Output Parameter:

Level: beginner

-seealso: PETSCVIEWEREXODUSII, PetscViewer, PetscViewerExodusIIGetId(), PetscViewerExodusIISetOrder()

External Links

source
PETSc.LibPETSc.PetscViewerExodusIIGetZonalVariableMethod
PetscViewerExodusIIGetZonalVariable(petsclib::PetscLibType,viewer::PetscViewer, num::PetscExodusIIInt)

Gets the number of zonal variables in an ExodusII file

Collective

Input Parameters:

  • viewer - a PetscViewer of type PETSCVIEWEREXODUSII

Output Parameter:

  • num - the number variables in the ExodusII file

Level: intermediate

-seealso: PETSCVIEWEREXODUSII, PetscViewer, PetscViewerCreate(), PetscViewerDestroy(), PetscViewerExodusIIOpen(), PetscViewerSetType(), PetscViewerType, PetscViewerExodusIIsetZonalVariable()

External Links

source
PETSc.LibPETSc.PetscViewerExodusIIGetZonalVariableIndexMethod
PetscViewerExodusIIGetZonalVariableIndex(petsclib::PetscLibType,viewer::PetscViewer, name::String, varIndex::Cint)

return the location of a zonal variable in an ExodusII file given its name

Collective

Input Parameters:

  • viewer - a PetscViewer of type PETSCVIEWEREXODUSII
  • name - the name of the result

Output Parameter:

  • varIndex - the location of the variable in the exodus file or -1 if the variable is not found

Level: beginner

-seealso: PetscViewerExodusIISetNodalVariable(), PetscViewerExodusIIGetNodalVariable(), PetscViewerExodusIISetNodalVariableName(), PetscViewerExodusIISetNodalVariableNames(), PetscViewerExodusIIGetNodalVariableName(), PetscViewerExodusIIGetNodalVariableNames()

External Links

source
PETSc.LibPETSc.PetscViewerExodusIIGetZonalVariableNameMethod
PetscViewerExodusIIGetZonalVariableName(petsclib::PetscLibType,viewer::PetscViewer, idx::PetscExodusIIInt, name::String)

Gets the name of a zonal variable.

Collective;

Input Parameters:

  • viewer - a PetscViewer of type PETSCVIEWEREXODUSII
  • idx - the index for which you want to get the name

Output Parameter:

  • name - pointer to the string containing the name characters

Level: intermediate

-seealso: PETSCVIEWEREXODUSII, PetscViewer, PetscViewerCreate(), PetscViewerDestroy(), PetscViewerExodusIIOpen(), PetscViewerSetType(), PetscViewerType, PetscViewerExodusIISetZonalVariableName()

External Links

source
PETSc.LibPETSc.PetscViewerExodusIIGetZonalVariableNamesMethod
PetscViewerExodusIIGetZonalVariableNames(petsclib::PetscLibType,viewer::PetscViewer, numVars::PetscExodusIIInt, varNames::String)

Gets the names of all zonal variables.

Collective; No Fortran Support

Input Parameters:

  • viewer - a PetscViewer of type PETSCVIEWEREXODUSII
  • numVars - the number of zonal variable names to retrieve

Output Parameter:

  • varNames - returns an array of char pointers where the zonal variable names are

Level: intermediate

-seealso: PETSCVIEWEREXODUSII, PetscViewer, PetscViewerCreate(), PetscViewerDestroy(), PetscViewerExodusIIOpen(), PetscViewerSetType(), PetscViewerType, PetscViewerExodusIISetZonalVariableNames()

External Links

source
PETSc.LibPETSc.PetscViewerExodusIIOpenMethod
PetscViewerExodusIIOpen(petsclib::PetscLibType,comm::MPI_Comm, name::String, type::PetscFileMode, exo::PetscViewer)

Opens a file for ExodusII input/output.

Collective

Input Parameters:

  • comm - MPI communicator
  • name - name of file
  • type - type of file

-seealso: PETSCVIEWEREXODUSII, PetscViewer, PetscViewerPushFormat(), PetscViewerDestroy(), DMLoad(), PetscFileMode, PetscViewerSetType(), PetscViewerFileSetMode(), PetscViewerFileSetName()

External Links

source
PETSc.LibPETSc.PetscViewerExodusIISetNodalVariableMethod
PetscViewerExodusIISetNodalVariable(petsclib::PetscLibType,viewer::PetscViewer, num::PetscExodusIIInt)

Sets the number of nodal variables in an ExodusII file

Collective;

Input Parameters:

  • viewer - a PetscViewer of type PETSCVIEWEREXODUSII
  • num - the number of nodal variables in the ExodusII file

Level: intermediate

-seealso: PETSCVIEWEREXODUSII, PetscViewer, PetscViewerCreate(), PetscViewerDestroy(), PetscViewerExodusIIOpen(), PetscViewerSetType(), PetscViewerType, PetscViewerExodusIIGetNodalVariable()

External Links

source
PETSc.LibPETSc.PetscViewerExodusIISetNodalVariableNameMethod
PetscViewerExodusIISetNodalVariableName(petsclib::PetscLibType,viewer::PetscViewer, idx::PetscExodusIIInt, name::String)

Sets the name of a nodal variable.

Collective;

Input Parameters:

  • viewer - a PetscViewer of type PETSCVIEWEREXODUSII
  • idx - the index for which you want to save the name
  • name - string containing the name characters

Level: intermediate

-seealso: PETSCVIEWEREXODUSII, PetscViewer, PetscViewerCreate(), PetscViewerDestroy(), PetscViewerExodusIIOpen(), PetscViewerSetType(), PetscViewerType, PetscViewerExodusIIGetNodalVariableName()

External Links

source
PETSc.LibPETSc.PetscViewerExodusIISetNodalVariableNamesMethod
PetscViewerExodusIISetNodalVariableNames(petsclib::PetscLibType,viewer::PetscViewer, names::String)

Sets the names of all nodal variables.

Collective; No Fortran Support

Input Parameters:

  • viewer - a PetscViewer of type PETSCVIEWEREXODUSII
  • names - an array of string names to be set, the strings are copied into the PetscViewer

Level: intermediate

-seealso: PETSCVIEWEREXODUSII, PetscViewer, PetscViewerCreate(), PetscViewerDestroy(), PetscViewerExodusIIOpen(), PetscViewerSetType(), PetscViewerType, PetscViewerExodusIIGetNodalVariableNames()

External Links

source
PETSc.LibPETSc.PetscViewerExodusIISetOrderMethod
PetscViewerExodusIISetOrder(petsclib::PetscLibType,viewer::PetscViewer, order::PetscInt)

Set the elements order in the ExodusII file.

Collective

Input Parameters:

  • viewer - the PETSCVIEWEREXODUSII viewer
  • order - elements order

Output Parameter:

Level: beginner

-seealso: PETSCVIEWEREXODUSII, PetscViewer, PetscViewerExodusIIGetId(), PetscViewerExodusIIGetOrder()

External Links

source
PETSc.LibPETSc.PetscViewerExodusIISetZonalVariableMethod
PetscViewerExodusIISetZonalVariable(petsclib::PetscLibType,viewer::PetscViewer, num::PetscExodusIIInt)

Sets the number of zonal variables in an ExodusII file

Collective;

Input Parameters:

  • viewer - a PetscViewer of type PETSCVIEWEREXODUSII
  • num - the number of zonal variables in the ExodusII file

Level: intermediate

-seealso: PETSCVIEWEREXODUSII, PetscViewer, PetscViewerCreate(), PetscViewerDestroy(), PetscViewerExodusIIOpen(), PetscViewerSetType(), PetscViewerType, PetscViewerExodusIIGetZonalVariable()

External Links

source
PETSc.LibPETSc.PetscViewerExodusIISetZonalVariableNameMethod
PetscViewerExodusIISetZonalVariableName(petsclib::PetscLibType,viewer::PetscViewer, idx::PetscExodusIIInt, name::String)

Sets the name of a zonal variable.

Collective;

Input Parameters:

  • viewer - a PetscViewer of type PETSCVIEWEREXODUSII
  • idx - the index for which you want to save the name
  • name - string containing the name characters

Level: intermediate

-seealso: PETSCVIEWEREXODUSII, PetscViewer, PetscViewerCreate(), PetscViewerDestroy(), PetscViewerExodusIIOpen(), PetscViewerSetType(), PetscViewerType, PetscViewerExodusIIGetZonalVariableName()

External Links

source
PETSc.LibPETSc.PetscViewerExodusIISetZonalVariableNamesMethod
PetscViewerExodusIISetZonalVariableNames(petsclib::PetscLibType,viewer::PetscViewer, names::String)

Sets the names of all nodal variables

Collective; No Fortran Support

Input Parameters:

  • viewer - a PetscViewer of type PETSCVIEWEREXODUSII
  • names - an array of string names to be set, the strings are copied into the PetscViewer

Level: intermediate

-seealso: PETSCVIEWEREXODUSII, PetscViewer, PetscViewerCreate(), PetscViewerDestroy(), PetscViewerExodusIIOpen(), PetscViewerSetType(), PetscViewerType, PetscViewerExodusIIGetZonalVariableNames()

External Links

source
PETSc.LibPETSc.PetscViewerFileGetModeMethod
PetscViewerFileGetMode(petsclib::PetscLibType,viewer::PetscViewer, mode::PetscFileMode)

Gets the open mode of a file associated with a PetscViewer

Not Collective

Input Parameter:

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

Output Parameter:

  • mode - open mode of file

-seealso: , PetscViewerFileSetMode(), PetscViewerCreate(), PetscViewerSetType(), PetscViewerBinaryOpen()

External Links

source
PETSc.LibPETSc.PetscViewerFileGetNameMethod
PetscViewerFileGetName(petsclib::PetscLibType,viewer::PetscViewer, name::String)

Gets the name of the file the PetscViewer is using

Not Collective

Input Parameter:

  • viewer - the PetscViewer

Output Parameter:

  • name - the name of the file it is using

Level: advanced

-seealso: , PetscViewerCreate(), PetscViewerSetType(), PetscViewerASCIIOpen(), PetscViewerBinaryOpen(), PetscViewerFileSetName()

External Links

source
PETSc.LibPETSc.PetscViewerFileSetModeMethod
PetscViewerFileSetMode(petsclib::PetscLibType,viewer::PetscViewer, mode::PetscFileMode)

Sets the open mode of file

Logically Collective

Input Parameters:

  • viewer - the PetscViewer; must be a PETSCVIEWERBINARY, PETSCVIEWERMATLAB, PETSCVIEWERHDF5, or PETSCVIEWERASCII PetscViewer
  • mode - open mode of file

-seealso: , PetscViewerCreate(), PetscViewerSetType(), PetscViewerBinaryOpen()

External Links

source
PETSc.LibPETSc.PetscViewerFileSetNameMethod
PetscViewerFileSetName(petsclib::PetscLibType,viewer::PetscViewer, name::String)

Sets the name of the file the PetscViewer should use.

Collective

Input Parameters:

  • viewer - the PetscViewer; for example, of type PETSCVIEWERASCII or PETSCVIEWERBINARY
  • name - the name of the file it should use

Level: advanced

-seealso: , PetscViewerCreate(), PetscViewerSetType(), PetscViewerASCIIOpen(), PetscViewerBinaryOpen(), PetscViewerDestroy(), PetscViewerASCIIGetPointer(), PetscViewerASCIIPrintf(), PetscViewerASCIISynchronizedPrintf()

External Links

source
PETSc.LibPETSc.PetscViewerFlushMethod
PetscViewerFlush(petsclib::PetscLibType,viewer::PetscViewer)

Flushes a PetscViewer (i.e. tries to dump all the data that has been printed through a PetscViewer).

Collective

Input Parameter:

  • viewer - the PetscViewer to be flushed

Level: intermediate

-seealso: , PetscViewer, PetscViewerWriteable(), PetscViewerSocketOpen(), PetscViewerASCIIOpen(), PetscViewerDrawOpen(), PetscViewerCreate(), PetscViewerDestroy(), PetscViewerSetType()

External Links

source
PETSc.LibPETSc.PetscViewerGLVisOpenMethod
PetscViewerGLVisOpen(petsclib::PetscLibType,comm::MPI_Comm, type::PetscViewerGLVisType, name::String, port::PetscInt, viewer::PetscViewer)

Opens a PETSCVIEWERGLVIS PetscViewer

Collective; No Fortran Support

Input Parameters:

  • comm - the MPI communicator
  • type - the viewer type: PETSC_VIEWER_GLVIS_SOCKET for real-time visualization or PETSC_VIEWER_GLVIS_DUMP for dumping to a file
  • name - either the hostname where the GLVis server is running or the base filename for dumping the data for subsequent visualizations
  • port - socket port where the GLVis server is listening. Not referenced when type is PETSC_VIEWER_GLVIS_DUMP

Output Parameter:

  • viewer - the PetscViewer object

Options Database Keys:

  • -glvis_precision <precision> - Sets number of digits for floating point values
  • -glvis_size <width,height> - Sets the window size (in pixels)
  • -glvis_pause <pause> - Sets time (in seconds) that the program pauses after each visualization

(0 is default, -1 implies every visualization)

  • -glvis_keys - Additional keys to configure visualization
  • -glvis_exec - Additional commands to configure visualization

Level: beginner

-seealso: , PETSCVIEWERGLVIS, PetscViewerCreate(), PetscViewerSetType(), PetscViewerGLVisType

External Links

source
PETSc.LibPETSc.PetscViewerGLVisSetFieldsMethod
PetscViewerGLVisSetFields(petsclib::PetscLibType,viewer::PetscViewer, nf::PetscInt, fec_type::String, dim::Vector{PetscInt}, g2l::external, Vfield::Vector{PetscObject}, ctx::Cvoid, destroyctx::external)

Sets the required information to visualize different fields from a vector.

Logically Collective

Input Parameters:

  • viewer - the PetscViewer of type PETSCVIEWERGLVIS
  • nf - number of fields to be visualized
  • fec_type - the type of finite element to be used to visualize the data (see FiniteElementCollection::Name() in MFEM)
  • dim - array of space dimension for field vectors (used to initialize the scene)
  • g2l - User routine to compute the local field vectors to be visualized; PetscObject is used in place of Vec on the prototype
  • Vfield - array of work vectors, one for each field
  • ctx - User context to store the relevant data to apply g2lfields
  • destroyctx - Destroy function for userctx

Level: intermediate

-seealso: , PETSCVIEWERGLVIS, PetscViewerGLVisOpen(), PetscViewerCreate(), PetscViewerSetType(), PetscObjectSetName()

External Links

source
PETSc.LibPETSc.PetscViewerGLVisSetPrecisionMethod
PetscViewerGLVisSetPrecision(petsclib::PetscLibType,viewer::PetscViewer, prec::PetscInt)

Set the number of digits for floating point values to be displayed

Not Collective

Input Parameters:

  • viewer - the PetscViewer of type PETSCVIEWERGLVIS
  • prec - the number of digits required

Level: beginner

-seealso: , PETSCVIEWERGLVIS, PetscViewerGLVisOpen(), PetscViewerGLVisSetFields(), PetscViewerCreate(), PetscViewerSetType()

External Links

source
PETSc.LibPETSc.PetscViewerGLVisSetSnapIdMethod
PetscViewerGLVisSetSnapId(petsclib::PetscLibType,viewer::PetscViewer, id::PetscInt)

Set the snapshot id. Only relevant when the PetscViewerGLVisType is PETSC_VIEWER_GLVIS_DUMP

Logically Collective

Input Parameters:

  • viewer - the PetscViewer of type PETSCVIEWERGLVIS
  • id - the current snapshot id in a time-dependent simulation

Level: beginner

-seealso: , PETSCVIEWERGLVIS, PetscViewerGLVisOpen(), PetscViewerGLVisSetFields(), PetscViewerCreate(), PetscViewerSetType()

External Links

source
PETSc.LibPETSc.PetscViewerGetFormatMethod
PetscViewerGetFormat(petsclib::PetscLibType,viewer::PetscViewer, format::PetscViewerFormat)

Gets the current format for PetscViewer.

Not Collective

Input Parameter:

  • viewer - the PetscViewer

Output Parameter:

  • format - the format

Level: intermediate

-seealso: , PetscViewer, PetscViewerASCIIOpen(), PetscViewerBinaryOpen(), MatView(), VecView(), PetscViewerType, PetscViewerPushFormat(), PetscViewerPopFormat(), PetscViewerDrawOpen(), PetscViewerSocketOpen()

External Links

source
PETSc.LibPETSc.PetscViewerGetOptionsPrefixMethod
PetscViewerGetOptionsPrefix(petsclib::PetscLibType,viewer::PetscViewer, prefix::String)

Gets the prefix used for searching for PetscViewer options in the database during PetscViewerSetFromOptions().

Not Collective

Input Parameter:

  • viewer - the PetscViewer context

Output Parameter:

  • prefix - pointer to the prefix string used

Level: advanced

-seealso: , PetscViewer, PetscViewerAppendOptionsPrefix(), PetscViewerSetOptionsPrefix()

External Links

source
PETSc.LibPETSc.PetscViewerGetSubViewerMethod
PetscViewerGetSubViewer(petsclib::PetscLibType,viewer::PetscViewer, comm::MPI_Comm, outviewer::PetscViewer)

Creates a new PetscViewer (same type as the old) that lives on a subcommunicator of the original viewer's communicator

Collective

Input Parameters:

  • viewer - the PetscViewer to be reproduced
  • comm - the sub communicator to use

Output Parameter:

  • outviewer - new PetscViewer

Level: advanced

-seealso: , PetscViewer, PetscViewerSocketOpen(), PetscViewerASCIIOpen(), PetscViewerDrawOpen(), PetscViewerFlush(), PetscViewerRestoreSubViewer()

External Links

source
PETSc.LibPETSc.PetscViewerGetTypeMethod
type::PetscViewerType = PetscViewerGetType(petsclib::PetscLibType,viewer::PetscViewer)

Returns the type of a PetscViewer.

Not Collective

Input Parameter:

  • viewer - the PetscViewer

Output Parameter:

  • type - PetscViewerType

Level: intermediate

-seealso: , PetscViewerType, PetscViewer, PetscViewerCreate(), PetscViewerSetType()

External Links

source
PETSc.LibPETSc.PetscViewerHDF5GetBaseDimension2Method
flg::PetscBool = PetscViewerHDF5GetBaseDimension2(petsclib::PetscLibType,viewer::PetscViewer)

Vectors of 1 dimension (i.e. bs/dof is 1) will be saved in the HDF5 file with a dimension of 2.

Logically Collective

Input Parameter:

  • viewer - the PetscViewer, must be PETSCVIEWERHDF5

Output Parameter:

  • flg - if PETSC_TRUE the vector will always have at least a dimension of 2 even if that first dimension is of size 1

Level: intermediate

-seealso: , PETSCVIEWERHDF5, PetscViewerFileSetMode(), PetscViewerCreate(), PetscViewerSetType(), PetscViewerBinaryOpen()

External Links

source
PETSc.LibPETSc.PetscViewerHDF5GetCollectiveMethod
flg::PetscBool = PetscViewerHDF5GetCollective(petsclib::PetscLibType,viewer::PetscViewer)

Return flag whether collective MPI

Not Collective

Input Parameter:

  • viewer - the PETSCVIEWERHDF5 PetscViewer

Output Parameter:

  • flg - the flag

Level: intermediate

-seealso: , PETSCVIEWERHDF5, PetscViewerHDF5SetCollective(), PetscViewerCreate(), PetscViewerSetType(), PetscViewerHDF5Open()

External Links

source
PETSc.LibPETSc.PetscViewerHDF5GetCompressMethod
flg::PetscBool = PetscViewerHDF5GetCompress(petsclib::PetscLibType,viewer::PetscViewer)

Get the flag for compression

Not Collective

Input Parameter:

  • viewer - the PetscViewer of type PETSCVIEWERHDF5

Output Parameter:

  • flg - if PETSC_TRUE we will turn on compression

Level: intermediate

-seealso: , PETSCVIEWERHDF5, PetscViewerHDF5SetCompress()

External Links

source
PETSc.LibPETSc.PetscViewerHDF5GetDMPlexStorageVersionReadingMethod
PetscViewerHDF5GetDMPlexStorageVersionReading(petsclib::PetscLibType,viewer::PetscViewer, version::DMPlexStorageVersion)

Get the storage version for reading

Logically collective

Input Parameter:

  • viewer - The PetscViewer

Output Parameter:

  • version - The storage format version

Options Database Keys:

  • -dm_plex_view_hdf5_storage_version <num> - Overrides the storage format version

Level: advanced

Note: The version has major, minor, and subminor integers. Parallel operations are only available for version 3.0.0.

See also:

DM, PetscViewerHDF5SetDMPlexStorageVersionReading(), PetscViewerHDF5GetDMPlexStorageVersionWriting(), PetscViewerHDF5SetDMPlexStorageVersionWriting()

External Links

source
PETSc.LibPETSc.PetscViewerHDF5GetDMPlexStorageVersionWritingMethod
PetscViewerHDF5GetDMPlexStorageVersionWriting(petsclib::PetscLibType,viewer::PetscViewer, version::DMPlexStorageVersion)

Get the storage version for writing

Logically collective

Input Parameter:

  • viewer - The PetscViewer

Output Parameter:

  • version - The storage format version

Options Database Keys:

  • -dm_plex_view_hdf5_storage_version <num> - Overrides the storage format version

Level: advanced

Note: The version has major, minor, and subminor integers. Parallel operations are only available for version 3.0.0.

See also:

DM, PetscViewerHDF5SetDMPlexStorageVersionWriting(), PetscViewerHDF5GetDMPlexStorageVersionReading(), PetscViewerHDF5SetDMPlexStorageVersionReading()

External Links

source
PETSc.LibPETSc.PetscViewerHDF5GetDefaultTimesteppingMethod
flg::PetscBool = PetscViewerHDF5GetDefaultTimestepping(petsclib::PetscLibType,viewer::PetscViewer)

Get the flag for default timestepping

Not Collective

Input Parameter:

  • viewer - the PetscViewer of type PETSCVIEWERHDF5

Output Parameter:

  • flg - if PETSC_TRUE we will assume that timestepping is on

Level: intermediate

-seealso: , PETSCVIEWERHDF5, PetscViewerHDF5SetDefaultTimestepping(), PetscViewerHDF5PushTimestepping(), PetscViewerHDF5GetTimestep()

External Links

source
PETSc.LibPETSc.PetscViewerHDF5GetFileIdMethod
PetscViewerHDF5GetFileId(petsclib::PetscLibType,viewer::PetscViewer, file_id::hid_t)

Retrieve the file id, this file ID then can be used in direct HDF5 calls

Not Collective

Input Parameter:

  • viewer - the PetscViewer

Output Parameter:

  • file_id - The file id

Level: intermediate

-seealso: , PETSCVIEWERHDF5, PetscViewerHDF5Open()

External Links

source
PETSc.LibPETSc.PetscViewerHDF5GetGroupMethod
PetscViewerHDF5GetGroup(petsclib::PetscLibType,viewer::PetscViewer, path::String, abspath::String)

Get the current HDF5 group name (full path), set with PetscViewerHDF5PushGroup()/PetscViewerHDF5PopGroup().

Not Collective

Input Parameters:

  • viewer - the PetscViewer of type PETSCVIEWERHDF5
  • path - (Optional) The path relative to the pushed group

Output Parameter:

  • abspath - The absolute HDF5 path (group)

Level: intermediate

-seealso: , PETSCVIEWERHDF5, PetscViewerHDF5Open(), PetscViewerHDF5PushGroup(), PetscViewerHDF5PopGroup(), PetscViewerHDF5OpenGroup(), PetscViewerHDF5WriteGroup()

External Links

source
PETSc.LibPETSc.PetscViewerHDF5GetSPOutputMethod
flg::PetscBool = PetscViewerHDF5GetSPOutput(petsclib::PetscLibType,viewer::PetscViewer)

Data is written to disk in single precision even if PETSc is compiled with double precision PetscReal.

Logically Collective

Input Parameter:

  • viewer - the PetscViewer, must be of type PETSCVIEWERHDF5

Output Parameter:

  • flg - if PETSC_TRUE the data will be written to disk with single precision

Level: intermediate

-seealso: , PetscViewerFileSetMode(), PetscViewerCreate(), PetscViewerSetType(), PetscViewerBinaryOpen(), PetscReal, PetscViewerHDF5SetSPOutput()

External Links

source
PETSc.LibPETSc.PetscViewerHDF5GetTimestepMethod
timestep::PetscInt = PetscViewerHDF5GetTimestep(petsclib::PetscLibType,viewer::PetscViewer)

Get the current timestep for the HDF5 output. Fields are stacked in time.

Not Collective

Input Parameter:

  • viewer - the PetscViewer of type PETSCVIEWERHDF5

Output Parameter:

  • timestep - The timestep

Level: intermediate

-seealso: , PETSCVIEWERHDF5, PetscViewerHDF5Open(), PetscViewerHDF5PushTimestepping(), PetscViewerHDF5IncrementTimestep(), PetscViewerHDF5SetTimestep()

External Links

source
PETSc.LibPETSc.PetscViewerHDF5HasAttributeMethod
has::PetscBool = PetscViewerHDF5HasAttribute(petsclib::PetscLibType,viewer::PetscViewer, parent::String, name::String)

Check whether an attribute exists

Collective

Input Parameters:

  • viewer - The PETSCVIEWERHDF5 viewer
  • parent - The parent dataset/group name
  • name - The attribute name

Output Parameter:

  • has - Flag for attribute existence

Level: advanced

-seealso: , PETSCVIEWERHDF5, PetscViewerHDF5Open(), PetscViewerHDF5HasObjectAttribute(), PetscViewerHDF5WriteAttribute(), PetscViewerHDF5ReadAttribute(), PetscViewerHDF5PushGroup(), PetscViewerHDF5PopGroup(), PetscViewerHDF5GetGroup()

External Links

source
PETSc.LibPETSc.PetscViewerHDF5HasDatasetMethod
has::PetscBool = PetscViewerHDF5HasDataset(petsclib::PetscLibType,viewer::PetscViewer, path::String)

Check whether a given dataset exists in the HDF5 file

Collective

Input Parameters:

  • viewer - The PETSCVIEWERHDF5 viewer
  • path - The dataset path

Output Parameter:

  • has - Flag whether dataset exists

Level: advanced

-seealso: , PETSCVIEWERHDF5, PetscViewerHDF5HasObject(), PetscViewerHDF5HasAttribute(), PetscViewerHDF5HasGroup(), PetscViewerHDF5PushGroup(), PetscViewerHDF5PopGroup(), PetscViewerHDF5GetGroup()

External Links

source
PETSc.LibPETSc.PetscViewerHDF5HasGroupMethod
has::PetscBool = PetscViewerHDF5HasGroup(petsclib::PetscLibType,viewer::PetscViewer, path::String)

Check whether the current (pushed) group exists in the HDF5 file

Collective

Input Parameters:

  • viewer - The PETSCVIEWERHDF5 viewer
  • path - (Optional) The path relative to the pushed group

Output Parameter:

  • has - Flag for group existence

Level: advanced

-seealso: , PETSCVIEWERHDF5, PetscViewerHDF5HasAttribute(), PetscViewerHDF5HasDataset(), PetscViewerHDF5PushGroup(), PetscViewerHDF5PopGroup(), PetscViewerHDF5GetGroup(), PetscViewerHDF5OpenGroup()

External Links

source
PETSc.LibPETSc.PetscViewerHDF5HasObjectMethod
has::PetscBool = PetscViewerHDF5HasObject(petsclib::PetscLibType,viewer::PetscViewer, obj::PetscObject)

Check whether a dataset with the same name as given object exists in the HDF5 file under current group

Collective

Input Parameters:

  • viewer - The PETSCVIEWERHDF5 viewer
  • obj - The named object

Output Parameter:

  • has - Flag for dataset existence

Level: advanced

-seealso: , PETSCVIEWERHDF5, PetscViewerHDF5Open(), PetscViewerHDF5HasDataset(), PetscViewerHDF5HasAttribute(), PetscViewerHDF5PushGroup(), PetscViewerHDF5PopGroup(), PetscViewerHDF5GetGroup()

External Links

source
PETSc.LibPETSc.PetscViewerHDF5HasObjectAttributeMethod
has::PetscBool = PetscViewerHDF5HasObjectAttribute(petsclib::PetscLibType,viewer::PetscViewer, obj::PetscObject, name::String)

Check whether an attribute is attached to the dataset matching the given PetscObject by name

Collective

Input Parameters:

  • viewer - The PETSCVIEWERHDF5 viewer
  • obj - The object whose name is used to lookup the parent dataset, relative to the current group.
  • name - The attribute name

Output Parameter:

  • has - Flag for attribute existence

Level: advanced

-seealso: , PETSCVIEWERHDF5, PetscViewerHDF5Open(), PetscViewerHDF5HasAttribute(), PetscViewerHDF5WriteObjectAttribute(), PetscViewerHDF5ReadObjectAttribute(), PetscViewerHDF5HasObject(), PetscViewerHDF5PushGroup(), PetscViewerHDF5PopGroup(), PetscViewerHDF5GetGroup()

External Links

source
PETSc.LibPETSc.PetscViewerHDF5IncrementTimestepMethod
PetscViewerHDF5IncrementTimestep(petsclib::PetscLibType,viewer::PetscViewer)

Increments current timestep for the HDF5 output. Fields are stacked in time.

Not Collective

Input Parameter:

  • viewer - the PetscViewer of type PETSCVIEWERHDF5

Level: intermediate

-seealso: , PETSCVIEWERHDF5, PetscViewerHDF5Open(), PetscViewerHDF5PushTimestepping(), PetscViewerHDF5SetTimestep(), PetscViewerHDF5GetTimestep()

External Links

source
PETSc.LibPETSc.PetscViewerHDF5IsTimesteppingMethod
flg::PetscBool = PetscViewerHDF5IsTimestepping(petsclib::PetscLibType,viewer::PetscViewer)

Ask the viewer whether it is in timestepping mode currently.

Not Collective

Input Parameter:

  • viewer - the PetscViewer of type PETSCVIEWERHDF5

Output Parameter:

  • flg - is timestepping active?

Level: intermediate

-seealso: , PETSCVIEWERHDF5, PetscViewerHDF5Open(), PetscViewerHDF5PushTimestepping(), PetscViewerHDF5PopTimestepping(), PetscViewerHDF5SetTimestep(), PetscViewerHDF5IncrementTimestep(), PetscViewerHDF5GetTimestep()

External Links

source
PETSc.LibPETSc.PetscViewerHDF5LoadMethod
PetscViewerHDF5Load(petsclib::PetscLibType,viewer::PetscViewer, name::String, map::PetscLayout, datatype::hid_t, newarr::Cvoid)

Read a raw array from the PETSCVIEWERHDF5 dataset in parallel

Collective; No Fortran Support

Input Parameters:

  • viewer - The PETSCVIEWERHDF5 viewer
  • name - The dataset name
  • datatype - The HDF5 datatype of the items in the dataset

Input/Output Parameter:

  • map - The layout which specifies array partitioning, on output the

set up layout (with global size and blocksize according to dataset)

Output Parameter:

  • newarr - The partitioned array, a memory image of the given dataset

Level: developer

-seealso: PetscViewer, PETSCVIEWERHDF5, PetscViewerHDF5Open(), PetscViewerHDF5PushGroup(), PetscViewerHDF5OpenGroup(), PetscViewerHDF5ReadSizes(), VecLoad(), ISLoad(), PetscLayout

External Links

source
PETSc.LibPETSc.PetscViewerHDF5OpenMethod
PetscViewerHDF5Open(petsclib::PetscLibType,comm::MPI_Comm, name::String, type::PetscFileMode, hdf5v::PetscViewer)

Opens a file for HDF5 input/output as a PETSCVIEWERHDF5 PetscViewer

Collective

Input Parameters:

  • comm - MPI communicator
  • name - name of file
  • type - type of file

Output Parameter:

  • hdf5v - PetscViewer for HDF5 input/output to use with the specified file

Options Database Keys:

  • -viewer_hdf5_base_dimension2 - turns on (true) or off (false) using a dimension of 2 in the HDF5 file even if the bs/dof of the vector is 1
  • -viewer_hdf5_sp_output - forces (if true) the viewer to write data in single precision independent on the precision of PetscReal

Level: beginner

-seealso: , PETSCVIEWERHDF5, PetscViewerASCIIOpen(), PetscViewerPushFormat(), PetscViewerDestroy(), PetscViewerHDF5SetBaseDimension2(), PetscViewerHDF5SetSPOutput(), PetscViewerHDF5GetBaseDimension2(), VecView(), MatView(), VecLoad(), MatLoad(), PetscFileMode, PetscViewer, PetscViewerSetType(), PetscViewerFileSetMode(), PetscViewerFileSetName()

External Links

source
PETSc.LibPETSc.PetscViewerHDF5OpenGroupMethod
PetscViewerHDF5OpenGroup(petsclib::PetscLibType,viewer::PetscViewer, path::String, fileId::hid_t, groupId::hid_t)

Open the HDF5 group with the name (full path) returned by PetscViewerHDF5GetGroup(), and return this group's ID and file ID. If PetscViewerHDF5GetGroup() yields NULL, then group ID is file ID.

Not Collective

Input Parameters:

  • viewer - the PetscViewer of type PETSCVIEWERHDF5
  • path - (Optional) The path relative to the pushed group

Output Parameters:

  • fileId - The HDF5 file ID
  • groupId - The HDF5 group ID

Level: intermediate

-seealso: , PETSCVIEWERHDF5, PetscViewerHDF5Open(), PetscViewerHDF5PushGroup(), PetscViewerHDF5PopGroup(), PetscViewerHDF5GetGroup(), PetscViewerHDF5WriteGroup()

External Links

source
PETSc.LibPETSc.PetscViewerHDF5PopGroupMethod
PetscViewerHDF5PopGroup(petsclib::PetscLibType,viewer::PetscViewer)

Return the current HDF5 group for output to the previous value

Not Collective

Input Parameter:

  • viewer - the PetscViewer of type PETSCVIEWERHDF5

Level: intermediate

-seealso: , PETSCVIEWERHDF5, PetscViewerHDF5Open(), PetscViewerHDF5PushGroup(), PetscViewerHDF5GetGroup(), PetscViewerHDF5OpenGroup(), PetscViewerHDF5WriteGroup()

External Links

source
PETSc.LibPETSc.PetscViewerHDF5PopTimesteppingMethod
PetscViewerHDF5PopTimestepping(petsclib::PetscLibType,viewer::PetscViewer)

Deactivate timestepping mode for subsequent HDF5 reading and writing.

Not Collective

Input Parameter:

  • viewer - the PetscViewer of type PETSCVIEWERHDF5

Level: intermediate

-seealso: , PETSCVIEWERHDF5, PetscViewerHDF5Open(), PetscViewerHDF5PushTimestepping(), PetscViewerHDF5IsTimestepping(), PetscViewerHDF5SetTimestep(), PetscViewerHDF5IncrementTimestep(), PetscViewerHDF5GetTimestep()

External Links

source
PETSc.LibPETSc.PetscViewerHDF5PushGroupMethod
PetscViewerHDF5PushGroup(petsclib::PetscLibType,viewer::PetscViewer, name::String)

Set the current HDF5 group for output

Not Collective

Input Parameters:

  • viewer - the PetscViewer of type PETSCVIEWERHDF5
  • name - The group name

Level: intermediate

-seealso: , PETSCVIEWERHDF5, PetscViewerHDF5Open(), PetscViewerHDF5PopGroup(), PetscViewerHDF5GetGroup(), PetscViewerHDF5OpenGroup(), PetscViewerHDF5WriteGroup()

External Links

source
PETSc.LibPETSc.PetscViewerHDF5PushTimesteppingMethod
PetscViewerHDF5PushTimestepping(petsclib::PetscLibType,viewer::PetscViewer)

Activate timestepping mode for subsequent HDF5 reading and writing.

Not Collective

Input Parameter:

  • viewer - the PetscViewer of type PETSCVIEWERHDF5

Level: intermediate

-seealso: , PETSCVIEWERHDF5, PetscViewerHDF5Open(), PetscViewerHDF5PopTimestepping(), PetscViewerHDF5IsTimestepping(), PetscViewerHDF5SetTimestep(), PetscViewerHDF5IncrementTimestep(), PetscViewerHDF5GetTimestep()

External Links

source
PETSc.LibPETSc.PetscViewerHDF5ReadAttributeMethod
PetscViewerHDF5ReadAttribute(petsclib::PetscLibType,viewer::PetscViewer, parent::String, name::String, datatype::PetscDataType, defaultValue::Cvoid, value::Cvoid)

Read an attribute

Collective

Input Parameters:

  • viewer - The PETSCVIEWERHDF5 viewer
  • parent - The parent dataset/group name
  • name - The attribute name
  • datatype - The attribute type
  • defaultValue - The pointer to the default value

Output Parameter:

  • value - The pointer to the read HDF5 attribute value

Level: advanced

-seealso: , PETSCVIEWERHDF5, PetscViewerHDF5Open(), PetscViewerHDF5ReadObjectAttribute(), PetscViewerHDF5WriteAttribute(), PetscViewerHDF5HasAttribute(), PetscViewerHDF5HasObject(), PetscViewerHDF5PushGroup(), PetscViewerHDF5PopGroup(), PetscViewerHDF5GetGroup()

External Links

source
PETSc.LibPETSc.PetscViewerHDF5ReadObjectAttributeMethod
PetscViewerHDF5ReadObjectAttribute(petsclib::PetscLibType,viewer::PetscViewer, obj::PetscObject, name::String, datatype::PetscDataType, defaultValue::Cvoid, value::Cvoid)

Read an attribute from the dataset matching the given PetscObject by name

Collective

Input Parameters:

  • viewer - The PETSCVIEWERHDF5 viewer
  • obj - The object whose name is used to lookup the parent dataset, relative to the current group.
  • name - The attribute name
  • datatype - The attribute type
  • defaultValue - The default attribute value

Output Parameter:

  • value - The attribute value

Level: advanced

-seealso: , PETSCVIEWERHDF5, PetscViewerHDF5Open(), PetscViewerHDF5ReadAttribute() PetscViewerHDF5WriteObjectAttribute(), PetscViewerHDF5HasObjectAttribute(), PetscViewerHDF5PushGroup(), PetscViewerHDF5PopGroup(), PetscViewerHDF5GetGroup()

External Links

source
PETSc.LibPETSc.PetscViewerHDF5ReadSizesMethod
bs::PetscInt,N::PetscInt = PetscViewerHDF5ReadSizes(petsclib::PetscLibType,viewer::PetscViewer, name::String)

Read block size and global size of a Vec or IS stored in an HDF5 file.

Input Parameters:

  • viewer - The PETSCVIEWERHDF5 viewer
  • name - The dataset name

Output Parameters:

  • bs - block size
  • N - global size

Level: advanced

-seealso: PetscViewer, PETSCVIEWERHDF5, PetscViewerHDF5Open(), VecLoad(), ISLoad(), VecGetSize(), ISGetSize(), PetscViewerHDF5SetBaseDimension2()

External Links

source
PETSc.LibPETSc.PetscViewerHDF5SetBaseDimension2Method
PetscViewerHDF5SetBaseDimension2(petsclib::PetscLibType,viewer::PetscViewer, flg::PetscBool)

Vectors of 1 dimension (i.e. bs/dof is 1) will be saved in the HDF5 file with a dimension of 2.

Logically Collective

Input Parameters:

  • viewer - the PetscViewer; if it is a PETSCVIEWERHDF5 then this command is ignored
  • flg - if PETSC_TRUE the vector will always have at least a dimension of 2 even if that first dimension is of size 1

Options Database Key:

  • -viewer_hdf5_base_dimension2 - turns on (true) or off (false) using a dimension of 2 in the HDF5 file even if the bs/dof of the vector is 1

Level: intermediate

-seealso: , PETSCVIEWERHDF5, PetscViewerFileSetMode(), PetscViewerCreate(), PetscViewerSetType(), PetscViewerBinaryOpen()

External Links

source
PETSc.LibPETSc.PetscViewerHDF5SetCollectiveMethod
PetscViewerHDF5SetCollective(petsclib::PetscLibType,viewer::PetscViewer, flg::PetscBool)

Use collective MPI

Logically Collective; flg must contain common value

Input Parameters:

  • viewer - the PetscViewer; if it is not PETSCVIEWERHDF5 then this command is ignored
  • flg - PETSC_TRUE for collective mode; PETSC_FALSE for independent mode (default)

Options Database Key:

  • -viewer_hdf5_collective - turns on (true) or off (false) collective transfers

Level: intermediate

-seealso: , PETSCVIEWERHDF5, PetscViewerHDF5GetCollective(), PetscViewerCreate(), PetscViewerSetType(), PetscViewerHDF5Open()

External Links

source
PETSc.LibPETSc.PetscViewerHDF5SetCompressMethod
PetscViewerHDF5SetCompress(petsclib::PetscLibType,viewer::PetscViewer, flg::PetscBool)

Set the flag for compression

Logically Collective

Input Parameters:

  • viewer - the PetscViewer; if it is not PETSCVIEWERHDF5 then this command is ignored
  • flg - if PETSC_TRUE we will turn on compression

Options Database Key:

  • -viewer_hdf5_compress - turns on (true) or off (false) compression

Level: intermediate

-seealso: , PETSCVIEWERHDF5, PetscViewerHDF5GetCompress()

External Links

source
PETSc.LibPETSc.PetscViewerHDF5SetDMPlexStorageVersionReadingMethod
PetscViewerHDF5SetDMPlexStorageVersionReading(petsclib::PetscLibType,viewer::PetscViewer, version::DMPlexStorageVersion)

Set the storage version for reading

Logically collective

Input Parameters:

  • viewer - The PetscViewer
  • version - The storage format version

Level: advanced

Note: The version has major, minor, and subminor integers. Parallel operations are only available for version 3.0.0.

See also:

DM, PetscViewerHDF5GetDMPlexStorageVersionReading(), PetscViewerHDF5GetDMPlexStorageVersionWriting(), PetscViewerHDF5SetDMPlexStorageVersionWriting()

External Links

source
PETSc.LibPETSc.PetscViewerHDF5SetDMPlexStorageVersionWritingMethod
PetscViewerHDF5SetDMPlexStorageVersionWriting(petsclib::PetscLibType,viewer::PetscViewer, version::DMPlexStorageVersion)

Set the storage version for writing

Logically collective

Input Parameters:

  • viewer - The PetscViewer
  • version - The storage format version

Level: advanced

Note: The version has major, minor, and subminor integers. Parallel operations are only available for version 3.0.0.

See also:

DM, PetscViewerHDF5GetDMPlexStorageVersionWriting(), PetscViewerHDF5GetDMPlexStorageVersionReading(), PetscViewerHDF5SetDMPlexStorageVersionReading()

External Links

source
PETSc.LibPETSc.PetscViewerHDF5SetDefaultTimesteppingMethod
PetscViewerHDF5SetDefaultTimestepping(petsclib::PetscLibType,viewer::PetscViewer, flg::PetscBool)

Set the flag for default timestepping

Logically Collective

Input Parameters:

  • viewer - the PetscViewer; if it is not PETSCVIEWERHDF5 then this command is ignored
  • flg - if PETSC_TRUE we will assume that timestepping is on

Options Database Key:

  • -viewer_hdf5_default_timestepping - turns on (true) or off (false) default timestepping

Level: intermediate

-seealso: , PETSCVIEWERHDF5, PetscViewerHDF5GetDefaultTimestepping(), PetscViewerHDF5PushTimestepping(), PetscViewerHDF5GetTimestep()

External Links

source
PETSc.LibPETSc.PetscViewerHDF5SetSPOutputMethod
PetscViewerHDF5SetSPOutput(petsclib::PetscLibType,viewer::PetscViewer, flg::PetscBool)

Data is written to disk in single precision even if PETSc is compiled with double precision PetscReal.

Logically Collective

Input Parameters:

  • viewer - the PetscViewer; if it is a PETSCVIEWERHDF5 then this command is ignored
  • flg - if PETSC_TRUE the data will be written to disk with single precision

Options Database Key:

  • -viewer_hdf5_sp_output - turns on (true) or off (false) output in single precision

Level: intermediate

-seealso: , PETSCVIEWERHDF5, PetscViewerFileSetMode(), PetscViewerCreate(), PetscViewerSetType(), PetscViewerBinaryOpen(), PetscReal, PetscViewerHDF5GetSPOutput()

External Links

source
PETSc.LibPETSc.PetscViewerHDF5SetTimestepMethod
PetscViewerHDF5SetTimestep(petsclib::PetscLibType,viewer::PetscViewer, timestep::PetscInt)

Set the current timestep for the HDF5 output. Fields are stacked in time.

Logically Collective

Input Parameters:

  • viewer - the PetscViewer of type PETSCVIEWERHDF5
  • timestep - The timestep

Level: intermediate

-seealso: , PETSCVIEWERHDF5, PetscViewerHDF5Open(), PetscViewerHDF5PushTimestepping(), PetscViewerHDF5IncrementTimestep(), PetscViewerHDF5GetTimestep()

External Links

source
PETSc.LibPETSc.PetscViewerHDF5WriteAttributeMethod
PetscViewerHDF5WriteAttribute(petsclib::PetscLibType,viewer::PetscViewer, parent::String, name::String, datatype::PetscDataType, value::Cvoid)

Write an attribute

Collective

Input Parameters:

  • viewer - The PETSCVIEWERHDF5 viewer
  • parent - The parent dataset/group name
  • name - The attribute name
  • datatype - The attribute type
  • value - The attribute value

Level: advanced

-seealso: , PETSCVIEWERHDF5, PetscViewerHDF5Open(), PetscViewerHDF5WriteObjectAttribute(), PetscViewerHDF5ReadAttribute(), PetscViewerHDF5HasAttribute(), PetscViewerHDF5PushGroup(), PetscViewerHDF5PopGroup(), PetscViewerHDF5GetGroup()

External Links

source
PETSc.LibPETSc.PetscViewerHDF5WriteGroupMethod
PetscViewerHDF5WriteGroup(petsclib::PetscLibType,viewer::PetscViewer, path::String)

Ensure the HDF5 group exists in the HDF5 file

Not Collective

Input Parameters:

  • viewer - the PetscViewer of type PETSCVIEWERHDF5
  • path - (Optional) The path relative to the pushed group

Level: intermediate

-seealso: , PETSCVIEWERHDF5, PetscViewerHDF5Open(), PetscViewerHDF5PushGroup(), PetscViewerHDF5PopGroup(), PetscViewerHDF5GetGroup(), PetscViewerHDF5OpenGroup()

External Links

source
PETSc.LibPETSc.PetscViewerHDF5WriteObjectAttributeMethod
PetscViewerHDF5WriteObjectAttribute(petsclib::PetscLibType,viewer::PetscViewer, obj::PetscObject, name::String, datatype::PetscDataType, value::Cvoid)

Write an attribute to the dataset matching the given PetscObject by name

Collective

Input Parameters:

  • viewer - The PETSCVIEWERHDF5 viewer
  • obj - The object whose name is used to lookup the parent dataset, relative to the current group.
  • name - The attribute name
  • datatype - The attribute type
  • value - The attribute value

Level: advanced

-seealso: , PETSCVIEWERHDF5, PetscViewerHDF5Open(), PetscViewerHDF5WriteAttribute(), PetscViewerHDF5ReadObjectAttribute(), PetscViewerHDF5HasObjectAttribute(), PetscViewerHDF5HasObject(), PetscViewerHDF5PushGroup(), PetscViewerHDF5PopGroup(), PetscViewerHDF5GetGroup()

External Links

source
PETSc.LibPETSc.PetscViewerMathematicaGetNameMethod
PetscViewerMathematicaGetName(petsclib::PetscLibType,viewer::PetscViewer, name::Cchar)

Retrieve the default name for objects communicated to Mathematica via PETSCVIEWERMATHEMATICA

Input Parameter:

  • viewer - The Mathematica viewer

Output Parameter:

  • name - The name for new objects created in Mathematica

Level: intermediate

-seealso: PETSCVIEWERMATHEMATICA, PetscViewerMathematicaSetName(), PetscViewerMathematicaClearName()

External Links

source
PETSc.LibPETSc.PetscViewerMathematicaOpenMethod
PetscViewerMathematicaOpen(petsclib::PetscLibType,comm::MPI_Comm, port::Cint, machine::String, mode::String, v::PetscViewer)

Communicates with Mathemtica using MathLink.

Collective

Input Parameters:

  • comm - The MPI communicator
  • port - [optional] The port to connect on, or PETSC_DECIDE
  • machine - [optional] The machine to run Mathematica on, or NULL
  • mode - [optional] The connection mode, or NULL

Output Parameter:

  • v - The Mathematica viewer

Options Database Keys:

  • -viewer_math_linkhost <machine> - The host machine for the kernel
  • -viewer_math_linkname <name> - The full link name for the connection
  • -viewer_math_linkport <port> - The port for the connection
  • -viewer_math_mode <mode> - The mode, e.g. Launch, Connect
  • -viewer_math_type <type> - The plot type, e.g. Triangulation, Vector
  • -viewer_math_graphics <output> - The output type, e.g. Motif, PS, PSFile

Level: intermediate

-seealso: PETSCVIEWERMATHEMATICA, MatView(), VecView()

External Links

source
PETSc.LibPETSc.PetscViewerMathematicaSetNameMethod
PetscViewerMathematicaSetName(petsclib::PetscLibType,viewer::PetscViewer, name::String)

Override the default name for objects communicated to Mathematica via PETSCVIEWERMATHEMATICA

Input Parameters:

  • viewer - The Mathematica viewer
  • name - The name for new objects created in Mathematica

Level: intermediate

-seealso: PETSCVIEWERMATHEMATICA, PetscViewerMathematicaClearName()

External Links

source
PETSc.LibPETSc.PetscViewerMathematicaSkipPacketsMethod
PetscViewerMathematicaSkipPackets(petsclib::PetscLibType,viewer::PetscViewer, type::Cint)

Discard packets sent by Mathematica until a certain packet type is received

Input Parameters:

  • viewer - The Mathematica viewer
  • type - The packet type to search for, e.g RETURNPKT

Level: advanced

-seealso: PetscViewerMathematicaSetName(), PetscViewerMathematicaGetVector()

External Links

source
PETSc.LibPETSc.PetscViewerMatlabGetArrayMethod
PetscViewerMatlabGetArray(petsclib::PetscLibType,mfile::PetscViewer, m::Cint, n::Cint, array::Vector{PetscScalar}, name::String)

Gets a variable from a PETSCVIEWERMATLAB viewer into an array

Not Collective; only processor zero reads in the array

Input Parameters:

  • mfile - the MATLAB file viewer
  • m - the first dimensions of array
  • n - the second dimensions of array
  • array - the array (represented in one dimension), must of be length m * n
  • name - the MATLAB name of array

Level: advanced

-seealso: PETSCVIEWERMATLAB, PetscViewerMatlabPutArray()

External Links

source
PETSc.LibPETSc.PetscViewerMatlabOpenMethod
PetscViewerMatlabOpen(petsclib::PetscLibType,comm::MPI_Comm, name::String, type::PetscFileMode, binv::PetscViewer)

Opens a MATLAB .mat file for output

Collective

Input Parameters:

  • comm - MPI communicator
  • name - name of file
  • type - type of file

-seealso: PETSCVIEWERMATLAB, PetscViewerASCIIOpen(), PetscViewerPushFormat(), PetscViewerDestroy(), PETSCVIEWERBINARY, PetscViewerBinaryOpen() VecView(), MatView(), VecLoad(), MatLoad()

External Links

source
PETSc.LibPETSc.PetscViewerMatlabPutArrayMethod
PetscViewerMatlabPutArray(petsclib::PetscLibType,mfile::PetscViewer, m::Cint, n::Cint, array::PetscScalar, name::String)

Puts an array into the PETSCVIEWERMATLAB viewer.

Not Collective, only processor zero saves array

Input Parameters:

  • mfile - the viewer
  • m - the first dimensions of array
  • n - the second dimensions of array
  • array - the array (represented in one dimension)
  • name - the MATLAB name of array

Level: advanced

-seealso: PETSCVIEWERMATLAB, PetscViewerMatlabGetArray()

External Links

source
PETSc.LibPETSc.PetscViewerMonitorLGSetUpMethod
PetscViewerMonitorLGSetUp(petsclib::PetscLibType,viewer::PetscViewer, host::String, title::String, metric::String, l::PetscInt, names::String, x::Cint, y::Cint, m::Cint, n::Cint)

sets up a viewer to be used by line graph monitoring routines such as KSPMonitorResidualDrawLG()

Collective

Input Parameters:

  • viewer - the viewer in which to display the line graphs, it not a PETSCVIEWERDRAW it will set to that PetscViewerType
  • host - the host to open the window on, 'NULL' indicates the local host
  • title - the title at the top of the window
  • metric - the label above the graph
  • l - the number of curves
  • names - the names of each curve to be used in displaying the legend. May be 'NULL'
  • x - horizontal screen coordinate of the upper left corner of window, or use PETSC_DECIDE
  • y - vertical screen coordinate of the upper left corner of window, or use PETSC_DECIDE
  • m - window width in pixels, or may use PETSC_DECIDE or PETSC_DRAW_FULL_SIZE, PETSC_DRAW_HALF_SIZE,PETSC_DRAW_THIRD_SIZE, PETSC_DRAW_QUARTER_SIZE
  • n - window height in pixels, or may use PETSC_DECIDE or PETSC_DRAW_FULL_SIZE, PETSC_DRAW_HALF_SIZE,PETSC_DRAW_THIRD_SIZE, PETSC_DRAW_QUARTER_SIZE

Level: developer

-seealso: PetscViewer(), PETSCVIEWERDRAW, PetscViewerDrawGetDrawLG(), PetscViewerDrawOpen(), PetscViewerDrawSetInfo()

External Links

source
PETSc.LibPETSc.PetscViewerPopFormatMethod
PetscViewerPopFormat(petsclib::PetscLibType,viewer::PetscViewer)

Resets the format for a PetscViewer to the value it had before the previous call to PetscViewerPushFormat()

Logically Collective

Input Parameter:

  • viewer - the PetscViewer

Level: intermediate

-seealso: , PetscViewer, PetscViewerFormat, PetscViewerASCIIOpen(), PetscViewerBinaryOpen(), MatView(), VecView(), PetscViewerSetFormat(), PetscViewerPushFormat()

External Links

source
PETSc.LibPETSc.PetscViewerPushFormatMethod
PetscViewerPushFormat(petsclib::PetscLibType,viewer::PetscViewer, format::PetscViewerFormat)

Sets the format for a PetscViewer.

Logically Collective

Input Parameters:

  • viewer - the PetscViewer
  • format - the format

Level: intermediate

-seealso: , PetscViewer, PetscViewerFormat, PetscViewerASCIIOpen(), PetscViewerBinaryOpen(), MatView(), VecView(), PetscViewerSetFormat(), PetscViewerPopFormat()

External Links

source
PETSc.LibPETSc.PetscViewerPythonCreateMethod
viewer::PetscViewer = PetscViewerPythonCreate(petsclib::PetscLibType,comm::MPI_Comm, pyname::String)

Create a PetscViewer object implemented in Python.

Collective

Input Parameters:

  • comm - MPI communicator
  • pyname - full dotted Python name [package].module[.{class|function}]

Output Parameter:

  • viewer - the viewer

Level: intermediate

-seealso: , PetscViewer, PetscViewerType, PETSCVIEWERPYTHON, PetscViewerPythonSetType(), PetscPythonInitialize(), PetscViewerPythonViewObject()

External Links

source
PETSc.LibPETSc.PetscViewerPythonGetTypeMethod
pyname::String = PetscViewerPythonGetType(petsclib::PetscLibType,viewer::PetscViewer)

Get the Python name of a PetscViewer object implemented in Python.

Not Collective

Input Parameter:

  • viewer - the viewer

Output Parameter:

  • pyname - full dotted Python name [package].module[.{class|function}]

Level: intermediate

-seealso: , PetscViewer, PetscViewerType, PetscViewerCreate(), PetscViewerSetType(), PETSCVIEWERPYTHON, PetscPythonInitialize(), PetscViewerPythonSetType()

External Links

source
PETSc.LibPETSc.PetscViewerPythonSetTypeMethod
PetscViewerPythonSetType(petsclib::PetscLibType,viewer::PetscViewer, pyname::String)

Initialize a PetscViewer object implemented in Python.

Collective

Input Parameters:

  • viewer - the viewer object.
  • pyname - full dotted Python name [package].module[.{class|function}]

Options Database Key:

  • -viewer_python_type <pyname> - python class

Level: intermediate

-seealso: , PetscViewer, PetscViewerType, PetscViewerCreate(), PetscViewerSetType(), PETSCVIEWERPYTHON, PetscPythonInitialize()

External Links

source
PETSc.LibPETSc.PetscViewerReadMethod
count::PetscInt = PetscViewerRead(petsclib::PetscLibType,viewer::PetscViewer, data::Cvoid, num::PetscInt, dtype::PetscDataType)

Reads data from a PetscViewer

Collective

Input Parameters:

  • viewer - The viewer
  • data - Location to write the data, treated as an array of the type defined by datatype
  • num - Number of items of data to read
  • dtype - Type of data to read

Output Parameter:

  • count - number of items of data actually read, or NULL

Level: beginner

-seealso: , PetscViewer, PetscViewerASCIIOpen(), PetscViewerPushFormat(), PetscViewerDestroy(), PetscViewerReadable(), PetscViewerBinaryGetDescriptor(), PetscViewerBinaryGetInfoPointer(), PetscFileMode

External Links

source
PETSc.LibPETSc.PetscViewerReadableMethod
flg::PetscBool = PetscViewerReadable(petsclib::PetscLibType,viewer::PetscViewer)

Return a flag whether the viewer can be read from with PetscViewerRead()

Not Collective

Input Parameter:

  • viewer - the PetscViewer context

Output Parameter:

  • flg - PETSC_TRUE if the viewer is readable, PETSC_FALSE otherwise

Level: intermediate

-seealso: , PetscViewerRead(), PetscViewer, PetscViewerWritable(), PetscViewerCheckReadable(), PetscViewerCreate(), PetscViewerFileSetMode(), PetscViewerFileSetType()

External Links

source
PETSc.LibPETSc.PetscViewerRegisterMethod
PetscViewerRegister(petsclib::PetscLibType,sname::String, fnc::external)

Adds a viewer to those available for use with PetscViewerSetType()

Not Collective, No Fortran Support

Input Parameters:

  • sname - name of a new user-defined viewer
  • function - routine to create method context

Level: developer

-seealso: , PetscViewerRegisterAll()

External Links

source
PETSc.LibPETSc.PetscViewerRestoreSubViewerMethod
PetscViewerRestoreSubViewer(petsclib::PetscLibType,viewer::PetscViewer, comm::MPI_Comm, outviewer::PetscViewer)

Restores a PetscViewer obtained with PetscViewerGetSubViewer().

Collective

Input Parameters:

  • viewer - the PetscViewer that was reproduced
  • comm - the sub communicator
  • outviewer - the subviewer to be returned

Level: advanced

-seealso: , PetscViewer, PetscViewerSocketOpen(), PetscViewerASCIIOpen(), PetscViewerDrawOpen(), PetscViewerGetSubViewer(), PetscViewerFlush()

External Links

source
PETSc.LibPETSc.PetscViewerSAWsOpenMethod
PetscViewerSAWsOpen(petsclib::PetscLibType,comm::MPI_Comm, lab::PetscViewer)

Opens an SAWs PetscViewer.

Collective; No Fortran Support

Input Parameter:

  • comm - the MPI communicator

Output Parameter:

  • lab - the PetscViewer

Options Database Keys:

  • -saws_port <port number> - port number where you are running SAWs client
  • -xxx_view saws - publish the object xxx
  • -xxx_saws_block - blocks the program at the end of a critical point (for KSP and SNES it is the end of a solve) until

the user unblocks the problem with an external tool that access the object with SAWS

Level: advanced

-seealso: , PetscViewerDestroy(), PetscViewerStringSPrintf(), PETSC_VIEWER_SAWS_(), PetscObjectSAWsBlock(), PetscObjectSAWsViewOff(), PetscObjectSAWsTakeAccess(), PetscObjectSAWsGrantAccess()

External Links

source
PETSc.LibPETSc.PetscViewerSetFromOptionsMethod
PetscViewerSetFromOptions(petsclib::PetscLibType,viewer::PetscViewer)

Sets various options for a viewer based on values in the options database.

Collective

Input Parameter:

  • viewer - the viewer context

Level: intermediate

-seealso: , PetscViewer, PetscViewerCreate(), PetscViewerSetType(), PetscViewerType

External Links

source
PETSc.LibPETSc.PetscViewerSetOptionsPrefixMethod
PetscViewerSetOptionsPrefix(petsclib::PetscLibType,viewer::PetscViewer, prefix::String)

Sets the prefix used for searching for PetscViewer options in the database during PetscViewerSetFromOptions().

Logically Collective

Input Parameters:

  • viewer - the PetscViewer context
  • prefix - the prefix to prepend to all option names

-seealso: , PetscViewer, PetscViewerSetFromOptions(), PetscViewerAppendOptionsPrefix()

External Links

source
PETSc.LibPETSc.PetscViewerSetTypeMethod
PetscViewerSetType(petsclib::PetscLibType,viewer::PetscViewer, type::PetscViewerType)

Builds PetscViewer for a particular implementation.

Collective

Input Parameters:

  • viewer - the PetscViewer context obtained with PetscViewerCreate()
  • type - for example, PETSCVIEWERASCII

Options Database Key:

  • -viewer_type <type> - Sets the type; use -help for a list of available methods (for instance, ascii)

Level: advanced

-seealso: , PetscViewer, PetscViewerCreate(), PetscViewerGetType(), PetscViewerType, PetscViewerPushFormat()

External Links

source
PETSc.LibPETSc.PetscViewerSetUpMethod
PetscViewerSetUp(petsclib::PetscLibType,viewer::PetscViewer)

Sets up the internal viewer data structures for the later use.

Collective

Input Parameter:

  • viewer - the PetscViewer context

Level: advanced

-seealso: , PetscViewer, PetscViewerCreate(), PetscViewerDestroy()

External Links

source
PETSc.LibPETSc.PetscViewerSocketOpenMethod
PetscViewerSocketOpen(petsclib::PetscLibType,comm::MPI_Comm, machine::String, port::Cint, lab::PetscViewer)

Opens a connection to a MATLAB or other socket based server.

Collective

Input Parameters:

  • comm - the MPI communicator
  • machine - the machine the server is running on, use NULL for the local machine, use "server" to passively wait for

a connection from elsewhere

  • port - the port to connect to, use PETSC_DEFAULT for the default

Output Parameter:

  • lab - a context to use when communicating with the server

Options Database Keys: For use with PETSC_VIEWER_SOCKET_WORLD, PETSC_VIEWER_SOCKET_SELF, PETSC_VIEWER_SOCKET_() or if NULL is passed for machine or PETSC_DEFAULT is passed for port

  • -viewer_socket_machine <machine> - the machine where the socket is available
  • -viewer_socket_port <port> - the socket to connect to

Environmental variables:

  • PETSC_VIEWER_SOCKET_MACHINE - machine name
  • PETSC_VIEWER_SOCKET_PORT - portnumber

Level: intermediate

-seealso: , PETSCVIEWERBINARY, PETSCVIEWERSOCKET, MatView(), VecView(), PetscViewerDestroy(), PetscViewerCreate(), PetscViewerSetType(), PetscViewerSocketSetConnection(), PETSC_VIEWER_SOCKET_, PETSC_VIEWER_SOCKET_WORLD, PETSC_VIEWER_SOCKET_SELF, PetscViewerBinaryWrite(), PetscViewerBinaryRead(), PetscViewerBinaryWriteStringArray(), PetscBinaryViewerGetDescriptor(), PetscMatlabEngineCreate()

External Links

source
PETSc.LibPETSc.PetscViewerSocketSetConnectionMethod
PetscViewerSocketSetConnection(petsclib::PetscLibType,v::PetscViewer, machine::String, port::Cint)

Sets the machine and port that a PETSc socket viewer is to use

Logically Collective

Input Parameters:

  • v - viewer to connect
  • machine - host to connect to, use NULL for the local machine,use "server" to passively wait for

a connection from elsewhere

  • port - the port on the machine one is connecting to, use PETSC_DEFAULT for default

Level: advanced

-seealso: , PETSCVIEWERMATLAB, PETSCVIEWERSOCKET, PetscViewerSocketOpen()

External Links

source
PETSc.LibPETSc.PetscViewerStringGetStringReadMethod
PetscViewerStringGetStringRead(petsclib::PetscLibType,viewer::PetscViewer, string::String, len::Csize_t)

Returns the string that a PETSCVIEWERSTRING uses

Logically Collective

Input Parameter:

  • viewer - PETSCVIEWERSTRING viewer

Output Parameters:

  • string - the string, optional use NULL if you do not need
  • len - the length of the string, optional use NULL if you do not need it

Level: advanced

-seealso: , PetscViewerStringOpen(), PETSCVIEWERSTRING, PetscViewerStringSetString(), PetscViewerStringSPrintf(), PetscViewerStringSetOwnString()

External Links

source
PETSc.LibPETSc.PetscViewerStringOpenMethod
PetscViewerStringOpen(petsclib::PetscLibType,comm::MPI_Comm, string::String, len::Csize_t, lab::PetscViewer)

Opens a string as a PETSCVIEWERSTRING PetscViewer. This is a very simple PetscViewer; information on the object is simply stored into the string in a fairly nice way.

Collective; No Fortran Support

Input Parameters:

  • comm - the communicator
  • string - the string to use
  • len - the string length

Output Parameter:

  • lab - the PetscViewer

Level: advanced

-seealso: , PETSCVIEWERSTRING, PetscViewerDestroy(), PetscViewerStringSPrintf(), PetscViewerStringGetStringRead(), PetscViewerStringSetString()

External Links

source
PETSc.LibPETSc.PetscViewerStringSetOwnStringMethod
PetscViewerStringSetOwnString(petsclib::PetscLibType,viewer::PetscViewer)

tells the viewer that it now owns the string and is responsible for freeing it with PetscFree()

Logically Collective

Input Parameter:

  • viewer - string viewer

Level: advanced

-seealso: , PetscViewerStringOpen(), PETSCVIEWERSTRING, PetscViewerStringGetStringRead(), PetscViewerStringSPrintf(), PetscViewerStringSetString()

External Links

source
PETSc.LibPETSc.PetscViewerStringSetStringMethod
PetscViewerStringSetString(petsclib::PetscLibType,viewer::PetscViewer, string::String, len::Csize_t)

sets the string that a string viewer will print to

Logically Collective

Input Parameters:

  • viewer - string viewer you wish to attach string to
  • string - the string to print data into
  • len - the length of the string

Level: advanced

-seealso: , PetscViewerStringOpen(), PETSCVIEWERSTRING, PetscViewerStringGetStringRead(), PetscViewerStringSPrintf(), PetscViewerStringSetOwnString()

External Links

source
PETSc.LibPETSc.PetscViewerVTKAddFieldMethod
PetscViewerVTKAddField(petsclib::PetscLibType,viewer::PetscViewer, dm::PetscObject, PetscViewerVTKWriteFunction::external, fieldnum::PetscInt, fieldtype::PetscViewerVTKFieldType, checkdm::PetscBool, vec::PetscObject)

Add a field to the viewer

Collective

Input Parameters:

  • viewer - PETSCVIEWERVTK
  • dm - DM on which Vec lives
  • PetscViewerVTKWriteFunction - function to write this Vec
  • fieldnum - which field of the DM to write (PETSC_DEFAULT if the whole vector should be written)
  • fieldtype - Either PETSC_VTK_POINT_FIELD or PETSC_VTK_CELL_FIELD
  • checkdm - whether to check for identical dm arguments as fields are added
  • vec - Vec from which to write

Level: developer

-seealso: , PETSCVIEWERVTK, PetscViewerVTKOpen(), DMDAVTKWriteAll(), PetscViewerVTKWriteFunction, PetscViewerVTKGetDM()

External Links

source
PETSc.LibPETSc.PetscViewerVTKGetDMMethod
PetscViewerVTKGetDM(petsclib::PetscLibType,viewer::PetscViewer, dm::PetscObject)

get the DM associated with the PETSCVIEWERVTK viewer

Collective

Input Parameters:

  • viewer - PETSCVIEWERVTK viewer
  • dm - DM associated with the viewer (as a PetscObject)

Level: developer

-seealso: , PETSCVIEWERVTK, PetscViewerVTKOpen(), DMDAVTKWriteAll(), PetscViewerVTKWriteFunction, PetscViewerVTKAddField()

External Links

source
PETSc.LibPETSc.PetscViewerVTKOpenMethod
PetscViewerVTKOpen(petsclib::PetscLibType,comm::MPI_Comm, name::String, type::PetscFileMode, vtk::PetscViewer)

Opens a PETSCVIEWERVTK viewer file.

Collective

Input Parameters:

  • comm - MPI communicator
  • name - name of file
  • type - type of file

-seealso: , PETSCVIEWERVTK, PetscViewerASCIIOpen(), PetscViewerPushFormat(), PetscViewerDestroy(), VecView(), MatView(), VecLoad(), MatLoad(), PetscFileMode, PetscViewer

External Links

source
PETSc.LibPETSc.PetscViewerVUGetPointerMethod
PetscViewerVUGetPointer(petsclib::PetscLibType,viewer::PetscViewer, fd::Libc.FILE)

Extracts the file pointer from a PETSCVIEWERVU PetscViewer.

Not Collective

Input Parameter:

  • viewer - The PetscViewer

Output Parameter:

  • fd - The file pointer

Level: intermediate

-seealso: , PETSCVIEWERVU, PetscViewerASCIIGetPointer()

External Links

source
PETSc.LibPETSc.PetscViewerVUGetVecSeenMethod
vecSeen::PetscBool = PetscViewerVUGetVecSeen(petsclib::PetscLibType,viewer::PetscViewer)

Gets the flag which indicates whether we have viewed a vector. This is usually called internally rather than by a user.

Not Collective

Input Parameter:

  • viewer - The PETSCVIEWERVU PetscViewer

Output Parameter:

  • vecSeen - The flag which indicates whether we have viewed a vector

Level: advanced

-seealso: , PETSCVIEWERVU

External Links

source
PETSc.LibPETSc.PetscViewerVUSetVecSeenMethod
PetscViewerVUSetVecSeen(petsclib::PetscLibType,viewer::PetscViewer, vecSeen::PetscBool)

Sets the flag which indicates whether we have viewed a vector. This is usually called internally rather than by a user.

Not Collective

Input Parameters:

  • viewer - The PETSCVIEWERVU PetscViewer
  • vecSeen - The flag which indicates whether we have viewed a vector

Level: developer

-seealso: , PETSCVIEWERVU, PetscViewerVUGetVecSeen()

External Links

source
PETSc.LibPETSc.PetscViewerViewMethod
PetscViewerView(petsclib::PetscLibType,v::PetscViewer, viewer::PetscViewer)

Visualizes a viewer object.

Collective

Input Parameters:

  • v - the viewer to be viewed
  • viewer - visualization context

Level: beginner

-seealso: , PetscViewer, PetscViewerPushFormat(), PetscViewerASCIIOpen(), PetscViewerDrawOpen(), PetscViewerSocketOpen(), PetscViewerBinaryOpen(), PetscViewerLoad()

External Links

source
PETSc.LibPETSc.PetscViewerViewFromOptionsMethod
PetscViewerViewFromOptions(petsclib::PetscLibType,A::PetscViewer, obj::PetscObject, name::String)

View from the viewer based on options in the options database

Collective

Input Parameters:

  • A - the PetscViewer context
  • obj - Optional object that provides the prefix for the option names
  • name - command line option

Level: intermediate

-seealso: , PetscViewer, PetscViewerView, PetscObjectViewFromOptions(), PetscViewerCreate()

External Links

source
PETSc.LibPETSc.PetscViewerWritableMethod
flg::PetscBool = PetscViewerWritable(petsclib::PetscLibType,viewer::PetscViewer)

Return a flag whether the viewer can be written to with PetscViewerWrite()

Not Collective

Input Parameter:

  • viewer - the PetscViewer context

Output Parameter:

  • flg - PETSC_TRUE if the viewer is writable, PETSC_FALSE otherwise

Level: intermediate

-seealso: , PetscViewer, PetscViewerReadable(), PetscViewerCheckWritable(), PetscViewerCreate(), PetscViewerFileSetMode(), PetscViewerFileSetType()

External Links

source
PETSc.LibPETSc.PetscViewersCreateMethod
v::PetscViewers = PetscViewersCreate(petsclib::PetscLibType,comm::MPI_Comm)

Creates a container to hold a set of PetscViewer's. The container is essentially a sparse, growable in length array of PetscViewers

Collective

Input Parameter:

  • comm - the MPI communicator

Output Parameter:

  • v - the collection of PetscViewers

Level: intermediate

-seealso: , PetscViewer, PetscViewers, PetscViewerCreate(), PetscViewersDestroy()

External Links

source
PETSc.LibPETSc.PetscViewersDestroyMethod
PetscViewersDestroy(petsclib::PetscLibType,v::PetscViewers)

Destroys a set of PetscViewers created with PetscViewersCreate().

Collective

Input Parameter:

  • v - the PetscViewers to be destroyed.

Level: intermediate

-seealso: , PetscViewer, PetscViewerDestroy(), PetscViewers, PetscViewerSocketOpen(), PetscViewerASCIIOpen(), PetscViewerCreate(), PetscViewerDrawOpen(), PetscViewersCreate()

External Links

source
PETSc.LibPETSc.PetscViewersGetViewerMethod
PetscViewersGetViewer(petsclib::PetscLibType,viewers::PetscViewers, n::PetscInt, viewer::PetscViewer)

Gets a PetscViewer from a PetscViewers collection

Collective if the viewer has not previously be obtained.

Input Parameters:

  • viewers - object created with PetscViewersCreate()
  • n - number of PetscViewer you want

Output Parameter:

  • viewer - the PetscViewer

Level: intermediate

-seealso: , PetscViewer, PetscViewers, PetscViewersCreate(), PetscViewersDestroy()

External Links

source