[petsc-users] Checking if a vector is a localvector of a given DMDA

Phil Tooley phil.tooley at sheffield.ac.uk
Tue Sep 25 06:12:10 CDT 2018


Hi Matt,

Thanks for the rapid response.  The reason I want to ensure I have a
DMDA is that this is a custom gradient function, the results of which
are meaningless for anything but a regular grid. I would rather raise an
exception upfront with the user than allow the program to continue with
garbage data.

Phil

On 25/09/18 11:55, Matthew Knepley wrote:
> On Tue, Sep 25, 2018 at 6:49 AM Phil Tooley
> <phil.tooley at sheffield.ac.uk <mailto:phil.tooley at sheffield.ac.uk>> wrote:
>
>     Hi all,
>
>     Given a vector I know I can get an associated DM (if there is one) by
>     calling VecGetDM, but I need to also be able to check that
>
>     a) the vector is the localvector of that DM rather than the global
>
>
> Get a local vector from the DM and check the sizes.
>  
>
>     b) the DM is a DMDA rather than some other subclass
>
>
> You can do this (PetscObjectTypeCompare), but it is not recommended.
> Why would
> you want to do that?
>
>   Thanks,
>
>      Matt
>  
>
>     I can't immediately see routines that do what I need, but I am likely
>     missing something obvious. Is there a way to achieve the above?
>
>     Thanks
>
>     Phil
>
>     -- 
>     Phil Tooley
>     Research Software Engineering
>     University of Sheffield
>
>
>
> -- 
> 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/%7Eknepley/>

-- 
Phil Tooley
Research Software Engineering
University of Sheffield

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20180925/d3845385/attachment.html>


More information about the petsc-users mailing list