[petsc-dev] PetscExceptionTry1
Matthew Knepley
knepley at gmail.com
Mon Feb 14 13:43:17 CST 2011
On Mon, Feb 14, 2011 at 1:40 PM, Barry Smith <bsmith at mcs.anl.gov> wrote:
>
> On Feb 14, 2011, at 1:38 PM, Matthew Knepley wrote:
>
> > Do we have a replacement for this?
>
> Nope.
>
> > I was using it, but it seems to be broken
> > and now my code spits out annoying error messages to the screen.
>
> Handle the "exception" with "regular" code that does not call the
> SETERRQ() but instead "handles the problem" itself.
This code
for(i = 0; i < 10000; ++i) {
std::ostringstream trial;
FILE *fp;
trial << "dft_" << std::setw(5) << std::setfill('0') << i << ".py";
//ierr = PetscExceptionTry1(PetscFOpen(PETSC_COMM_WORLD,
trial.str().c_str(), "r", &fp), PETSC_ERR_FILE_OPEN);
ierr = PetscFOpen(PETSC_COMM_WORLD, trial.str().c_str(), "r", &fp);
if (ierr == PETSC_ERR_FILE_OPEN) break;
ierr = PetscFClose(PETSC_COMM_WORLD, fp);CHKERRQ(ierr);
}
produces the following printout
[0]PETSC ERROR: --------------------- Error Message
------------------------------------
[0]PETSC ERROR: Unable to open file!
[0]PETSC ERROR: Unable to open file dft_00001.py
!
[0]PETSC ERROR:
------------------------------------------------------------------------
[0]PETSC ERROR: Petsc Development HG revision:
f77bf280bb316b4e138b482394ca6d06ce3b63cd HG Date: Mon Jan 31 21:25:29 2011
-0600
[0]PETSC ERROR: See docs/changes/index.html for recent updates.
[0]PETSC ERROR: See docs/faq.html for hints about trouble shooting.
[0]PETSC ERROR: See docs/index.html for manual pages.
[0]PETSC ERROR:
------------------------------------------------------------------------
[0]PETSC ERROR:
/PETSc3/biology/dft-rfd/bin/arch-complex-fftw-debug/dft-fft-3d on a
arch-comp named cohn0636n.rush.edu by knepley Mon Feb 14 13:25:35 2011
[0]PETSC ERROR: Libraries linked from
/PETSc3/petsc/petsc-dev/arch-complex-fftw-debug/lib
[0]PETSC ERROR: Configure run at Thu Feb 3 11:53:58 2011
[0]PETSC ERROR: Configure options --PETSC_ARCH=arch-complex-fftw-debug
--with-shared-libearies --with-dynamic-loading --download-mpich
--download-fftw --with-clanguage=cxx --with-scalar-type=complex
[0]PETSC ERROR:
------------------------------------------------------------------------
[0]PETSC ERROR: PetscFOpen() line 63 in src/sys/fileio/mpiuopen.c
Matt
>
> Barry
>
> >
> > Matt
> >
> > --
> > 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
>
>
--
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20110214/b3813a9b/attachment.html>
More information about the petsc-dev
mailing list