On Tue, Nov 8, 2011 at 8:02 PM, mspieg <mspieg at ldeo.columbia.edu> wrote:
> Nevermind?I should always think for 10 more minutes before I type? > > Just want to check that the following is a kosher use of the return error > handler > > bool _is_ghosted = true; > PetscErrorCode ierr; > PetscPushErrorHandler(PetscReturnErrorHandler,PETSC_NULL); > ierr= VecGhostGetLocalForm(*x, x_ghosted.get()); > if (ierr != 0 ) > _is_ghosted = false; > PetscPopErrorHandler(); > Do you need to mess with the error handler? Matt > cheers > marc > > On Nov 8, 2011, at 2:06 PM, mspieg wrote: > > > Hi All, > > is there a clean way to test if a vector is ghosted (i.e created with > VecCreateGhost?) without trying to call VecGhostGetLocalForm and throwing > an exception? > > > > In 3.1 I got around this using PetscExceptonTry1 but apparently in 3.2 > and dev PetscException? is "too cool for school" ;^) > > > > One possible simple fix would be something like > > > > PetscError VecGhostIsGhosted(Vec g, PetscBool isghosted) > > > > and just return the results of the logical tests in > VecGhostGetLocalForm without throwing an error. > > > > (alternatively, I suppose I could mess with the ErrorHandlers but that > seems like overkill for this). > > Let me know what might work. > > cheers > > marc > > > > > > > > > > > > ---------------------------------------------------- > > Marc Spiegelman > > Lamont-Doherty Earth Observatory > > Dept. of Applied Physics/Applied Math > > Columbia University > > http://www.ldeo.columbia.edu/~mspieg > > tel: 845 704 2323 (SkypeIn) > > ---------------------------------------------------- > > > > ---------------------------------------------------- > Marc Spiegelman > Lamont-Doherty Earth Observatory > Dept. of Applied Physics/Applied Math > Columbia University > http://www.ldeo.columbia.edu/~mspieg > tel: 845 704 2323 (SkypeIn) > ---------------------------------------------------- > > > -- 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/20111108/7509d6c1/attachment.html>