[petsc-users] how to check if cell is local owned in DMPlex

Matthew Knepley knepley at gmail.com
Fri Mar 2 14:08:37 CST 2018


On Fri, Mar 2, 2018 at 3:00 PM, Danyang Su <danyang.su at gmail.com> wrote:

> On 18-03-02 10:58 AM, Matthew Knepley wrote:
>
> On Fri, Mar 2, 2018 at 1:41 PM, Danyang Su <danyang.su at gmail.com> wrote:
>
>>
>> On 18-02-19 03:30 PM, Matthew Knepley wrote:
>>
>> On Mon, Feb 19, 2018 at 3:11 PM, Danyang Su <danyang.su at gmail.com> wrote:
>>
>>> Hi Matt,
>>>
>>> Would you please let me know how to check if a cell is local owned? When
>>> overlap is 0 in DMPlexDistribute, all the cells are local owned. How about
>>> overlap > 0? It sounds like impossible to check by node because a cell can
>>> be local owned even if none of the nodes in this cell is local owned.
>>>
>>
>> If a cell is in the PetscSF, then it is not locally owned. The local
>> nodes in the SF are sorted, so I use
>> PetscFindInt (http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages
>> /Sys/PetscFindInt.html).
>>
>> Hi Matt,
>>
>> Would you please give me a little more about how to mark the ghost cells
>> when overlap > 0? What do you mean a cell is in the PetscSF? I use
>> PetscSFView to export the graph (original mesh file pile.vtk) and it
>> exports all the cells, including the ghost cells (PETScSFView.txt).
>>
>
> Yes, I will send you some sample code when I get time. The first problem
> is that you are looking at a different PetscSF. This looks like the
> one returned by DMPlexDistribute(). This is mapping the serial mesh to the
> parallel mesh. You want
>
>   http://www.mcs.anl.gov/petsc/petsc-current/docs/
> manualpages/DM/DMGetPointSF.html
>
> Then you can look at
>
>   https://bitbucket.org/petsc/petsc/src/1788fc36644e622df8cb1a0de85676
> ccc5af0239/src/dm/impls/plex/plexsubmesh.c?at=master&
> fileviewer=file-view-default#plexsubmesh.c-683
>
> I get the pointSF, get out the list of leaves, and find points in it using
> PetscFindInt()
>
> Hi Matt,
> By using the local dm, I can get the PetscSF I want, as shown below. Now I
> need to get the number of ghost cells or local cells (here 4944) or number
> of leaves (here 825) for each processor. I try to use PetscSFGetGraph to
> get number of leaves in Fortran. After including "petscsf.h", I got
> compilation error saying "You need a ISO C conforming compiler to use the
> glibc headers". Is there any alternative way to do this? I do not need the
> ghost-neighbor mapping, but just the number of local owned cells.
>

Also, make sure you are using the latest Fortran style for PETSc:


http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Sys/UsingFortran.html


>   [0] Number of roots=11449, leaves=825, remote ranks=1
>   [0] 4944 <- (1,0)
>   [0] 4945 <- (1,28)
>   [0] 4946 <- (1,56)
> ...
>   [1] Number of roots=11695, leaves=538, remote ranks=1
>   [1] 5056 <- (0,21)
>   [1] 5057 <- (0,43)
>   [1] 5058 <- (0,65)
>   [1] 5059 <- (0,87)
>
> In file included from /usr/include/features.h:375:0,
>                  from /usr/include/stdio.h:28,
>                  from /home/dsu/Soft/PETSc/petsc-3.
> 8.3/include/petscsys.h:175,
>                  from /home/dsu/Soft/PETSc/petsc-3.
> 8.3/include/petscsf.h:7,
>                  from ../../solver/solver_ddmethod.F90:4837:
> /usr/include/x86_64-linux-gnu/sys/cdefs.h:30:3: error: #error "You need a
> ISO C conforming compile\
> r to use the glibc headers"
>  # error "You need a ISO C conforming compiler to use the glibc headers"
>

Can you send this to petsc-maint at mcs.anl.gov? It looks like a build problem
that can be fixed.

  Thanks,

    Matt


> Thanks,
>
> Danyang
>
>
>   Thanks,
>
>     Matt
>
>
>> Thanks,
>>
>> Danyang
>>
>>
>>   Thanks,
>>
>>     Matt
>>
>>
>>> Thanks,
>>>
>>> Danyang
>>>
>> --
>> 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.caam.rice.edu/%7Emk51/>
>>
>>
>>
>
>
> --
> 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.caam.rice.edu/%7Emk51/>
>
>
>


-- 
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.caam.rice.edu/~mk51/>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20180302/148a6042/attachment-0001.html>


More information about the petsc-users mailing list