petsc4py.PETSc.Viewer#

class petsc4py.PETSc.Viewer#

Bases: Object

Viewer object.

Viewer is described in the PETSc manual.

Viewers can be called as functions where the argument specified is the PETSc object to be viewed. See the example below.

Examples

>>> from petsc4py import PETSc
>>> u = PETSc.Vec().createWithArray([1,2])
>>> v = PETSc.Viewer()
>>> v(u)
Vec Object: 1 MPI process
  type: seq
1.
2.

See also

PetscViewer

Enumerations

DrawSize

Window size.

FileMode

Viewer file mode.

Format

Viewer format.

Type

Viewer type.

Methods Summary

ASCII(name[, comm])

Return an ASCII viewer associated with the communicator.

BINARY([comm])

Return the default Type.BINARY viewer associated with the communicator.

DRAW([comm])

Return the default Type.DRAW viewer associated with the communicator.

STDERR([comm])

Return the standard error viewer associated with the communicator.

STDOUT([comm])

Return the standard output viewer associated with the communicator.

addASCIITab(tabs)

Increment the ASCII tab level.

clearDraw()

Reset graphics.

create([comm])

Create a viewer.

createASCII(name[, mode, comm])

Create a viewer of type Type.ASCII.

createBinary(name[, mode, comm])

Create a viewer of type Type.BINARY.

createDraw([display, title, position, size, ...])

Create a Type.DRAW viewer.

createHDF5(name[, mode, comm])

Create a viewer of type Type.HDF5.

createMPIIO(name[, mode, comm])

Create a viewer of type Type.BINARY supporting MPI-IO.

createVTK(name[, mode, comm])

Create a viewer of type Type.VTK.

destroy()

Destroy the viewer.

flush()

Flush the viewer.

getASCIITab()

Return the ASCII tab level.

getFileMode()

Return the file mode.

getFileName()

Return file name.

getFormat()

Return the format of the viewer.

getSubViewer([comm])

Return a viewer defined on a subcommunicator.

getType()

Return the type of the viewer.

popASCIISynchronized()

Disallow ASCII synchronized calls.

popASCIITab()

Pop an additional tab level pushed via pushASCIITab.

popFormat()

Pop format from the viewer.

printfASCII(msg)

Print a message.

printfASCIISynchronized(msg)

Print a synchronized message.

pushASCIISynchronized()

Allow ASCII synchronized calls.

pushASCIITab()

Push an additional tab level.

pushFormat(format)

Push format to the viewer.

restoreSubViewer(sub)

Restore a viewer defined on a subcommunicator.

setASCIITab(tabs)

Set ASCII tab level.

setDrawInfo([display, title, position, size])

Set window information for a Type.DRAW viewer.

setFileMode(mode)

Set file mode.

setFileName(name)

Set file name.

setType(vwr_type)

Set the type of the viewer.

subtractASCIITab(tabs)

Decrement the ASCII tab level.

useASCIITabs(flag)

Enable/disable the use of ASCII tabs.

view([obj])

View the viewer.

Methods Documentation

classmethod ASCII(name, comm=None)#

Return an ASCII viewer associated with the communicator.

Collective.

Parameters:
Return type:

Viewer

Source code at petsc4py/PETSc/Viewer.pyx:575

classmethod BINARY(comm=None)#

Return the default Type.BINARY viewer associated with the communicator.

Collective.

Parameters:

comm (Comm | None) – MPI communicator, defaults to Sys.getDefaultComm.

Return type:

Viewer

Source code at petsc4py/PETSc/Viewer.pyx:596

classmethod DRAW(comm=None)#

Return the default Type.DRAW viewer associated with the communicator.

Collective.

Parameters:

comm (Comm | None) – MPI communicator, defaults to Sys.getDefaultComm.

Return type:

Viewer

Source code at petsc4py/PETSc/Viewer.pyx:614

classmethod STDERR(comm=None)#

Return the standard error viewer associated with the communicator.

Collective.

Parameters:

comm (Comm | None) – MPI communicator, defaults to Sys.getDefaultComm.

Return type:

Viewer

Source code at petsc4py/PETSc/Viewer.pyx:557

classmethod STDOUT(comm=None)#

Return the standard output viewer associated with the communicator.

Collective.

Parameters:

comm (Comm | None) – MPI communicator, defaults to Sys.getDefaultComm.

Return type:

Viewer

Source code at petsc4py/PETSc/Viewer.pyx:539

addASCIITab(tabs)#

Increment the ASCII tab level.

Collective.

Source code at petsc4py/PETSc/Viewer.pyx:661

Parameters:

tabs (int) –

clearDraw()#

Reset graphics.

Not collective.

Source code at petsc4py/PETSc/Viewer.pyx:892

Return type:

None

create(comm=None)#

Create a viewer.

Collective.

Parameters:

comm (Comm | None) – MPI communicator, defaults to Sys.getDefaultComm.

Return type:

Self

Source code at petsc4py/PETSc/Viewer.pyx:175

createASCII(name, mode=None, comm=None)#

Create a viewer of type Type.ASCII.

Collective.

Parameters:
Return type:

Self

Source code at petsc4py/PETSc/Viewer.pyx:196

createBinary(name, mode=None, comm=None)#

Create a viewer of type Type.BINARY.

Collective.

Parameters:
Return type:

Self

Source code at petsc4py/PETSc/Viewer.pyx:234

createDraw(display=None, title=None, position=None, size=None, comm=None)#

Create a Type.DRAW viewer.

Collective.

Parameters:
Return type:

Self

Source code at petsc4py/PETSc/Viewer.pyx:376

