[petsc-users] PetscBinaryRead fails
Matthew Knepley
knepley at gmail.com
Mon Feb 18 20:27:09 CST 2019
If you used a PetscVIewer(), then you need to set the mode
https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Viewer/PetscViewerFileSetMode.html
or open it for reading with PETSC_MODE_READ
https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Viewer/PetscViewerBinaryOpen.html
Thanks,
Matt
On Mon, Feb 18, 2019 at 9:25 PM Matthew Knepley <knepley at gmail.com> wrote:
> It sounds like you opened the file for writing.
>
> Matt
>
> On Mon, Feb 18, 2019 at 9:08 PM Yuyun Yang via petsc-users <
> petsc-users at mcs.anl.gov> wrote:
>
>> Hello,
>>
>>
>>
>> I am writing a very simple function just to read in a single value from
>> an input file (which also just contains one single scalar value). Using
>> PetscBinaryRead(fd, &value, 1, PETSC_SCALAR) gives me the following error.
>> Could you help me figure out why?
>>
>>
>>
>> [0]PETSC ERROR: --------------------- Error Message
>> --------------------------------------------------------------
>>
>> [0]PETSC ERROR: Read from file failed
>>
>> [0]PETSC ERROR: Read past end of file
>>
>> [0]PETSC ERROR: See http://www.mcs.anl.gov/petsc/documentation/faq.html
>> for trouble shooting.
>>
>> [0]PETSC ERROR: Petsc Release Version 3.10.3, unknown
>>
>> [0]PETSC ERROR: ./output on a arch-linux2-c-debug named
>> DESKTOP-02K82L1.stanford.edu by yyy910805 Mon Feb 18 17:58:30 2019
>>
>> [0]PETSC ERROR: Configure options --with-cc=gcc --with-cxx=g++
>> --with-shared-libraries=1 --download-hdf5 --download-metis
>> --download-parmetis --download-hypre --download-superlu --download-mumps
>> --download-scalapack --download-mpich
>> --download-mpich-configure-arguments="--enable-error-messages=all
>> --enable-g"
>>
>> [0]PETSC ERROR: #1 PetscBinaryRead() line 276 in
>> /home/yyy910805/petsc/src/sys/fileio/sysio.c
>>
>> 0.000000
>>
>>
>>
>> Thanks a lot!
>>
>> Yuyun
>>
>
>
> --
> What most experimenters take for granted before they begin their
> experiments is infinitely more interesting than any results to which their
> experiments lead.
> -- Norbert Wiener
>
> https://www.cse.buffalo.edu/~knepley/
> <http://www.cse.buffalo.edu/~knepley/>
>
--
What most experimenters take for granted before they begin their
experiments is infinitely more interesting than any results to which their
experiments lead.
-- Norbert Wiener
https://www.cse.buffalo.edu/~knepley/ <http://www.cse.buffalo.edu/~knepley/>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20190218/f91897ef/attachment.html>
More information about the petsc-users
mailing list