xref: /petsc/share/petsc/matlab/@PetscOpenSocket/PetscOpenSocket.m (revision 375d23e45bc7f27f90f326da17aaea364b3bd8d3)
1function O = PetscOpenSocket(socketnumber)
2%
3%   O = PetscOpenSocket(socketnumber) - waits for a socket connection (from PETSc socket viewer)
4%
5%  This provides an object-oriented interface to the PETSc provided MATLAB routines sopen(), sread(), and sclose()
6%  allowing PETSc MATLAB utilities like PetscBinaryRead.m to work cleanly with either binary files or sockets
7%
8%  The MEX source for sopen(), sread() and sclose() is in $PETSC_DIR/src/sys/classes/viewer/impls/socket/matlab/
9%
10if nargin == 0
11  S = struct('fd', sopen());
12else
13  S = struct('fd', sopen(socketnumber));
14end
15O = class(S,'PetscOpenSocket');
16
17