createHDF5(name, mode=None, comm=None)#

Create a viewer of type Type.HDF5.

Collective.

Parameters:
Return type:

Self

Source code at petsc4py/PETSc/Viewer.pyx:340

createMPIIO(name, mode=None, comm=None)#

Create a viewer of type Type.BINARY supporting MPI-IO.

Collective.

Parameters:
Return type:

Self

Source code at petsc4py/PETSc/Viewer.pyx:267

createVTK(name, mode=None, comm=None)#

Create a viewer of type Type.VTK.

Collective.

Parameters:
Return type:

Self

Source code at petsc4py/PETSc/Viewer.pyx:304

destroy()#

Destroy the viewer.

Collective.

Source code at petsc4py/PETSc/Viewer.pyx:162

Return type:

Self

flush()#

Flush the viewer.

Collective.

See also

PetscViewerFlush

Source code at petsc4py/PETSc/Viewer.pyx:780

Return type:

None

getASCIITab()#

Return the ASCII tab level.

Not collective.

Source code at petsc4py/PETSc/Viewer.pyx:647

Return type:

int

getFileMode()#

Return the file mode.

Not collective.

Source code at petsc4py/PETSc/Viewer.pyx:804

Return type:

FileMode

getFileName()#

Return file name.

Not collective.

Source code at petsc4py/PETSc/Viewer.pyx:832

Return type:

str

getFormat()#

Return the format of the viewer.

Not collective.

Source code at petsc4py/PETSc/Viewer.pyx:459

Return type:

Format

getSubViewer(comm=None)#

Return a viewer defined on a subcommunicator.

Collective.

Parameters:

comm (Comm | None) – The subcommunicator. If None, uses COMM_SELF.

Return type:

Viewer

Notes

Users must call restoreSubViewer when done.

Source code at petsc4py/PETSc/Viewer.pyx:497

getType()#

Return the type of the viewer.

Not collective.

Source code at petsc4py/PETSc/Viewer.pyx:445

Return type:

str

popASCIISynchronized()#

Disallow ASCII synchronized calls.

Collective.

Source code at petsc4py/PETSc/Viewer.pyx:700

Return type:

None

popASCIITab()#

Pop an additional tab level pushed via pushASCIITab.

Collective.

Source code at petsc4py/PETSc/Viewer.pyx:725

Return type:

None

popFormat()#

Pop format from the viewer.

Collective.

Source code at petsc4py/PETSc/Viewer.pyx:485

Return type:

None

printfASCII(msg)#

Print a message.

Collective.

Source code at petsc4py/PETSc/Viewer.pyx:750

Parameters:

msg (str) –

Return type:

None

printfASCIISynchronized(msg)#

Print a synchronized message.

Collective.

Source code at petsc4py/PETSc/Viewer.pyx:764

Parameters:

msg (str) –

Return type:

None

pushASCIISynchronized()#

Allow ASCII synchronized calls.

Collective.

Source code at petsc4py/PETSc/Viewer.pyx:687

Return type:

None

pushASCIITab()#

Push an additional tab level.

Collective.

Source code at petsc4py/PETSc/Viewer.pyx:713

Return type:

None

pushFormat(format)#

Push format to the viewer.

Collective.

Source code at petsc4py/PETSc/Viewer.pyx:473

Parameters:

format (Format) –

Return type:

None

restoreSubViewer(sub)#

Restore a viewer defined on a subcommunicator.

Collective.

Parameters:

sub (Viewer) – The subviewer obtained from getSubViewer.

Return type:

None

Source code at petsc4py/PETSc/Viewer.pyx:521

setASCIITab(tabs)#

Set ASCII tab level.

Collective.

Source code at petsc4py/PETSc/Viewer.pyx:634

Parameters:

tabs (int) –

Return type:

None

setDrawInfo(display=None, title=None, position=None, size=None)#

Set window information for a Type.DRAW viewer.

Collective.

Parameters:
  • display (str | None) – The X display to use or None for the local machine.

  • title (str | None) – The window title or None for no title.

  • position (tuple[int, int] | None) – Screen coordinates of the upper left corner, or None for default.

  • size (tuple[int, int] | int | None) – Window size or None for default.

Return type:

None

Source code at petsc4py/PETSc/Viewer.pyx:848

setFileMode(mode)#

Set file mode.

Collective.

Source code at petsc4py/PETSc/Viewer.pyx:792

Parameters:

mode (FileMode | str) –

Return type:

None

setFileName(name)#

Set file name.

Collective.

Source code at petsc4py/PETSc/Viewer.pyx:818

Parameters:

name (str) –

Return type:

None

setType(vwr_type)#

Set the type of the viewer.

Logically collective.

Parameters:

vwr_type (Type | str) – The type of the viewer.

Return type:

None

Source code at petsc4py/PETSc/Viewer.pyx:426

subtractASCIITab(tabs)#

Decrement the ASCII tab level.

Collective.

Source code at petsc4py/PETSc/Viewer.pyx:674

Parameters:

tabs (int) –

Return type:

None

useASCIITabs(flag)#

Enable/disable the use of ASCII tabs.

Collective.

Source code at petsc4py/PETSc/Viewer.pyx:737

Parameters:

flag (bool) –

Return type:

None

view(obj=None)#

View the viewer.

Collective.

Parameters:

obj (Viewer | Object | None) – A Viewer instance or None for the default viewer. If none of the above applies, it assumes obj is an instance of Object and it calls the generic view for obj.

Return type:

None

Notes

See also

PetscViewerView

Source code at petsc4py/PETSc/Viewer.pyx:134