On Tue, Nov 8, 2011 at 8:02 PM, mspieg <span dir="ltr"><<a href="mailto:mspieg@ldeo.columbia.edu">mspieg@ldeo.columbia.edu</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Nevermind…I should always think for 10 more minutes before I type…<br>
<br>
Just want to check that the following is a kosher use of the return error handler<br>
<br>
    bool _is_ghosted = true;<br>
    PetscErrorCode ierr;<br>
    PetscPushErrorHandler(PetscReturnErrorHandler,PETSC_NULL);<br>
    ierr= VecGhostGetLocalForm(*x, x_ghosted.get());<br>
    if (ierr != 0 )<br>
      _is_ghosted = false;<br>
    PetscPopErrorHandler();<br></blockquote><div><br></div><div>Do you need to mess with the error handler?</div><div><br></div><div>   Matt</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">

cheers<br>
marc<br>
<div><div></div><div class="h5"><br>
On Nov 8, 2011, at 2:06 PM, mspieg wrote:<br>
<br>
> Hi All,<br>
>   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?<br>
><br>
> In 3.1 I got around this using  PetscExceptonTry1  but apparently in 3.2 and dev  PetscException… is "too cool for school" ;^)<br>
><br>
> One possible  simple fix would be something like<br>
><br>
> PetscError VecGhostIsGhosted(Vec g, PetscBool isghosted)<br>
><br>
> and just return the results of  the logical tests in VecGhostGetLocalForm without throwing an error.<br>
><br>
> (alternatively, I suppose I could mess with the ErrorHandlers but that seems like overkill for this).<br>
> Let me know what might work.<br>
> cheers<br>
> marc<br>
><br>
><br>
><br>
><br>
><br>
> ----------------------------------------------------<br>
> Marc Spiegelman<br>
> Lamont-Doherty Earth Observatory<br>
> Dept. of Applied Physics/Applied Math<br>
> Columbia University<br>
> <a href="http://www.ldeo.columbia.edu/~mspieg" target="_blank">http://www.ldeo.columbia.edu/~mspieg</a><br>
> tel: <a href="tel:845%20704%202323" value="+18457042323">845 704 2323</a> (SkypeIn)<br>
> ----------------------------------------------------<br>
><br>
<br>
----------------------------------------------------<br>
Marc Spiegelman<br>
Lamont-Doherty Earth Observatory<br>
Dept. of Applied Physics/Applied Math<br>
Columbia University<br>
<a href="http://www.ldeo.columbia.edu/~mspieg" target="_blank">http://www.ldeo.columbia.edu/~mspieg</a><br>
tel: <a href="tel:845%20704%202323" value="+18457042323">845 704 2323</a> (SkypeIn)<br>
----------------------------------------------------<br>
<br>
<br>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br>What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br>
-- Norbert Wiener<br>