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();

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)
----------------------------------------------------



Reply via email to