[petsc-users] how to get the vertices belongs to a control volume in 2D?

leejearl leejearl at 126.com
Mon May 15 03:20:44 CDT 2017


Hi, all:
     Thanks for your kind reply. Matt's course notes looks very nice.

     Thanks,
leejearl

    


On 2017年05月12日 17:10, Matthew Knepley wrote:
> On Fri, May 12, 2017 at 3:48 AM, Lawrence Mitchell 
> <lawrence.mitchell at imperial.ac.uk 
> <mailto:lawrence.mitchell at imperial.ac.uk>> wrote:
>
>
>     > On 12 May 2017, at 04:57, 李季 <leejearl at 126.com
>     <mailto:leejearl at 126.com>> wrote:
>     >
>     > Hi developers:
>     >     I have such a question that I want to get the vertices of a
>     cell. I know I can get the points by
>     >     1. Getting the faces of a cell such as "DMPlexGetCone(dm, c,
>     &faces";
>     >     2. Getting the vertices of every face of the cell such as
>     "DMPlexGetCone(dm, f, &vertices)".
>     >
>     >     Then I can obtain the vertices belongs to a cell. Is there
>     any concise routine which I can choose to get the
>     > vertices of a cell directly?
>
>     You should use the interface for the transitive closure.
>
>     Find bounds of points that are vertices:
>
>     DMPlexGetDepthStratum(dm, &vStart, &vEnd);
>
>     ...
>     DMPlexGetTransitiveClosure(dm, c, PETSC_TRUE, &nclosure, &closure);
>     for (PetscInt i = 0; i < nclosure; i++) {
>         const PetscInt p = closure[2*i];
>         if (p >= vStart && p < vEnd) {
>             p is a vertex
>         }
>     }
>
>     This works regardless of the topological dimension of the "cell"
>     point you are using (the same code is good to find the vertices in
>     the closure of a facet, say).
>
>     Matt's course notes (http://www.caam.rice.edu/~caam519/CSBook.pdf
>     <http://www.caam.rice.edu/%7Ecaam519/CSBook.pdf>) have nice
>     pictures that help understand this language in section 7.1.
>
>
> Also note that this is fine for getting vertices if you want to do 
> topological things. However, if what you really want is
> some function over the vertices (like coordinates), you should use
>
> http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/DM/DMPlexVecGetClosure.html
>
>   Thanks,
>
>      Matt
>
>     Cheers,
>
>     Lawrence
>
>
>
>
> -- 
> 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-users/attachments/20170515/b81fd265/attachment.html>


More information about the petsc-users mailing list