PetscViewerSocketOpen#
Opens a connection to a MATLAB or other socket based server.
Synopsis#
#include "petscviewer.h"
PetscErrorCode PetscViewerSocketOpen(MPI_Comm comm, const char machine[], int port, PetscViewer *lab)
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 elsewhereport - 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
- the machine where the socket is available-viewer_socket_port
- the socket to connect to
Environmental variables#
PETSC_VIEWER_SOCKET_MACHINE
- machine namePETSC_VIEWER_SOCKET_PORT
- portnumber
Notes#
Most users should employ the following commands to access the
MATLAB PetscViewer
PetscViewerSocketOpen(MPI_Comm comm, char *machine,int port,PetscViewer &viewer)
MatView(Mat matrix,PetscViewer viewer)
or
PetscViewerSocketOpen(MPI_Comm comm,char *machine,int port,PetscViewer &viewer)
VecView(Vec vector,PetscViewer viewer)
Currently the only socket client available is MATLAB, PETSc must be configured with –with-matlab for this client. See src/dm/tests/ex12.c and ex12.m for an example of usage.
The socket viewer is in some sense a subclass of the binary viewer, to read and write to the socket
use PetscViewerBinaryRead()
, PetscViewerBinaryWrite()
, PetscViewerBinarWriteStringArray()
, PetscViewerBinaryGetDescriptor()
.
Use this for communicating with an interactive MATLAB session, see PETSC_VIEWER_MATLAB_()
for writing output to a
.mat file. Use PetscMatlabEngineCreate()
or PETSC_MATLAB_ENGINE_()
, PETSC_MATLAB_ENGINE_SELF
, or PETSC_MATLAB_ENGINE_WORLD
for communicating with a MATLAB Engine
See Also#
Viewers: Looking at PETSc Objects, PETSCVIEWERBINARY
, PETSCVIEWERSOCKET
, MatView()
, VecView()
, PetscViewerDestroy()
, PetscViewerCreate()
, PetscViewerSetType()
,
PetscViewerSocketSetConnection()
, PETSC_VIEWER_SOCKET_
, PETSC_VIEWER_SOCKET_WORLD
,
PETSC_VIEWER_SOCKET_SELF
, PetscViewerBinaryWrite()
, PetscViewerBinaryRead()
, PetscViewerBinaryWriteStringArray()
,
PetscBinaryViewerGetDescriptor()
, PetscMatlabEngineCreate()
Level#
intermediate
Location#
Examples#
Index of all Viewer routines
Table of Contents for all manual pages
Index of all manual pages