/usr/lib/petscdir/3.7.7/x86_64-linux-gnu-complex/share/petsc/matlab/PetscReadBinaryMatlab.m is in libpetsc-complex-3.7.7-dev 3.7.7+dfsg1-2build5.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | function Set = PetscReadBinaryMatlab(filename)
% PETSCREADBINARYMATLAB - Reads and interprets matlab specific lines
% from the .info files produced by PetscViewerBinaryMatlab
%
% Input filename can be the name of the binary file with or without
% the .info suffix
%
% This function returns a single struct containing all objects submitted
% to the PetscViewerBinaryMatlab viewer.
matlabHeader = ['%$$ '; '#$$ ']; % string that marks a matlab line for evaluation (could be passed)
matlabHeaderLen = size(matlabHeader,2);
if (isempty(strfind(filename,'.info')))
filename = [filename,'.info'];
end
fid=fopen(filename,'r');
if (fid == -1)
error(sprintf('PetscReadBinaryMatlab: cannot load file %s',filename))
end
str=fgets(fid);
while (ischar(str))
% check for output lines that start matlabHeader
if strncmp(str,matlabHeader(1,:),matlabHeaderLen) || strncmp(str,matlabHeader(2,:),matlabHeaderLen)
str = str(1+matlabHeaderLen:end);
% check for old-style file open/close commands
if strfind(str,'fopen(Set.filename')
str = 'fd = PetscOpenFile(Set.filename);';
elseif strfind(str,'if (fd < 0) error'); % ignore this line
str = '%';
elseif strfind(str,'fclose(fd)');
str = 'close(fd);';
end
eval(str);
end
str=fgets(fid);
end
fclose(fid);
return
|